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

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

2/n: AuthSession should manage its own state

1) State calculation, updating, side-effects, outputs are moved
   within AuthSession
2) StatusBarService invocations are all within AuthSession
3) PendingSession and CurrentSession are merged into CurrentSession.
   PendingSession was mostly the same as CurrentSession, with the
   two considerations:
     A) It's only ever valid in STATE_AUTH_CALLED (waiting for sensors
        to become ready)
     B) It's possible for new authentication to be requested while
        CurrentSession is in-progress.

Previously, the PendingSession would request <Biometric>Service(s)
to prepare for auth, which would cancel any existing authentications
and send ERROR_CANCELED to BiometricService, ending the CurrentSession
lifecycle. With this change, if authentication is requested while an
existing AuthSession is in progress, it will immediately send
ERROR_CANCELED to the previous caller and cancel sensors if necessary.
ERROR_CANCELED that are received from the sensors will not affect
the new AuthSession (as expected), since the cookies will no longer
match.

Bug: 149067920

Test: atest com.android.systemui.biometrics
Test: atest com.android.server.biometrics

Change-Id: Ia89920d2225eb9a71f25a5b9fbbd36f92a550127
parent 10a39331
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -171,6 +171,19 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
     */
    public static final int DISMISSED_REASON_CREDENTIAL_CONFIRMED = 7;

    /**
     * @hide
     */
    @IntDef({DISMISSED_REASON_BIOMETRIC_CONFIRMED,
            DISMISSED_REASON_NEGATIVE,
            DISMISSED_REASON_USER_CANCEL,
            DISMISSED_REASON_BIOMETRIC_CONFIRM_NOT_REQUIRED,
            DISMISSED_REASON_ERROR,
            DISMISSED_REASON_SERVER_REQUESTED,
            DISMISSED_REASON_CREDENTIAL_CONFIRMED})
    @Retention(RetentionPolicy.SOURCE)
    public @interface DismissedReason {}

    private static class ButtonInfo {
        Executor executor;
        DialogInterface.OnClickListener listener;
+2 −2
Original line number Diff line number Diff line
@@ -40,9 +40,9 @@ interface IBiometricAuthenticator {
    // Starts authentication with the previously prepared client.
    void startPreparedClient(int cookie);

    // Same as above, with extra arguments.
    // Cancels authentication.
    void cancelAuthenticationFromService(IBinder token, String opPackageName,
            int callingUid, int callingPid, int callingUserId, boolean fromClient);
            int callingUid, int callingPid, int callingUserId);

    // Determine if HAL is loaded and ready
    boolean isHardwareDetected(String opPackageName);
+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ interface IFaceService {

    // Same as above, with extra arguments.
    void cancelAuthenticationFromService(IBinder token, String opPackageName,
            int callingUid, int callingPid, int callingUserId, boolean fromClient);
            int callingUid, int callingPid, int callingUserId);

    // Start face enrollment
    void enroll(int userId, IBinder token, in byte [] cryptoToken, IFaceServiceReceiver receiver,
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ interface IFingerprintService {
    // Same as above, except this is protected by the MANAGE_BIOMETRIC signature permission. Takes
    // an additional uid, pid, userid.
    void cancelAuthenticationFromService(IBinder token, String opPackageName,
            int callingUid, int callingPid, int callingUserId, boolean fromClient);
            int callingUid, int callingPid, int callingUserId);

    // Start fingerprint enrollment
    void enroll(IBinder token, in byte [] cryptoToken, int groupId, IFingerprintServiceReceiver receiver,
+353 −29

File changed.

Preview size limit exceeded, changes collapsed.

Loading