Merge "Fix simFingerDown and simFingerUp not working"
This commit is contained in:
committed by
Android (Google) Code Review
commit
690df90011
@@ -332,17 +332,19 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
*
|
||||
* @param event MotionEvent to simulate in onTouch
|
||||
*/
|
||||
public void debugOnTouch(long requestId, MotionEvent event) {
|
||||
UdfpsController.this.onTouch(requestId, event, false);
|
||||
public void debugOnTouch(MotionEvent event) {
|
||||
final long requestId = (mOverlay != null) ? mOverlay.getRequestId() : 0L;
|
||||
UdfpsController.this.onTouch(requestId, event, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug to run onUiReady
|
||||
*/
|
||||
public void debugOnUiReady(long requestId, int sensorId) {
|
||||
public void debugOnUiReady(int sensorId) {
|
||||
if (UdfpsController.this.mAlternateTouchProvider != null) {
|
||||
UdfpsController.this.mAlternateTouchProvider.onUiReady();
|
||||
} else {
|
||||
final long requestId = (mOverlay != null) ? mOverlay.getRequestId() : 0L;
|
||||
UdfpsController.this.mFingerprintManager.onUiReady(requestId, sensorId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ class UdfpsShell @Inject constructor(
|
||||
|
||||
@VisibleForTesting
|
||||
fun onUiReady() {
|
||||
udfpsOverlayController?.debugOnUiReady(REQUEST_ID, SENSOR_ID)
|
||||
udfpsOverlayController?.debugOnUiReady(SENSOR_ID)
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -157,11 +157,11 @@ class UdfpsShell @Inject constructor(
|
||||
|
||||
val downEvent: MotionEvent? = obtainMotionEvent(ACTION_DOWN, sensorBounds.exactCenterX(),
|
||||
sensorBounds.exactCenterY(), MINOR, MAJOR)
|
||||
udfpsOverlayController?.debugOnTouch(REQUEST_ID, downEvent)
|
||||
udfpsOverlayController?.debugOnTouch(downEvent)
|
||||
|
||||
val moveEvent: MotionEvent? = obtainMotionEvent(ACTION_MOVE, sensorBounds.exactCenterX(),
|
||||
sensorBounds.exactCenterY(), MINOR, MAJOR)
|
||||
udfpsOverlayController?.debugOnTouch(REQUEST_ID, moveEvent)
|
||||
udfpsOverlayController?.debugOnTouch(moveEvent)
|
||||
|
||||
downEvent?.recycle()
|
||||
moveEvent?.recycle()
|
||||
@@ -173,7 +173,7 @@ class UdfpsShell @Inject constructor(
|
||||
|
||||
val upEvent: MotionEvent? = obtainMotionEvent(ACTION_UP, sensorBounds.exactCenterX(),
|
||||
sensorBounds.exactCenterY(), MINOR, MAJOR)
|
||||
udfpsOverlayController?.debugOnTouch(REQUEST_ID, upEvent)
|
||||
udfpsOverlayController?.debugOnTouch(upEvent)
|
||||
upEvent?.recycle()
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class UdfpsShellTest : SysuiTestCase() {
|
||||
fun testSimFingerDown() {
|
||||
udfpsShell.simFingerDown()
|
||||
|
||||
verify(udfpsOverlayController, times(2)).debugOnTouch(any(), motionEvent.capture())
|
||||
verify(udfpsOverlayController, times(2)).debugOnTouch(motionEvent.capture())
|
||||
|
||||
assertEquals(motionEvent.allValues[0].action, MotionEvent.ACTION_DOWN) // ACTION_MOVE
|
||||
assertEquals(motionEvent.allValues[1].action, MotionEvent.ACTION_MOVE) // ACTION_MOVE
|
||||
@@ -78,7 +78,7 @@ class UdfpsShellTest : SysuiTestCase() {
|
||||
fun testSimFingerUp() {
|
||||
udfpsShell.simFingerUp()
|
||||
|
||||
verify(udfpsOverlayController).debugOnTouch(any(), motionEvent.capture())
|
||||
verify(udfpsOverlayController).debugOnTouch(motionEvent.capture())
|
||||
|
||||
assertEquals(motionEvent.value.action, MotionEvent.ACTION_UP)
|
||||
}
|
||||
@@ -87,6 +87,6 @@ class UdfpsShellTest : SysuiTestCase() {
|
||||
fun testOnUiReady() {
|
||||
udfpsShell.onUiReady()
|
||||
|
||||
verify(udfpsOverlayController).debugOnUiReady(any(), any())
|
||||
verify(udfpsOverlayController).debugOnUiReady(any())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user