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

Commit 667b5d58 authored by Brian Colonna's avatar Brian Colonna
Browse files

Suppressing FUL after going to backup fixes b/7449820

Face Unlock would reappear when rotating a tablet after it had already
fallen back to the backup unlock method.  This change suppresses Face
Unlock after going to the backup so it isn't seen again until the user
leaves and revisits keyguard.

This change also removes the exposeFallback() callback from Face
Unlock.  It has been unnecessary for a long tiem since Face Unlock no
longer covers the backup.  The Face Unlock service was therefore
making unnecesaary calls via the AIDL interface.

Note that the AIDL interface change broke obsolete keyguard stuff.
That is being deleted soon anyway, so code has just been commented out
of the obsolete files to make it compile.

Change-Id: Ia5c451cce1703b3bc03e27a35c6b38373e944d1b
parent 11952e73
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -22,6 +22,5 @@ oneway interface IFaceLockCallback {
    void unlock();
    void cancel();
    void reportFailedAttempt();
    void exposeFallback();
    void pokeWakelock(int millis);
}
+9 −25
Original line number Diff line number Diff line
@@ -57,8 +57,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
    private final int MSG_UNLOCK = 2;
    private final int MSG_CANCEL = 3;
    private final int MSG_REPORT_FAILED_ATTEMPT = 4;
    private final int MSG_EXPOSE_FALLBACK = 5;
    private final int MSG_POKE_WAKELOCK = 6;
    private final int MSG_POKE_WAKELOCK = 5;

    // TODO: This was added for the purpose of adhering to what the biometric interface expects
    // the isRunning() function to return.  However, it is probably not necessary to have both
@@ -220,9 +219,6 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
            case MSG_REPORT_FAILED_ATTEMPT:
                handleReportFailedAttempt();
                break;
            case MSG_EXPOSE_FALLBACK:
                handleExposeFallback();
                break;
            case MSG_POKE_WAKELOCK:
                handlePokeWakelock(msg.arg1);
                break;
@@ -310,6 +306,10 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
     */
    void handleCancel() {
        if (DEBUG) Log.d(TAG, "handleCancel()");
        // We are going to the backup method, so we don't want to see Face Unlock again until the
        // next time the user visits keyguard.
        KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false);

        mKeyguardScreenCallback.showBackupSecurity();
        stop();
        mKeyguardScreenCallback.userActivity(BACKUP_LOCK_TIMEOUT);
@@ -320,17 +320,11 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
     */
    void handleReportFailedAttempt() {
        if (DEBUG) Log.d(TAG, "handleReportFailedAttempt()");
        mKeyguardScreenCallback.reportFailedUnlockAttempt();
    }
        // We are going to the backup method, so we don't want to see Face Unlock again until the
        // next time the user visits keyguard.
        KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false);

    /**
     * Hides the Face Unlock view to expose the backup lock.  Called when the Face Unlock service UI
     * is started, indicating there is no need to continue displaying the underlying view because
     * the service UI is now covering the backup lock.
     */
    void handleExposeFallback() {
        if (DEBUG) Log.d(TAG, "handleExposeFallback()");
        // No longer required because face unlock doesn't cover backup unlock.
        mKeyguardScreenCallback.reportFailedUnlockAttempt();
    }

    /**
@@ -442,16 +436,6 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
            mHandler.sendEmptyMessage(MSG_REPORT_FAILED_ATTEMPT);
        }

        /**
         * Called when the Face Unlock service starts displaying the UI, indicating that the backup
         * unlock can be exposed because the Face Unlock service is now covering the backup with its
         * UI.
         */
        public void exposeFallback() {
            if (DEBUG) Log.d(TAG, "exposeFallback()");
            mHandler.sendEmptyMessage(MSG_EXPOSE_FALLBACK);
        }

        /**
         * Called when Face Unlock wants to keep the screen alive and active for a specific amount
         * of time.
+17 −17
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
    private final int MSG_UNLOCK = 4;
    private final int MSG_CANCEL = 5;
    private final int MSG_REPORT_FAILED_ATTEMPT = 6;
    private final int MSG_EXPOSE_FALLBACK = 7;
    //private final int MSG_EXPOSE_FALLBACK = 7;
    private final int MSG_POKE_WAKELOCK = 8;

    // TODO: This was added for the purpose of adhering to what the biometric interface expects
@@ -258,9 +258,9 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
            case MSG_REPORT_FAILED_ATTEMPT:
                handleReportFailedAttempt();
                break;
            case MSG_EXPOSE_FALLBACK:
                handleExposeFallback();
                break;
                //case MSG_EXPOSE_FALLBACK:
                //handleExposeFallback();
                //break;
            case MSG_POKE_WAKELOCK:
                handlePokeWakelock(msg.arg1);
                break;
@@ -401,14 +401,14 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
     * is started, indicating there is no need to continue displaying the underlying view because
     * the service UI is now covering the backup lock.
     */
    void handleExposeFallback() {
        if (DEBUG) Log.d(TAG, "handleExposeFallback()");
        if (mFaceUnlockView != null) {
            mFaceUnlockView.setVisibility(View.INVISIBLE);
        } else {
            Log.e(TAG, "mFaceUnlockView is null in handleExposeFallback()");
        }
    }
    //void handleExposeFallback() {
    //    if (DEBUG) Log.d(TAG, "handleExposeFallback()");
    //    if (mFaceUnlockView != null) {
    //        mFaceUnlockView.setVisibility(View.INVISIBLE);
    //    } else {
    //        Log.e(TAG, "mFaceUnlockView is null in handleExposeFallback()");
    //    }
    //}

    /**
     * Pokes the wakelock to keep the screen alive and active for a specific amount of time.
@@ -534,11 +534,11 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
         * unlock can be exposed because the Face Unlock service is now covering the backup with its
         * UI.
         **/
        @Override
        public void exposeFallback() {
            if (DEBUG) Log.d(TAG, "exposeFallback()");
            mHandler.sendEmptyMessage(MSG_EXPOSE_FALLBACK);
        }
        //@Override
        //public void exposeFallback() {
        //    if (DEBUG) Log.d(TAG, "exposeFallback()");
        //    mHandler.sendEmptyMessage(MSG_EXPOSE_FALLBACK);
        //}

        /**
         * Called when Face Unlock wants to keep the screen alive and active for a specific amount