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

This commit is contained in:
Randy Lin 2012-12-11 18:26:01 +08:00
Родитель f5800a023c
Коммит eea4b358f4
3 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -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]],

Просмотреть файл

@ -391,10 +391,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;
}

Просмотреть файл

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