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

Commit f7174e87 authored by Svetoslav's avatar Svetoslav
Browse files

Fix backwards compatibility for introspected windows.

1. The APIs for introspecting interactive windows were reporting only
   the touchable windows but were missing the focused window. The user
   can interact with the latter by typing, hence it should always be
   reported. Also this was breaking backwards compatibility as if the
   focused window is covered by a modal one, the focused window was not
   reporeted and this was putting the active window in a bad state as
   the latter is either the focused window or the one the user is touching.

2. Window change events are too frequent as on window transition things
   are chanign a lot. Now we are trottling the windows changed events
   at the standard recurring accessibility event interval.

3. Fixed a wrong flag comparison and removed some unneded code.

buy:15434666
bug:15432989

Change-Id: I825b33067e8cbf26396a4d38642bde4907b6427a
parent 02a9c359
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -462,7 +462,9 @@ public abstract class AccessibilityService extends Service {
     * 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.
     * are higher in the Z-order 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
+2 −2
Original line number Diff line number Diff line
@@ -286,8 +286,8 @@ public class AccessibilityServiceInfo implements Parcelable {
    /**
     * This flag indicates to the system that the accessibility service wants
     * to access content of all interactive windows. An interactive window is a
     * window that can be touched by a sighted user when explore by touch is not
     * enabled. If this flag is not set your service will not receive
     * window that has input focus or can be touched by a sighted user when explore
     * by touch is not enabled. If this flag is not set your service will not receive
     * {@link android.view.accessibility.AccessibilityEvent#TYPE_WINDOWS_CHANGED}
     * events, calling AccessibilityService{@link AccessibilityService#getWindows()
     * AccessibilityService.getWindows()} will return an empty list, and {@link
+16 −16
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ interface IWindowSession {
    /**
     * Notifies that a rectangle on the screen has been requested.
     */
    void onRectangleOnScreenRequested(IBinder token, in Rect rectangle, boolean immediate);
    void onRectangleOnScreenRequested(IBinder token, in Rect rectangle);

    IWindowId getWindowId(IBinder window);
}
+1 −1
Original line number Diff line number Diff line
@@ -6215,7 +6215,7 @@ public final class ViewRootImpl implements ViewParent,
            mTempRect.offset(0, -mCurScrollY);
            mTempRect.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop);
            try {
                mWindowSession.onRectangleOnScreenRequested(mWindow, mTempRect, immediate);
                mWindowSession.onRectangleOnScreenRequested(mWindow, mTempRect);
            } catch (RemoteException re) {
                /* ignore */
            }
+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ public class WindowInfo implements Parcelable {
        builder.append("type=").append(type);
        builder.append(", layer=").append(layer);
        builder.append(", token=").append(token);
        builder.append(", bounds=").append(boundsInScreen);
        builder.append(", parent=").append(parentToken);
        builder.append(", focused=").append(focused);
        builder.append(", children=").append(childTokens);
Loading