summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-10-02 18:18:48 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-02 18:18:48 -0700
commit06fcebc62cafd4d9d3324ccfbf97ab10742af4e1 (patch)
treed022068ccdbe8703eb06bb5ae9e5ea2efc903a65
parent1ed299f822b22998b7236e3147d8cf4707bced08 (diff)
parent002e9d382d2daa7ed41636463ecdbddbd4897aba (diff)
downloadframeworks_base-06fcebc62cafd4d9d3324ccfbf97ab10742af4e1.zip
frameworks_base-06fcebc62cafd4d9d3324ccfbf97ab10742af4e1.tar.gz
frameworks_base-06fcebc62cafd4d9d3324ccfbf97ab10742af4e1.tar.bz2
Merge "audio service: fix system volume settings" into jb-mr1-dev
-rw-r--r--media/java/android/media/AudioService.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index fdb6818..61418fb 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1737,7 +1737,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
streamState.readSettings();
// unmute stream that was muted but is not affect by mute anymore
- if (streamState.muteCount() != 0 && !isStreamAffectedByMute(streamType)) {
+ if (streamState.muteCount() != 0 && !isStreamAffectedByMute(streamType) &&
+ !isStreamMutedByRingerMode(streamType)) {
int size = streamState.mDeathHandlers.size();
for (int i = 0; i < size; i++) {
streamState.mDeathHandlers.get(i).mMuteCount = 1;
@@ -2591,6 +2592,18 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
public synchronized void readSettings() {
int remainingDevices = AudioSystem.DEVICE_OUT_ALL;
+ // do not read system stream volume from settings: this stream is always aliased
+ // to another stream type and its volume is never persisted. Values in settings can
+ // only be stale values
+ if ((mStreamType == AudioSystem.STREAM_SYSTEM) ||
+ (mStreamType == AudioSystem.STREAM_SYSTEM_ENFORCED)) {
+ mLastAudibleIndex.put(AudioSystem.DEVICE_OUT_DEFAULT,
+ 10 * AudioManager.DEFAULT_STREAM_VOLUME[mStreamType]);
+ mIndex.put(AudioSystem.DEVICE_OUT_DEFAULT,
+ 10 * AudioManager.DEFAULT_STREAM_VOLUME[mStreamType]);
+ return;
+ }
+
for (int i = 0; remainingDevices != 0; i++) {
int device = (1 << i);
if ((device & remainingDevices) == 0) {
@@ -2621,11 +2634,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
// a last audible index of 0 should never be stored for ring and notification
// streams on phones (voice capable devices).
- // same for system stream on phones and tablets
- if ((lastAudibleIndex == 0) &&
- ((mVoiceCapable &&
- (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) ||
- (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_SYSTEM))) {
+ if ((lastAudibleIndex == 0) && mVoiceCapable &&
+ (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) {
lastAudibleIndex = AudioManager.DEFAULT_STREAM_VOLUME[mStreamType];
// Correct the data base
sendMsg(mAudioHandler,
@@ -2639,11 +2649,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
mLastAudibleIndex.put(device, getValidIndex(10 * lastAudibleIndex));
// the initial index should never be 0 for ring and notification streams on phones
// (voice capable devices) if not in silent or vibrate mode.
- // same for system stream on phones and tablets
if ((index == 0) && (mRingerMode == AudioManager.RINGER_MODE_NORMAL) &&
- ((mVoiceCapable &&
- (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) ||
- (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_SYSTEM))) {
+ mVoiceCapable &&
+ (mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) {
index = lastAudibleIndex;
// Correct the data base
sendMsg(mAudioHandler,