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

Commit 6a0f8c57 authored by Kevin Chyn's avatar Kevin Chyn Committed by Automerger Merge Worker
Browse files

Merge "Add prop to test various enrollment scaling" into sc-dev am: aef42e77

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13854705

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia5e7b33468b4ebc3546cb2e4715da9451a18ad98
parents cbf6b183 aef42e77
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -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);
    }
}