1/n: Move UDFPS enroll haptics back to system_server
The last enrollment step no longer requires special treatment. This also allows us to consolidate haptic logic (eventually) into one place (system_server) Bug: 193089985 Test: enroll Change-Id: Ib71e05c37c607a04673b139708df80f7a037c123
This commit is contained in:
@@ -21,11 +21,8 @@ import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.graphics.PointF;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.media.AudioAttributes;
|
||||
import android.os.Build;
|
||||
import android.os.UserHandle;
|
||||
import android.os.VibrationEffect;
|
||||
import android.os.Vibrator;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
@@ -50,12 +47,6 @@ public class UdfpsEnrollHelper {
|
||||
// Enroll with two center touches before going to guided enrollment
|
||||
private static final int NUM_CENTER_TOUCHES = 2;
|
||||
|
||||
private static final AudioAttributes VIBRATION_SONFICATION_ATTRIBUTES =
|
||||
new AudioAttributes.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
|
||||
.build();
|
||||
|
||||
interface Listener {
|
||||
void onEnrollmentProgress(int remaining, int totalSteps);
|
||||
void onLastStepAcquired();
|
||||
@@ -66,9 +57,6 @@ public class UdfpsEnrollHelper {
|
||||
private final int mEnrollReason;
|
||||
private final boolean mAccessibilityEnabled;
|
||||
@NonNull private final List<PointF> mGuidedEnrollmentPoints;
|
||||
@NonNull private final Vibrator mVibrator;
|
||||
@NonNull private final VibrationEffect mEffectClick =
|
||||
VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
|
||||
|
||||
private int mTotalSteps = -1;
|
||||
private int mRemainingSteps = -1;
|
||||
@@ -82,7 +70,6 @@ public class UdfpsEnrollHelper {
|
||||
public UdfpsEnrollHelper(@NonNull Context context, int reason) {
|
||||
mContext = context;
|
||||
mEnrollReason = reason;
|
||||
mVibrator = context.getSystemService(Vibrator.class);
|
||||
|
||||
final AccessibilityManager am = context.getSystemService(AccessibilityManager.class);
|
||||
mAccessibilityEnabled = am.isEnabled();
|
||||
@@ -141,7 +128,6 @@ public class UdfpsEnrollHelper {
|
||||
|
||||
if (remaining != mRemainingSteps) {
|
||||
mLocationsEnrolled++;
|
||||
vibrateSuccess();
|
||||
}
|
||||
|
||||
mRemainingSteps = remaining;
|
||||
@@ -202,11 +188,6 @@ public class UdfpsEnrollHelper {
|
||||
|
||||
if (mRemainingSteps <= 2 && mRemainingSteps >= 0) {
|
||||
mListener.onLastStepAcquired();
|
||||
vibrateSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
private void vibrateSuccess() {
|
||||
mVibrator.vibrate(mEffectClick, VIBRATION_SONFICATION_ATTRIBUTES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,10 +65,9 @@ class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
|
||||
@Nullable IUdfpsOverlayController udfpsOvelayController,
|
||||
@Nullable ISidefpsController sidefpsController,
|
||||
int maxTemplatesPerUser, @FingerprintManager.EnrollReason int enrollReason) {
|
||||
// UDFPS enroll vibrations are handled in SystemUI
|
||||
super(context, lazyDaemon, token, listener, userId, hardwareAuthToken, owner, utils,
|
||||
0 /* timeoutSec */, BiometricsProtoEnums.MODALITY_FINGERPRINT, sensorId,
|
||||
!sensorProps.isAnyUdfpsType() /* shouldVibrate */);
|
||||
true /* shouldVibrate */);
|
||||
mSensorProps = sensorProps;
|
||||
mUdfpsOverlayController = udfpsOvelayController;
|
||||
mSidefpsController = sidefpsController;
|
||||
|
||||
Reference in New Issue
Block a user