Bug 1072021: Fix bluetooth address is empty to set Audio HAL when A2DP is disconnected. r=echou
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -194,22 +194,22 @@ IsDeviceOn(audio_devices_t device)
static void ProcessDelayedAudioRoute(SwitchState aState)
{
if (sSwitchDone)
return;
InternalSetAudioRoutes(aState);
sSwitchDone = true;
}
-static void ProcessDelayedA2dpRoute(audio_policy_dev_state_t aState, const char *aAddress)
+static void ProcessDelayedA2dpRoute(audio_policy_dev_state_t aState, const nsCString aAddress)
{
if (sA2dpSwitchDone)
return;
AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP,
- aState, aAddress);
+ aState, aAddress.get());
String8 cmd("bluetooth_enabled=false");
AudioSystem::setParameters(0, cmd);
cmd.setTo("A2dpSuspended=true");
AudioSystem::setParameters(0, cmd);
sA2dpSwitchDone = true;
}
NS_IMPL_ISUPPORTS(AudioManager, nsIAudioManager, nsIObserver)
@@ -275,17 +275,17 @@ AudioManager::HandleBluetoothStatusChang
int32_t force;
GetForceForUse(nsIAudioManager::USE_COMMUNICATION, &force);
if (force == nsIAudioManager::FORCE_BT_SCO)
SetForceForUse(nsIAudioManager::USE_COMMUNICATION, nsIAudioManager::FORCE_NONE);
}
} else if (!strcmp(aTopic, BLUETOOTH_A2DP_STATUS_CHANGED_ID)) {
if (audioState == AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE && sA2dpSwitchDone) {
MessageLoop::current()->PostDelayedTask(
- FROM_HERE, NewRunnableFunction(&ProcessDelayedA2dpRoute, audioState, aAddress.get()), 1000);
+ FROM_HERE, NewRunnableFunction(&ProcessDelayedA2dpRoute, audioState, aAddress), 1000);
sA2dpSwitchDone = false;
} else {
AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP,
audioState, aAddress.get());
String8 cmd("bluetooth_enabled=true");
AudioSystem::setParameters(0, cmd);
cmd.setTo("A2dpSuspended=false");
AudioSystem::setParameters(0, cmd);