summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-11-08 10:31:57 -0800
committerEric Laurent <elaurent@google.com>2011-11-09 18:06:37 -0800
commit96a33d1caad2fab0bc28891cfbf553f4b050bf0b (patch)
tree9a2560cbaa3a850793a0c7de5738953dcc859807 /media
parent36a7f2a9adfa21ec31f00d496fef82e68931c860 (diff)
downloadframeworks_base-96a33d1caad2fab0bc28891cfbf553f4b050bf0b.zip
frameworks_base-96a33d1caad2fab0bc28891cfbf553f4b050bf0b.tar.gz
frameworks_base-96a33d1caad2fab0bc28891cfbf553f4b050bf0b.tar.bz2
Fix problems in tablet silent mode.
Do not enter silent mode when ALARM stream volume is changed to 0 by volume down key: Only RING, NOTIFICATION and MUSIC streams control silent mode. Report correct volume (0) for NOTIFICATION stream when silent mode is entered by changing NOTIFICATION stream volume to 0 with volume down key. Change-Id: I3e0816dfae40bc127cc30cca02cdca6ec19e30a4
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioService.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 2f32bd8..fe15605 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -521,6 +521,9 @@ public class AudioService extends IAudioService.Stub {
ensureValidDirection(direction);
ensureValidStreamType(streamType);
+ // use stream type alias here so that streams with same alias have the same behavior,
+ // including with regard to silent mode control (e.g the use of STREAM_RING below and in
+ // checkForRingerModeChange() in place of STREAM_RING or STREAM_NOTIFICATION)
int streamTypeAlias = STREAM_VOLUME_ALIAS[streamType];
VolumeStreamState streamState = mStreamStates[streamTypeAlias];
final int oldIndex = (streamState.muteCount() != 0) ? streamState.mLastAudibleIndex : streamState.mIndex;
@@ -529,9 +532,8 @@ public class AudioService extends IAudioService.Stub {
// If either the client forces allowing ringer modes for this adjustment,
// or the stream type is one that is affected by ringer modes
if (((flags & AudioManager.FLAG_ALLOW_RINGER_MODES) != 0) ||
- (!mVoiceCapable && streamType != AudioSystem.STREAM_VOICE_CALL &&
- streamType != AudioSystem.STREAM_BLUETOOTH_SCO) ||
- (mVoiceCapable && streamTypeAlias == AudioSystem.STREAM_RING)) {
+ streamTypeAlias == AudioSystem.STREAM_RING ||
+ (!mVoiceCapable && streamTypeAlias == AudioSystem.STREAM_MUSIC)) {
// do not vibrate if already in vibrate mode
if (mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
flags &= ~AudioManager.FLAG_VIBRATE;
@@ -545,10 +547,19 @@ public class AudioService extends IAudioService.Stub {
int index;
if (streamState.muteCount() != 0) {
if (adjustVolume) {
- streamState.adjustLastAudibleIndex(direction);
- // Post a persist volume msg
- sendMsg(mAudioHandler, MSG_PERSIST_VOLUME, streamType,
- SENDMSG_REPLACE, 0, 1, streamState, PERSIST_DELAY);
+ // adjust volume on all stream types sharing the same alias otherwise a query
+ // on last audible index for an alias would not give the correct value
+ int numStreamTypes = AudioSystem.getNumStreamTypes();
+ for (int i = numStreamTypes - 1; i >= 0; i--) {
+ if (STREAM_VOLUME_ALIAS[i] == streamTypeAlias) {
+ VolumeStreamState s = mStreamStates[i];
+
+ s.adjustLastAudibleIndex(direction);
+ // Post a persist volume msg
+ sendMsg(mAudioHandler, MSG_PERSIST_VOLUME, i,
+ SENDMSG_REPLACE, 0, 1, s, PERSIST_DELAY);
+ }
+ }
}
index = streamState.mLastAudibleIndex;
} else {