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
This commit is contained in:
@@ -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<PointF> mGuidedEnrollmentPoints;
|
||||
@NonNull private final List<PointF> 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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user