summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-06-15 02:39:11 +0200
committerDanny Baumann <dannybaumann@web.de>2013-06-16 20:07:38 +0200
commite6d8bcafff46fb0a465a194d29683da56abc8b26 (patch)
treea18025689873e63513381b9572e0752bf7f94f18 /media
parent44d22ba5d90b340cb99566ee99ac0b5f4fb2e826 (diff)
downloadframeworks_base-e6d8bcafff46fb0a465a194d29683da56abc8b26.zip
frameworks_base-e6d8bcafff46fb0a465a194d29683da56abc8b26.tar.gz
frameworks_base-e6d8bcafff46fb0a465a194d29683da56abc8b26.tar.bz2
Fix ringer mode being unneededly changed by setting ringer mode volume
to 0. When having set the ringer mode to silent on a device with vibrator and calling setStreamVolume() for the ringer stream again (e.g. in one of the volume control dialogs in the settings app), the ringer mode is set to vibrate, although there's no reason to do so. Fix that by remembering the last non-normal (that is, either silent or vibrate) ringer mode and using that when setting the stream volume to 0. Change-Id: I27f1c75a0fef52bd63ac20f4101042808ce2c458 JIRA: CYAN-1403
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioService.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 1144325..e9bd455 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -319,6 +319,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
*/
// protected by mSettingsLock
private int mRingerMode;
+ // last non-normal ringer mode
+ private int mLastSilentRingerMode = -1;
/** @see System#MODE_RINGER_STREAMS_AFFECTED */
private int mRingerModeAffectedStreams;
@@ -1002,8 +1004,14 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
(mStreamVolumeAlias[streamType] == getMasterStreamType())) {
int newRingerMode;
if (index == 0) {
- newRingerMode = mHasVibrator ? AudioManager.RINGER_MODE_VIBRATE
- : AudioManager.RINGER_MODE_SILENT;
+ synchronized (mSettingsLock) {
+ if (mLastSilentRingerMode != -1) {
+ newRingerMode = mLastSilentRingerMode;
+ } else {
+ newRingerMode = mHasVibrator ? AudioManager.RINGER_MODE_VIBRATE
+ : AudioManager.RINGER_MODE_SILENT;
+ }
+ }
setStreamVolumeInt(mStreamVolumeAlias[streamType],
index,
device,
@@ -1359,6 +1367,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
private void setRingerModeInt(int ringerMode, boolean persist) {
synchronized(mSettingsLock) {
mRingerMode = ringerMode;
+ if (ringerMode != AudioManager.RINGER_MODE_NORMAL) {
+ mLastSilentRingerMode = ringerMode;
+ }
}
// Mute stream if not previously muted by ringer mode and ringer mode