Bug 815452 - Don't unmute FM audio if the user increases the volume when FM audio is muted for channel policy reasons. r=sicking

This commit is contained in:
Randy Lin 2012-12-11 18:26:01 +08:00
parent ef07f2b80f
commit d39fa81ef3
3 changed files with 10 additions and 3 deletions

View File

@ -70,7 +70,7 @@ if ("nsIAudioManager" in Ci) {
const nsIAudioManager = Ci.nsIAudioManager;
audioChannelSettings = [
// settings name, max value, apply to stream types
['audio.volume.content', 15, [nsIAudioManager.STREAM_TYPE_SYSTEM, nsIAudioManager.STREAM_TYPE_MUSIC, nsIAudioManager.STREAM_TYPE_FM]],
['audio.volume.content', 15, [nsIAudioManager.STREAM_TYPE_SYSTEM, nsIAudioManager.STREAM_TYPE_MUSIC]],
['audio.volume.notification', 15, [nsIAudioManager.STREAM_TYPE_RING, nsIAudioManager.STREAM_TYPE_NOTIFICATION]],
['audio.volume.alarm', 15, [nsIAudioManager.STREAM_TYPE_ALARM]],
['audio.volume.telephony', 5, [nsIAudioManager.STREAM_TYPE_VOICE_CALL]],

View File

@ -393,10 +393,16 @@ 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
if (aStream == AUDIO_STREAM_MUSIC && IsDeviceOn(AUDIO_DEVICE_OUT_FM)) {
// 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) {
AudioSystem::setStreamVolumeIndex(static_cast<audio_stream_type_t>(AUDIO_STREAM_FM), aIndex);
}
return status ? NS_ERROR_FAILURE : NS_OK;
}

View File

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