Merge "Pilfer pointers when alternate bouncer is showing" into udc-dev

This commit is contained in:
Austin Delgado
2023-04-03 21:19:12 +00:00
committed by Android (Google) Code Review
2 changed files with 43 additions and 3 deletions

View File

@@ -618,9 +618,9 @@ public class UdfpsController implements DozeReceiver, Dumpable {
} }
logBiometricTouch(processedTouch.getEvent(), data); logBiometricTouch(processedTouch.getEvent(), data);
// Always pilfer pointers that are within sensor area // Always pilfer pointers that are within sensor area or when alternate bouncer is showing
if (isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true)) { if (isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true)
Log.d("Austin", "pilferTouch invalid overlap"); || mAlternateBouncerInteractor.isVisibleState()) {
mInputManager.pilferPointers( mInputManager.pilferPointers(
mOverlay.getOverlayView().getViewRootImpl().getInputToken()); mOverlay.getOverlayView().getViewRootImpl().getInputToken());
} }

View File

@@ -1343,6 +1343,46 @@ public class UdfpsControllerTest extends SysuiTestCase {
verify(mInputManager, times(0)).pilferPointers(any()); verify(mInputManager, times(0)).pilferPointers(any());
} }
@Test
public void onTouch_withNewTouchDetection_pilferPointerWhenAltBouncerShowing()
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 alternate bouncer is showing and a11y touch exploration NOT enabled
when(mAccessibilityManager.isTouchExplorationEnabled()).thenReturn(false);
when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(true);
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 pilfered
verify(mInputManager, times(1)).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