summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-04-13 10:38:05 -0700
committerEric Laurent <elaurent@google.com>2010-04-14 10:52:01 -0700
commit758dd527f64f1e827adfe09f0141ab213733ca22 (patch)
tree0199bb7d4f92fad65529f6c6fab6d71818c18518
parent745b43c28fd6bb82c72a15b28be75c55dd115171 (diff)
downloadframeworks_base-758dd527f64f1e827adfe09f0141ab213733ca22.zip
frameworks_base-758dd527f64f1e827adfe09f0141ab213733ca22.tar.gz
frameworks_base-758dd527f64f1e827adfe09f0141ab213733ca22.tar.bz2
Fix issue 2592680: Saved ringer volume forced to 0 when receiving a call in silent mode.
This is a regression introduced by change 5b4e654d0c7de8e4d58d73e73b0d5220f19b68f7 for issue 2472495. When AudioService changes audio mode, setMode() reapplies current volume for the default active stream which in this case is STREAM_RING. Because the new implementation of silent mode actually mutes the ringer stream, setStreamVolumeInt() now applies the volume change received while in silent mode to the last audible value and we end up clearing the last audible volume for ringer. The fix consists in not modifying last audible value when the new value is 0. Also removed obsolete code in setStreamVolumeInt() since new implementation of setRingerModeInt() in change 5b4e654d0c7de8e4d58d73e73b0d5220f19b68f7. Change-Id: I746f3bc1af39a602ce12d130ce592007b2d0ebb6
-rw-r--r--media/java/android/media/AudioService.java26
1 files changed, 9 insertions, 17 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 3e38e53..a38be48 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -492,27 +492,19 @@ public class AudioService extends IAudioService.Stub {
// If stream is muted, set last audible index only
if (streamState.muteCount() != 0) {
- streamState.setLastAudibleIndex(index);
- // Post a persist volume msg
- sendMsg(mAudioHandler, MSG_PERSIST_VOLUME, streamType,
- SENDMSG_REPLACE, 0, 1, streamState, PERSIST_DELAY);
+ // Do not allow last audible index to be 0
+ if (index != 0) {
+ streamState.setLastAudibleIndex(index);
+ // Post a persist volume msg
+ sendMsg(mAudioHandler, MSG_PERSIST_VOLUME, streamType,
+ SENDMSG_REPLACE, 0, 1, streamState, PERSIST_DELAY);
+ }
} else {
if (streamState.setIndex(index, lastAudible) || force) {
// Post message to set system volume (it in turn will post a message
// to persist).
- // If we are in silent mode and stream is affected by ringer mode
- // and the new volume is not 0, just persist the new volume but do not change
- // current value
- if (mRingerMode == AudioManager.RINGER_MODE_NORMAL ||
- !isStreamAffectedByRingerMode(streamType) ||
- index == 0) {
- sendMsg(mAudioHandler, MSG_SET_SYSTEM_VOLUME, streamType, SENDMSG_NOOP, 0, 0,
- streamState, 0);
- } else {
- // Post a persist volume msg
- sendMsg(mAudioHandler, MSG_PERSIST_VOLUME, streamType,
- SENDMSG_REPLACE, 0, 1, streamState, PERSIST_DELAY);
- }
+ sendMsg(mAudioHandler, MSG_SET_SYSTEM_VOLUME, streamType, SENDMSG_NOOP, 0, 0,
+ streamState, 0);
}
}
}