diff options
author | Steven Ross <stross@google.com> | 2011-10-13 07:04:37 -0400 |
---|---|---|
committer | Steven Ross <stross@google.com> | 2011-10-13 21:41:17 -0400 |
commit | 7726289c2890d13baa3d10dc504b43e2128b4918 (patch) | |
tree | ba104f72afef49c42fcf6737525c3b42ea09a7ae /policy | |
parent | 3505abf31df8dafab2c83ceb8f85b5694cac3b78 (diff) | |
download | frameworks_base-7726289c2890d13baa3d10dc504b43e2128b4918.zip frameworks_base-7726289c2890d13baa3d10dc504b43e2128b4918.tar.gz frameworks_base-7726289c2890d13baa3d10dc504b43e2128b4918.tar.bz2 |
Making FaceUnlock not pop up for overlays Fixes 5451837 Fixes 5446341
When the screen turns on because of an incoming phone call or
when the emergency dialer is selected, FaceUnlock is deactivated
until the phone call is completed and the screen is turned off.
This also checks for non-phone overlays.
If the lockscreen becomes unfocused while the screen is on,
we assume that the reason is an overlay and prevent FaceUnlock
from starting. The normal clock app is not considered an overlay by
this approach, and thus it works as intended (back button
brings up FaceUnlock).
Also reverts: https://android-git.corp.google.com/g/#/c/139885/2
to make FaceUnlock appear when music is playing again
Change-Id: Id715878556667d2b7e35c30a28d91be6a4eee575
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index c3f6767..3474f0c 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -136,7 +136,10 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler private boolean mRequiresSim; - private volatile boolean mEmergencyCall; + //True if we have some sort of overlay on top of the Lockscreen + //Also true if we've activated a phone call, either emergency dialing or incoming + //This resets when the phone is turned off with no current call + private boolean mHasOverlay; /** @@ -243,8 +246,6 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler } }; - private TransportControlView mTransportControlView; - /** * @return Whether we are stuck on the lock screen because the sim is * missing. @@ -277,7 +278,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler mUpdateMonitor = updateMonitor; mLockPatternUtils = lockPatternUtils; mWindowController = controller; - mEmergencyCall = false; + mHasOverlay = false; mUpdateMonitor.registerInfoCallback(this); @@ -332,7 +333,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler } public void takeEmergencyCallAction() { - mEmergencyCall = true; + mHasOverlay = true; // FaceLock must be stopped if it is running when emergency call is pressed stopAndUnbindFromFaceLock(); @@ -514,9 +515,10 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler @Override public void onScreenTurnedOff() { + if (DEBUG) Log.d(TAG, "screen off"); mScreenOn = false; mForgotPattern = false; - mEmergencyCall = false; + mHasOverlay = mUpdateMonitor.getPhoneState() != TelephonyManager.CALL_STATE_IDLE; if (mMode == Mode.LockScreen) { ((KeyguardScreen) mLockScreen).onPause(); } else { @@ -531,10 +533,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler * FaceLock, but only if we're not dealing with a call */ private void activateFaceLockIfAble() { - final boolean transportInvisible = mTransportControlView == null ? true : - mTransportControlView.getVisibility() != View.VISIBLE; - if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE - && transportInvisible) { + if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE && !mHasOverlay) { bindToFaceLock(); // Show FaceLock area, but only for a little bit so lockpattern will become visible if // FaceLock fails to start or crashes @@ -546,6 +545,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler @Override public void onScreenTurnedOn() { + if (DEBUG) Log.d(TAG, "screen on"); boolean runFaceLock = false; //Make sure to start facelock iff the screen is both on and focused synchronized(mFaceLockStartupLock) { @@ -561,7 +561,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler */ @Override public void onWindowFocusChanged (boolean hasWindowFocus) { - if(DEBUG) Log.d(TAG, hasWindowFocus ? "focused" : "unfocused"); + if (DEBUG) Log.d(TAG, hasWindowFocus ? "focused" : "unfocused"); boolean runFaceLock = false; //Make sure to start facelock iff the screen is both on and focused synchronized(mFaceLockStartupLock) { @@ -569,14 +569,11 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler mWindowFocused = hasWindowFocus; } if(!hasWindowFocus) { + mHasOverlay = true; stopAndUnbindFromFaceLock(); hideFaceLockArea(); } else if (runFaceLock) { - //Don't activate facelock while the user is calling 911! - if(mEmergencyCall) mEmergencyCall = false; - else { - activateFaceLockIfAble(); - } + activateFaceLockIfAble(); } } @@ -589,7 +586,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler } if (mLockPatternUtils.usingBiometricWeak() && - mLockPatternUtils.isBiometricWeakInstalled()) { + mLockPatternUtils.isBiometricWeakInstalled() && !mHasOverlay) { // Note that show() gets called before the screen turns off to set it up for next time // it is turned on. We don't want to set a timeout on the FaceLock area here because it // may be gone by the time the screen is turned on again. We set the timout when the @@ -664,6 +661,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler public void onPhoneStateChanged(int phoneState) { if (DEBUG) Log.d(TAG, "phone state: " + phoneState); if(phoneState == TelephonyManager.CALL_STATE_RINGING) { + mHasOverlay = true; stopAndUnbindFromFaceLock(); hideFaceLockArea(); } @@ -891,13 +889,13 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler } private void initializeTransportControlView(View view) { - mTransportControlView = (TransportControlView) view.findViewById(R.id.transport); - if (mTransportControlView == null) { + TransportControlView tcv = (TransportControlView) view.findViewById(R.id.transport); + if (tcv == null) { if (DEBUG) Log.w(TAG, "Couldn't find transport control widget"); } else { mUpdateMonitor.reportClockVisible(true); - mTransportControlView.setVisibility(View.GONE); // hide until it requests being shown. - mTransportControlView.setCallback(mWidgetCallback); + tcv.setVisibility(View.GONE); // hide until it requests being shown. + tcv.setCallback(mWidgetCallback); } } |