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

Commit 1429a312 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Vibrate conditionally depending on modality

Bug: 111548033

Test: fingerprint enroll still vibrates
Change-Id: I77f3861e0a9884de74464a1a6c488e23fbccc200
parent 367f0686
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ public abstract class BiometricServiceBase extends SystemService
        }
    }

    protected class EnrollClientImpl extends EnrollClient {
    protected abstract class EnrollClientImpl extends EnrollClient {

        public EnrollClientImpl(Context context, DaemonWrapper daemon, long halDeviceId,
                IBinder token, ServiceListener listener, int userId, int groupId,
+5 −1
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ public abstract class EnrollClient extends ClientMonitor {
    private final BiometricUtils mBiometricUtils;
    private final int[] mDisabledFeatures;

    public abstract boolean shouldVibrate();

    public EnrollClient(Context context, Metrics metrics,
            BiometricServiceBase.DaemonWrapper daemon, long halDeviceId, IBinder token,
            BiometricServiceBase.ServiceListener listener, int userId, int groupId,
@@ -62,7 +64,9 @@ public abstract class EnrollClient extends ClientMonitor {
     */
    private boolean sendEnrollResult(BiometricAuthenticator.Identifier identifier,
            int remaining) {
        if (shouldVibrate()) {
            vibrateSuccess();
        }
        mMetricsLogger.action(mMetrics.actionBiometricEnroll());
        try {
            getListener().onEnrollResult(identifier, remaining);
+6 −1
Original line number Diff line number Diff line
@@ -121,7 +121,12 @@ 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) {
                @Override
                public boolean shouldVibrate() {
                    return false;
                }
            };

            enrollInternal(client, UserHandle.getCallingUserId());
        }
+6 −1
Original line number Diff line number Diff line
@@ -142,7 +142,12 @@ 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 */) {
                @Override
                public boolean shouldVibrate() {
                    return true;
                }
            };

            enrollInternal(client, userId);
        }