diff options
author | Eric Laurent <elaurent@google.com> | 2011-07-20 11:04:18 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-20 11:04:18 -0700 |
commit | 5531a3a3cfce0fe0dd279cdce2de30cf777f5227 (patch) | |
tree | 58c8fe7108f10cf405b890de255955f18fa5337a /media | |
parent | 7f60a81a2a5fd03bc770611c9516986f7c194155 (diff) | |
parent | c1d4166289ce016965d1147f7e8d37862ee347ec (diff) | |
download | frameworks_base-5531a3a3cfce0fe0dd279cdce2de30cf777f5227.zip frameworks_base-5531a3a3cfce0fe0dd279cdce2de30cf777f5227.tar.gz frameworks_base-5531a3a3cfce0fe0dd279cdce2de30cf777f5227.tar.bz2 |
Merge "Fix issue 5012047: silent mode mutes music"
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioService.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 2e9b64c..682560a 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -332,10 +332,10 @@ public class AudioService extends IAudioService.Stub { SOUND_EFFECT_DEFAULT_VOLUME_DB); mVolumePanel = new VolumePanel(context, this); - mSettingsObserver = new SettingsObserver(); mForcedUseForComm = AudioSystem.FORCE_NONE; createAudioSystemThread(); readPersistedSettings(); + mSettingsObserver = new SettingsObserver(); createStreamStates(); // Call setMode() to initialize mSetModeDeathHandlers mMode = AudioSystem.MODE_INVALID; @@ -433,15 +433,20 @@ public class AudioService extends IAudioService.Stub { mVibrateSetting = System.getInt(cr, System.VIBRATE_ON, 0); + // make sure settings for ringer mode are consistent with device type: non voice capable + // devices (tablets) include media stream in silent mode whereas phones don't. mRingerModeAffectedStreams = Settings.System.getInt(cr, Settings.System.MODE_RINGER_STREAMS_AFFECTED, ((1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_NOTIFICATION)| - (1 << AudioSystem.STREAM_SYSTEM)|(1 << AudioSystem.STREAM_SYSTEM_ENFORCED)| - (1 << AudioSystem.STREAM_MUSIC))); - - if (!mVoiceCapable) { + (1 << AudioSystem.STREAM_SYSTEM)|(1 << AudioSystem.STREAM_SYSTEM_ENFORCED))); + if (mVoiceCapable) { + mRingerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_MUSIC); + } else { mRingerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC); } + Settings.System.putInt(cr, + Settings.System.MODE_RINGER_STREAMS_AFFECTED, mRingerModeAffectedStreams); + mMuteAffectedStreams = System.getInt(cr, System.MUTE_STREAMS_AFFECTED, ((1 << AudioSystem.STREAM_MUSIC)|(1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_SYSTEM))); @@ -2172,12 +2177,14 @@ public class AudioService extends IAudioService.Stub { super.onChange(selfChange); synchronized (mSettingsLock) { int ringerModeAffectedStreams = Settings.System.getInt(mContentResolver, - Settings.System.MODE_RINGER_STREAMS_AFFECTED, - 0); - if (!mVoiceCapable) { + Settings.System.MODE_RINGER_STREAMS_AFFECTED, + ((1 << AudioSystem.STREAM_RING)|(1 << AudioSystem.STREAM_NOTIFICATION)| + (1 << AudioSystem.STREAM_SYSTEM)|(1 << AudioSystem.STREAM_SYSTEM_ENFORCED))); + if (mVoiceCapable) { + ringerModeAffectedStreams &= ~(1 << AudioSystem.STREAM_MUSIC); + } else { ringerModeAffectedStreams |= (1 << AudioSystem.STREAM_MUSIC); } - if (ringerModeAffectedStreams != mRingerModeAffectedStreams) { /* * Ensure all stream types that should be affected by ringer mode |