From 3644f70367b5ae00e3ccaf7b66b30dcff92a4a21 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Fri, 12 Mar 2021 10:07:04 -0800 Subject: [PATCH] Add prop to test various enrollment scaling Fixes: 182511708 Test: adb shell settings put secure com.android.systemui.biometrics.UdfpsEnrollHelper.scale 0.1 Change-Id: Id4bcf241cdedb5c3612e3b8f3217e9d99fd83f0a --- .../biometrics/UdfpsEnrollHelper.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollHelper.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollHelper.java index 62058a965c09f..98a703f595d28 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollHelper.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollHelper.java @@ -21,6 +21,9 @@ import android.annotation.Nullable; import android.content.Context; import android.graphics.PointF; import android.hardware.fingerprint.IUdfpsOverlayController; +import android.os.Build; +import android.os.UserHandle; +import android.provider.Settings; import android.util.TypedValue; import java.util.ArrayList; @@ -32,6 +35,10 @@ import java.util.List; public class UdfpsEnrollHelper { private static final String TAG = "UdfpsEnrollHelper"; + private static final String SCALE_OVERRIDE = + "com.android.systemui.biometrics.UdfpsEnrollHelper.scale"; + private static final float SCALE = 0.5f; + // Enroll with two center touches before going to guided enrollment private static final int NUM_CENTER_TOUCHES = 2; @@ -39,9 +46,10 @@ public class UdfpsEnrollHelper { void onEnrollmentProgress(int remaining, int totalSteps); } + @NonNull private final Context mContext; // IUdfpsOverlayController reason private final int mEnrollReason; - private final List mGuidedEnrollmentPoints; + @NonNull private final List mGuidedEnrollmentPoints; private int mTotalSteps = -1; private int mRemainingSteps = -1; @@ -53,6 +61,7 @@ public class UdfpsEnrollHelper { @Nullable Listener mListener; public UdfpsEnrollHelper(@NonNull Context context, int reason) { + mContext = context; mEnrollReason = reason; mGuidedEnrollmentPoints = new ArrayList<>(); @@ -121,9 +130,15 @@ public class UdfpsEnrollHelper { @NonNull PointF getNextGuidedEnrollmentPoint() { + float scale = SCALE; + if (Build.IS_ENG || Build.IS_USERDEBUG) { + scale = Settings.Secure.getFloatForUser(mContext.getContentResolver(), + SCALE_OVERRIDE, SCALE, + UserHandle.USER_CURRENT); + } final int index = mLocationsEnrolled - NUM_CENTER_TOUCHES; final PointF originalPoint = mGuidedEnrollmentPoints .get(index % mGuidedEnrollmentPoints.size()); - return new PointF(originalPoint.x * 0.5f, originalPoint.y * 0.5f); + return new PointF(originalPoint.x * scale, originalPoint.y * scale); } }