Merge "Removed haptic from udfps enrollment" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
882cdf1594
@@ -138,7 +138,8 @@
|
|||||||
<color name="udfps_enroll_icon">#7DA7F1</color>
|
<color name="udfps_enroll_icon">#7DA7F1</color>
|
||||||
<color name="udfps_moving_target_fill">#475670</color>
|
<color name="udfps_moving_target_fill">#475670</color>
|
||||||
<color name="udfps_enroll_progress">#7DA7F1</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 -->
|
<!-- Floating overlay actions -->
|
||||||
<color name="overlay_button_ripple">#1f000000</color>
|
<color name="overlay_button_ripple">#1f000000</color>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.graphics.Canvas;
|
|||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
import android.view.animation.OvershootInterpolator;
|
import android.view.animation.OvershootInterpolator;
|
||||||
|
|
||||||
@@ -71,7 +72,13 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable {
|
|||||||
public UdfpsEnrollProgressBarDrawable(@NonNull Context context) {
|
public UdfpsEnrollProgressBarDrawable(@NonNull Context context) {
|
||||||
mStrokeWidthPx = Utils.dpToPixels(context, STROKE_WIDTH_DP);
|
mStrokeWidthPx = Utils.dpToPixels(context, STROKE_WIDTH_DP);
|
||||||
mProgressColor = context.getColor(R.color.udfps_enroll_progress);
|
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);
|
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 = context.getDrawable(R.drawable.udfps_enroll_checkmark);
|
||||||
mCheckmarkDrawable.mutate();
|
mCheckmarkDrawable.mutate();
|
||||||
mCheckmarkInterpolator = new OvershootInterpolator();
|
mCheckmarkInterpolator = new OvershootInterpolator();
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implement
|
|||||||
|
|
||||||
protected final void vibrateSuccess() {
|
protected final void vibrateSuccess() {
|
||||||
Vibrator vibrator = getContext().getSystemService(Vibrator.class);
|
Vibrator vibrator = getContext().getSystemService(Vibrator.class);
|
||||||
if (vibrator != null) {
|
if (vibrator != null && mShouldVibrate) {
|
||||||
vibrator.vibrate(Process.myUid(),
|
vibrator.vibrate(Process.myUid(),
|
||||||
getContext().getOpPackageName(),
|
getContext().getOpPackageName(),
|
||||||
SUCCESS_VIBRATION_EFFECT,
|
SUCCESS_VIBRATION_EFFECT,
|
||||||
@@ -209,7 +209,7 @@ public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implement
|
|||||||
|
|
||||||
protected final void vibrateError() {
|
protected final void vibrateError() {
|
||||||
Vibrator vibrator = getContext().getSystemService(Vibrator.class);
|
Vibrator vibrator = getContext().getSystemService(Vibrator.class);
|
||||||
if (vibrator != null) {
|
if (vibrator != null && mShouldVibrate) {
|
||||||
vibrator.vibrate(Process.myUid(),
|
vibrator.vibrate(Process.myUid(),
|
||||||
getContext().getOpPackageName(),
|
getContext().getOpPackageName(),
|
||||||
ERROR_VIBRATION_EFFECT,
|
ERROR_VIBRATION_EFFECT,
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import android.hardware.keymaster.HardwareAuthToken;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
|
||||||
import com.android.server.biometrics.HardwareAuthTokenUtils;
|
import com.android.server.biometrics.HardwareAuthTokenUtils;
|
||||||
import com.android.server.biometrics.log.BiometricContext;
|
import com.android.server.biometrics.log.BiometricContext;
|
||||||
@@ -66,6 +67,13 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps
|
|||||||
private final int mMaxTemplatesPerUser;
|
private final int mMaxTemplatesPerUser;
|
||||||
private boolean mIsPointerDown;
|
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,
|
FingerprintEnrollClient(@NonNull Context context,
|
||||||
@NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token, long requestId,
|
@NonNull Supplier<AidlSession> lazyDaemon, @NonNull IBinder token, long requestId,
|
||||||
@NonNull ClientMonitorCallbackConverter listener, int userId,
|
@NonNull ClientMonitorCallbackConverter listener, int userId,
|
||||||
@@ -78,8 +86,8 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps
|
|||||||
int maxTemplatesPerUser, @FingerprintManager.EnrollReason int enrollReason) {
|
int maxTemplatesPerUser, @FingerprintManager.EnrollReason int enrollReason) {
|
||||||
// UDFPS haptics occur when an image is acquired (instead of when the result is known)
|
// UDFPS haptics occur when an image is acquired (instead of when the result is known)
|
||||||
super(context, lazyDaemon, token, listener, userId, hardwareAuthToken, owner, utils,
|
super(context, lazyDaemon, token, listener, userId, hardwareAuthToken, owner, utils,
|
||||||
0 /* timeoutSec */, sensorId,
|
0 /* timeoutSec */, sensorId, shouldVibrateFor(context, sensorProps), logger,
|
||||||
!sensorProps.isAnyUdfpsType() /* shouldVibrate */, logger, biometricContext);
|
biometricContext);
|
||||||
setRequestId(requestId);
|
setRequestId(requestId);
|
||||||
mSensorProps = sensorProps;
|
mSensorProps = sensorProps;
|
||||||
mSensorOverlays = new SensorOverlays(udfpsOverlayController, sidefpsController);
|
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.
|
// For UDFPS, notify SysUI that the illumination can be turned off.
|
||||||
// See AcquiredInfo#GOOD and AcquiredInfo#RETRYING_CAPTURE
|
// See AcquiredInfo#GOOD and AcquiredInfo#RETRYING_CAPTURE
|
||||||
if (mSensorProps.isAnyUdfpsType()) {
|
if (mSensorProps.isAnyUdfpsType()) {
|
||||||
if (acquiredGood) {
|
if (acquiredGood && mShouldVibrate) {
|
||||||
vibrateSuccess();
|
vibrateSuccess();
|
||||||
}
|
}
|
||||||
mSensorOverlays.ifUdfps(
|
mSensorOverlays.ifUdfps(
|
||||||
|
|||||||
Reference in New Issue
Block a user