Remove exception for injecting pointer event from sendTrackballEventSync

Starting from T, a MotionEvent's default source is SOURCE_CLASS_POINTER.
This means injecting a newly obtained MotionEvent into
sendTrackballEventSync would cause the exception to be triggered.

Adding such an exception doesn't make sense in T, since it adds the
additional precondition to sendTrackballEventSync that the MotionEvent's
source must correctly configured. This precondition did not exist before,
so we remove the exception.

Bug: 228194124
Test: atest android.app.cts.DialogTest
Change-Id: I039e30e6c768ce11c64d077d20373da12f27b72f
This commit is contained in:
Prabir Pradhan
2022-04-05 18:04:40 +00:00
parent b7021e4077
commit be382c32b3

View File

@@ -1207,11 +1207,6 @@ public class Instrumentation {
*/
public void sendTrackballEventSync(MotionEvent event) {
validateNotAppThread();
if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) {
throw new IllegalArgumentException(
"Cannot inject pointer events from sendTrackballEventSync()."
+ " Use sendPointerSync() to inject pointer events.");
}
if (!event.isFromSource(InputDevice.SOURCE_CLASS_TRACKBALL)) {
event.setSource(InputDevice.SOURCE_TRACKBALL);
}