Merge "Pilfer pointers when alternate bouncer is showing" into udc-dev am: a03af9df53 am: 03c4b26ab9

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

Change-Id: Iff8057701242c3fb798980df5716dcf648b486a5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Austin Delgado
2023-04-03 22:15:10 +00:00
committed by Automerger Merge Worker
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);
// Always pilfer pointers that are within sensor area
if (isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true)) {
Log.d("Austin", "pilferTouch invalid overlap");
// Always pilfer pointers that are within sensor area or when alternate bouncer is showing
if (isWithinSensorArea(mOverlay.getOverlayView(), event.getRawX(), event.getRawY(), true)
|| mAlternateBouncerInteractor.isVisibleState()) {
mInputManager.pilferPointers(
mOverlay.getOverlayView().getViewRootImpl().getInputToken());
}

View File

@@ -1343,6 +1343,46 @@ public class UdfpsControllerTest extends SysuiTestCase {
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
public void onAodInterrupt_onAcquiredGood_fingerNoLongerDown() throws RemoteException {
// GIVEN UDFPS overlay is showing