Merge "Always play haptic on UDFPS reject." into tm-d1-dev am: fb18e86f59

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

Change-Id: I89136f6e588569016875efe30d02686f246c5718
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Joe Bolinger
2022-04-27 18:29:50 +00:00
committed by Automerger Merge Worker
2 changed files with 5 additions and 20 deletions

View File

@@ -92,7 +92,7 @@ public class CoexCoordinator {
void sendHapticFeedback(); void sendHapticFeedback();
} }
private static CoexCoordinator sInstance; private static final CoexCoordinator sInstance = new CoexCoordinator();
@VisibleForTesting @VisibleForTesting
public static class SuccessfulAuth { public static class SuccessfulAuth {
@@ -147,14 +147,9 @@ public class CoexCoordinator {
} }
} }
/** /** The singleton instance. */
* @return a singleton instance.
*/
@NonNull @NonNull
public static CoexCoordinator getInstance() { public static CoexCoordinator getInstance() {
if (sInstance == null) {
sInstance = new CoexCoordinator();
}
return sInstance; return sInstance;
} }
@@ -339,18 +334,8 @@ public class CoexCoordinator {
auth.mCallback.sendHapticFeedback(); auth.mCallback.sendHapticFeedback();
auth.mCallback.sendAuthenticationResult(true /* addAuthTokenIfStrong */); auth.mCallback.sendAuthenticationResult(true /* addAuthTokenIfStrong */);
auth.mCallback.handleLifecycleAfterAuth(); auth.mCallback.handleLifecycleAfterAuth();
} else if (isFaceScanning()) {
// UDFPS rejected but face is still scanning
Slog.d(TAG, "UDFPS rejected in multi-sensor auth, face: " + face);
callback.handleLifecycleAfterAuth();
// TODO(b/193089985): Enforce/ensure that face auth finishes (whether
// accept/reject) within X amount of time. Otherwise users will be stuck
// waiting with their finger down for a long time.
} else { } else {
// Face not scanning, and was not found in the queue. Most likely, face Slog.d(TAG, "UDFPS rejected in multi-sensor auth");
// auth was too long ago.
Slog.d(TAG, "UDFPS rejected in multi-sensor auth, face not scanning");
callback.sendHapticFeedback(); callback.sendHapticFeedback();
callback.handleLifecycleAfterAuth(); callback.handleLifecycleAfterAuth();
} }

View File

@@ -415,7 +415,7 @@ public class CoexCoordinatorTest {
// Auth was attempted // Auth was attempted
when(mUdfpsClient.getState()) when(mUdfpsClient.getState())
.thenReturn(AuthenticationClient.STATE_STARTED_PAUSED_ATTEMPTED); .thenReturn(AuthenticationClient.STATE_STARTED_PAUSED_ATTEMPTED);
verify(mCallback, never()).sendHapticFeedback(); verify(mCallback).sendHapticFeedback();
verify(mCallback).handleLifecycleAfterAuth(); verify(mCallback).handleLifecycleAfterAuth();
// Then face rejected. Note that scheduler leaves UDFPS in the CoexCoordinator since // Then face rejected. Note that scheduler leaves UDFPS in the CoexCoordinator since
@@ -425,7 +425,7 @@ public class CoexCoordinatorTest {
LockoutTracker.LOCKOUT_NONE, faceCallback); LockoutTracker.LOCKOUT_NONE, faceCallback);
verify(faceCallback).sendHapticFeedback(); verify(faceCallback).sendHapticFeedback();
verify(faceCallback).sendAuthenticationResult(eq(false) /* addAuthTokenIfStrong */); verify(faceCallback).sendAuthenticationResult(eq(false) /* addAuthTokenIfStrong */);
verify(mCallback, never()).sendHapticFeedback(); verify(mCallback).sendHapticFeedback();
} }
@Test @Test