From 10bff88e831c9b9425133fced2d7160e7e530d66 Mon Sep 17 00:00:00 2001 From: Beverly Date: Wed, 28 Jul 2021 15:18:36 -0400 Subject: [PATCH] Don't setDeviceEntryIntent on AOD Only setDeviceEntryIntent=true if we're on the lock screen (not on AOD). We do this b/c the tap on the udfps area on AOD could have been an accident. Test: manual, UdfpsControllerTest Fixes: 194921838 Change-Id: Ief2518f88f27fae01abe4bd72cb677b03e4e525a --- .../systemui/biometrics/UdfpsController.java | 3 +- .../biometrics/UdfpsControllerTest.java | 28 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java index 594dcff2644d2..80352d499379f 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -888,7 +888,8 @@ public class UdfpsController implements DozeReceiver { return; } - if (mView.getAnimationViewController() instanceof UdfpsKeyguardViewController) { + if (mView.getAnimationViewController() instanceof UdfpsKeyguardViewController + && !mStatusBarStateController.isDozing()) { mKeyguardBypassController.setUserHasDeviceEntryIntent(true); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java index 191140c46693f..e56b619b8d162 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java @@ -275,11 +275,35 @@ public class UdfpsControllerTest extends SysuiTestCase { } @Test - public void onActionMove_onKeyguard_setDeviceEntryIntent() throws RemoteException { - // GIVEN the current animation is UdfpsKeyguardViewController + public void onActionMove_dozing_setDeviceEntryIntent() throws RemoteException { + // GIVEN the current animation is UdfpsKeyguardViewController and device IS dozing when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false); when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(true); when(mUdfpsView.getAnimationViewController()).thenReturn(mUdfpsKeyguardViewController); + when(mStatusBarStateController.isDozing()).thenReturn(true); + + // GIVEN that the overlay is showing + mOverlayController.showUdfpsOverlay(TEST_UDFPS_SENSOR_ID, + IUdfpsOverlayController.REASON_AUTH_FPM_KEYGUARD, mUdfpsOverlayControllerCallback); + mFgExecutor.runAllReady(); + + // WHEN ACTION_DOWN is received + verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture()); + MotionEvent moveEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 0, 0, 0); + mTouchListenerCaptor.getValue().onTouch(mUdfpsView, moveEvent); + moveEvent.recycle(); + + // THEN device entry intent is never to true b/c device was dozing on touch + verify(mKeyguardBypassController, never()).setUserHasDeviceEntryIntent(true); + } + + @Test + public void onActionMove_onKeyguard_setDeviceEntryIntent() throws RemoteException { + // GIVEN the current animation is UdfpsKeyguardViewController and device isn't dozing + when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false); + when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(true); + when(mUdfpsView.getAnimationViewController()).thenReturn(mUdfpsKeyguardViewController); + when(mStatusBarStateController.isDozing()).thenReturn(false); // GIVEN that the overlay is showing mOverlayController.showUdfpsOverlay(TEST_UDFPS_SENSOR_ID,