From fb45f7b08b0218b59b5b3a9631f9b37fc8fb3dfd Mon Sep 17 00:00:00 2001 From: Brian Colonna Date: Mon, 19 Dec 2011 15:51:10 -0500 Subject: Unbinding from FU when going to backup Lockscreen was stopping Face Unlock when going to the backup lock, but not unbinding from the Face Unlock service until the device was unlocked. This caused a bug on the tablets where Face Unlock would reappear when switching between portait and landscape orientations, even after the backup lock was exposed. On an orientation change, Face Unlock is restarted if the service is bound to during the orientation change. Since it was bound to when it should not have been, Face Unlock was restarting when it should not have been. The wakelock is also now being poked on an orientation change because on the tablet you can keep Face Unlock alive by switching the orientation back and forth, but eventually the screen would go dark with Face Unlock running. Also, a conditional was moved in activateFaceLockIfAble() so the whole section isn't executed if Face Unlock is not in use. Part of it was being executed with only the inner-most part having the check. This did not cause any issues that I am aware of. Change-Id: Ib452b8ced28a507bf9272dbf5d3477a8abd1ba90 --- .../internal/policy/impl/LockPatternKeyguardView.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index e3c0601b5dc3..0d0461baed7b 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -587,15 +587,20 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler (failedBackupAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT); if (tooManyFaceUnlockTries) Log.i(TAG, "tooManyFaceUnlockTries: " + tooManyFaceUnlockTries); if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE + && usingFaceLock() && !mHasOverlay && !tooManyFaceUnlockTries && !backupIsTimedOut) { bindToFaceLock(); + // Show FaceLock area, but only for a little bit so lockpattern will become visible if // FaceLock fails to start or crashes - if (usingFaceLock()) { - showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_SERVICE_TIMEOUT); - } + showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_SERVICE_TIMEOUT); + + // When switching between portrait and landscape view while FaceLock is running, the + // screen will eventually go dark unless we poke the wakelock when FaceLock is + // restarted + mKeyguardScreenCallback.pokeWakelock(); } else { hideFaceLockArea(); } @@ -1377,7 +1382,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler public void unlock() { if (DEBUG) Log.d(TAG, "FaceLock unlock()"); showFaceLockArea(); // Keep fallback covered - stopFaceLock(); + stopAndUnbindFromFaceLock(); mKeyguardScreenCallback.keyguardDone(true); mKeyguardScreenCallback.reportSuccessfulUnlockAttempt(); @@ -1389,7 +1394,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler public void cancel() { if (DEBUG) Log.d(TAG, "FaceLock cancel()"); hideFaceLockArea(); // Expose fallback - stopFaceLock(); + stopAndUnbindFromFaceLock(); mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT); } @@ -1400,7 +1405,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler if (DEBUG) Log.d(TAG, "FaceLock reportFailedAttempt()"); mUpdateMonitor.reportFailedFaceUnlockAttempt(); hideFaceLockArea(); // Expose fallback - stopFaceLock(); + stopAndUnbindFromFaceLock(); mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT); } -- cgit v1.2.3-59-g8ed1b