Merge "Split onPointerDown to onPointerDown and onUiReady" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
22f83b56f7
@@ -925,6 +925,23 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
|
||||||
|
public void onUiReady(int sensorId) {
|
||||||
|
if (mService == null) {
|
||||||
|
Slog.w(TAG, "onUiReady: no fingerprint service");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mService.onUiReady(sensorId);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if there is at least one fingerprint enrolled.
|
* Determine if there is at least one fingerprint enrolled.
|
||||||
*
|
*
|
||||||
@@ -1450,7 +1467,6 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
|
|||||||
@Override // binder call
|
@Override // binder call
|
||||||
public void onUdfpsPointerUp(int sensorId) {
|
public void onUdfpsPointerUp(int sensorId) {
|
||||||
mHandler.obtainMessage(MSG_UDFPS_POINTER_UP, sensorId, 0).sendToTarget();
|
mHandler.obtainMessage(MSG_UDFPS_POINTER_UP, sensorId, 0).sendToTarget();
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -160,6 +160,9 @@ interface IFingerprintService {
|
|||||||
// Notifies about a finger leaving the sensor area.
|
// Notifies about a finger leaving the sensor area.
|
||||||
void onPointerUp(int sensorId);
|
void onPointerUp(int sensorId);
|
||||||
|
|
||||||
|
// Notifies about the fingerprint UI being ready (e.g. HBM illumination is enabled).
|
||||||
|
void onUiReady(int sensorId);
|
||||||
|
|
||||||
// Sets the controller for managing the UDFPS overlay.
|
// Sets the controller for managing the UDFPS overlay.
|
||||||
void setUdfpsOverlayController(in IUdfpsOverlayController controller);
|
void setUdfpsOverlayController(in IUdfpsOverlayController controller);
|
||||||
|
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
|
|||||||
}
|
}
|
||||||
if (isWithinSensorArea(udfpsView, event.getX(), event.getY(), fromUdfpsView)) {
|
if (isWithinSensorArea(udfpsView, event.getX(), event.getY(), fromUdfpsView)) {
|
||||||
Trace.beginAsyncSection(
|
Trace.beginAsyncSection(
|
||||||
"UdfpsController.mOnTouchListener#isWithinSensorArea", 1);
|
"UdfpsController#ACTION_DOWN", 1);
|
||||||
// The pointer that causes ACTION_DOWN is always at index 0.
|
// The pointer that causes ACTION_DOWN is always at index 0.
|
||||||
// We need to persist its ID to track it during ACTION_MOVE that could include
|
// We need to persist its ID to track it during ACTION_MOVE that could include
|
||||||
// data for many other pointers because of multi-touch support.
|
// data for many other pointers because of multi-touch support.
|
||||||
@@ -382,8 +382,6 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
|
|||||||
minor, major, v, exceedsVelocityThreshold);
|
minor, major, v, exceedsVelocityThreshold);
|
||||||
final long sinceLastLog = SystemClock.elapsedRealtime() - mTouchLogTime;
|
final long sinceLastLog = SystemClock.elapsedRealtime() - mTouchLogTime;
|
||||||
if (!isFingerDown && !exceedsVelocityThreshold) {
|
if (!isFingerDown && !exceedsVelocityThreshold) {
|
||||||
Trace.endAsyncSection(
|
|
||||||
"UdfpsController.mOnTouchListener#isWithinSensorArea", 1);
|
|
||||||
onFingerDown((int) x, (int) y, minor, major);
|
onFingerDown((int) x, (int) y, minor, major);
|
||||||
Log.v(TAG, "onTouch | finger down: " + touchInfo);
|
Log.v(TAG, "onTouch | finger down: " + touchInfo);
|
||||||
mTouchLogTime = SystemClock.elapsedRealtime();
|
mTouchLogTime = SystemClock.elapsedRealtime();
|
||||||
@@ -761,10 +759,13 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
|
|||||||
Log.w(TAG, "Null view in onFingerDown");
|
Log.w(TAG, "Null view in onFingerDown");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major);
|
||||||
|
Trace.endAsyncSection(
|
||||||
|
"UdfpsController#ACTION_DOWN", 1);
|
||||||
Trace.beginAsyncSection("UdfpsController#startIllumination", 1);
|
Trace.beginAsyncSection("UdfpsController#startIllumination", 1);
|
||||||
mView.startIllumination(() -> {
|
mView.startIllumination(() -> {
|
||||||
|
mFingerprintManager.onUiReady(mSensorProps.sensorId);
|
||||||
Trace.endAsyncSection("UdfpsController#startIllumination", 1);
|
Trace.endAsyncSection("UdfpsController#startIllumination", 1);
|
||||||
mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -232,12 +232,14 @@ public class UdfpsControllerTest extends SysuiTestCase {
|
|||||||
MotionEvent moveEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 0, 0, 0);
|
MotionEvent moveEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 0, 0, 0);
|
||||||
mTouchListenerCaptor.getValue().onTouch(mUdfpsView, moveEvent);
|
mTouchListenerCaptor.getValue().onTouch(mUdfpsView, moveEvent);
|
||||||
moveEvent.recycle();
|
moveEvent.recycle();
|
||||||
// THEN illumination begins
|
// THEN FingerprintManager is notified about onPointerDown
|
||||||
// AND onIlluminatedRunnable that notifies FingerprintManager is set
|
|
||||||
verify(mUdfpsView).startIllumination(mOnIlluminatedRunnableCaptor.capture());
|
|
||||||
mOnIlluminatedRunnableCaptor.getValue().run();
|
|
||||||
verify(mFingerprintManager).onPointerDown(eq(mUdfpsController.mSensorProps.sensorId), eq(0),
|
verify(mFingerprintManager).onPointerDown(eq(mUdfpsController.mSensorProps.sensorId), eq(0),
|
||||||
eq(0), eq(0f), eq(0f));
|
eq(0), eq(0f), eq(0f));
|
||||||
|
// AND illumination begins
|
||||||
|
verify(mUdfpsView).startIllumination(mOnIlluminatedRunnableCaptor.capture());
|
||||||
|
// AND onIlluminatedRunnable notifies FingerprintManager about onUiReady
|
||||||
|
mOnIlluminatedRunnableCaptor.getValue().run();
|
||||||
|
verify(mFingerprintManager).onUiReady(eq(mUdfpsController.mSensorProps.sensorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -167,13 +167,13 @@ public class ClientMonitorCallbackConverter {
|
|||||||
|
|
||||||
// Fingerprint-specific callbacks for FingerprintManager only
|
// Fingerprint-specific callbacks for FingerprintManager only
|
||||||
|
|
||||||
public void onUdfpsPointerDown(int sensorId, int cookie) throws RemoteException {
|
public void onUdfpsPointerDown(int sensorId) throws RemoteException {
|
||||||
if (mFingerprintServiceReceiver != null) {
|
if (mFingerprintServiceReceiver != null) {
|
||||||
mFingerprintServiceReceiver.onUdfpsPointerDown(sensorId);
|
mFingerprintServiceReceiver.onUdfpsPointerDown(sensorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUdfpsPointerUp(int sensorId, int cookie) throws RemoteException {
|
public void onUdfpsPointerUp(int sensorId) throws RemoteException {
|
||||||
if (mFingerprintServiceReceiver != null) {
|
if (mFingerprintServiceReceiver != null) {
|
||||||
mFingerprintServiceReceiver.onUdfpsPointerUp(sensorId);
|
mFingerprintServiceReceiver.onUdfpsPointerUp(sensorId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -924,6 +924,18 @@ public class FingerprintService extends SystemService {
|
|||||||
provider.onPointerUp(sensorId);
|
provider.onPointerUp(sensorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUiReady(int sensorId) {
|
||||||
|
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||||
|
|
||||||
|
final ServiceProvider provider = getProviderForSensor(sensorId);
|
||||||
|
if (provider == null) {
|
||||||
|
Slog.w(TAG, "No matching provider for onUiReady, sensorId: " + sensorId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
provider.onUiReady(sensorId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUdfpsOverlayController(@NonNull IUdfpsOverlayController controller) {
|
public void setUdfpsOverlayController(@NonNull IUdfpsOverlayController controller) {
|
||||||
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
Utils.checkPermission(getContext(), USE_BIOMETRIC_INTERNAL);
|
||||||
|
|||||||
@@ -140,6 +140,8 @@ public interface ServiceProvider {
|
|||||||
|
|
||||||
void onPointerUp(int sensorId);
|
void onPointerUp(int sensorId);
|
||||||
|
|
||||||
|
void onUiReady(int sensorId);
|
||||||
|
|
||||||
void setUdfpsOverlayController(@NonNull IUdfpsOverlayController controller);
|
void setUdfpsOverlayController(@NonNull IUdfpsOverlayController controller);
|
||||||
|
|
||||||
void dumpProtoState(int sensorId, @NonNull ProtoOutputStream proto,
|
void dumpProtoState(int sensorId, @NonNull ProtoOutputStream proto,
|
||||||
|
|||||||
@@ -26,4 +26,5 @@ import com.android.server.biometrics.sensors.BaseClientMonitor;
|
|||||||
public interface Udfps {
|
public interface Udfps {
|
||||||
void onPointerDown(int x, int y, float minor, float major);
|
void onPointerDown(int x, int y, float minor, float major);
|
||||||
void onPointerUp();
|
void onPointerUp();
|
||||||
|
void onUiReady();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
|||||||
try {
|
try {
|
||||||
getFreshDaemon().onPointerDown(0 /* pointerId */, x, y, minor, major);
|
getFreshDaemon().onPointerDown(0 /* pointerId */, x, y, minor, major);
|
||||||
if (getListener() != null) {
|
if (getListener() != null) {
|
||||||
getListener().onUdfpsPointerDown(getSensorId(), getCookie());
|
getListener().onUdfpsPointerDown(getSensorId());
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Remote exception", e);
|
Slog.e(TAG, "Remote exception", e);
|
||||||
@@ -132,13 +132,22 @@ class FingerprintAuthenticationClient extends AuthenticationClient<ISession> imp
|
|||||||
try {
|
try {
|
||||||
getFreshDaemon().onPointerUp(0 /* pointerId */);
|
getFreshDaemon().onPointerUp(0 /* pointerId */);
|
||||||
if (getListener() != null) {
|
if (getListener() != null) {
|
||||||
getListener().onUdfpsPointerUp(getSensorId(), getCookie());
|
getListener().onUdfpsPointerUp(getSensorId());
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Remote exception", e);
|
Slog.e(TAG, "Remote exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUiReady() {
|
||||||
|
try {
|
||||||
|
getFreshDaemon().onUiReady();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Remote exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLockoutTimed(long durationMillis) {
|
public void onLockoutTimed(long durationMillis) {
|
||||||
mLockoutCache.setLockoutModeForUser(getTargetUserId(), LockoutTracker.LOCKOUT_TIMED);
|
mLockoutCache.setLockoutModeForUser(getTargetUserId(), LockoutTracker.LOCKOUT_TIMED);
|
||||||
|
|||||||
@@ -150,4 +150,13 @@ class FingerprintEnrollClient extends EnrollClient<ISession> implements Udfps {
|
|||||||
Slog.e(TAG, "Unable to send pointer up", e);
|
Slog.e(TAG, "Unable to send pointer up", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUiReady() {
|
||||||
|
try {
|
||||||
|
getFreshDaemon().onUiReady();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.e(TAG, "Unable to send UI ready", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -513,6 +513,18 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi
|
|||||||
udfps.onPointerUp();
|
udfps.onPointerUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUiReady(int sensorId) {
|
||||||
|
final BaseClientMonitor client =
|
||||||
|
mSensors.get(sensorId).getScheduler().getCurrentClient();
|
||||||
|
if (!(client instanceof Udfps)) {
|
||||||
|
Slog.e(getTag(), "onUiReady received during client: " + client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Udfps udfps = (Udfps) client;
|
||||||
|
udfps.onUiReady();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUdfpsOverlayController(@NonNull IUdfpsOverlayController controller) {
|
public void setUdfpsOverlayController(@NonNull IUdfpsOverlayController controller) {
|
||||||
mUdfpsOverlayController = controller;
|
mUdfpsOverlayController = controller;
|
||||||
|
|||||||
@@ -737,6 +737,17 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider
|
|||||||
udfps.onPointerUp();
|
udfps.onPointerUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUiReady(int sensorId) {
|
||||||
|
final BaseClientMonitor client = mScheduler.getCurrentClient();
|
||||||
|
if (!(client instanceof Udfps)) {
|
||||||
|
Slog.w(TAG, "onUiReady received during client: " + client);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Udfps udfps = (Udfps) client;
|
||||||
|
udfps.onUiReady();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUdfpsOverlayController(@NonNull IUdfpsOverlayController controller) {
|
public void setUdfpsOverlayController(@NonNull IUdfpsOverlayController controller) {
|
||||||
mUdfpsOverlayController = controller;
|
mUdfpsOverlayController = controller;
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ class FingerprintAuthenticationClient extends AuthenticationClient<IBiometricsFi
|
|||||||
UdfpsHelper.onFingerDown(getFreshDaemon(), x, y, minor, major);
|
UdfpsHelper.onFingerDown(getFreshDaemon(), x, y, minor, major);
|
||||||
if (getListener() != null) {
|
if (getListener() != null) {
|
||||||
try {
|
try {
|
||||||
getListener().onUdfpsPointerDown(getSensorId(), getCookie());
|
getListener().onUdfpsPointerDown(getSensorId());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Remote exception", e);
|
Slog.e(TAG, "Remote exception", e);
|
||||||
}
|
}
|
||||||
@@ -164,10 +164,15 @@ class FingerprintAuthenticationClient extends AuthenticationClient<IBiometricsFi
|
|||||||
UdfpsHelper.onFingerUp(getFreshDaemon());
|
UdfpsHelper.onFingerUp(getFreshDaemon());
|
||||||
if (getListener() != null) {
|
if (getListener() != null) {
|
||||||
try {
|
try {
|
||||||
getListener().onUdfpsPointerUp(getSensorId(), getCookie());
|
getListener().onUdfpsPointerUp(getSensorId());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.e(TAG, "Remote exception", e);
|
Slog.e(TAG, "Remote exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUiReady() {
|
||||||
|
// Unsupported in HIDL.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,11 @@ class FingerprintDetectClient extends AcquisitionClient<IBiometricsFingerprint>
|
|||||||
UdfpsHelper.onFingerUp(getFreshDaemon());
|
UdfpsHelper.onFingerUp(getFreshDaemon());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUiReady() {
|
||||||
|
// Unsupported in HIDL.
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticated(BiometricAuthenticator.Identifier identifier, boolean authenticated,
|
public void onAuthenticated(BiometricAuthenticator.Identifier identifier, boolean authenticated,
|
||||||
ArrayList<Byte> hardwareAuthToken) {
|
ArrayList<Byte> hardwareAuthToken) {
|
||||||
|
|||||||
@@ -146,4 +146,9 @@ public class FingerprintEnrollClient extends EnrollClient<IBiometricsFingerprint
|
|||||||
public void onPointerUp() {
|
public void onPointerUp() {
|
||||||
UdfpsHelper.onFingerUp(getFreshDaemon());
|
UdfpsHelper.onFingerUp(getFreshDaemon());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUiReady() {
|
||||||
|
// Unsupported in HIDL.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user