summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-08-31 12:59:28 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-31 12:59:28 -0700
commit16b241a58f1ec4b317647b6fd0ad9b5cc3f7ba3d (patch)
treeca95d0bbe1dbe8391e437f0bb0824719b7e6a2c5 /media
parent528e382f48681a2175a24e7403f63a4493d7c44b (diff)
parent3d4c06f90726a85e89dab13c41ddc15b9c912a3f (diff)
downloadframeworks_base-16b241a58f1ec4b317647b6fd0ad9b5cc3f7ba3d.zip
frameworks_base-16b241a58f1ec4b317647b6fd0ad9b5cc3f7ba3d.tar.gz
frameworks_base-16b241a58f1ec4b317647b6fd0ad9b5cc3f7ba3d.tar.bz2
Merge "Change condition to enter silent mode."
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioService.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index de94ebd..ddd9d1f 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1558,21 +1558,29 @@ public class AudioService extends IAudioService.Stub {
private boolean checkForRingerModeChange(int oldIndex, int direction) {
boolean adjustVolumeIndex = true;
int newRingerMode = mRingerMode;
+ int uiIndex = (oldIndex + 5) / 10;
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) && (uiIndex <= 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;
+ }
+ if (uiIndex == 0) {
+ adjustVolumeIndex = false;
+ }
}
} else {
if (direction == AudioManager.ADJUST_RAISE) {
// exiting silent mode
newRingerMode = AudioManager.RINGER_MODE_NORMAL;
+ if (uiIndex != 0) {
+ adjustVolumeIndex = false;
+ }
} else {
// prevent last audible index to reach 0
adjustVolumeIndex = false;
@@ -1581,13 +1589,6 @@ public class AudioService extends IAudioService.Stub {
if (newRingerMode != mRingerMode) {
setRingerMode(newRingerMode);
-
- /*
- * If we are changing ringer modes, do not increment/decrement the
- * volume index. Instead, the handler for the message above will
- * take care of changing the index.
- */
- adjustVolumeIndex = false;
}
mPrevVolDirection = direction;