Make single volume devices more robust to ringer mode changes.

In single volume mode:
Make getNewRingerMode always return the existing one, as setRingerMode
does nothing when in single volume mode.
Check ringer mode change respects single volume mode.

Bug: 69814628
Test: flash to single volume mode device
Change-Id: I66ef173c97118fe471dec462d7a82ad2e62064b0
This commit is contained in:
Zak Cohen
2017-11-30 12:34:20 -08:00
parent d27c9dabcb
commit 477982915a

View File

@@ -1645,6 +1645,11 @@ public class AudioService extends IAudioService.Stub
};
private int getNewRingerMode(int stream, int index, int flags) {
// setRingerMode does nothing if the device is single volume,so the value would be unchanged
if (mIsSingleVolume) {
return getRingerModeExternal();
}
// setting volume on ui sounds stream type also controls silent mode
if (((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0) ||
(stream == getUiSoundsStreamType())) {
@@ -3691,7 +3696,7 @@ public class AudioService extends IAudioService.Stub
private int checkForRingerModeChange(int oldIndex, int direction, int step, boolean isMuted,
String caller, int flags) {
int result = FLAG_ADJUST_VOLUME;
if (isPlatformTelevision()) {
if (isPlatformTelevision() || mIsSingleVolume) {
return result;
}