Loading core/java/android/hardware/fingerprint/FingerprintManager.java +21 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.Manifest.permission.USE_BIOMETRIC; import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL; import static android.Manifest.permission.USE_FINGERPRINT; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresFeature; Loading Loading @@ -55,6 +56,8 @@ import android.security.identity.IdentityCredential; import android.util.Slog; import android.view.Surface; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.security.Signature; import java.util.ArrayList; import java.util.List; Loading Loading @@ -89,6 +92,22 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing private static final int MSG_UDFPS_POINTER_DOWN = 108; private static final int MSG_UDFPS_POINTER_UP = 109; /** * @hide */ public static final int ENROLL_FIND_SENSOR = 1; /** * @hide */ public static final int ENROLL_ENROLL = 2; /** * @hide */ @IntDef({ENROLL_FIND_SENSOR, ENROLL_ENROLL}) @Retention(RetentionPolicy.SOURCE) public @interface EnrollReason {} /** * Request authentication with any single sensor. * @hide Loading Loading @@ -580,7 +599,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing */ @RequiresPermission(MANAGE_FINGERPRINT) public void enroll(byte [] hardwareAuthToken, CancellationSignal cancel, int userId, EnrollmentCallback callback, boolean shouldLogMetrics) { EnrollmentCallback callback, @EnrollReason int enrollReason) { if (userId == UserHandle.USER_CURRENT) { userId = getCurrentUserId(); } Loading @@ -601,7 +620,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing try { mEnrollmentCallback = callback; mService.enroll(mToken, hardwareAuthToken, userId, mServiceReceiver, mContext.getOpPackageName(), shouldLogMetrics); mContext.getOpPackageName(), enrollReason); } catch (RemoteException e) { Slog.w(TAG, "Remote exception in enroll: ", e); // Though this may not be a hardware issue, it will cause apps to give up or try Loading core/java/android/hardware/fingerprint/IFingerprintService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ interface IFingerprintService { // Start fingerprint enrollment void enroll(IBinder token, in byte [] hardwareAuthToken, int userId, IFingerprintServiceReceiver receiver, String opPackageName, boolean shouldLogMetrics); String opPackageName, int enrollReason); // Cancel enrollment in progress void cancelEnrollment(IBinder token); Loading core/java/android/hardware/fingerprint/IUdfpsOverlayController.aidl +5 −4 Original line number Diff line number Diff line Loading @@ -21,10 +21,11 @@ package android.hardware.fingerprint; */ oneway interface IUdfpsOverlayController { const int REASON_UNKNOWN = 0; const int REASON_ENROLL = 1; const int REASON_AUTH_BP = 2; // BiometricPrompt const int REASON_AUTH_FPM_KEYGUARD = 3; // FingerprintManager usage from Keyguard const int REASON_AUTH_FPM_OTHER = 4; // Other FingerprintManager usage const int REASON_ENROLL_FIND_SENSOR = 1; const int REASON_ENROLL_ENROLLING = 2; const int REASON_AUTH_BP = 3; // BiometricPrompt const int REASON_AUTH_FPM_KEYGUARD = 4; // FingerprintManager usage from Keyguard const int REASON_AUTH_FPM_OTHER = 5; // Other FingerprintManager usage // Shows the overlay. void showUdfpsOverlay(int sensorId, int reason); Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +9 −6 Original line number Diff line number Diff line Loading @@ -96,8 +96,11 @@ public class UdfpsController implements DozeReceiver, HbmCallback { public class UdfpsOverlayController extends IUdfpsOverlayController.Stub { @Override public void showUdfpsOverlay(int sensorId, int reason) { if (reason == IUdfpsOverlayController.REASON_ENROLL) { mEnrollHelper = new UdfpsEnrollHelper(); if (reason == IUdfpsOverlayController.REASON_ENROLL_FIND_SENSOR || reason == IUdfpsOverlayController.REASON_ENROLL_ENROLLING) { mEnrollHelper = new UdfpsEnrollHelper(reason); } else { mEnrollHelper = null; } UdfpsController.this.showOverlay(reason); } Loading Loading @@ -300,8 +303,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback { try { Log.v(TAG, "showUdfpsOverlay | adding window"); final UdfpsAnimation animation = getUdfpsAnimationForReason(reason); mView.setUdfpsAnimation(animation); mView.setEnrollHelper(mEnrollHelper); mView.setExtras(animation, mEnrollHelper); mWindowManager.addView(mView, computeLayoutParams(animation)); mView.setOnTouchListener(mOnTouchListener); mIsOverlayShowing = true; Loading @@ -318,7 +320,8 @@ public class UdfpsController implements DozeReceiver, HbmCallback { private UdfpsAnimation getUdfpsAnimationForReason(int reason) { Log.d(TAG, "getUdfpsAnimationForReason: " + reason); switch (reason) { case IUdfpsOverlayController.REASON_ENROLL: case IUdfpsOverlayController.REASON_ENROLL_FIND_SENSOR: case IUdfpsOverlayController.REASON_ENROLL_ENROLLING: return new UdfpsAnimationEnroll(mContext); case IUdfpsOverlayController.REASON_AUTH_FPM_KEYGUARD: return new UdfpsAnimationKeyguard(mView, mContext, mStatusBarStateController); Loading @@ -334,7 +337,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback { mFgExecutor.execute(() -> { if (mIsOverlayShowing) { Log.v(TAG, "hideUdfpsOverlay | removing window"); mView.setUdfpsAnimation(null); mView.setExtras(null, null); mView.setOnTouchListener(null); // Reset the controller back to its starting state. onFingerUp(); Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollHelper.java +12 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.biometrics; import android.hardware.fingerprint.IUdfpsOverlayController; import androidx.annotation.NonNull; /** Loading @@ -24,10 +26,20 @@ import androidx.annotation.NonNull; public class UdfpsEnrollHelper { private static final String TAG = "UdfpsEnrollHelper"; // IUdfpsOverlayController reason private final int mEnrollReason; private int mTotalSteps = -1; private int mCurrentProgress = 0; public UdfpsEnrollHelper(int reason) { mEnrollReason = reason; } boolean shouldShowProgressBar() { return mEnrollReason == IUdfpsOverlayController.REASON_ENROLL_ENROLLING; } void onEnrollmentProgress(int remaining, @NonNull UdfpsProgressBar progressBar) { if (mTotalSteps == -1) { mTotalSteps = remaining; Loading Loading
core/java/android/hardware/fingerprint/FingerprintManager.java +21 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.Manifest.permission.USE_BIOMETRIC; import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL; import static android.Manifest.permission.USE_FINGERPRINT; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresFeature; Loading Loading @@ -55,6 +56,8 @@ import android.security.identity.IdentityCredential; import android.util.Slog; import android.view.Surface; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.security.Signature; import java.util.ArrayList; import java.util.List; Loading Loading @@ -89,6 +92,22 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing private static final int MSG_UDFPS_POINTER_DOWN = 108; private static final int MSG_UDFPS_POINTER_UP = 109; /** * @hide */ public static final int ENROLL_FIND_SENSOR = 1; /** * @hide */ public static final int ENROLL_ENROLL = 2; /** * @hide */ @IntDef({ENROLL_FIND_SENSOR, ENROLL_ENROLL}) @Retention(RetentionPolicy.SOURCE) public @interface EnrollReason {} /** * Request authentication with any single sensor. * @hide Loading Loading @@ -580,7 +599,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing */ @RequiresPermission(MANAGE_FINGERPRINT) public void enroll(byte [] hardwareAuthToken, CancellationSignal cancel, int userId, EnrollmentCallback callback, boolean shouldLogMetrics) { EnrollmentCallback callback, @EnrollReason int enrollReason) { if (userId == UserHandle.USER_CURRENT) { userId = getCurrentUserId(); } Loading @@ -601,7 +620,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing try { mEnrollmentCallback = callback; mService.enroll(mToken, hardwareAuthToken, userId, mServiceReceiver, mContext.getOpPackageName(), shouldLogMetrics); mContext.getOpPackageName(), enrollReason); } catch (RemoteException e) { Slog.w(TAG, "Remote exception in enroll: ", e); // Though this may not be a hardware issue, it will cause apps to give up or try Loading
core/java/android/hardware/fingerprint/IFingerprintService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ interface IFingerprintService { // Start fingerprint enrollment void enroll(IBinder token, in byte [] hardwareAuthToken, int userId, IFingerprintServiceReceiver receiver, String opPackageName, boolean shouldLogMetrics); String opPackageName, int enrollReason); // Cancel enrollment in progress void cancelEnrollment(IBinder token); Loading
core/java/android/hardware/fingerprint/IUdfpsOverlayController.aidl +5 −4 Original line number Diff line number Diff line Loading @@ -21,10 +21,11 @@ package android.hardware.fingerprint; */ oneway interface IUdfpsOverlayController { const int REASON_UNKNOWN = 0; const int REASON_ENROLL = 1; const int REASON_AUTH_BP = 2; // BiometricPrompt const int REASON_AUTH_FPM_KEYGUARD = 3; // FingerprintManager usage from Keyguard const int REASON_AUTH_FPM_OTHER = 4; // Other FingerprintManager usage const int REASON_ENROLL_FIND_SENSOR = 1; const int REASON_ENROLL_ENROLLING = 2; const int REASON_AUTH_BP = 3; // BiometricPrompt const int REASON_AUTH_FPM_KEYGUARD = 4; // FingerprintManager usage from Keyguard const int REASON_AUTH_FPM_OTHER = 5; // Other FingerprintManager usage // Shows the overlay. void showUdfpsOverlay(int sensorId, int reason); Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +9 −6 Original line number Diff line number Diff line Loading @@ -96,8 +96,11 @@ public class UdfpsController implements DozeReceiver, HbmCallback { public class UdfpsOverlayController extends IUdfpsOverlayController.Stub { @Override public void showUdfpsOverlay(int sensorId, int reason) { if (reason == IUdfpsOverlayController.REASON_ENROLL) { mEnrollHelper = new UdfpsEnrollHelper(); if (reason == IUdfpsOverlayController.REASON_ENROLL_FIND_SENSOR || reason == IUdfpsOverlayController.REASON_ENROLL_ENROLLING) { mEnrollHelper = new UdfpsEnrollHelper(reason); } else { mEnrollHelper = null; } UdfpsController.this.showOverlay(reason); } Loading Loading @@ -300,8 +303,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback { try { Log.v(TAG, "showUdfpsOverlay | adding window"); final UdfpsAnimation animation = getUdfpsAnimationForReason(reason); mView.setUdfpsAnimation(animation); mView.setEnrollHelper(mEnrollHelper); mView.setExtras(animation, mEnrollHelper); mWindowManager.addView(mView, computeLayoutParams(animation)); mView.setOnTouchListener(mOnTouchListener); mIsOverlayShowing = true; Loading @@ -318,7 +320,8 @@ public class UdfpsController implements DozeReceiver, HbmCallback { private UdfpsAnimation getUdfpsAnimationForReason(int reason) { Log.d(TAG, "getUdfpsAnimationForReason: " + reason); switch (reason) { case IUdfpsOverlayController.REASON_ENROLL: case IUdfpsOverlayController.REASON_ENROLL_FIND_SENSOR: case IUdfpsOverlayController.REASON_ENROLL_ENROLLING: return new UdfpsAnimationEnroll(mContext); case IUdfpsOverlayController.REASON_AUTH_FPM_KEYGUARD: return new UdfpsAnimationKeyguard(mView, mContext, mStatusBarStateController); Loading @@ -334,7 +337,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback { mFgExecutor.execute(() -> { if (mIsOverlayShowing) { Log.v(TAG, "hideUdfpsOverlay | removing window"); mView.setUdfpsAnimation(null); mView.setExtras(null, null); mView.setOnTouchListener(null); // Reset the controller back to its starting state. onFingerUp(); Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollHelper.java +12 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.biometrics; import android.hardware.fingerprint.IUdfpsOverlayController; import androidx.annotation.NonNull; /** Loading @@ -24,10 +26,20 @@ import androidx.annotation.NonNull; public class UdfpsEnrollHelper { private static final String TAG = "UdfpsEnrollHelper"; // IUdfpsOverlayController reason private final int mEnrollReason; private int mTotalSteps = -1; private int mCurrentProgress = 0; public UdfpsEnrollHelper(int reason) { mEnrollReason = reason; } boolean shouldShowProgressBar() { return mEnrollReason == IUdfpsOverlayController.REASON_ENROLL_ENROLLING; } void onEnrollmentProgress(int remaining, @NonNull UdfpsProgressBar progressBar) { if (mTotalSteps == -1) { mTotalSteps = remaining; Loading