summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-01-13 12:19:53 -0800
committerEric Laurent <elaurent@google.com>2015-01-13 12:19:53 -0800
commit4fb3b602156d093c1082be88f2f016f3a791a978 (patch)
tree984224b6f57bc7c11f6adcf6a4276c8f54c2444a /media
parent71922de6c8e407ff24bb1a500cb53bb1a647c758 (diff)
downloadframeworks_base-4fb3b602156d093c1082be88f2f016f3a791a978.zip
frameworks_base-4fb3b602156d093c1082be88f2f016f3a791a978.tar.gz
frameworks_base-4fb3b602156d093c1082be88f2f016f3a791a978.tar.bz2
AudioService: handle stream mute by stream alias
Handle stream mute/unmute requests at the stream alias level (like is done volume changes) to be consistent. E.g a request to mute/unmute a stream will affect all streams sharing the same alias for volume management. Bug: 18844550. Change-Id: Ie2e463c58df0371589150f0ebb9b36c38b14e1be
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/AudioService.java26
1 files changed, 16 insertions, 10 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 5b6ca29..f4c8986 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1511,9 +1511,11 @@ public class AudioService extends IAudioService.Stub {
if (mUseFixedVolume) {
return;
}
-
+ int streamAlias = mStreamVolumeAlias[streamType];
for (int stream = 0; stream < mStreamStates.length; stream++) {
- if (!isStreamAffectedByMute(stream) || stream == streamType) continue;
+ if (!isStreamAffectedByMute(streamAlias) || streamAlias == mStreamVolumeAlias[stream]) {
+ continue;
+ }
mStreamStates[stream].mute(cb, state);
}
}
@@ -1526,17 +1528,21 @@ public class AudioService extends IAudioService.Stub {
if (streamType == AudioManager.USE_DEFAULT_STREAM_TYPE) {
streamType = getActiveStreamType(streamType);
}
-
- if (isStreamAffectedByMute(streamType)) {
- if (streamType == AudioSystem.STREAM_MUSIC) {
+ int streamAlias = mStreamVolumeAlias[streamType];
+ if (isStreamAffectedByMute(streamAlias)) {
+ if (streamAlias == AudioSystem.STREAM_MUSIC) {
setSystemAudioMute(state);
}
- mStreamStates[streamType].mute(cb, state);
+ for (int stream = 0; stream < mStreamStates.length; stream++) {
+ if (streamAlias == mStreamVolumeAlias[stream]) {
+ mStreamStates[stream].mute(cb, state);
- Intent intent = new Intent(AudioManager.STREAM_MUTE_CHANGED_ACTION);
- intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, streamType);
- intent.putExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, state);
- sendBroadcastToAll(intent);
+ Intent intent = new Intent(AudioManager.STREAM_MUTE_CHANGED_ACTION);
+ intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, stream);
+ intent.putExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, state);
+ sendBroadcastToAll(intent);
+ }
+ }
}
}