Set stream volume to max when userMasterVolume is set to true.
When useMasterVolume is set, we don't want to apply the volume attenuation twice, once at the stream mixer and once at the master volume control. It should only be applied once at the master volume control. Change-Id: Id5b1cf97571733515b5680c638f11cde8824cfc0 Fixed: b/18460548
This commit is contained in:
@@ -608,6 +608,10 @@ public class AudioService extends IAudioService.Stub {
|
||||
|
||||
mUseFixedVolume = mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_useFixedVolume);
|
||||
mUseMasterVolume = context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_useMasterVolume);
|
||||
mMasterVolumeRamp = context.getResources().getIntArray(
|
||||
com.android.internal.R.array.config_masterVolumeRamp);
|
||||
|
||||
// must be called before readPersistedSettings() which needs a valid mStreamVolumeAlias[]
|
||||
// array initialized by updateStreamVolumeAlias()
|
||||
@@ -658,13 +662,8 @@ public class AudioService extends IAudioService.Stub {
|
||||
|
||||
context.registerReceiver(mReceiver, intentFilter);
|
||||
|
||||
mUseMasterVolume = context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_useMasterVolume);
|
||||
restoreMasterVolume();
|
||||
|
||||
mMasterVolumeRamp = context.getResources().getIntArray(
|
||||
com.android.internal.R.array.config_masterVolumeRamp);
|
||||
|
||||
LocalServices.addService(AudioManagerInternal.class, new AudioServiceInternal());
|
||||
}
|
||||
|
||||
@@ -3446,8 +3445,9 @@ public class AudioService extends IAudioService.Stub {
|
||||
|
||||
public void readSettings() {
|
||||
synchronized (VolumeStreamState.class) {
|
||||
// force maximum volume on all streams if fixed volume property is set
|
||||
if (mUseFixedVolume) {
|
||||
// force maximum volume on all streams if fixed volume property
|
||||
// or master volume property is set
|
||||
if (mUseFixedVolume || mUseMasterVolume) {
|
||||
mIndex.put(AudioSystem.DEVICE_OUT_DEFAULT, mIndexMax);
|
||||
return;
|
||||
}
|
||||
@@ -3672,7 +3672,7 @@ public class AudioService extends IAudioService.Stub {
|
||||
private int getValidIndex(int index) {
|
||||
if (index < 0) {
|
||||
return 0;
|
||||
} else if (mUseFixedVolume || index > mIndexMax) {
|
||||
} else if (mUseFixedVolume || mUseMasterVolume || index > mIndexMax) {
|
||||
return mIndexMax;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user