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

Commit aa0d74e6 authored by chaviw's avatar chaviw
Browse files

Removed regionId from updateTapExcludeRegion request.

There was no need for regionId in the request since you can just replace
the previous region with a new one. This reduces confusion and
simplifies the code. This also allowed TapExcludeRegionHolder to get
deleted and just store the excluded region in the WindowState.

Additionally, this fixed a bug where the excluded region would get
overwritten when the window region was smaller. If the window region was
resized later, the exclude region would remain small.

This is also preparing for more uses of this API with embedded windows
and window magnification.

Test: ActivityViewTest
Change-Id: Ia151115b5a5e8f2ce5e606fe627821dcfef5d9b5
parent 4c3a915c
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -423,7 +423,7 @@ public class TaskEmbedder {
            return;
        }
        reportLocation(mHost.getScreenToTaskMatrix(), mHost.getPositionInWindow());
        applyTapExcludeRegion(mHost.getWindow(), hashCode(), mHost.getTapExcludeRegion());
        applyTapExcludeRegion(mHost.getWindow(), mHost.getTapExcludeRegion());
    }

    /**
@@ -458,13 +458,12 @@ public class TaskEmbedder {
     * {@link #updateLocationAndTapExcludeRegion()}. This method
     * is provided as an optimization when managing multiple TaskSurfaces within a view.
     *
     * @see IWindowSession#updateTapExcludeRegion(IWindow, int, Region)
     * @see IWindowSession#updateTapExcludeRegion(IWindow, Region)
     */
    private void applyTapExcludeRegion(IWindow window, int regionId,
            @Nullable Region tapExcludeRegion) {
    private void applyTapExcludeRegion(IWindow window, @Nullable Region tapExcludeRegion) {
        try {
            IWindowSession session = WindowManagerGlobal.getWindowSession();
            session.updateTapExcludeRegion(window, regionId, tapExcludeRegion);
            session.updateTapExcludeRegion(window, tapExcludeRegion);
        } catch (RemoteException e) {
            e.rethrowAsRuntimeException();
        }
@@ -486,7 +485,7 @@ public class TaskEmbedder {
            Log.w(TAG, "clearTapExcludeRegion: not attached to window!");
            return;
        }
        applyTapExcludeRegion(mHost.getWindow(), hashCode(), null);
        applyTapExcludeRegion(mHost.getWindow(), null);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ interface IWindowSession {
     * will neither be dispatched to this window nor change the focus to this window. Passing an
     * invalid region will remove the area from the exclude region of this window.
     */
    void updateTapExcludeRegion(IWindow window, int regionId, in Region region);
    void updateTapExcludeRegion(IWindow window, in Region region);

    /**
     * Called when the client has changed the local insets state, and now the server should reflect
+1 −1
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ public class WindowlessWindowManager implements IWindowSession {
    }

    @Override
    public void updateTapExcludeRegion(android.view.IWindow window, int regionId,
    public void updateTapExcludeRegion(android.view.IWindow window,
            android.graphics.Region region) {
    }

+1 −1
Original line number Diff line number Diff line
@@ -1309,7 +1309,7 @@ final class AccessibilityController {
                        // If a window has tap exclude region, we need to account it.
                        final Region displayRegion = new Region(windowState.getDisplayFrameLw());
                        final Region tapExcludeRegion = new Region();
                        windowState.amendTapExcludeRegion(tapExcludeRegion);
                        windowState.getTapExcludeRegion(tapExcludeRegion);
                        displayRegion.op(tapExcludeRegion, displayRegion,
                                Region.Op.REVERSE_DIFFERENCE);
                        unaccountedSpace.op(displayRegion, unaccountedSpace,
+4 −1
Original line number Diff line number Diff line
@@ -2489,10 +2489,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
     * @param inOutRegion The region to be amended.
     */
    private void amendWindowTapExcludeRegion(Region inOutRegion) {
        final Region region = Region.obtain();
        for (int i = mTapExcludeProvidingWindows.size() - 1; i >= 0; i--) {
            final WindowState win = mTapExcludeProvidingWindows.valueAt(i);
            win.amendTapExcludeRegion(inOutRegion);
            win.getTapExcludeRegion(region);
            inOutRegion.op(region, Op.UNION);
        }
        region.recycle();
    }

    @Override
Loading