Bug 1072021: Fix bluetooth address is empty to set Audio HAL when A2DP is disconnected. r=echou
authorWayne Chen <waychen@mozilla.com>
Thu, 02 Oct 2014 17:22:44 +0800
changeset 231889 f6b6547207ab6b81aea044c2465b9b0deb5973f9
parent 231888 5b0c35716c02ca872ce752636f6cffe9269a1397
child 231890 e5be40292af6e49a5a12cfd955c14c2344c4bfc2
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou
bugs1072021
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1072021: Fix bluetooth address is empty to set Audio HAL when A2DP is disconnected. r=echou
dom/system/gonk/AudioManager.cpp
--- 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);