From 3891c4cc918e8062abb97c542a8625d556dccc59 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 20 Apr 2010 09:40:57 -0700 Subject: [PATCH] Fix issue 2602879: camera shutter sound not playing. The problem occurs if the device is powered down in silent mode. When the device restarts, AudioService reads current ringer mode from saved settings but does not call setRingerModeInt() to perform actions required when ringer mode changes. The volumes of streams affected by ringer mode are actually at 0 because they are also read from settings but their mute state is not applied correclty. When we later exit from silent mode, the streams other than STREAM_RING that are affected by ringer mode are not restored as they are not considered muted. This applies to STREAM_SYSTEM but also to STREAM_NOTIFICATION if its volume is controlled independently from STREAM_RING. The fix consists in calling setRingerModeInt() when AudioService starts. Change-Id: Ica75b9874938dda1bc1b634c3e97db4a650d295c --- media/java/android/media/AudioService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 44596bfc2c24d..df07059990675 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -279,6 +279,12 @@ public class AudioService extends IAudioService.Stub { mMode = AudioSystem.MODE_INVALID; setMode(AudioSystem.MODE_NORMAL, null); mMediaServerOk = true; + + // Call setRingerModeInt() to apply correct mute + // state on streams affected by ringer mode. + mRingerModeMutedStreams = 0; + setRingerModeInt(getRingerMode(), false); + AudioSystem.setErrorCallback(mAudioSystemCallback); loadSoundEffects();