Merge "Send enrollment signals to SystemUI" into sc-dev am: 3850b098b1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13413164 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ic97317f69f4b5a1c20e7ca7b148fd3b908e1f531
This commit is contained in:
@@ -32,6 +32,12 @@ oneway interface IUdfpsOverlayController {
|
|||||||
// Hides the overlay.
|
// Hides the overlay.
|
||||||
void hideUdfpsOverlay(int sensorId);
|
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.
|
// Shows debug messages on the UDFPS overlay.
|
||||||
void setDebugMessage(int sensorId, String message);
|
void setDebugMessage(int sensorId, String message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.graphics.Color;
|
|||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -85,4 +86,12 @@ public class UdfpsAnimationEnroll extends UdfpsAnimation {
|
|||||||
public int getOpacity() {
|
public int getOpacity() {
|
||||||
return 0;
|
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();
|
UdfpsController.this.hideOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnrollmentProgress(int sensorId, int remaining) {
|
||||||
|
mView.onEnrollmentProgress(remaining);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEnrollmentHelp(int sensorId) {
|
||||||
|
mView.onEnrollmentHelp();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDebugMessage(int sensorId, String message) {
|
public void setDebugMessage(int sensorId, String message) {
|
||||||
mView.setDebugMessage(message);
|
mView.setDebugMessage(message);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ public class UdfpsView extends View implements DozeReceiver {
|
|||||||
@NonNull private final Paint mSensorPaint;
|
@NonNull private final Paint mSensorPaint;
|
||||||
private final float mSensorTouchAreaCoefficient;
|
private final float mSensorTouchAreaCoefficient;
|
||||||
|
|
||||||
|
|
||||||
// Stores rounded up values from mSensorRect. Necessary for APIs that only take Rect (not RecF).
|
// Stores rounded up values from mSensorRect. Necessary for APIs that only take Rect (not RecF).
|
||||||
@NonNull private final Rect mTouchableRegion;
|
@NonNull private final Rect mTouchableRegion;
|
||||||
// mInsetsListener is used to set the touchable region for our window. Our window covers the
|
// 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;
|
mShowScrimAndDot = false;
|
||||||
invalidate();
|
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;
|
package com.android.server.biometrics.sensors.fingerprint;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
|
import android.content.Context;
|
||||||
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
|
import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint;
|
||||||
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.hardware.fingerprint.IUdfpsOverlayController;
|
import android.hardware.fingerprint.IUdfpsOverlayController;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
@@ -85,4 +88,33 @@ public class UdfpsHelper {
|
|||||||
Slog.e(TAG, "Remote exception when hiding the UDFPS overlay", e);
|
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) {
|
public void onEnrollResult(BiometricAuthenticator.Identifier identifier, int remaining) {
|
||||||
super.onEnrollResult(identifier, remaining);
|
super.onEnrollResult(identifier, remaining);
|
||||||
|
|
||||||
|
UdfpsHelper.onEnrollmentProgress(getSensorId(), remaining, mUdfpsOverlayController);
|
||||||
|
|
||||||
if (remaining == 0) {
|
if (remaining == 0) {
|
||||||
UdfpsHelper.hideUdfpsOverlay(getSensorId(), mUdfpsOverlayController);
|
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
|
@Override
|
||||||
public void onError(int errorCode, int vendorCode) {
|
public void onError(int errorCode, int vendorCode) {
|
||||||
super.onError(errorCode, vendorCode);
|
super.onError(errorCode, vendorCode);
|
||||||
|
|||||||
@@ -107,11 +107,22 @@ public class FingerprintEnrollClient extends EnrollClient<IBiometricsFingerprint
|
|||||||
public void onEnrollResult(BiometricAuthenticator.Identifier identifier, int remaining) {
|
public void onEnrollResult(BiometricAuthenticator.Identifier identifier, int remaining) {
|
||||||
super.onEnrollResult(identifier, remaining);
|
super.onEnrollResult(identifier, remaining);
|
||||||
|
|
||||||
|
UdfpsHelper.onEnrollmentProgress(getSensorId(), remaining, mUdfpsOverlayController);
|
||||||
|
|
||||||
if (remaining == 0) {
|
if (remaining == 0) {
|
||||||
UdfpsHelper.hideUdfpsOverlay(getSensorId(), mUdfpsOverlayController);
|
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
|
@Override
|
||||||
public void onError(int errorCode, int vendorCode) {
|
public void onError(int errorCode, int vendorCode) {
|
||||||
super.onError(errorCode, vendorCode);
|
super.onError(errorCode, vendorCode);
|
||||||
|
|||||||
Reference in New Issue
Block a user