From c11c3ae4dd5d4054e5b44a7bdfe6b203bdb69976 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Mon, 15 Aug 2011 19:58:28 -0700 Subject: Change condition to enter silent mode. Previously, silent mode was entered if volume was already at 0 and volume down key was pressed once. The new volume management policy specifies that silent mode is entered when volume is at last audible step and volume down key is pressed once. Pressing volume down key continuously will decrease volume until last audible step is reached, not 0. Change-Id: Ib7b530668473d6a5af1e748f445d6185afed2158 --- media/java/android/media/AudioService.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'media/java') diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index ff2e66b..179b8a4 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -1552,14 +1552,17 @@ public class AudioService extends IAudioService.Stub { int newRingerMode = mRingerMode; if (mRingerMode == AudioManager.RINGER_MODE_NORMAL) { - // audible mode, at the bottom of the scale - if ((direction == AudioManager.ADJUST_LOWER && - mPrevVolDirection != AudioManager.ADJUST_LOWER) && - ((oldIndex + 5) / 10 == 0)) { - // "silent mode", but which one? - newRingerMode = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1 - ? AudioManager.RINGER_MODE_VIBRATE - : AudioManager.RINGER_MODE_SILENT; + if ((direction == AudioManager.ADJUST_LOWER) && ((oldIndex + 5) / 10 <= 1)) { + // enter silent mode if current index is the last audible one and not repeating a + // volume key down + if (mPrevVolDirection != AudioManager.ADJUST_LOWER) { + // "silent mode", but which one? + newRingerMode = System.getInt(mContentResolver, System.VIBRATE_IN_SILENT, 1) == 1 + ? AudioManager.RINGER_MODE_VIBRATE + : AudioManager.RINGER_MODE_SILENT; + } else { + adjustVolumeIndex = false; + } } } else { if (direction == AudioManager.ADJUST_RAISE) { -- cgit v1.1