Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -2834,6 +2834,7 @@ package android.accessibilityservice { method public final android.accessibilityservice.AccessibilityServiceInfo getServiceInfo(); method @NonNull public final android.accessibilityservice.AccessibilityService.SoftKeyboardController getSoftKeyboardController(); method public java.util.List<android.view.accessibility.AccessibilityWindowInfo> getWindows(); method @NonNull public final android.util.SparseArray<java.util.List<android.view.accessibility.AccessibilityWindowInfo>> getWindowsOnAllDisplays(); method public abstract void onAccessibilityEvent(android.view.accessibility.AccessibilityEvent); method public final android.os.IBinder onBind(android.content.Intent); method @Deprecated protected boolean onGesture(int); Loading Loading @@ -6363,6 +6364,7 @@ package android.app { method public android.view.WindowAnimationFrameStats getWindowAnimationFrameStats(); method public android.view.WindowContentFrameStats getWindowContentFrameStats(int); method public java.util.List<android.view.accessibility.AccessibilityWindowInfo> getWindows(); method @NonNull public android.util.SparseArray<java.util.List<android.view.accessibility.AccessibilityWindowInfo>> getWindowsOnAllDisplays(); method public void grantRuntimePermission(String, String); method public void grantRuntimePermissionAsUser(String, String, android.os.UserHandle); method public boolean injectInputEvent(android.view.InputEvent, boolean); core/java/android/accessibilityservice/AccessibilityService.java +29 −1 Original line number Diff line number Diff line Loading @@ -605,7 +605,7 @@ public abstract class AccessibilityService extends Service { } /** * Gets the windows on the screen. This method returns only the windows * Gets the windows on the screen of the default display. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. * For example, if there is a modal dialog shown and the user cannot touch * anything behind it, then only the modal window will be reported Loading @@ -631,6 +631,34 @@ public abstract class AccessibilityService extends Service { return AccessibilityInteractionClient.getInstance().getWindows(mConnectionId); } /** * Gets the windows on the screen of all displays. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. * For example, if there is a modal dialog shown and the user cannot touch * anything behind it, then only the modal window will be reported * (assuming it is the top one). For convenience the returned windows * are ordered in a descending layer order, which is the windows that * are on top are reported first. Since the user can always * interact with the window that has input focus by typing, the focused * window is always returned (even if covered by a modal window). * <p> * <strong>Note:</strong> In order to access the windows your service has * to declare the capability to retrieve window content by setting the * {@link android.R.styleable#AccessibilityService_canRetrieveWindowContent} * property in its meta-data. For details refer to {@link #SERVICE_META_DATA}. * Also the service has to opt-in to retrieve the interactive windows by * setting the {@link AccessibilityServiceInfo#FLAG_RETRIEVE_INTERACTIVE_WINDOWS} * flag. * </p> * * @return The windows of all displays if there are windows and the service is can retrieve * them, otherwise an empty list. The key of SparseArray is display ID. */ @NonNull public final SparseArray<List<AccessibilityWindowInfo>> getWindowsOnAllDisplays() { return AccessibilityInteractionClient.getInstance().getWindowsOnAllDisplays(mConnectionId); } /** * Gets the root node in the currently active window if this service * can retrieve window content. The active window is the one that the user Loading core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ interface IAccessibilityServiceConnection { AccessibilityWindowInfo getWindow(int windowId); List<AccessibilityWindowInfo> getWindows(); AccessibilityWindowInfo.WindowListSparseArray getWindows(); AccessibilityServiceInfo getServiceInfo(); Loading core/java/android/app/UiAutomation.java +31 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.util.Log; import android.util.SparseArray; import android.view.Display; import android.view.InputEvent; import android.view.KeyEvent; Loading Loading @@ -535,7 +536,7 @@ public final class UiAutomation { } /** * Gets the windows on the screen. This method returns only the windows * Gets the windows on the screen of the default display. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. * For example, if there is a modal dialog shown and the user cannot touch * anything behind it, then only the modal window will be reported Loading @@ -561,6 +562,35 @@ public final class UiAutomation { .getWindows(connectionId); } /** * Gets the windows on the screen of all displays. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. * For example, if there is a modal dialog shown and the user cannot touch * anything behind it, then only the modal window will be reported * (assuming it is the top one). For convenience the returned windows * are ordered in a descending layer order, which is the windows that * are higher in the Z-order are reported first. * <p> * <strong>Note:</strong> In order to access the windows you have to opt-in * to retrieve the interactive windows by setting the * {@link AccessibilityServiceInfo#FLAG_RETRIEVE_INTERACTIVE_WINDOWS} flag. * </p> * * @return The windows of all displays if there are windows and the service is can retrieve * them, otherwise an empty list. The key of SparseArray is display ID. */ @NonNull public SparseArray<List<AccessibilityWindowInfo>> getWindowsOnAllDisplays() { final int connectionId; synchronized (mLock) { throwIfNotConnectedLocked(); connectionId = mConnectionId; } // Calling out without a lock held. return AccessibilityInteractionClient.getInstance() .getWindowsOnAllDisplays(connectionId); } /** * Gets the root {@link AccessibilityNodeInfo} in the active window. * Loading core/java/android/view/accessibility/AccessibilityInteractionClient.java +25 −10 Original line number Diff line number Diff line Loading @@ -259,23 +259,38 @@ public final class AccessibilityInteractionClient } /** * Gets the info for all windows. * Gets the info for all windows of the default display. * * @param connectionId The id of a connection for interacting with the system. * @return The {@link AccessibilityWindowInfo} list. */ public List<AccessibilityWindowInfo> getWindows(int connectionId) { final SparseArray<List<AccessibilityWindowInfo>> windows = getWindowsOnAllDisplays(connectionId); if (windows.size() > 0) { return windows.valueAt(Display.DEFAULT_DISPLAY); } return Collections.emptyList(); } /** * Gets the info for all windows of all displays. * * @param connectionId The id of a connection for interacting with the system. * @return The SparseArray of {@link AccessibilityWindowInfo} list. * The key of SparseArray is display ID. */ public SparseArray<List<AccessibilityWindowInfo>> getWindowsOnAllDisplays(int connectionId) { try { IAccessibilityServiceConnection connection = getConnection(connectionId); if (connection != null) { SparseArray<List<AccessibilityWindowInfo>> allWindows = SparseArray<List<AccessibilityWindowInfo>> windows = sAccessibilityCache.getWindowsOnAllDisplays(); List<AccessibilityWindowInfo> windows; if (allWindows != null) { if (windows != null) { if (DEBUG) { Log.i(LOG_TAG, "Windows cache hit"); } return allWindows.valueAt(Display.DEFAULT_DISPLAY); return windows; } if (DEBUG) { Log.i(LOG_TAG, "Windows cache miss"); Loading @@ -287,9 +302,7 @@ public final class AccessibilityInteractionClient Binder.restoreCallingIdentity(identityToken); } if (windows != null) { allWindows = new SparseArray<>(); allWindows.put(Display.DEFAULT_DISPLAY, windows); sAccessibilityCache.setWindowsOnAllDisplays(allWindows); sAccessibilityCache.setWindowsOnAllDisplays(windows); return windows; } } else { Loading @@ -298,9 +311,11 @@ public final class AccessibilityInteractionClient } } } catch (RemoteException re) { Log.e(LOG_TAG, "Error while calling remote getWindows", re); Log.e(LOG_TAG, "Error while calling remote getWindowsOnAllDisplays", re); } return Collections.emptyList(); final SparseArray<List<AccessibilityWindowInfo>> emptyWindows = new SparseArray<>(); return emptyWindows; } /** Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -2834,6 +2834,7 @@ package android.accessibilityservice { method public final android.accessibilityservice.AccessibilityServiceInfo getServiceInfo(); method @NonNull public final android.accessibilityservice.AccessibilityService.SoftKeyboardController getSoftKeyboardController(); method public java.util.List<android.view.accessibility.AccessibilityWindowInfo> getWindows(); method @NonNull public final android.util.SparseArray<java.util.List<android.view.accessibility.AccessibilityWindowInfo>> getWindowsOnAllDisplays(); method public abstract void onAccessibilityEvent(android.view.accessibility.AccessibilityEvent); method public final android.os.IBinder onBind(android.content.Intent); method @Deprecated protected boolean onGesture(int); Loading Loading @@ -6363,6 +6364,7 @@ package android.app { method public android.view.WindowAnimationFrameStats getWindowAnimationFrameStats(); method public android.view.WindowContentFrameStats getWindowContentFrameStats(int); method public java.util.List<android.view.accessibility.AccessibilityWindowInfo> getWindows(); method @NonNull public android.util.SparseArray<java.util.List<android.view.accessibility.AccessibilityWindowInfo>> getWindowsOnAllDisplays(); method public void grantRuntimePermission(String, String); method public void grantRuntimePermissionAsUser(String, String, android.os.UserHandle); method public boolean injectInputEvent(android.view.InputEvent, boolean);
core/java/android/accessibilityservice/AccessibilityService.java +29 −1 Original line number Diff line number Diff line Loading @@ -605,7 +605,7 @@ public abstract class AccessibilityService extends Service { } /** * Gets the windows on the screen. This method returns only the windows * Gets the windows on the screen of the default display. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. * For example, if there is a modal dialog shown and the user cannot touch * anything behind it, then only the modal window will be reported Loading @@ -631,6 +631,34 @@ public abstract class AccessibilityService extends Service { return AccessibilityInteractionClient.getInstance().getWindows(mConnectionId); } /** * Gets the windows on the screen of all displays. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. * For example, if there is a modal dialog shown and the user cannot touch * anything behind it, then only the modal window will be reported * (assuming it is the top one). For convenience the returned windows * are ordered in a descending layer order, which is the windows that * are on top are reported first. Since the user can always * interact with the window that has input focus by typing, the focused * window is always returned (even if covered by a modal window). * <p> * <strong>Note:</strong> In order to access the windows your service has * to declare the capability to retrieve window content by setting the * {@link android.R.styleable#AccessibilityService_canRetrieveWindowContent} * property in its meta-data. For details refer to {@link #SERVICE_META_DATA}. * Also the service has to opt-in to retrieve the interactive windows by * setting the {@link AccessibilityServiceInfo#FLAG_RETRIEVE_INTERACTIVE_WINDOWS} * flag. * </p> * * @return The windows of all displays if there are windows and the service is can retrieve * them, otherwise an empty list. The key of SparseArray is display ID. */ @NonNull public final SparseArray<List<AccessibilityWindowInfo>> getWindowsOnAllDisplays() { return AccessibilityInteractionClient.getInstance().getWindowsOnAllDisplays(mConnectionId); } /** * Gets the root node in the currently active window if this service * can retrieve window content. The active window is the one that the user Loading
core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ interface IAccessibilityServiceConnection { AccessibilityWindowInfo getWindow(int windowId); List<AccessibilityWindowInfo> getWindows(); AccessibilityWindowInfo.WindowListSparseArray getWindows(); AccessibilityServiceInfo getServiceInfo(); Loading
core/java/android/app/UiAutomation.java +31 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.util.Log; import android.util.SparseArray; import android.view.Display; import android.view.InputEvent; import android.view.KeyEvent; Loading Loading @@ -535,7 +536,7 @@ public final class UiAutomation { } /** * Gets the windows on the screen. This method returns only the windows * Gets the windows on the screen of the default display. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. * For example, if there is a modal dialog shown and the user cannot touch * anything behind it, then only the modal window will be reported Loading @@ -561,6 +562,35 @@ public final class UiAutomation { .getWindows(connectionId); } /** * Gets the windows on the screen of all displays. This method returns only the windows * that a sighted user can interact with, as opposed to all windows. * For example, if there is a modal dialog shown and the user cannot touch * anything behind it, then only the modal window will be reported * (assuming it is the top one). For convenience the returned windows * are ordered in a descending layer order, which is the windows that * are higher in the Z-order are reported first. * <p> * <strong>Note:</strong> In order to access the windows you have to opt-in * to retrieve the interactive windows by setting the * {@link AccessibilityServiceInfo#FLAG_RETRIEVE_INTERACTIVE_WINDOWS} flag. * </p> * * @return The windows of all displays if there are windows and the service is can retrieve * them, otherwise an empty list. The key of SparseArray is display ID. */ @NonNull public SparseArray<List<AccessibilityWindowInfo>> getWindowsOnAllDisplays() { final int connectionId; synchronized (mLock) { throwIfNotConnectedLocked(); connectionId = mConnectionId; } // Calling out without a lock held. return AccessibilityInteractionClient.getInstance() .getWindowsOnAllDisplays(connectionId); } /** * Gets the root {@link AccessibilityNodeInfo} in the active window. * Loading
core/java/android/view/accessibility/AccessibilityInteractionClient.java +25 −10 Original line number Diff line number Diff line Loading @@ -259,23 +259,38 @@ public final class AccessibilityInteractionClient } /** * Gets the info for all windows. * Gets the info for all windows of the default display. * * @param connectionId The id of a connection for interacting with the system. * @return The {@link AccessibilityWindowInfo} list. */ public List<AccessibilityWindowInfo> getWindows(int connectionId) { final SparseArray<List<AccessibilityWindowInfo>> windows = getWindowsOnAllDisplays(connectionId); if (windows.size() > 0) { return windows.valueAt(Display.DEFAULT_DISPLAY); } return Collections.emptyList(); } /** * Gets the info for all windows of all displays. * * @param connectionId The id of a connection for interacting with the system. * @return The SparseArray of {@link AccessibilityWindowInfo} list. * The key of SparseArray is display ID. */ public SparseArray<List<AccessibilityWindowInfo>> getWindowsOnAllDisplays(int connectionId) { try { IAccessibilityServiceConnection connection = getConnection(connectionId); if (connection != null) { SparseArray<List<AccessibilityWindowInfo>> allWindows = SparseArray<List<AccessibilityWindowInfo>> windows = sAccessibilityCache.getWindowsOnAllDisplays(); List<AccessibilityWindowInfo> windows; if (allWindows != null) { if (windows != null) { if (DEBUG) { Log.i(LOG_TAG, "Windows cache hit"); } return allWindows.valueAt(Display.DEFAULT_DISPLAY); return windows; } if (DEBUG) { Log.i(LOG_TAG, "Windows cache miss"); Loading @@ -287,9 +302,7 @@ public final class AccessibilityInteractionClient Binder.restoreCallingIdentity(identityToken); } if (windows != null) { allWindows = new SparseArray<>(); allWindows.put(Display.DEFAULT_DISPLAY, windows); sAccessibilityCache.setWindowsOnAllDisplays(allWindows); sAccessibilityCache.setWindowsOnAllDisplays(windows); return windows; } } else { Loading @@ -298,9 +311,11 @@ public final class AccessibilityInteractionClient } } } catch (RemoteException re) { Log.e(LOG_TAG, "Error while calling remote getWindows", re); Log.e(LOG_TAG, "Error while calling remote getWindowsOnAllDisplays", re); } return Collections.emptyList(); final SparseArray<List<AccessibilityWindowInfo>> emptyWindows = new SparseArray<>(); return emptyWindows; } /** Loading