Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb45f7b0 authored by Brian Colonna's avatar Brian Colonna
Browse files

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
parent 01583ef7
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -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);
            }

            // 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);
        }