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

Commit 882cdf15 authored by Joshua Mccloskey's avatar Joshua Mccloskey Committed by Android (Google) Code Review
Browse files

Merge "Removed haptic from udfps enrollment" into tm-dev

parents acc04270 abc1d4c2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@
    <color name="udfps_enroll_icon">#7DA7F1</color>
    <color name="udfps_moving_target_fill">#475670</color>
    <color name="udfps_enroll_progress">#7DA7F1</color>
    <color name="udfps_enroll_progress_help">#ffEE675C</color>
    <color name="udfps_enroll_progress_help">#607DA7F1</color>
    <color name="udfps_enroll_progress_help_with_talkback">#ffEE675C</color>

    <!-- Floating overlay actions -->
    <color name="overlay_button_ripple">#1f000000</color>
+8 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Interpolator;
import android.view.animation.OvershootInterpolator;

@@ -71,7 +72,13 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable {
    public UdfpsEnrollProgressBarDrawable(@NonNull Context context) {
        mStrokeWidthPx = Utils.dpToPixels(context, STROKE_WIDTH_DP);
        mProgressColor = context.getColor(R.color.udfps_enroll_progress);
        final AccessibilityManager am = context.getSystemService(AccessibilityManager.class);
        final boolean isAccessbilityEnabled = am.isTouchExplorationEnabled();
        if (!isAccessbilityEnabled) {
            mHelpColor = context.getColor(R.color.udfps_enroll_progress_help);
        } else {
            mHelpColor = context.getColor(R.color.udfps_enroll_progress_help_with_talkback);
        }
        mCheckmarkDrawable = context.getDrawable(R.drawable.udfps_enroll_checkmark);
        mCheckmarkDrawable.mutate();
        mCheckmarkInterpolator = new OvershootInterpolator();
+2 −2
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implement

    protected final void vibrateSuccess() {
        Vibrator vibrator = getContext().getSystemService(Vibrator.class);
        if (vibrator != null) {
        if (vibrator != null && mShouldVibrate) {
            vibrator.vibrate(Process.myUid(),
                    getContext().getOpPackageName(),
                    SUCCESS_VIBRATION_EFFECT,
@@ -209,7 +209,7 @@ public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implement

    protected final void vibrateError() {
        Vibrator vibrator = getContext().getSystemService(Vibrator.class);
        if (vibrator != null) {
        if (vibrator != null && mShouldVibrate) {
            vibrator.vibrate(Process.myUid(),
                    getContext().getOpPackageName(),
                    ERROR_VIBRATION_EFFECT,
+11 −3
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.hardware.keymaster.HardwareAuthToken;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Slog;
import android.view.accessibility.AccessibilityManager;

import com.android.server.biometrics.HardwareAuthTokenUtils;
import com.android.server.biometrics.log.BiometricContext;
@@ -66,6 +67,13 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps
    private final int mMaxTemplatesPerUser;
    private boolean mIsPointerDown;

    private static boolean shouldVibrateFor(Context context,
            FingerprintSensorPropertiesInternal sensorProps) {
        final AccessibilityManager am = context.getSystemService(AccessibilityManager.class);
        final boolean isAccessbilityEnabled = am.isTouchExplorationEnabled();
        return !sensorProps.isAnyUdfpsType() || isAccessbilityEnabled;
    }

    FingerprintEnrollClient(@NonNull Context context,
            @NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token, long requestId,
            @NonNull ClientMonitorCallbackConverter listener, int userId,
@@ -78,8 +86,8 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps
            int maxTemplatesPerUser, @FingerprintManager.EnrollReason int enrollReason) {
        // UDFPS haptics occur when an image is acquired (instead of when the result is known)
        super(context, lazyDaemon, token, listener, userId, hardwareAuthToken, owner, utils,
                0 /* timeoutSec */, sensorId,
                !sensorProps.isAnyUdfpsType() /* shouldVibrate */, logger, biometricContext);
                0 /* timeoutSec */, sensorId, shouldVibrateFor(context, sensorProps), logger,
                biometricContext);
        setRequestId(requestId);
        mSensorProps = sensorProps;
        mSensorOverlays = new SensorOverlays(udfpsOverlayController, sidefpsController);
@@ -119,7 +127,7 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps
        // For UDFPS, notify SysUI that the illumination can be turned off.
        // See AcquiredInfo#GOOD and AcquiredInfo#RETRYING_CAPTURE
        if (mSensorProps.isAnyUdfpsType()) {
            if (acquiredGood) {
            if (acquiredGood && mShouldVibrate) {
                vibrateSuccess();
            }
            mSensorOverlays.ifUdfps(