Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +10 −2 Original line number Diff line number Diff line Loading @@ -188,6 +188,8 @@ public class UdfpsController implements DozeReceiver, Dumpable { @Nullable private VelocityTracker mVelocityTracker; // The ID of the pointer for which ACTION_DOWN has occurred. -1 means no pointer is active. private int mActivePointerId = -1; // Whether a pointer has been pilfered for current gesture private boolean mPointerPilfered = false; // The timestamp of the most recent touch log. private long mTouchLogTime; // The timestamp of the most recent log of a touch InteractionEvent. Loading Loading @@ -557,6 +559,11 @@ public class UdfpsController implements DozeReceiver, Dumpable { || mPrimaryBouncerInteractor.isInTransit()) { 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 @@ -630,10 +637,11 @@ public class UdfpsController implements DozeReceiver, Dumpable { shouldPilfer = true; } // Execute the pilfer if (shouldPilfer) { // Pilfer only once per gesture if (shouldPilfer && !mPointerPilfered) { mInputManager.pilferPointers( mOverlay.getOverlayView().getViewRootImpl().getInputToken()); mPointerPilfered = true; } return processedTouch.getTouchData().isWithinBounds(mOverlayParams.getNativeSensorBounds()); Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +14 −4 Original line number Diff line number Diff line Loading @@ -1300,12 +1300,22 @@ public class UdfpsControllerTest extends SysuiTestCase { // 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); MotionEvent event = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); mBiometricExecutor.runAllReady(); downEvent.recycle(); // THEN the touch is pilfered // WHEN ACTION_MOVE is received after final TouchProcessorResult processorResultUnchanged = new TouchProcessorResult.ProcessedTouch( InteractionEvent.UNCHANGED, 1 /* pointerId */, touchData); when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn( processorResultUnchanged); event.setAction(ACTION_MOVE); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); mBiometricExecutor.runAllReady(); event.recycle(); // THEN only pilfer once on the initial down verify(mInputManager).pilferPointers(any()); } Loading Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +10 −2 Original line number Diff line number Diff line Loading @@ -188,6 +188,8 @@ public class UdfpsController implements DozeReceiver, Dumpable { @Nullable private VelocityTracker mVelocityTracker; // The ID of the pointer for which ACTION_DOWN has occurred. -1 means no pointer is active. private int mActivePointerId = -1; // Whether a pointer has been pilfered for current gesture private boolean mPointerPilfered = false; // The timestamp of the most recent touch log. private long mTouchLogTime; // The timestamp of the most recent log of a touch InteractionEvent. Loading Loading @@ -557,6 +559,11 @@ public class UdfpsController implements DozeReceiver, Dumpable { || mPrimaryBouncerInteractor.isInTransit()) { 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 @@ -630,10 +637,11 @@ public class UdfpsController implements DozeReceiver, Dumpable { shouldPilfer = true; } // Execute the pilfer if (shouldPilfer) { // Pilfer only once per gesture if (shouldPilfer && !mPointerPilfered) { mInputManager.pilferPointers( mOverlay.getOverlayView().getViewRootImpl().getInputToken()); mPointerPilfered = true; } return processedTouch.getTouchData().isWithinBounds(mOverlayParams.getNativeSensorBounds()); Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +14 −4 Original line number Diff line number Diff line Loading @@ -1300,12 +1300,22 @@ public class UdfpsControllerTest extends SysuiTestCase { // 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); MotionEvent event = MotionEvent.obtain(0, 0, ACTION_DOWN, 0, 0, 0); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); mBiometricExecutor.runAllReady(); downEvent.recycle(); // THEN the touch is pilfered // WHEN ACTION_MOVE is received after final TouchProcessorResult processorResultUnchanged = new TouchProcessorResult.ProcessedTouch( InteractionEvent.UNCHANGED, 1 /* pointerId */, touchData); when(mSinglePointerTouchProcessor.processTouch(any(), anyInt(), any())).thenReturn( processorResultUnchanged); event.setAction(ACTION_MOVE); mTouchListenerCaptor.getValue().onTouch(mUdfpsView, event); mBiometricExecutor.runAllReady(); event.recycle(); // THEN only pilfer once on the initial down verify(mInputManager).pilferPointers(any()); } Loading