From be382c32b35a4b499bb58c5672bbad0dbf6b25ce Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Tue, 5 Apr 2022 18:04:40 +0000 Subject: [PATCH] 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 --- core/java/android/app/Instrumentation.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index e9df50f1d9877..961135f471439 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -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); }