@@ -136,7 +136,10 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
136136
137137
138138 private boolean mRequiresSim ;
139- private volatile boolean mEmergencyCall ;
139+ //True if we have some sort of overlay on top of the Lockscreen
140+ //Also true if we've activated a phone call, either emergency dialing or incoming
141+ //This resets when the phone is turned off with no current call
142+ private boolean mHasOverlay ;
140143
141144
142145 /**
@@ -243,8 +246,6 @@ public void requestHide(View view) {
243246 }
244247 };
245248
246- private TransportControlView mTransportControlView ;
247-
248249 /**
249250 * @return Whether we are stuck on the lock screen because the sim is
250251 * missing.
@@ -277,7 +278,7 @@ public LockPatternKeyguardView(
277278 mUpdateMonitor = updateMonitor ;
278279 mLockPatternUtils = lockPatternUtils ;
279280 mWindowController = controller ;
280- mEmergencyCall = false ;
281+ mHasOverlay = false ;
281282
282283 mUpdateMonitor .registerInfoCallback (this );
283284
@@ -332,7 +333,7 @@ public void recreateMe(Configuration config) {
332333 }
333334
334335 public void takeEmergencyCallAction () {
335- mEmergencyCall = true ;
336+ mHasOverlay = true ;
336337 // FaceLock must be stopped if it is running when emergency call is pressed
337338 stopAndUnbindFromFaceLock ();
338339
@@ -517,9 +518,10 @@ public void reset() {
517518
518519 @ Override
519520 public void onScreenTurnedOff () {
521+ if (DEBUG ) Log .d (TAG , "screen off" );
520522 mScreenOn = false ;
521523 mForgotPattern = false ;
522- mEmergencyCall = false ;
524+ mHasOverlay = mUpdateMonitor . getPhoneState () != TelephonyManager . CALL_STATE_IDLE ;
523525 if (mMode == Mode .LockScreen ) {
524526 ((KeyguardScreen ) mLockScreen ).onPause ();
525527 } else {
@@ -534,10 +536,7 @@ public void onScreenTurnedOff() {
534536 * FaceLock, but only if we're not dealing with a call
535537 */
536538 private void activateFaceLockIfAble () {
537- final boolean transportInvisible = mTransportControlView == null ? true :
538- mTransportControlView .getVisibility () != View .VISIBLE ;
539- if (mUpdateMonitor .getPhoneState () == TelephonyManager .CALL_STATE_IDLE
540- && transportInvisible ) {
539+ if (mUpdateMonitor .getPhoneState () == TelephonyManager .CALL_STATE_IDLE && !mHasOverlay ) {
541540 bindToFaceLock ();
542541 // Show FaceLock area, but only for a little bit so lockpattern will become visible if
543542 // FaceLock fails to start or crashes
@@ -552,6 +551,7 @@ private void activateFaceLockIfAble() {
552551
553552 @ Override
554553 public void onScreenTurnedOn () {
554+ if (DEBUG ) Log .d (TAG , "screen on" );
555555 boolean runFaceLock = false ;
556556 //Make sure to start facelock iff the screen is both on and focused
557557 synchronized (mFaceLockStartupLock ) {
@@ -567,22 +567,19 @@ public void onScreenTurnedOn() {
567567 */
568568 @ Override
569569 public void onWindowFocusChanged (boolean hasWindowFocus ) {
570- if (DEBUG ) Log .d (TAG , hasWindowFocus ? "focused" : "unfocused" );
570+ if (DEBUG ) Log .d (TAG , hasWindowFocus ? "focused" : "unfocused" );
571571 boolean runFaceLock = false ;
572572 //Make sure to start facelock iff the screen is both on and focused
573573 synchronized (mFaceLockStartupLock ) {
574574 if (mScreenOn && !mWindowFocused ) runFaceLock = hasWindowFocus ;
575575 mWindowFocused = hasWindowFocus ;
576576 }
577577 if (!hasWindowFocus ) {
578+ mHasOverlay = true ;
578579 stopAndUnbindFromFaceLock ();
579580 hideFaceLockArea ();
580581 } else if (runFaceLock ) {
581- //Don't activate facelock while the user is calling 911!
582- if (mEmergencyCall ) mEmergencyCall = false ;
583- else {
584- activateFaceLockIfAble ();
585- }
582+ activateFaceLockIfAble ();
586583 }
587584 }
588585
@@ -595,7 +592,7 @@ public void show() {
595592 }
596593
597594 if (mLockPatternUtils .usingBiometricWeak () &&
598- mLockPatternUtils .isBiometricWeakInstalled ()) {
595+ mLockPatternUtils .isBiometricWeakInstalled () && ! mHasOverlay ) {
599596 // Note that show() gets called before the screen turns off to set it up for next time
600597 // it is turned on. We don't want to set a timeout on the FaceLock area here because it
601598 // may be gone by the time the screen is turned on again. We set the timout when the
@@ -670,6 +667,7 @@ public void onDeviceProvisioned() {}
670667 public void onPhoneStateChanged (int phoneState ) {
671668 if (DEBUG ) Log .d (TAG , "phone state: " + phoneState );
672669 if (phoneState == TelephonyManager .CALL_STATE_RINGING ) {
670+ mHasOverlay = true ;
673671 stopAndUnbindFromFaceLock ();
674672 hideFaceLockArea ();
675673 }
@@ -897,13 +895,13 @@ View createUnlockScreenFor(UnlockMode unlockMode) {
897895 }
898896
899897 private void initializeTransportControlView (View view ) {
900- mTransportControlView = (TransportControlView ) view .findViewById (R .id .transport );
901- if (mTransportControlView == null ) {
898+ TransportControlView tcv = (TransportControlView ) view .findViewById (R .id .transport );
899+ if (tcv == null ) {
902900 if (DEBUG ) Log .w (TAG , "Couldn't find transport control widget" );
903901 } else {
904902 mUpdateMonitor .reportClockVisible (true );
905- mTransportControlView .setVisibility (View .GONE ); // hide until it requests being shown.
906- mTransportControlView .setCallback (mWidgetCallback );
903+ tcv .setVisibility (View .GONE ); // hide until it requests being shown.
904+ tcv .setCallback (mWidgetCallback );
907905 }
908906 }
909907
0 commit comments