diff options
author | Daniel Sandler <dsandler@google.com> | 2010-02-22 13:09:48 -0500 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2010-02-22 13:27:55 -0500 |
commit | 4de49ec917c51e4c6f4826459bafb37d4b5b38a6 (patch) | |
tree | 899e0e7e033e4d49c8296e64b0db71bdeb0f0ead | |
parent | 93815e6038dd2609ab2587051ebd93c7bc2c3ab2 (diff) | |
download | base-4de49ec917c51e4c6f4826459bafb37d4b5b38a6.tar.gz |
Suppress unlock noises while in-call.
Bug: 2458106
-rw-r--r-- | phone/com/android/internal/policy/impl/KeyguardViewMediator.java | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/phone/com/android/internal/policy/impl/KeyguardViewMediator.java b/phone/com/android/internal/policy/impl/KeyguardViewMediator.java index f82d1a9..1a2898f 100644 --- a/phone/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/phone/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -225,6 +225,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback, private boolean mScreenOn = false; + // last known state of the cellular connection + private String mPhoneState = TelephonyManager.EXTRA_STATE_IDLE; + /** * we send this intent when the keyguard is dismissed. */ @@ -683,19 +686,21 @@ public class KeyguardViewMediator implements KeyguardViewCallback, if (mDelayedShowingSequence == sequence) { doKeyguard(); } - } else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action) - && TelephonyManager.EXTRA_STATE_IDLE.equals(intent.getStringExtra( - TelephonyManager.EXTRA_STATE)) // call ending - && !mScreenOn // screen off - && mExternallyEnabled) { // not disabled by any app - - // note: this is a way to gracefully reenable the keyguard when the call - // ends and the screen is off without always reenabling the keyguard - // each time the screen turns off while in call (and having an occasional ugly - // flicker while turning back on the screen and disabling the keyguard again). - if (DEBUG) Log.d(TAG, "screen is off and call ended, let's make sure the " - + "keyguard is showing"); - doKeyguard(); + } else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) { + mPhoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE); + + if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState) // call ending + && !mScreenOn // screen off + && mExternallyEnabled) { // not disabled by any app + + // note: this is a way to gracefully reenable the keyguard when the call + // ends and the screen is off without always reenabling the keyguard + // each time the screen turns off while in call (and having an occasional ugly + // flicker while turning back on the screen and disabling the keyguard again). + if (DEBUG) Log.d(TAG, "screen is off and call ended, let's make sure the " + + "keyguard is showing"); + doKeyguard(); + } } } }; @@ -977,7 +982,11 @@ public class KeyguardViewMediator implements KeyguardViewCallback, return; } - playSounds(false); + // only play "unlock" noises if not on a call (since the incall UI + // disables the keyguard) + if (TelephonyManager.EXTRA_STATE_IDLE.equals(mPhoneState)) { + playSounds(false); + } mKeyguardViewManager.hide(); mShowing = false; |