summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@google.com>2010-03-15 23:09:57 -0400
committerDaniel Sandler <dsandler@google.com>2010-03-15 23:10:58 -0400
commitcd07b9e220421ff882c97ffe598721131b7537c8 (patch)
tree1ca3f1cd592c3866c8bc5f8172eda6b72122fe97
parent2b9ba227a59a17d27536f15a5615ae18248892e6 (diff)
downloadbase-cd07b9e220421ff882c97ffe598721131b7537c8.tar.gz
Suppress lock sound effect on screen timeout.
Bug: 2512130 (without regressing http://b/2453032) Change-Id: I79c90e6f59b95c3096808ad5ee9845369a2e50ce
-rw-r--r--phone/com/android/internal/policy/impl/KeyguardViewMediator.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/phone/com/android/internal/policy/impl/KeyguardViewMediator.java b/phone/com/android/internal/policy/impl/KeyguardViewMediator.java
index 862e328..c255041 100644
--- a/phone/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/phone/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -149,7 +149,11 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
private IBinder mSecureLockIcon = null;
private boolean mSystemReady;
- private boolean mFirstShow = true;
+
+ // Whether the next call to playSounds() should be skipped. Defaults to
+ // true because the first lock (on boot) should be silent.
+ private boolean mSuppressNextLockSound = true;
+
/** Low level access to the power manager for enableUserActivity. Having this
* requires that we run in the system process. */
@@ -689,6 +693,10 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
+ sequence + ", mDelayedShowingSequence = " + mDelayedShowingSequence);
if (mDelayedShowingSequence == sequence) {
+ // Don't play lockscreen SFX if the screen went off due to
+ // timeout.
+ mSuppressNextLockSound = true;
+
doKeyguard();
}
} else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) {
@@ -926,6 +934,12 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
private void playSounds(boolean locked) {
// User feedback for keyguard.
+
+ if (mSuppressNextLockSound) {
+ mSuppressNextLockSound = false;
+ return;
+ }
+
final ContentResolver cr = mContext.getContentResolver();
if (Settings.System.getInt(cr, Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) == 1)
{
@@ -961,11 +975,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
if (DEBUG) Log.d(TAG, "handleShow");
if (!mSystemReady) return;
- if (mFirstShow) {
- mFirstShow = false;
- } else {
- playSounds(true);
- }
+ playSounds(true);
mKeyguardViewManager.show();
mShowing = true;