Bug 1072021 - Fix bluetooth address is empty to set Audio HAL when A2DP is disconnected. r=echou, a=bajaj
authorWayne Chen <waychen@mozilla.com>
Thu, 02 Oct 2014 17:22:44 +0800
changeset 225319 2ea176a71d179beb345c9956b32398ac518ae9fb
parent 225318 de46351a998acdc8ac6574dde1e6214034619841
child 225320 4a8b7ebaec9121919c4d046b32632fdda50d2d1c
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou, bajaj
bugs1072021
milestone34.0a2
Bug 1072021 - Fix bluetooth address is empty to set Audio HAL when A2DP is disconnected. r=echou, a=bajaj
dom/system/gonk/AudioManager.cpp
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -192,22 +192,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)
@@ -273,17 +273,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);