Revert "Deprecate UiAutomation#injectInputEvent for CTS tests"
This reverts commit 1e9ade9a075e07e5203dcfe51ab0a3e1753025ac.
Reason for revert: b/394104998
Change-Id: I2ae48c23445149bcc1bb771bfcecda4ec18c3295
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 6e11cbc..f06bd48 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -478,8 +478,8 @@
method public void destroy();
method @NonNull public java.util.Set<java.lang.String> getAdoptedShellPermissions();
method @Deprecated public boolean grantRuntimePermission(String, String, android.os.UserHandle);
- method @Deprecated @FlaggedApi("com.android.input.flags.deprecate_uiautomation_input_injection") public boolean injectInputEvent(@NonNull android.view.InputEvent, boolean, boolean);
- method @Deprecated @FlaggedApi("com.android.input.flags.deprecate_uiautomation_input_injection") public void injectInputEventToInputFilter(@NonNull android.view.InputEvent);
+ method public boolean injectInputEvent(@NonNull android.view.InputEvent, boolean, boolean);
+ method public void injectInputEventToInputFilter(@NonNull android.view.InputEvent);
method public boolean isNodeInCache(@NonNull android.view.accessibility.AccessibilityNodeInfo);
method public void removeOverridePermissionState(int, @NonNull String);
method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle);
diff --git a/core/java/android/app/UiAutomation.java b/core/java/android/app/UiAutomation.java
index c89cb55..6f8e335 100644
--- a/core/java/android/app/UiAutomation.java
+++ b/core/java/android/app/UiAutomation.java
@@ -18,8 +18,6 @@
import static android.view.Display.DEFAULT_DISPLAY;
-import static com.android.input.flags.Flags.FLAG_DEPRECATE_UIAUTOMATION_INPUT_INJECTION;
-
import android.accessibilityservice.AccessibilityGestureEvent;
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityService.Callbacks;
@@ -28,7 +26,6 @@
import android.accessibilityservice.IAccessibilityServiceClient;
import android.accessibilityservice.IAccessibilityServiceConnection;
import android.accessibilityservice.MagnificationConfig;
-import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -111,10 +108,7 @@
* client should be using a higher-level library or implement high-level functions.
* For example, performing a tap on the screen requires construction and injecting
* of a touch down and up events which have to be delivered to the system by a
- * call to {@link #injectInputEvent(InputEvent, boolean)}. <strong>Note:</strong> For CTS tests, it
- * is preferable to inject input events using uinput (com.android.cts.input.UinputDevice) or hid
- * devices (com.android.cts.input.HidDevice). Alternatively, use InjectInputInProcess
- * (com.android.cts.input.InjectInputInProcess) for in-process injection.
+ * call to {@link #injectInputEvent(InputEvent, boolean)}.
* </p>
* <p>
* The APIs exposed by this class operate across applications enabling a client
@@ -962,17 +956,9 @@
* <strong>Note:</strong> It is caller's responsibility to recycle the event.
* </p>
*
- * <p>
- * <strong>Note:</strong> Avoid this method when injecting input events in CTS tests. Instead
- * use uinput (com.android.cts.input.UinputDevice)
- * or hid devices (com.android.cts.input.HidDevice), as they provide a more accurate simulation
- * of real device behavior. Alternatively, InjectInputInProcess
- * (com.android.cts.input.InjectInputProcess) can be used for in-process injection.
- * </p>
- *
- * @param event the event to inject
- * @param sync whether to inject the event synchronously
- * @return {@code true} if event injection succeeded
+ * @param event The event to inject.
+ * @param sync Whether to inject the event synchronously.
+ * @return Whether event injection succeeded.
*/
public boolean injectInputEvent(InputEvent event, boolean sync) {
return injectInputEvent(event, sync, true /* waitForAnimations */);
@@ -985,21 +971,15 @@
* <strong>Note:</strong> It is caller's responsibility to recycle the event.
* </p>
*
- * @param event the event to inject
- * @param sync whether to inject the event synchronously.
- * @param waitForAnimations whether to wait for all window container animations and surface
- * operations to complete
- * @return {@code true} if event injection succeeded
+ * @param event The event to inject.
+ * @param sync Whether to inject the event synchronously.
+ * @param waitForAnimations Whether to wait for all window container animations and surface
+ * operations to complete.
+ * @return Whether event injection succeeded.
*
- * @deprecated for CTS tests prefer inject input events using uinput
- * (com.android.cts.input.UinputDevice) or hid devices (com.android.cts.input.HidDevice).
- * Alternatively, InjectInputInProcess (com.android.cts.input.InjectInputProcess) can be used
- * for in-process injection.
* @hide
*/
@TestApi
- @Deprecated // Deprecated for CTS tests
- @FlaggedApi(FLAG_DEPRECATE_UIAUTOMATION_INPUT_INJECTION)
public boolean injectInputEvent(@NonNull InputEvent event, boolean sync,
boolean waitForAnimations) {
try {
@@ -1022,15 +1002,9 @@
* Events injected to the input subsystem using the standard {@link #injectInputEvent} method
* skip the accessibility input filter to avoid feedback loops.
*
- * @deprecated for CTS tests prefer inject input events using uinput
- * (com.android.cts.input.UinputDevice) or hid devices (com.android.cts.input.HidDevice).
- * Alternatively, InjectInputInProcess (com.android.cts.input.InjectInputProcess) can be used
- * for in-process injection.
* @hide
*/
@TestApi
- @Deprecated
- @FlaggedApi(FLAG_DEPRECATE_UIAUTOMATION_INPUT_INJECTION)
public void injectInputEventToInputFilter(@NonNull InputEvent event) {
try {
mUiAutomationConnection.injectInputEventToInputFilter(event);