Loading core/api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -302,8 +302,10 @@ package android.app { method public void destroy(); method @NonNull public android.os.ParcelFileDescriptor[] executeShellCommandRwe(@NonNull String); method @Deprecated public boolean grantRuntimePermission(String, String, android.os.UserHandle); method public boolean injectInputEvent(@NonNull android.view.InputEvent, boolean, boolean); method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle); method public void syncInputTransactions(); method public void syncInputTransactions(boolean); } public class UiModeManager { Loading core/java/android/app/IUiAutomationConnection.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ import android.os.ParcelFileDescriptor; interface IUiAutomationConnection { void connect(IAccessibilityServiceClient client, int flags); void disconnect(); boolean injectInputEvent(in InputEvent event, boolean sync); void syncInputTransactions(); boolean injectInputEvent(in InputEvent event, boolean sync, boolean waitForAnimations); void syncInputTransactions(boolean waitForAnimations); boolean setRotation(int rotation); Bitmap takeScreenshot(in Rect crop); boolean clearWindowContentFrameStats(int windowId); Loading core/java/android/app/Instrumentation.java +2 −1 Original line number Diff line number Diff line Loading @@ -1119,7 +1119,8 @@ public class Instrumentation { } try { WindowManagerGlobal.getWindowManagerService().injectInputAfterTransactionsApplied(event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH, true /* waitForAnimations */); } catch (RemoteException e) { } } Loading core/java/android/app/UiAutomation.java +47 −3 Original line number Diff line number Diff line Loading @@ -695,6 +695,9 @@ public final class UiAutomation { /** * A method for injecting an arbitrary input event. * * This method waits for all window container animations and surface operations to complete. * * <p> * <strong>Note:</strong> It is caller's responsibility to recycle the event. * </p> Loading @@ -704,12 +707,34 @@ public final class UiAutomation { * @return Whether event injection succeeded. */ public boolean injectInputEvent(InputEvent event, boolean sync) { return injectInputEvent(event, sync, true /* waitForAnimations */); } /** * A method for injecting an arbitrary input event, optionally waiting for window animations to * complete. * <p> * <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 Whether event injection succeeded. * * @hide */ @TestApi public boolean injectInputEvent(@NonNull InputEvent event, boolean sync, boolean waitForAnimations) { try { if (DEBUG) { Log.i(LOG_TAG, "Injecting: " + event + " sync: " + sync); Log.i(LOG_TAG, "Injecting: " + event + " sync: " + sync + " waitForAnimations: " + waitForAnimations); } // Calling out without a lock held. return mUiAutomationConnection.injectInputEvent(event, sync); return mUiAutomationConnection.injectInputEvent(event, sync, waitForAnimations); } catch (RemoteException re) { Log.e(LOG_TAG, "Error while injecting input event!", re); } Loading @@ -726,7 +751,26 @@ public final class UiAutomation { public void syncInputTransactions() { try { // Calling out without a lock held. mUiAutomationConnection.syncInputTransactions(); mUiAutomationConnection.syncInputTransactions(true /* waitForAnimations */); } catch (RemoteException re) { Log.e(LOG_TAG, "Error while syncing input transactions!", re); } } /** * A request for WindowManagerService to wait until all input information has been sent from * WindowManager to native InputManager and optionally wait for animations to complete. * * @param waitForAnimations Whether to wait for all window container animations and surface * operations to complete. * * @hide */ @TestApi public void syncInputTransactions(boolean waitForAnimations) { try { // Calling out without a lock held. mUiAutomationConnection.syncInputTransactions(waitForAnimations); } catch (RemoteException re) { Log.e(LOG_TAG, "Error while syncing input transactions!", re); } Loading core/java/android/app/UiAutomationConnection.java +5 −5 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { } @Override public boolean injectInputEvent(InputEvent event, boolean sync) { public boolean injectInputEvent(InputEvent event, boolean sync, boolean waitForAnimations) { synchronized (mLock) { throwIfCalledByNotTrustedUidLocked(); throwIfShutdownLocked(); Loading @@ -134,7 +134,8 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { : InputManager.INJECT_INPUT_EVENT_MODE_ASYNC; final long identity = Binder.clearCallingIdentity(); try { return mWindowManager.injectInputAfterTransactionsApplied(event, mode); return mWindowManager.injectInputAfterTransactionsApplied(event, mode, waitForAnimations); } catch (RemoteException e) { } finally { Binder.restoreCallingIdentity(identity); Loading @@ -143,7 +144,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { } @Override public void syncInputTransactions() { public void syncInputTransactions(boolean waitForAnimations) { synchronized (mLock) { throwIfCalledByNotTrustedUidLocked(); throwIfShutdownLocked(); Loading @@ -151,12 +152,11 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { } try { mWindowManager.syncInputTransactions(); mWindowManager.syncInputTransactions(waitForAnimations); } catch (RemoteException e) { } } @Override public boolean setRotation(int rotation) { synchronized (mLock) { Loading Loading
core/api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -302,8 +302,10 @@ package android.app { method public void destroy(); method @NonNull public android.os.ParcelFileDescriptor[] executeShellCommandRwe(@NonNull String); method @Deprecated public boolean grantRuntimePermission(String, String, android.os.UserHandle); method public boolean injectInputEvent(@NonNull android.view.InputEvent, boolean, boolean); method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle); method public void syncInputTransactions(); method public void syncInputTransactions(boolean); } public class UiModeManager { Loading
core/java/android/app/IUiAutomationConnection.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -36,8 +36,8 @@ import android.os.ParcelFileDescriptor; interface IUiAutomationConnection { void connect(IAccessibilityServiceClient client, int flags); void disconnect(); boolean injectInputEvent(in InputEvent event, boolean sync); void syncInputTransactions(); boolean injectInputEvent(in InputEvent event, boolean sync, boolean waitForAnimations); void syncInputTransactions(boolean waitForAnimations); boolean setRotation(int rotation); Bitmap takeScreenshot(in Rect crop); boolean clearWindowContentFrameStats(int windowId); Loading
core/java/android/app/Instrumentation.java +2 −1 Original line number Diff line number Diff line Loading @@ -1119,7 +1119,8 @@ public class Instrumentation { } try { WindowManagerGlobal.getWindowManagerService().injectInputAfterTransactionsApplied(event, InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH); InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH, true /* waitForAnimations */); } catch (RemoteException e) { } } Loading
core/java/android/app/UiAutomation.java +47 −3 Original line number Diff line number Diff line Loading @@ -695,6 +695,9 @@ public final class UiAutomation { /** * A method for injecting an arbitrary input event. * * This method waits for all window container animations and surface operations to complete. * * <p> * <strong>Note:</strong> It is caller's responsibility to recycle the event. * </p> Loading @@ -704,12 +707,34 @@ public final class UiAutomation { * @return Whether event injection succeeded. */ public boolean injectInputEvent(InputEvent event, boolean sync) { return injectInputEvent(event, sync, true /* waitForAnimations */); } /** * A method for injecting an arbitrary input event, optionally waiting for window animations to * complete. * <p> * <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 Whether event injection succeeded. * * @hide */ @TestApi public boolean injectInputEvent(@NonNull InputEvent event, boolean sync, boolean waitForAnimations) { try { if (DEBUG) { Log.i(LOG_TAG, "Injecting: " + event + " sync: " + sync); Log.i(LOG_TAG, "Injecting: " + event + " sync: " + sync + " waitForAnimations: " + waitForAnimations); } // Calling out without a lock held. return mUiAutomationConnection.injectInputEvent(event, sync); return mUiAutomationConnection.injectInputEvent(event, sync, waitForAnimations); } catch (RemoteException re) { Log.e(LOG_TAG, "Error while injecting input event!", re); } Loading @@ -726,7 +751,26 @@ public final class UiAutomation { public void syncInputTransactions() { try { // Calling out without a lock held. mUiAutomationConnection.syncInputTransactions(); mUiAutomationConnection.syncInputTransactions(true /* waitForAnimations */); } catch (RemoteException re) { Log.e(LOG_TAG, "Error while syncing input transactions!", re); } } /** * A request for WindowManagerService to wait until all input information has been sent from * WindowManager to native InputManager and optionally wait for animations to complete. * * @param waitForAnimations Whether to wait for all window container animations and surface * operations to complete. * * @hide */ @TestApi public void syncInputTransactions(boolean waitForAnimations) { try { // Calling out without a lock held. mUiAutomationConnection.syncInputTransactions(waitForAnimations); } catch (RemoteException re) { Log.e(LOG_TAG, "Error while syncing input transactions!", re); } Loading
core/java/android/app/UiAutomationConnection.java +5 −5 Original line number Diff line number Diff line Loading @@ -124,7 +124,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { } @Override public boolean injectInputEvent(InputEvent event, boolean sync) { public boolean injectInputEvent(InputEvent event, boolean sync, boolean waitForAnimations) { synchronized (mLock) { throwIfCalledByNotTrustedUidLocked(); throwIfShutdownLocked(); Loading @@ -134,7 +134,8 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { : InputManager.INJECT_INPUT_EVENT_MODE_ASYNC; final long identity = Binder.clearCallingIdentity(); try { return mWindowManager.injectInputAfterTransactionsApplied(event, mode); return mWindowManager.injectInputAfterTransactionsApplied(event, mode, waitForAnimations); } catch (RemoteException e) { } finally { Binder.restoreCallingIdentity(identity); Loading @@ -143,7 +144,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { } @Override public void syncInputTransactions() { public void syncInputTransactions(boolean waitForAnimations) { synchronized (mLock) { throwIfCalledByNotTrustedUidLocked(); throwIfShutdownLocked(); Loading @@ -151,12 +152,11 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub { } try { mWindowManager.syncInputTransactions(); mWindowManager.syncInputTransactions(waitForAnimations); } catch (RemoteException e) { } } @Override public boolean setRotation(int rotation) { synchronized (mLock) { Loading