Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +16 −1 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.hardware.fingerprint.FingerprintSensorProperties; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.input.InputManager; import android.os.Build; import android.os.Build; import android.os.Handler; import android.os.Handler; import android.os.PowerManager; import android.os.PowerManager; Loading Loading @@ -169,6 +170,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { @NonNull private final AlternateBouncerInteractor mAlternateBouncerInteractor; @NonNull private final AlternateBouncerInteractor mAlternateBouncerInteractor; @NonNull private final SecureSettings mSecureSettings; @NonNull private final SecureSettings mSecureSettings; @NonNull private final UdfpsUtils mUdfpsUtils; @NonNull private final UdfpsUtils mUdfpsUtils; @NonNull private final InputManager mInputManager; // Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple // Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple // sensors, this, in addition to a lot of the code here, will be updated. // sensors, this, in addition to a lot of the code here, will be updated. Loading Loading @@ -576,6 +578,10 @@ public class UdfpsController implements DozeReceiver, Dumpable { data.getTime(), data.getTime(), data.getGestureStart(), data.getGestureStart(), mStatusBarStateController.isDozing()); mStatusBarStateController.isDozing()); // Pilfer if valid overlap, don't allow following events to reach keyguard mInputManager.pilferPointers( mOverlay.getOverlayView().getViewRootImpl().getInputToken()); break; break; case UP: case UP: Loading @@ -599,7 +605,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { break; break; case UNCHANGED: case UNCHANGED: if (!isWithinSensorArea(mOverlay.getOverlayView(), event.getX(), event.getY(), if (!isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true) && mActivePointerId == MotionEvent.INVALID_POINTER_ID true) && mActivePointerId == MotionEvent.INVALID_POINTER_ID && event.getActionMasked() == MotionEvent.ACTION_DOWN && event.getActionMasked() == MotionEvent.ACTION_DOWN && mAlternateBouncerInteractor.isVisibleState()) { && mAlternateBouncerInteractor.isVisibleState()) { Loading @@ -612,6 +618,13 @@ public class UdfpsController implements DozeReceiver, Dumpable { } } logBiometricTouch(processedTouch.getEvent(), data); logBiometricTouch(processedTouch.getEvent(), data); // Always pilfer pointers that are within sensor area if (isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true)) { Log.d("Austin", "pilferTouch invalid overlap"); mInputManager.pilferPointers( mOverlay.getOverlayView().getViewRootImpl().getInputToken()); } return processedTouch.getTouchData().isWithinSensor(mOverlayParams.getNativeSensorBounds()); return processedTouch.getTouchData().isWithinSensor(mOverlayParams.getNativeSensorBounds()); } } Loading Loading @@ -798,6 +811,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { @NonNull SessionTracker sessionTracker, @NonNull SessionTracker sessionTracker, @NonNull AlternateBouncerInteractor alternateBouncerInteractor, @NonNull AlternateBouncerInteractor alternateBouncerInteractor, @NonNull SecureSettings secureSettings, @NonNull SecureSettings secureSettings, @NonNull InputManager inputManager, @NonNull UdfpsUtils udfpsUtils) { @NonNull UdfpsUtils udfpsUtils) { mContext = context; mContext = context; mExecution = execution; mExecution = execution; Loading Loading @@ -841,6 +855,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { mAlternateBouncerInteractor = alternateBouncerInteractor; mAlternateBouncerInteractor = alternateBouncerInteractor; mSecureSettings = secureSettings; mSecureSettings = secureSettings; mUdfpsUtils = udfpsUtils; mUdfpsUtils = udfpsUtils; mInputManager = inputManager; mTouchProcessor = mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION) mTouchProcessor = mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION) ? singlePointerTouchProcessor : null; ? singlePointerTouchProcessor : null; Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +83 −2 Original line number Original line Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.hardware.fingerprint.FingerprintSensorProperties; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.input.InputManager; import android.os.Handler; import android.os.Handler; import android.os.PowerManager; import android.os.PowerManager; import android.os.RemoteException; import android.os.RemoteException; Loading @@ -63,6 +64,7 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.MotionEvent; import android.view.Surface; import android.view.Surface; import android.view.View; import android.view.View; import android.view.ViewRootImpl; import android.view.WindowManager; import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -231,6 +233,10 @@ public class UdfpsControllerTest extends SysuiTestCase { private FingerprintSensorPropertiesInternal mOpticalProps; private FingerprintSensorPropertiesInternal mOpticalProps; private FingerprintSensorPropertiesInternal mUltrasonicProps; private FingerprintSensorPropertiesInternal mUltrasonicProps; private UdfpsUtils mUdfpsUtils; private UdfpsUtils mUdfpsUtils; @Mock private InputManager mInputManager; @Mock private ViewRootImpl mViewRootImpl; @Before @Before public void setUp() { public void setUp() { Loading @@ -248,6 +254,7 @@ public class UdfpsControllerTest extends SysuiTestCase { when(mKeyguardUpdateMonitor.isFingerprintDetectionRunning()).thenReturn(true); when(mKeyguardUpdateMonitor.isFingerprintDetectionRunning()).thenReturn(true); when(mSessionTracker.getSessionId(anyInt())).thenReturn( when(mSessionTracker.getSessionId(anyInt())).thenReturn( (new InstanceIdSequence(1 << 20)).newInstanceId()); (new InstanceIdSequence(1 << 20)).newInstanceId()); when(mUdfpsView.getViewRootImpl()).thenReturn(mViewRootImpl); final List<ComponentInfoInternal> componentInfo = new ArrayList<>(); final List<ComponentInfoInternal> componentInfo = new ArrayList<>(); componentInfo.add(new ComponentInfoInternal("faceSensor" /* componentId */, componentInfo.add(new ComponentInfoInternal("faceSensor" /* componentId */, Loading Loading @@ -304,7 +311,7 @@ public class UdfpsControllerTest extends SysuiTestCase { mUnlockedScreenOffAnimationController, mSystemUIDialogManager, mLatencyTracker, mUnlockedScreenOffAnimationController, mSystemUIDialogManager, mLatencyTracker, mActivityLaunchAnimator, alternateTouchProvider, mBiometricExecutor, mActivityLaunchAnimator, alternateTouchProvider, mBiometricExecutor, mPrimaryBouncerInteractor, mSinglePointerTouchProcessor, mSessionTracker, mPrimaryBouncerInteractor, mSinglePointerTouchProcessor, mSessionTracker, mAlternateBouncerInteractor, mSecureSettings, mUdfpsUtils); mAlternateBouncerInteractor, mSecureSettings, mInputManager, mUdfpsUtils); verify(mFingerprintManager).setUdfpsOverlayController(mOverlayCaptor.capture()); verify(mFingerprintManager).setUdfpsOverlayController(mOverlayCaptor.capture()); mOverlayController = mOverlayCaptor.getValue(); mOverlayController = mOverlayCaptor.getValue(); verify(mScreenLifecycle).addObserver(mScreenObserverCaptor.capture()); verify(mScreenLifecycle).addObserver(mScreenObserverCaptor.capture()); Loading Loading @@ -1261,6 +1268,81 @@ public class UdfpsControllerTest extends SysuiTestCase { downEvent.recycle(); downEvent.recycle(); } } @Test public void onTouch_withNewTouchDetection_pilferPointer() throws RemoteException { final NormalizedTouchData touchData = new NormalizedTouchData(0, 0f, 0f, 0f, 0f, 0f, 0L, 0L); final TouchProcessorResult processorResultDown = new TouchProcessorResult.ProcessedTouch( InteractionEvent.DOWN, 1 /* pointerId */, touchData); // Enable new touch detection. when(mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)).thenReturn(true); // Configure UdfpsController to use FingerprintManager as opposed to AlternateTouchProvider. initUdfpsController(mOpticalProps, false /* hasAlternateTouchProvider */); // Configure UdfpsView to accept the ACTION_DOWN event when(mUdfpsView.isDisplayConfigured()).thenReturn(false); when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(true); // GIVEN that the overlay is showing and a11y touch exploration NOT enabled when(mAccessibilityManager.isTouchExplorationEnabled()).thenReturn(false); mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId, BiometricOverlayConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback); mFgExecutor.runAllReady(); verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture()); // WHEN ACTION_DOWN is received when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn( processorResultDown); MotionEvent downEvent = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, downEvent); mBiometricExecutor.runAllReady(); downEvent.recycle(); // THEN the touch is pilfered, expected twice (valid overlap and touch on sensor) verify(mInputManager, times(2)).pilferPointers(any()); } @Test public void onTouch_withNewTouchDetection_doNotPilferPointer() throws RemoteException { final NormalizedTouchData touchData = new NormalizedTouchData(0, 0f, 0f, 0f, 0f, 0f, 0L, 0L); final TouchProcessorResult processorResultUnchanged = new TouchProcessorResult.ProcessedTouch(InteractionEvent.UNCHANGED, 1 /* pointerId */, touchData); // Enable new touch detection. when(mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)).thenReturn(true); // Configure UdfpsController to use FingerprintManager as opposed to AlternateTouchProvider. initUdfpsController(mOpticalProps, false /* hasAlternateTouchProvider */); // Configure UdfpsView to not accept the ACTION_DOWN event when(mUdfpsView.isDisplayConfigured()).thenReturn(false); when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(false); // GIVEN that the overlay is showing and a11y touch exploration NOT enabled when(mAccessibilityManager.isTouchExplorationEnabled()).thenReturn(false); mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId, BiometricOverlayConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback); mFgExecutor.runAllReady(); verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture()); // WHEN ACTION_DOWN is received and touch is not within sensor when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn( processorResultUnchanged); MotionEvent downEvent = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, downEvent); mBiometricExecutor.runAllReady(); downEvent.recycle(); // THEN the touch is NOT pilfered verify(mInputManager, times(0)).pilferPointers(any()); } @Test @Test public void onAodInterrupt_onAcquiredGood_fingerNoLongerDown() throws RemoteException { public void onAodInterrupt_onAcquiredGood_fingerNoLongerDown() throws RemoteException { // GIVEN UDFPS overlay is showing // GIVEN UDFPS overlay is showing Loading @@ -1285,6 +1367,5 @@ public class UdfpsControllerTest extends SysuiTestCase { // THEN is fingerDown should be FALSE // THEN is fingerDown should be FALSE assertFalse(mUdfpsController.isFingerDown()); assertFalse(mUdfpsController.isFingerDown()); } } } } Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +16 −1 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.hardware.fingerprint.FingerprintSensorProperties; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.input.InputManager; import android.os.Build; import android.os.Build; import android.os.Handler; import android.os.Handler; import android.os.PowerManager; import android.os.PowerManager; Loading Loading @@ -169,6 +170,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { @NonNull private final AlternateBouncerInteractor mAlternateBouncerInteractor; @NonNull private final AlternateBouncerInteractor mAlternateBouncerInteractor; @NonNull private final SecureSettings mSecureSettings; @NonNull private final SecureSettings mSecureSettings; @NonNull private final UdfpsUtils mUdfpsUtils; @NonNull private final UdfpsUtils mUdfpsUtils; @NonNull private final InputManager mInputManager; // Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple // Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple // sensors, this, in addition to a lot of the code here, will be updated. // sensors, this, in addition to a lot of the code here, will be updated. Loading Loading @@ -576,6 +578,10 @@ public class UdfpsController implements DozeReceiver, Dumpable { data.getTime(), data.getTime(), data.getGestureStart(), data.getGestureStart(), mStatusBarStateController.isDozing()); mStatusBarStateController.isDozing()); // Pilfer if valid overlap, don't allow following events to reach keyguard mInputManager.pilferPointers( mOverlay.getOverlayView().getViewRootImpl().getInputToken()); break; break; case UP: case UP: Loading @@ -599,7 +605,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { break; break; case UNCHANGED: case UNCHANGED: if (!isWithinSensorArea(mOverlay.getOverlayView(), event.getX(), event.getY(), if (!isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true) && mActivePointerId == MotionEvent.INVALID_POINTER_ID true) && mActivePointerId == MotionEvent.INVALID_POINTER_ID && event.getActionMasked() == MotionEvent.ACTION_DOWN && event.getActionMasked() == MotionEvent.ACTION_DOWN && mAlternateBouncerInteractor.isVisibleState()) { && mAlternateBouncerInteractor.isVisibleState()) { Loading @@ -612,6 +618,13 @@ public class UdfpsController implements DozeReceiver, Dumpable { } } logBiometricTouch(processedTouch.getEvent(), data); logBiometricTouch(processedTouch.getEvent(), data); // Always pilfer pointers that are within sensor area if (isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true)) { Log.d("Austin", "pilferTouch invalid overlap"); mInputManager.pilferPointers( mOverlay.getOverlayView().getViewRootImpl().getInputToken()); } return processedTouch.getTouchData().isWithinSensor(mOverlayParams.getNativeSensorBounds()); return processedTouch.getTouchData().isWithinSensor(mOverlayParams.getNativeSensorBounds()); } } Loading Loading @@ -798,6 +811,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { @NonNull SessionTracker sessionTracker, @NonNull SessionTracker sessionTracker, @NonNull AlternateBouncerInteractor alternateBouncerInteractor, @NonNull AlternateBouncerInteractor alternateBouncerInteractor, @NonNull SecureSettings secureSettings, @NonNull SecureSettings secureSettings, @NonNull InputManager inputManager, @NonNull UdfpsUtils udfpsUtils) { @NonNull UdfpsUtils udfpsUtils) { mContext = context; mContext = context; mExecution = execution; mExecution = execution; Loading Loading @@ -841,6 +855,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { mAlternateBouncerInteractor = alternateBouncerInteractor; mAlternateBouncerInteractor = alternateBouncerInteractor; mSecureSettings = secureSettings; mSecureSettings = secureSettings; mUdfpsUtils = udfpsUtils; mUdfpsUtils = udfpsUtils; mInputManager = inputManager; mTouchProcessor = mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION) mTouchProcessor = mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION) ? singlePointerTouchProcessor : null; ? singlePointerTouchProcessor : null; Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +83 −2 Original line number Original line Diff line number Diff line Loading @@ -53,6 +53,7 @@ import android.hardware.fingerprint.FingerprintSensorProperties; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.input.InputManager; import android.os.Handler; import android.os.Handler; import android.os.PowerManager; import android.os.PowerManager; import android.os.RemoteException; import android.os.RemoteException; Loading @@ -63,6 +64,7 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.MotionEvent; import android.view.Surface; import android.view.Surface; import android.view.View; import android.view.View; import android.view.ViewRootImpl; import android.view.WindowManager; import android.view.WindowManager; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityManager; Loading Loading @@ -231,6 +233,10 @@ public class UdfpsControllerTest extends SysuiTestCase { private FingerprintSensorPropertiesInternal mOpticalProps; private FingerprintSensorPropertiesInternal mOpticalProps; private FingerprintSensorPropertiesInternal mUltrasonicProps; private FingerprintSensorPropertiesInternal mUltrasonicProps; private UdfpsUtils mUdfpsUtils; private UdfpsUtils mUdfpsUtils; @Mock private InputManager mInputManager; @Mock private ViewRootImpl mViewRootImpl; @Before @Before public void setUp() { public void setUp() { Loading @@ -248,6 +254,7 @@ public class UdfpsControllerTest extends SysuiTestCase { when(mKeyguardUpdateMonitor.isFingerprintDetectionRunning()).thenReturn(true); when(mKeyguardUpdateMonitor.isFingerprintDetectionRunning()).thenReturn(true); when(mSessionTracker.getSessionId(anyInt())).thenReturn( when(mSessionTracker.getSessionId(anyInt())).thenReturn( (new InstanceIdSequence(1 << 20)).newInstanceId()); (new InstanceIdSequence(1 << 20)).newInstanceId()); when(mUdfpsView.getViewRootImpl()).thenReturn(mViewRootImpl); final List<ComponentInfoInternal> componentInfo = new ArrayList<>(); final List<ComponentInfoInternal> componentInfo = new ArrayList<>(); componentInfo.add(new ComponentInfoInternal("faceSensor" /* componentId */, componentInfo.add(new ComponentInfoInternal("faceSensor" /* componentId */, Loading Loading @@ -304,7 +311,7 @@ public class UdfpsControllerTest extends SysuiTestCase { mUnlockedScreenOffAnimationController, mSystemUIDialogManager, mLatencyTracker, mUnlockedScreenOffAnimationController, mSystemUIDialogManager, mLatencyTracker, mActivityLaunchAnimator, alternateTouchProvider, mBiometricExecutor, mActivityLaunchAnimator, alternateTouchProvider, mBiometricExecutor, mPrimaryBouncerInteractor, mSinglePointerTouchProcessor, mSessionTracker, mPrimaryBouncerInteractor, mSinglePointerTouchProcessor, mSessionTracker, mAlternateBouncerInteractor, mSecureSettings, mUdfpsUtils); mAlternateBouncerInteractor, mSecureSettings, mInputManager, mUdfpsUtils); verify(mFingerprintManager).setUdfpsOverlayController(mOverlayCaptor.capture()); verify(mFingerprintManager).setUdfpsOverlayController(mOverlayCaptor.capture()); mOverlayController = mOverlayCaptor.getValue(); mOverlayController = mOverlayCaptor.getValue(); verify(mScreenLifecycle).addObserver(mScreenObserverCaptor.capture()); verify(mScreenLifecycle).addObserver(mScreenObserverCaptor.capture()); Loading Loading @@ -1261,6 +1268,81 @@ public class UdfpsControllerTest extends SysuiTestCase { downEvent.recycle(); downEvent.recycle(); } } @Test public void onTouch_withNewTouchDetection_pilferPointer() throws RemoteException { final NormalizedTouchData touchData = new NormalizedTouchData(0, 0f, 0f, 0f, 0f, 0f, 0L, 0L); final TouchProcessorResult processorResultDown = new TouchProcessorResult.ProcessedTouch( InteractionEvent.DOWN, 1 /* pointerId */, touchData); // Enable new touch detection. when(mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)).thenReturn(true); // Configure UdfpsController to use FingerprintManager as opposed to AlternateTouchProvider. initUdfpsController(mOpticalProps, false /* hasAlternateTouchProvider */); // Configure UdfpsView to accept the ACTION_DOWN event when(mUdfpsView.isDisplayConfigured()).thenReturn(false); when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(true); // GIVEN that the overlay is showing and a11y touch exploration NOT enabled when(mAccessibilityManager.isTouchExplorationEnabled()).thenReturn(false); mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId, BiometricOverlayConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback); mFgExecutor.runAllReady(); verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture()); // WHEN ACTION_DOWN is received when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn( processorResultDown); MotionEvent downEvent = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, downEvent); mBiometricExecutor.runAllReady(); downEvent.recycle(); // THEN the touch is pilfered, expected twice (valid overlap and touch on sensor) verify(mInputManager, times(2)).pilferPointers(any()); } @Test public void onTouch_withNewTouchDetection_doNotPilferPointer() throws RemoteException { final NormalizedTouchData touchData = new NormalizedTouchData(0, 0f, 0f, 0f, 0f, 0f, 0L, 0L); final TouchProcessorResult processorResultUnchanged = new TouchProcessorResult.ProcessedTouch(InteractionEvent.UNCHANGED, 1 /* pointerId */, touchData); // Enable new touch detection. when(mFeatureFlags.isEnabled(Flags.UDFPS_NEW_TOUCH_DETECTION)).thenReturn(true); // Configure UdfpsController to use FingerprintManager as opposed to AlternateTouchProvider. initUdfpsController(mOpticalProps, false /* hasAlternateTouchProvider */); // Configure UdfpsView to not accept the ACTION_DOWN event when(mUdfpsView.isDisplayConfigured()).thenReturn(false); when(mUdfpsView.isWithinSensorArea(anyFloat(), anyFloat())).thenReturn(false); // GIVEN that the overlay is showing and a11y touch exploration NOT enabled when(mAccessibilityManager.isTouchExplorationEnabled()).thenReturn(false); mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId, BiometricOverlayConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback); mFgExecutor.runAllReady(); verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture()); // WHEN ACTION_DOWN is received and touch is not within sensor when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn( processorResultUnchanged); MotionEvent downEvent = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, downEvent); mBiometricExecutor.runAllReady(); downEvent.recycle(); // THEN the touch is NOT pilfered verify(mInputManager, times(0)).pilferPointers(any()); } @Test @Test public void onAodInterrupt_onAcquiredGood_fingerNoLongerDown() throws RemoteException { public void onAodInterrupt_onAcquiredGood_fingerNoLongerDown() throws RemoteException { // GIVEN UDFPS overlay is showing // GIVEN UDFPS overlay is showing Loading @@ -1285,6 +1367,5 @@ public class UdfpsControllerTest extends SysuiTestCase { // THEN is fingerDown should be FALSE // THEN is fingerDown should be FALSE assertFalse(mUdfpsController.isFingerDown()); assertFalse(mUdfpsController.isFingerDown()); } } } }