diff options
| author | 2018-03-13 23:09:51 +0000 | |
|---|---|---|
| committer | 2018-03-13 23:09:51 +0000 | |
| commit | ab8f4a95f060f081cb6fd91438a8a7267abdc7f1 (patch) | |
| tree | 9d6aabaa305381bd05b7e79a31baa17f8ce8553e | |
| parent | eb950bbe462f7f8393f95f739b86edcc2d18f2e4 (diff) | |
| parent | 09b6c21593bb40fb81008d066949c2ba04a00ea2 (diff) | |
Merge "audioservice: add more properties for volume steps and default volumes" into pi-dev
| -rw-r--r-- | services/core/java/com/android/server/audio/AudioService.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index f577d09cdb9f..9ef84d20004f 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -727,6 +727,36 @@ public class AudioService extends IAudioService.Stub } } + int maxAlarmVolume = SystemProperties.getInt("ro.config.alarm_vol_steps", -1); + if (maxAlarmVolume != -1) { + MAX_STREAM_VOLUME[AudioSystem.STREAM_ALARM] = maxAlarmVolume; + } + + int defaultAlarmVolume = SystemProperties.getInt("ro.config.alarm_vol_default", -1); + if (defaultAlarmVolume != -1 && + defaultAlarmVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_ALARM]) { + AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_ALARM] = defaultAlarmVolume; + } else { + // Default is 6 out of 7 (default maximum), so scale accordingly. + AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_ALARM] = + 6 * MAX_STREAM_VOLUME[AudioSystem.STREAM_ALARM] / 7; + } + + int maxSystemVolume = SystemProperties.getInt("ro.config.system_vol_steps", -1); + if (maxSystemVolume != -1) { + MAX_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM] = maxSystemVolume; + } + + int defaultSystemVolume = SystemProperties.getInt("ro.config.system_vol_default", -1); + if (defaultSystemVolume != -1 && + defaultSystemVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM]) { + AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM] = defaultSystemVolume; + } else { + // Default is to use maximum. + AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM] = + MAX_STREAM_VOLUME[AudioSystem.STREAM_SYSTEM]; + } + sSoundEffectVolumeDb = context.getResources().getInteger( com.android.internal.R.integer.config_soundEffectVolumeDb); |