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

Commit 1134da75 authored by Ameer Armaly's avatar Ameer Armaly
Browse files

Fix overlay API per API review.

Fix: 260713026
Test: atest AccessibilityOverlayTest
Change-Id: I8619f556f8058940f050fb8221ffb51854c63e52
parent cc746067
Loading
Loading
Loading
Loading
+34 −11
Original line number Diff line number Diff line
@@ -3417,11 +3417,22 @@ public abstract class AccessibilityService extends Service {
    }

    /**
     * Attaches a {@link android.view.SurfaceControl} containing an accessibility overlay to the
     * specified display. This type of overlay should be used for content that does not need to
     * track the location and size of Views in the currently active app e.g. service configuration
     * or general service UI. To remove this overlay and free the associated resources, use
     * Attaches a {@link android.view.SurfaceControl} containing an accessibility
     * overlay to the
     * specified display. This type of overlay should be used for content that does
     * not need to
     * track the location and size of Views in the currently active app e.g. service
     * configuration
     * or general service UI. To remove this overlay and free the associated
     * resources, use
     * <code> new SurfaceControl.Transaction().reparent(sc, null).apply();</code>.
     * If the specified overlay has already been attached to the specified display
     * this method does nothing.
     * If the specified overlay has already been attached to a previous display this
     * function will transfer the overlay to the new display.
     * Services can attach multiple overlays. Use
     * <code> new SurfaceControl.Transaction().setLayer(sc, layer).apply();</code>.
     * to coordinate the order of the overlays on screen.
     *
     * @param displayId the display to which the SurfaceControl should be attached.
     * @param sc        the SurfaceControl containing the overlay content
@@ -3436,18 +3447,30 @@ public abstract class AccessibilityService extends Service {
        try {
            connection.attachAccessibilityOverlayToDisplay(displayId, sc);
        } catch (RemoteException re) {
            throw new RuntimeException(re);
            re.rethrowFromSystemServer();
        }
    }

    /**
     * Attaches an accessibility overlay {@link android.view.SurfaceControl} to the specified
     * window. This method should be used when you want the overlay to move and resize as the parent
     * window moves and resizes. To remove this overlay and free the associated resources, use
     * Attaches an accessibility overlay {@link android.view.SurfaceControl} to the
     * specified
     * window. This method should be used when you want the overlay to move and
     * resize as the parent
     * window moves and resizes. To remove this overlay and free the associated
     * resources, use
     * <code> new SurfaceControl.Transaction().reparent(sc, null).apply();</code>.
     *
     * @param accessibilityWindowId The window id, from {@link AccessibilityWindowInfo#getId()}.
     * @param sc the SurfaceControl containing the overlay content
     * If the specified overlay has already been attached to the specified window
     * this method does nothing.
     * If the specified overlay has already been attached to a previous window this
     * function will transfer the overlay to the new window.
     * Services can attach multiple overlays. Use
     * <code> new SurfaceControl.Transaction().setLayer(sc, layer).apply();</code>.
     * to coordinate the order of the overlays on screen.
     *
     * @param accessibilityWindowId The window id, from
     *                              {@link AccessibilityWindowInfo#getId()}.
     * @param sc                    the SurfaceControl containing the overlay
     *                              content
     */
    public void attachAccessibilityOverlayToWindow(
            int accessibilityWindowId, @NonNull SurfaceControl sc) {
+1 −1
Original line number Diff line number Diff line
@@ -1638,7 +1638,7 @@ public final class AccessibilityInteractionClient
                }
                connection.attachAccessibilityOverlayToWindow(accessibilityWindowId, sc);
            } catch (RemoteException re) {
                Log.e(LOG_TAG, "Error while calling remote attachAccessibilityOverlayToWindow", re);
                re.rethrowFromSystemServer();
            }
        }
    }