diff options
author | Amith Yamasani <yamasani@google.com> | 2011-12-06 15:36:10 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-12-06 15:36:10 -0800 |
commit | f336408000c4be36045401fb4df89528249e7383 (patch) | |
tree | a7a4d540cd262e9a3f13e65681739f70d7730912 /media | |
parent | 720efc43d89ce9fd50b66f22cdb1bb4363cfb291 (diff) | |
parent | 6243edd818b84adfbe712d5d233d6414b33653ac (diff) | |
download | frameworks_base-f336408000c4be36045401fb4df89528249e7383.zip frameworks_base-f336408000c4be36045401fb4df89528249e7383.tar.gz frameworks_base-f336408000c4be36045401fb4df89528249e7383.tar.bz2 |
Merge "New and improved silent mode on lockscreen." into ics-mr1
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioService.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 228786e..37aacab 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -21,6 +21,7 @@ import static android.media.AudioManager.RINGER_MODE_SILENT; import static android.media.AudioManager.RINGER_MODE_VIBRATE; import android.app.ActivityManagerNative; +import android.app.KeyguardManager; import android.app.PendingIntent; import android.app.PendingIntent.CanceledException; import android.bluetooth.BluetoothA2dp; @@ -319,6 +320,8 @@ public class AudioService extends IAudioService.Stub { private static final int NOTIFICATION_VOLUME_DELAY_MS = 5000; // previous volume adjustment direction received by checkForRingerModeChange() private int mPrevVolDirection = AudioManager.ADJUST_SAME; + // Keyguard manager proxy + private KeyguardManager mKeyguardManager; /////////////////////////////////////////////////////////////////////////// // Construction @@ -503,9 +506,10 @@ public class AudioService extends IAudioService.Stub { streamType = getActiveStreamType(suggestedStreamType); } - // Play sounds on STREAM_RING only. + // Play sounds on STREAM_RING only and if lock screen is not on. if ((flags & AudioManager.FLAG_PLAY_SOUND) != 0 && - ((STREAM_VOLUME_ALIAS[streamType] != AudioSystem.STREAM_RING))) { + ((STREAM_VOLUME_ALIAS[streamType] != AudioSystem.STREAM_RING) + || (mKeyguardManager != null && mKeyguardManager.isKeyguardLocked()))) { flags &= ~AudioManager.FLAG_PLAY_SOUND; } @@ -2665,6 +2669,8 @@ public class AudioService extends IAudioService.Stub { sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SHARED_MSG, SENDMSG_NOOP, 0, 0, null, 0); + mKeyguardManager = + (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE); mScoConnectionState = AudioManager.SCO_AUDIO_STATE_ERROR; resetBluetoothSco(); getBluetoothHeadset(); |