Loading packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +34 −0 Original line number Diff line number Diff line Loading @@ -1218,6 +1218,40 @@ public class UdfpsControllerTest extends SysuiTestCase { verify(mInputManager, never()).pilferPointers(any()); } @Test public void onDownTouchReceivedWithoutPreviousUp() 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); mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId, BiometricRequestConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback); mFgExecutor.runAllReady(); verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture()); // WHEN ACTION_DOWN is received and touch is within sensor when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn( processorResultDown); MotionEvent firstDownEvent = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, firstDownEvent); mBiometricExecutor.runAllReady(); firstDownEvent.recycle(); // And another ACTION_DOWN is received without an ACTION_UP before MotionEvent secondDownEvent = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, secondDownEvent); mBiometricExecutor.runAllReady(); secondDownEvent.recycle(); // THEN the touch is still processed verify(mFingerprintManager, times(2)).onPointerDown(anyLong(), anyInt(), anyInt(), anyFloat(), anyFloat(), anyFloat(), anyFloat(), anyFloat(), anyLong(), anyLong(), anyBoolean()); } @Test public void onTouch_pilferPointerWhenAltBouncerShowing() throws RemoteException { Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +12 −8 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { @Nullable private UdfpsDisplayModeProvider mUdfpsDisplayMode; // The ID of the pointer for which ACTION_DOWN has occurred. -1 means no pointer is active. private int mActivePointerId = -1; private int mActivePointerId = MotionEvent.INVALID_POINTER_ID; // Whether a pointer has been pilfered for current gesture private boolean mPointerPilfered = false; // The timestamp of the most recent touch log. Loading Loading @@ -510,7 +510,16 @@ public class UdfpsController implements DozeReceiver, Dumpable { + mOverlay.getRequestId()); return false; } if (!DeviceEntryUdfpsRefactor.isEnabled()) { if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_HOVER_ENTER) { // Reset on ACTION_DOWN, start of new gesture mPointerPilfered = false; if (mActivePointerId != MotionEvent.INVALID_POINTER_ID) { Log.w(TAG, "onTouch down received without a preceding up"); } mActivePointerId = MotionEvent.INVALID_POINTER_ID; mOnFingerDown = false; } else if (!DeviceEntryUdfpsRefactor.isEnabled()) { if ((mLockscreenShadeTransitionController.getQSDragProgress() != 0f && !mAlternateBouncerInteractor.isVisibleState()) || mPrimaryBouncerInteractor.isInTransit()) { Loading @@ -518,11 +527,6 @@ public class UdfpsController implements DozeReceiver, Dumpable { return false; } } if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_HOVER_ENTER) { // Reset on ACTION_DOWN, start of new gesture mPointerPilfered = false; } final TouchProcessorResult result = mTouchProcessor.processTouch(event, mActivePointerId, mOverlayParams); Loading Loading @@ -1080,7 +1084,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { long gestureStart, boolean isAod) { mExecution.assertIsMainThread(); mActivePointerId = -1; mActivePointerId = MotionEvent.INVALID_POINTER_ID; mAcquiredReceived = false; if (mOnFingerDown) { mFingerprintManager.onPointerUp(requestId, mSensorProps.sensorId, pointerId, x, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +34 −0 Original line number Diff line number Diff line Loading @@ -1218,6 +1218,40 @@ public class UdfpsControllerTest extends SysuiTestCase { verify(mInputManager, never()).pilferPointers(any()); } @Test public void onDownTouchReceivedWithoutPreviousUp() 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); mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId, BiometricRequestConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback); mFgExecutor.runAllReady(); verify(mUdfpsView).setOnTouchListener(mTouchListenerCaptor.capture()); // WHEN ACTION_DOWN is received and touch is within sensor when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn( processorResultDown); MotionEvent firstDownEvent = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, firstDownEvent); mBiometricExecutor.runAllReady(); firstDownEvent.recycle(); // And another ACTION_DOWN is received without an ACTION_UP before MotionEvent secondDownEvent = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, secondDownEvent); mBiometricExecutor.runAllReady(); secondDownEvent.recycle(); // THEN the touch is still processed verify(mFingerprintManager, times(2)).onPointerDown(anyLong(), anyInt(), anyInt(), anyFloat(), anyFloat(), anyFloat(), anyFloat(), anyFloat(), anyLong(), anyLong(), anyBoolean()); } @Test public void onTouch_pilferPointerWhenAltBouncerShowing() throws RemoteException { Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +12 −8 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { @Nullable private UdfpsDisplayModeProvider mUdfpsDisplayMode; // The ID of the pointer for which ACTION_DOWN has occurred. -1 means no pointer is active. private int mActivePointerId = -1; private int mActivePointerId = MotionEvent.INVALID_POINTER_ID; // Whether a pointer has been pilfered for current gesture private boolean mPointerPilfered = false; // The timestamp of the most recent touch log. Loading Loading @@ -510,7 +510,16 @@ public class UdfpsController implements DozeReceiver, Dumpable { + mOverlay.getRequestId()); return false; } if (!DeviceEntryUdfpsRefactor.isEnabled()) { if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_HOVER_ENTER) { // Reset on ACTION_DOWN, start of new gesture mPointerPilfered = false; if (mActivePointerId != MotionEvent.INVALID_POINTER_ID) { Log.w(TAG, "onTouch down received without a preceding up"); } mActivePointerId = MotionEvent.INVALID_POINTER_ID; mOnFingerDown = false; } else if (!DeviceEntryUdfpsRefactor.isEnabled()) { if ((mLockscreenShadeTransitionController.getQSDragProgress() != 0f && !mAlternateBouncerInteractor.isVisibleState()) || mPrimaryBouncerInteractor.isInTransit()) { Loading @@ -518,11 +527,6 @@ public class UdfpsController implements DozeReceiver, Dumpable { return false; } } if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_HOVER_ENTER) { // Reset on ACTION_DOWN, start of new gesture mPointerPilfered = false; } final TouchProcessorResult result = mTouchProcessor.processTouch(event, mActivePointerId, mOverlayParams); Loading Loading @@ -1080,7 +1084,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { long gestureStart, boolean isAod) { mExecution.assertIsMainThread(); mActivePointerId = -1; mActivePointerId = MotionEvent.INVALID_POINTER_ID; mAcquiredReceived = false; if (mOnFingerDown) { mFingerprintManager.onPointerUp(requestId, mSensorProps.sensorId, pointerId, x, Loading