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

Commit a4c2a68f authored by Curtis Belmonte's avatar Curtis Belmonte Committed by android-build-merger
Browse files

Merge "Use separate enroll timeout for fingerprint and face" into qt-r1-dev

am: c2f168ec

Change-Id: I303dceb0a30f93e151aab791fdf22a22b363f17a
parents ef1e18af c2f168ec
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -282,10 +282,10 @@ public abstract class BiometricServiceBase extends SystemService
        public EnrollClientImpl(Context context, DaemonWrapper daemon, long halDeviceId,
                IBinder token, ServiceListener listener, int userId, int groupId,
                byte[] cryptoToken, boolean restricted, String owner,
                final int[] disabledFeatures) {
                final int[] disabledFeatures, int timeoutSec) {
            super(context, getConstants(), daemon, halDeviceId, token, listener,
                    userId, groupId, cryptoToken, restricted, owner, getBiometricUtils(),
                    disabledFeatures);
                    disabledFeatures, timeoutSec);
        }

        @Override
+5 −5
Original line number Diff line number Diff line
@@ -31,11 +31,11 @@ import java.util.Arrays;
 * A class to keep track of the enrollment state for a given client.
 */
public abstract class EnrollClient extends ClientMonitor {
    private static final long MS_PER_SEC = 1000;
    private static final int ENROLLMENT_TIMEOUT_MS = 60 * 1000; // 1 minute
    private final byte[] mCryptoToken;
    private final BiometricUtils mBiometricUtils;
    private final int[] mDisabledFeatures;
    private final int mTimeoutSec;

    private long mEnrollmentStartTimeMs;

    public abstract boolean shouldVibrate();
@@ -44,12 +44,13 @@ public abstract class EnrollClient extends ClientMonitor {
            BiometricServiceBase.DaemonWrapper daemon, long halDeviceId, IBinder token,
            BiometricServiceBase.ServiceListener listener, int userId, int groupId,
            byte[] cryptoToken, boolean restricted, String owner, BiometricUtils utils,
            final int[] disabledFeatures) {
            final int[] disabledFeatures, int timeoutSec) {
        super(context, constants, daemon, halDeviceId, token, listener, userId, groupId, restricted,
                owner, 0 /* cookie */);
        mBiometricUtils = utils;
        mCryptoToken = Arrays.copyOf(cryptoToken, cryptoToken.length);
        mDisabledFeatures = Arrays.copyOf(disabledFeatures, disabledFeatures.length);
        mTimeoutSec = timeoutSec;
    }

    @Override
@@ -94,14 +95,13 @@ public abstract class EnrollClient extends ClientMonitor {
    @Override
    public int start() {
        mEnrollmentStartTimeMs = System.currentTimeMillis();
        final int timeout = (int) (ENROLLMENT_TIMEOUT_MS / MS_PER_SEC);
        try {
            final ArrayList<Integer> disabledFeatures = new ArrayList<>();
            for (int i = 0; i < mDisabledFeatures.length; i++) {
                disabledFeatures.add(mDisabledFeatures[i]);
            }

            final int result = getDaemonWrapper().enroll(mCryptoToken, getGroupId(), timeout,
            final int result = getDaemonWrapper().enroll(mCryptoToken, getGroupId(), mTimeoutSec,
                    disabledFeatures);
            if (result != 0) {
                Slog.w(getLogTag(), "startEnroll failed, result=" + result);
+3 −1
Original line number Diff line number Diff line
@@ -329,6 +329,7 @@ public class FaceService extends BiometricServiceBase {
     * Receives the incoming binder calls from FaceManager.
     */
    private final class FaceServiceWrapper extends IFaceService.Stub {
        private static final int ENROLL_TIMEOUT_SEC = 75;

        /**
         * The following methods contain common code which is shared in biometrics/common.
@@ -368,7 +369,8 @@ public class FaceService extends BiometricServiceBase {
            final boolean restricted = isRestricted();
            final EnrollClientImpl client = new EnrollClientImpl(getContext(), mDaemonWrapper,
                    mHalDeviceId, token, new ServiceListenerImpl(receiver), mCurrentUserId,
                    0 /* groupId */, cryptoToken, restricted, opPackageName, disabledFeatures) {
                    0 /* groupId */, cryptoToken, restricted, opPackageName, disabledFeatures,
                    ENROLL_TIMEOUT_SEC) {

                @Override
                public int[] getAcquireIgnorelist() {
+3 −1
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ public class FingerprintService extends BiometricServiceBase {
     * Receives the incoming binder calls from FingerprintManager.
     */
    private final class FingerprintServiceWrapper extends IFingerprintService.Stub {
        private static final int ENROLL_TIMEOUT_SEC = 60;

        /**
         * The following methods contain common code which is shared in biometrics/common.
@@ -203,7 +204,8 @@ public class FingerprintService extends BiometricServiceBase {
            final int groupId = userId; // default group for fingerprint enrollment
            final EnrollClientImpl client = new EnrollClientImpl(getContext(), mDaemonWrapper,
                    mHalDeviceId, token, new ServiceListenerImpl(receiver), mCurrentUserId, groupId,
                    cryptoToken, restricted, opPackageName, new int[0] /* disabledFeatures */) {
                    cryptoToken, restricted, opPackageName, new int[0] /* disabledFeatures */,
                    ENROLL_TIMEOUT_SEC) {
                @Override
                public boolean shouldVibrate() {
                    return true;