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

Commit 6c839dd1 authored by Haining Chen's avatar Haining Chen Committed by Android (Google) Code Review
Browse files

Merge "Implementations of biometric contraints for weak and convenience tiers...

Merge "Implementations of biometric contraints for weak and convenience tiers (1) 24 hours fallback (2) 4 hours idle timeout"
parents 3688af69 c06c481f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23,4 +23,5 @@ package android.app.trust;
 */
oneway interface IStrongAuthTracker {
    void onStrongAuthRequiredChanged(int strongAuthRequired, int userId);
    void onIsNonStrongBiometricAllowedChanged(boolean allowed, int userId);
}
 No newline at end of file
+22 −6
Original line number Diff line number Diff line
@@ -97,8 +97,10 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
        }

        @Override // binder call
        public void onAuthenticationSucceeded(long deviceId, Face face, int userId) {
            mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, 0, face).sendToTarget();
        public void onAuthenticationSucceeded(long deviceId, Face face, int userId,
                boolean isStrongBiometric) {
            mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, isStrongBiometric ? 1 : 0,
                    face).sendToTarget();
        }

        @Override // binder call
@@ -814,6 +816,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
        private Face mFace;
        private CryptoObject mCryptoObject;
        private int mUserId;
        private boolean mIsStrongBiometric;

        /**
         * Authentication result
@@ -822,10 +825,12 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
         * @param face   the recognized face data, if allowed.
         * @hide
         */
        public AuthenticationResult(CryptoObject crypto, Face face, int userId) {
        public AuthenticationResult(CryptoObject crypto, Face face, int userId,
                boolean isStrongBiometric) {
            mCryptoObject = crypto;
            mFace = face;
            mUserId = userId;
            mIsStrongBiometric = isStrongBiometric;
        }

        /**
@@ -857,6 +862,16 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
        public int getUserId() {
            return mUserId;
        }

        /**
         * Check whether the strength of the face modality associated with this operation is strong
         * (i.e. not weak or convenience).
         *
         * @hide
         */
        public boolean isStrongBiometric() {
            return mIsStrongBiometric;
        }
    }

    /**
@@ -1056,7 +1071,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
                            msg.arg2 /* vendorCode */);
                    break;
                case MSG_AUTHENTICATION_SUCCEEDED:
                    sendAuthenticatedSucceeded((Face) msg.obj, msg.arg1 /* userId */);
                    sendAuthenticatedSucceeded((Face) msg.obj, msg.arg1 /* userId */,
                            msg.arg2 == 1 /* isStrongBiometric */);
                    break;
                case MSG_AUTHENTICATION_FAILED:
                    sendAuthenticatedFailed();
@@ -1133,10 +1149,10 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
        }
    }

    private void sendAuthenticatedSucceeded(Face face, int userId) {
    private void sendAuthenticatedSucceeded(Face face, int userId, boolean isStrongBiometric) {
        if (mAuthenticationCallback != null) {
            final AuthenticationResult result =
                    new AuthenticationResult(mCryptoObject, face, userId);
                    new AuthenticationResult(mCryptoObject, face, userId, isStrongBiometric);
            mAuthenticationCallback.onAuthenticationSucceeded(result);
        }
    }
+3 −0
Original line number Diff line number Diff line
@@ -110,4 +110,7 @@ interface IFaceService {
    void getFeature(int userId, int feature, IFaceServiceReceiver receiver, String opPackageName);

    void userActivity();

    // Initialize the OEM configured biometric strength
    void initConfiguredStrength(int strength);
}
+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@ import android.hardware.face.Face;
oneway interface IFaceServiceReceiver {
    void onEnrollResult(long deviceId, int faceId, int remaining);
    void onAcquired(long deviceId, int acquiredInfo, int vendorCode);
    void onAuthenticationSucceeded(long deviceId, in Face face, int userId);
    void onAuthenticationSucceeded(long deviceId, in Face face, int userId,
            boolean isStrongBiometric);
    void onAuthenticationFailed(long deviceId);
    void onError(long deviceId, int error, int vendorCode);
    void onRemoved(long deviceId, int faceId, int remaining);
+21 −6
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        private Fingerprint mFingerprint;
        private CryptoObject mCryptoObject;
        private int mUserId;
        private boolean mIsStrongBiometric;

        /**
         * Authentication result
@@ -184,10 +185,12 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
         * @param fingerprint the recognized fingerprint data, if allowed.
         * @hide
         */
        public AuthenticationResult(CryptoObject crypto, Fingerprint fingerprint, int userId) {
        public AuthenticationResult(CryptoObject crypto, Fingerprint fingerprint, int userId,
                boolean isStrongBiometric) {
            mCryptoObject = crypto;
            mFingerprint = fingerprint;
            mUserId = userId;
            mIsStrongBiometric = isStrongBiometric;
        }

        /**
@@ -211,6 +214,15 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
         * @hide
         */
        public int getUserId() { return mUserId; }

        /**
         * Check whether the strength of the fingerprint modality associated with this operation is
         * strong (i.e. not weak or convenience).
         * @hide
         */
        public boolean isStrongBiometric() {
            return mIsStrongBiometric;
        }
    };

    /**
@@ -833,7 +845,8 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
                            msg.arg2 /* vendorCode */);
                    break;
                case MSG_AUTHENTICATION_SUCCEEDED:
                    sendAuthenticatedSucceeded((Fingerprint) msg.obj, msg.arg1 /* userId */);
                    sendAuthenticatedSucceeded((Fingerprint) msg.obj, msg.arg1 /* userId */,
                            msg.arg2 == 1 /* isStrongBiometric */);
                    break;
                case MSG_AUTHENTICATION_FAILED:
                    sendAuthenticatedFailed();
@@ -890,10 +903,10 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        }
    }

    private void sendAuthenticatedSucceeded(Fingerprint fp, int userId) {
    private void sendAuthenticatedSucceeded(Fingerprint fp, int userId, boolean isStrongBiometric) {
        if (mAuthenticationCallback != null) {
            final AuthenticationResult result =
                    new AuthenticationResult(mCryptoObject, fp, userId);
                    new AuthenticationResult(mCryptoObject, fp, userId, isStrongBiometric);
            mAuthenticationCallback.onAuthenticationSucceeded(result);
        }
    }
@@ -1078,8 +1091,10 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        }

        @Override // binder call
        public void onAuthenticationSucceeded(long deviceId, Fingerprint fp, int userId) {
            mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, 0, fp).sendToTarget();
        public void onAuthenticationSucceeded(long deviceId, Fingerprint fp, int userId,
                boolean isStrongBiometric) {
            mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, isStrongBiometric ? 1 : 0,
                    fp).sendToTarget();
        }

        @Override // binder call
Loading