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

Commit a38653cb authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Actually use HardwareAuthToken to resetLockout where applicable

Lockout reset now happens at the source of truth, where the HAT is received
from Gatekeeper.

Fixes: 121198195

Test: Lockout is reset properly

Change-Id: Icd72a20494a65f0e48cff1258109d82fb58cdc98
parent 6737c579
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -156,21 +156,21 @@ public class BiometricManager {
    }

    /**
     * Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
     * Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password)
     *
     * @param token an opaque token returned by password confirmation.
     * @hide
     */
    @RequiresPermission(USE_BIOMETRIC_INTERNAL)
    public void resetTimeout(byte[] token) {
    public void resetLockout(byte[] token) {
        if (mService != null) {
            try {
                mService.resetTimeout(token);
                mService.resetLockout(token);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        } else {
            Slog.w(TAG, "resetTimeout(): Service not connected");
            Slog.w(TAG, "resetLockout(): Service not connected");
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -49,8 +49,8 @@ interface IBiometricService {
    // Client lifecycle is still managed in <Biometric>Service.
    void onReadyForAuthentication(int cookie, boolean requireConfirmation, int userId);

    // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
    void resetTimeout(in byte [] token);
    // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password)
    void resetLockout(in byte [] token);

    // TODO(b/123378871): Remove when moved.
    // CDCA needs to send results to BiometricService if it was invoked using BiometricPrompt's
+0 −19
Original line number Diff line number Diff line
@@ -478,25 +478,6 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
        return 0;
    }

    /**
     * Reset the lockout timer when asked to do so by keyguard.
     *
     * @param token an opaque token returned by password confirmation.
     * @hide
     */
    @RequiresPermission(MANAGE_BIOMETRIC)
    public void resetTimeout(byte[] token) {
        if (mService != null) {
            try {
                mService.resetTimeout(token);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        } else {
            Log.w(TAG, "resetTimeout(): Service not connected!");
        }
    }

    /**
     * @hide
     */
+2 −2
Original line number Diff line number Diff line
@@ -86,8 +86,8 @@ interface IFaceService {
    // Gets the authenticator ID for face
    long getAuthenticatorId(String opPackageName);

    // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
    void resetTimeout(in byte [] cryptoToken);
    // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password)
    void resetLockout(in byte [] token);

    // Add a callback which gets notified when the face lockout period expired.
    void addLockoutResetCallback(IBiometricServiceLockoutResetCallback callback);
+0 −21
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package android.hardware.fingerprint;

import static android.Manifest.permission.INTERACT_ACROSS_USERS;
import static android.Manifest.permission.MANAGE_FINGERPRINT;
import static android.Manifest.permission.RESET_FINGERPRINT_LOCKOUT;
import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_FINGERPRINT;

@@ -723,26 +722,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        return 0;
    }

    /**
     * Reset the lockout timer when asked to do so by keyguard.
     *
     * @param token an opaque token returned by password confirmation.
     *
     * @hide
     */
    @RequiresPermission(RESET_FINGERPRINT_LOCKOUT)
    public void resetTimeout(byte[] token) {
        if (mService != null) {
            try {
                mService.resetTimeout(token);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        } else {
            Slog.w(TAG, "resetTimeout(): Service not connected!");
        }
    }

    /**
     * @hide
     */
Loading