Send enrollment signals to SystemUI
Fixes: 178147339 Test: UdfpsAnimationEnroll logs are seen Change-Id: Ifdaa58ab75662606fd0e46683448750843795249
This commit is contained in:
@@ -32,6 +32,12 @@ oneway interface IUdfpsOverlayController {
|
||||
// Hides the overlay.
|
||||
void hideUdfpsOverlay(int sensorId);
|
||||
|
||||
// Notifies of enrollment progress changes.
|
||||
void onEnrollmentProgress(int sensorId, int remaining);
|
||||
|
||||
// Notifies when a non-terminal error occurs (e.g. user moved their finger too fast).
|
||||
void onEnrollmentHelp(int sensorId);
|
||||
|
||||
// Shows debug messages on the UDFPS overlay.
|
||||
void setDebugMessage(int sensorId, String message);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -85,4 +86,12 @@ public class UdfpsAnimationEnroll extends UdfpsAnimation {
|
||||
public int getOpacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void onEnrollmentProgress(int remaining) {
|
||||
Log.d(TAG, "Remaining: " + remaining);
|
||||
}
|
||||
|
||||
public void onEnrollmentHelp() {
|
||||
Log.d(TAG, "onEnrollmentHelp");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,16 @@ class UdfpsController implements DozeReceiver {
|
||||
UdfpsController.this.hideOverlay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnrollmentProgress(int sensorId, int remaining) {
|
||||
mView.onEnrollmentProgress(remaining);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnrollmentHelp(int sensorId) {
|
||||
mView.onEnrollmentHelp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDebugMessage(int sensorId, String message) {
|
||||
mView.setDebugMessage(message);
|
||||
|
||||
@@ -55,7 +55,6 @@ public class UdfpsView extends View implements DozeReceiver {
|
||||
@NonNull private final Paint mSensorPaint;
|
||||
private final float mSensorTouchAreaCoefficient;
|
||||
|
||||
|
||||
// Stores rounded up values from mSensorRect. Necessary for APIs that only take Rect (not RecF).
|
||||
@NonNull private final Rect mTouchableRegion;
|
||||
// mInsetsListener is used to set the touchable region for our window. Our window covers the
|
||||
@@ -281,4 +280,16 @@ public class UdfpsView extends View implements DozeReceiver {
|
||||
mShowScrimAndDot = false;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void onEnrollmentProgress(int remaining) {
|
||||
if (mUdfpsAnimation instanceof UdfpsAnimationEnroll) {
|
||||
((UdfpsAnimationEnroll) mUdfpsAnimation).onEnrollmentProgress(remaining);
|
||||
}
|
||||
}
|
||||
|
||||
void onEnrollmentHelp() {
|
||||
if (mUdfpsAnimation instanceof UdfpsAnimationEnroll) {
|
||||
((UdfpsAnimationEnroll) mUdfpsAnimation).onEnrollmentHelp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,11 @@
|
||||
|
||||
package com.android.server.biometrics.sensors.fingerprint;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Slog;
|
||||
@@ -85,4 +88,33 @@ public class UdfpsHelper {
|
||||
Slog.e(TAG, "Remote exception when hiding the UDFPS overlay", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onEnrollmentProgress(int sensorId, int remaining,
|
||||
@Nullable IUdfpsOverlayController udfpsOverlayController) {
|
||||
if (udfpsOverlayController == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
udfpsOverlayController.onEnrollmentProgress(sensorId, remaining);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when sending onEnrollmentProgress", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onEnrollmentHelp(int sensorId,
|
||||
@Nullable IUdfpsOverlayController udfpsOverlayController) {
|
||||
if (udfpsOverlayController == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
udfpsOverlayController.onEnrollmentHelp(sensorId);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Remote exception when sending onEnrollmentHelp", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isValidAcquisitionMessage(@NonNull Context context,
|
||||
int acquireInfo, int vendorCode) {
|
||||
return FingerprintManager.getAcquiredString(context, acquireInfo, vendorCode) != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,11 +65,22 @@ class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
|
||||
public void onEnrollResult(BiometricAuthenticator.Identifier identifier, int remaining) {
|
||||
super.onEnrollResult(identifier, remaining);
|
||||
|
||||
UdfpsHelper.onEnrollmentProgress(getSensorId(), remaining, mUdfpsOverlayController);
|
||||
|
||||
if (remaining == 0) {
|
||||
UdfpsHelper.hideUdfpsOverlay(getSensorId(), mUdfpsOverlayController);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAcquired(int acquiredInfo, int vendorCode) {
|
||||
super.onAcquired(acquiredInfo, vendorCode);
|
||||
|
||||
if (UdfpsHelper.isValidAcquisitionMessage(getContext(), acquiredInfo, vendorCode)) {
|
||||
UdfpsHelper.onEnrollmentHelp(getSensorId(), mUdfpsOverlayController);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int errorCode, int vendorCode) {
|
||||
super.onError(errorCode, vendorCode);
|
||||
|
||||
@@ -107,11 +107,22 @@ public class FingerprintEnrollClient extends EnrollClient<IBiometricsFingerprint
|
||||
public void onEnrollResult(BiometricAuthenticator.Identifier identifier, int remaining) {
|
||||
super.onEnrollResult(identifier, remaining);
|
||||
|
||||
UdfpsHelper.onEnrollmentProgress(getSensorId(), remaining, mUdfpsOverlayController);
|
||||
|
||||
if (remaining == 0) {
|
||||
UdfpsHelper.hideUdfpsOverlay(getSensorId(), mUdfpsOverlayController);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAcquired(int acquiredInfo, int vendorCode) {
|
||||
super.onAcquired(acquiredInfo, vendorCode);
|
||||
|
||||
if (UdfpsHelper.isValidAcquisitionMessage(getContext(), acquiredInfo, vendorCode)) {
|
||||
UdfpsHelper.onEnrollmentHelp(getSensorId(), mUdfpsOverlayController);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int errorCode, int vendorCode) {
|
||||
super.onError(errorCode, vendorCode);
|
||||
|
||||
Reference in New Issue
Block a user