Bug 868960 - [FMRadio] FM Radio volume is not updated by headset ejecting. r=mwu
authorrlin@mozilla.com
Tue, 07 May 2013 15:31:13 +0800
changeset 142148 64c5d1f3d72802881a471e5530b610d6927e2ad2
parent 142146 b980d32c366f82691e99f065b1743e535df64843
child 142149 ea89e932e5a377dc19d3194ccd2719437a639f8b
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu
bugs868960
milestone23.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 868960 - [FMRadio] FM Radio volume is not updated by headset ejecting. r=mwu
dom/system/gonk/AudioManager.cpp
dom/system/gonk/AudioManager.h
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -194,18 +194,17 @@ class HeadphoneSwitchObserver : public S
 public:
   void Notify(const SwitchEvent& aEvent) {
     InternalSetAudioRoutes(aEvent.status());
     NotifyHeadphonesStatus(aEvent.status());
   }
 };
 
 AudioManager::AudioManager() : mPhoneState(PHONE_STATE_CURRENT),
-                 mObserver(new HeadphoneSwitchObserver()),
-                 mFMChannelIsMuted(0)
+                 mObserver(new HeadphoneSwitchObserver())
 {
   RegisterSwitchObserver(SWITCH_HEADPHONES, mObserver);
 
   InternalSetAudioRoutes(GetCurrentSwitchState(SWITCH_HEADPHONES));
   NotifyHeadphonesStatus(GetCurrentSwitchState(SWITCH_HEADPHONES));
 
   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
   if (NS_FAILED(obs->AddObserver(this, BLUETOOTH_SCO_STATUS_CHANGED, false))) {
@@ -418,22 +417,18 @@ AudioManager::SetFmRadioAudioEnabled(boo
   }
 }
 
 NS_IMETHODIMP
 AudioManager::SetStreamVolumeIndex(int32_t aStream, int32_t aIndex) {
   status_t status =
     AudioSystem::setStreamVolumeIndex(static_cast<audio_stream_type_t>(aStream), aIndex);
 
-  // sync the fm stream volume with music volume, except set fm volume by audioChannelServices
-  if (aStream == AUDIO_STREAM_FM && IsDeviceOn(AUDIO_DEVICE_OUT_FM)) {
-    mFMChannelIsMuted = aIndex == 0;
-  }
   // sync fm volume with music stream type
-  if (aStream == AUDIO_STREAM_MUSIC && IsDeviceOn(AUDIO_DEVICE_OUT_FM) && !mFMChannelIsMuted) {
+  if (aStream == AUDIO_STREAM_MUSIC && IsDeviceOn(AUDIO_DEVICE_OUT_FM)) {
     AudioSystem::setStreamVolumeIndex(static_cast<audio_stream_type_t>(AUDIO_STREAM_FM), aIndex);
   }
 
   return status ? NS_ERROR_FAILURE : NS_OK;
 }
 
 NS_IMETHODIMP
 AudioManager::GetStreamVolumeIndex(int32_t aStream, int32_t* aIndex) {
--- a/dom/system/gonk/AudioManager.h
+++ b/dom/system/gonk/AudioManager.h
@@ -50,16 +50,15 @@ public:
   ~AudioManager();
 
 protected:
   int32_t mPhoneState;
 
 private:
   nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
   nsCOMPtr<AudioChannelAgent>             mPhoneAudioAgent;
-  bool                                    mFMChannelIsMuted;
 };
 
 } /* namespace gonk */
 } /* namespace dom */
 } /* namespace mozilla */
 
 #endif // mozilla_dom_system_b2g_audiomanager_h__