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

Commit 4fa6a5f4 authored by Robert Carr's avatar Robert Carr
Browse files

WindowManagerService: Handle transparent region on client

Since the client owns its own SurfaceControl now, there is no
need to call through to the WM just to set transparent regions.

Bug: 161937501
Test: Existing tests pass
Change-Id: I1767090bc60be72b86879ae806876d49bfa0e06c
parent b610667b
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -122,14 +122,6 @@ interface IWindowSession {
     */
    boolean outOfMemory(IWindow window);

    /**
     * Give the window manager a hint of the part of the window that is
     * completely transparent, allowing it to work with the surface flinger
     * to optimize compositing of this part of the window.
     */
    @UnsupportedAppUsage
    oneway void setTransparentRegion(IWindow window, in Region region);

    /**
     * Tell the window manager about the content and visible insets of the
     * given window, which can be used to adjust the <var>outContentInsets</var>
+8 −5
Original line number Diff line number Diff line
@@ -3063,11 +3063,14 @@ public final class ViewRootImpl implements ViewParent,
                if (!mTransparentRegion.equals(mPreviousTransparentRegion)) {
                    mPreviousTransparentRegion.set(mTransparentRegion);
                    mFullRedrawNeeded = true;
                    // reconfigure window manager
                    try {
                        mWindowSession.setTransparentRegion(mWindow, mTransparentRegion);
                    } catch (RemoteException e) {
                    }
                    // TODO: Ideally we would do this in prepareSurfaces,
                    // but prepareSurfaces is currently working under
                    // the assumption that we paused the render thread
                    // via the WM relayout code path. We probably eventually
                    // want to synchronize transparent region hint changes
                    // with draws.
                    mTransaction.setTransparentRegionHint(getSurfaceControl(),
                        mTransparentRegion).apply();
                }
            }

+1 −5
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public class WindowlessWindowManager implements IWindowSession {
        new HashMap<IBinder, ResizeCompleteCallback>();

    private final SurfaceSession mSurfaceSession = new SurfaceSession();
    private final SurfaceControl mRootSurface;
    protected final SurfaceControl mRootSurface;
    private final Configuration mConfiguration;
    private final IWindowSession mRealWm;
    private final IBinder mHostInputToken;
@@ -301,10 +301,6 @@ public class WindowlessWindowManager implements IWindowSession {
        return false;
    }

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

    @Override
    public void setInsets(android.view.IWindow window, int touchableInsets,
            android.graphics.Rect contentInsets, android.graphics.Rect visibleInsets,
+0 −5
Original line number Diff line number Diff line
@@ -252,11 +252,6 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
        return mService.outOfMemoryWindow(this, window);
    }

    @Override
    public void setTransparentRegion(IWindow window, Region region) {
        mService.setTransparentRegionWindow(this, window, region);
    }

    @Override
    public void setInsets(IWindow window, int touchableInsets,
            Rect contentInsets, Rect visibleInsets, Region touchableArea) {
+0 −17
Original line number Diff line number Diff line
@@ -2148,23 +2148,6 @@ public class WindowManagerService extends IWindowManager.Stub
        Slog.i(tag, s, e);
    }

    void setTransparentRegionWindow(Session session, IWindow client, Region region) {
        final long origId = Binder.clearCallingIdentity();
        try {
            synchronized (mGlobalLock) {
                WindowState w = windowForClientLocked(session, client, false);
                ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE transparentRegionHint=%s: %s",
                        region, w);

                if ((w != null) && w.mHasSurface) {
                    w.mWinAnimator.setTransparentRegionHintLocked(region);
                }
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
    }

    void setInsetsWindow(Session session, IWindow client, int touchableInsets, Rect contentInsets,
            Rect visibleInsets, Region touchableRegion) {
        int uid = Binder.getCallingUid();
Loading