Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac972f44 authored by Marvin Ramin's avatar Marvin Ramin Committed by Android (Google) Code Review
Browse files

Revert "Deprecate UiAutomation#injectInputEvent for CTS tests"

This reverts commit 1e9ade9a.

Reason for revert: b/394104998

Change-Id: I2ae48c23445149bcc1bb771bfcecda4ec18c3295
parent 1e9ade9a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -478,8 +478,8 @@ package android.app {
    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);
+9 −35
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package android.app;

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.AccessibilityServiceInfo;
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 @@ import java.util.concurrent.TimeoutException;
 * 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 @@ public final class UiAutomation {
     * <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 @@ public final class UiAutomation {
     * <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 @@ public final class UiAutomation {
     * 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);