Bug 876334 - Remove master/FM volume control from nsIAudioManager. r=mwu

This commit is contained in:
Marco Chen 2013-07-18 10:21:24 +08:00
parent 5047ca96a3
commit 1752b92a2d
4 changed files with 4 additions and 86 deletions

View File

@ -63,14 +63,6 @@ var SettingsListener = {
SettingsListener.init();
// =================== Audio ====================
SettingsListener.observe('audio.volume.master', 1.0, function(value) {
let audioManager = Services.audioManager;
if (!audioManager)
return;
audioManager.masterVolume = Math.max(0.0, Math.min(value, 1.0));
});
let audioChannelSettings = [];
if ("nsIAudioManager" in Ci) {

View File

@ -39,16 +39,6 @@ XPCOMUtils.defineLazyServiceGetter(this, 'gSystemMessenger',
'@mozilla.org/system-message-internal;1',
'nsISystemMessagesInternal');
#ifdef MOZ_WIDGET_GONK
XPCOMUtils.defineLazyServiceGetter(Services, 'audioManager',
'@mozilla.org/telephony/audiomanager;1',
'nsIAudioManager');
#else
Services.audioManager = {
'masterVolume': 0
};
#endif
XPCOMUtils.defineLazyServiceGetter(Services, 'fm',
'@mozilla.org/focus-manager;1',
'nsIFocusManager');
@ -344,9 +334,6 @@ var shell = {
this.timer = null;
}
#ifndef MOZ_WIDGET_GONK
delete Services.audioManager;
#endif
UserAgentOverrides.uninit();
IndexedDBPromptHelper.uninit();
},

View File

@ -159,14 +159,6 @@ InternalSetAudioRoutesICS(SwitchState aState)
AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE, "");
sHeadsetState = 0;
}
// The audio volume is not consistent when we plug and unplug the headset.
// Set the fm volume again here.
if (IsDeviceOn(AUDIO_DEVICE_OUT_FM)) {
float masterVolume;
AudioSystem::getMasterVolume(&masterVolume);
AudioSystem::setFmVolume(masterVolume);
}
}
static void
@ -326,6 +318,9 @@ AudioManager::AudioManager() : mPhoneState(PHONE_STATE_CURRENT),
AUDIO_DEVICE_OUT_SPEAKER);
#endif
// Gecko only control stream volume not master so set to default value
// directly.
AudioSystem::setMasterVolume(1.0);
AudioSystem::setErrorCallback(BinderDeadCallback);
}
@ -360,52 +355,6 @@ AudioManager::SetMicrophoneMuted(bool aMicrophoneMuted)
return NS_OK;
}
NS_IMETHODIMP
AudioManager::GetMasterVolume(float* aMasterVolume)
{
if (AudioSystem::getMasterVolume(aMasterVolume)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
AudioManager::SetMasterVolume(float aMasterVolume)
{
if (AudioSystem::setMasterVolume(aMasterVolume)) {
return NS_ERROR_FAILURE;
}
// For now, just set the voice volume at the same level
if (AudioSystem::setVoiceVolume(aMasterVolume)) {
return NS_ERROR_FAILURE;
}
if (IsDeviceOn(AUDIO_DEVICE_OUT_FM) &&
AudioSystem::setFmVolume(aMasterVolume)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
AudioManager::GetMasterMuted(bool* aMasterMuted)
{
if (AudioSystem::getMasterMute(aMasterMuted)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
AudioManager::SetMasterMuted(bool aMasterMuted)
{
if (AudioSystem::setMasterMute(aMasterMuted)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
AudioManager::GetPhoneState(int32_t* aState)
{

View File

@ -4,7 +4,7 @@
#include "nsISupports.idl"
[scriptable, builtinclass, uuid(b76a3de4-79f4-4cbb-a0e2-871095eacb2c)]
[scriptable, builtinclass, uuid(60da41b4-cdc2-11e2-8a91-10bf48d64bd4)]
interface nsIAudioManager : nsISupports
{
/**
@ -12,16 +12,6 @@ interface nsIAudioManager : nsISupports
*/
attribute boolean microphoneMuted;
/**
* The master volume.
*/
attribute float masterVolume;
/**
* Master volume muted?
*/
attribute boolean masterMuted;
/**
* Are we playing audio from the FM radio?
*/