Bug 868960 - [FMRadio] FM Radio volume is not updated by headset ejecting. r=mwu

This commit is contained in:
rlin@mozilla.com 2013-05-07 15:31:13 +08:00
parent 210edab1cd
commit 36abc5d8ba
2 changed files with 2 additions and 8 deletions

View File

@ -199,8 +199,7 @@ public:
};
AudioManager::AudioManager() : mPhoneState(PHONE_STATE_CURRENT),
mObserver(new HeadphoneSwitchObserver()),
mFMChannelIsMuted(0)
mObserver(new HeadphoneSwitchObserver())
{
RegisterSwitchObserver(SWITCH_HEADPHONES, mObserver);
@ -423,12 +422,8 @@ 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);
}

View File

@ -55,7 +55,6 @@ protected:
private:
nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
nsCOMPtr<AudioChannelAgent> mPhoneAudioAgent;
bool mFMChannelIsMuted;
};
} /* namespace gonk */