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

Commit 1c9b3a3e authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Remove explicit creation of SurfaceSession from View" into main

parents 77a2330d 7b44e04e
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -192,7 +192,6 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
    boolean mDrawFinished = false;
    boolean mDrawFinished = false;


    final Rect mScreenRect = new Rect();
    final Rect mScreenRect = new Rect();
    private final SurfaceSession mSurfaceSession = new SurfaceSession();
    private final boolean mLimitedHdrEnabled = Flags.limitedHdr();
    private final boolean mLimitedHdrEnabled = Flags.limitedHdr();


    SurfaceControl mSurfaceControl;
    SurfaceControl mSurfaceControl;
@@ -1549,7 +1548,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
    private void createBlastSurfaceControls(ViewRootImpl viewRoot, String name,
    private void createBlastSurfaceControls(ViewRootImpl viewRoot, String name,
            Transaction surfaceUpdateTransaction) {
            Transaction surfaceUpdateTransaction) {
        if (mSurfaceControl == null) {
        if (mSurfaceControl == null) {
            mSurfaceControl = new SurfaceControl.Builder(mSurfaceSession)
            mSurfaceControl = new SurfaceControl.Builder()
                    .setName(name)
                    .setName(name)
                    .setLocalOwnerView(this)
                    .setLocalOwnerView(this)
                    .setParent(viewRoot.updateAndGetBoundsLayer(surfaceUpdateTransaction))
                    .setParent(viewRoot.updateAndGetBoundsLayer(surfaceUpdateTransaction))
@@ -1559,7 +1558,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
        }
        }


        if (mBlastSurfaceControl == null) {
        if (mBlastSurfaceControl == null) {
            mBlastSurfaceControl = new SurfaceControl.Builder(mSurfaceSession)
            mBlastSurfaceControl = new SurfaceControl.Builder()
                    .setName(name + "(BLAST)")
                    .setName(name + "(BLAST)")
                    .setLocalOwnerView(this)
                    .setLocalOwnerView(this)
                    .setParent(mSurfaceControl)
                    .setParent(mSurfaceControl)
@@ -1577,7 +1576,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
        }
        }


        if (mBackgroundControl == null) {
        if (mBackgroundControl == null) {
            mBackgroundControl = new SurfaceControl.Builder(mSurfaceSession)
            mBackgroundControl = new SurfaceControl.Builder()
                    .setName("Background for " + name)
                    .setName("Background for " + name)
                    .setLocalOwnerView(this)
                    .setLocalOwnerView(this)
                    .setOpaque(true)
                    .setOpaque(true)
+1 −3
Original line number Original line Diff line number Diff line
@@ -29217,8 +29217,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                    + " shadowX=" + shadowTouchPoint.x + " shadowY=" + shadowTouchPoint.y);
                    + " shadowX=" + shadowTouchPoint.x + " shadowY=" + shadowTouchPoint.y);
        }
        }
        final SurfaceSession session = new SurfaceSession();
        final SurfaceControl surfaceControl = new SurfaceControl.Builder()
        final SurfaceControl surfaceControl = new SurfaceControl.Builder(session)
                .setName("drag surface")
                .setName("drag surface")
                .setParent(root.getSurfaceControl())
                .setParent(root.getSurfaceControl())
                .setBufferSize(shadowSize.x, shadowSize.y)
                .setBufferSize(shadowSize.x, shadowSize.y)
@@ -29284,7 +29283,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            if (token == null) {
            if (token == null) {
                surface.destroy();
                surface.destroy();
            }
            }
            session.kill();
            surfaceControl.release();
            surfaceControl.release();
        }
        }
    }
    }
+1 −2
Original line number Original line Diff line number Diff line
@@ -841,7 +841,6 @@ public final class ViewRootImpl implements ViewParent,
     * surfaces can ensure they do not draw into the surface inset region set by the parent window.
     * surfaces can ensure they do not draw into the surface inset region set by the parent window.
     */
     */
    private SurfaceControl mBoundsLayer;
    private SurfaceControl mBoundsLayer;
    private final SurfaceSession mSurfaceSession = new SurfaceSession();
    private final Transaction mTransaction = new Transaction();
    private final Transaction mTransaction = new Transaction();
    private final Transaction mFrameRateTransaction = new Transaction();
    private final Transaction mFrameRateTransaction = new Transaction();
@@ -2712,7 +2711,7 @@ public final class ViewRootImpl implements ViewParent,
     */
     */
    public SurfaceControl updateAndGetBoundsLayer(Transaction t) {
    public SurfaceControl updateAndGetBoundsLayer(Transaction t) {
        if (mBoundsLayer == null) {
        if (mBoundsLayer == null) {
            mBoundsLayer = new SurfaceControl.Builder(mSurfaceSession)
            mBoundsLayer = new SurfaceControl.Builder()
                    .setContainerLayer()
                    .setContainerLayer()
                    .setName("Bounds for - " + getTitle().toString())
                    .setName("Bounds for - " + getTitle().toString())
                    .setParent(getSurfaceControl())
                    .setParent(getSurfaceControl())
+2 −3
Original line number Original line Diff line number Diff line
@@ -86,7 +86,6 @@ public class WindowlessWindowManager implements IWindowSession {
    final HashMap<IBinder, ResizeCompleteCallback> mResizeCompletionForWindow =
    final HashMap<IBinder, ResizeCompleteCallback> mResizeCompletionForWindow =
        new HashMap<IBinder, ResizeCompleteCallback>();
        new HashMap<IBinder, ResizeCompleteCallback>();


    private final SurfaceSession mSurfaceSession = new SurfaceSession();
    protected final SurfaceControl mRootSurface;
    protected final SurfaceControl mRootSurface;
    private final Configuration mConfiguration;
    private final Configuration mConfiguration;
    private final IWindowSession mRealWm;
    private final IWindowSession mRealWm;
@@ -184,13 +183,13 @@ public class WindowlessWindowManager implements IWindowSession {
            InputChannel outInputChannel, InsetsState outInsetsState,
            InputChannel outInputChannel, InsetsState outInsetsState,
            InsetsSourceControl.Array outActiveControls, Rect outAttachedFrame,
            InsetsSourceControl.Array outActiveControls, Rect outAttachedFrame,
            float[] outSizeCompatScale) {
            float[] outSizeCompatScale) {
        final SurfaceControl leash = new SurfaceControl.Builder(mSurfaceSession)
        final SurfaceControl leash = new SurfaceControl.Builder()
                .setName(attrs.getTitle().toString() + "Leash")
                .setName(attrs.getTitle().toString() + "Leash")
                .setCallsite("WindowlessWindowManager.addToDisplay")
                .setCallsite("WindowlessWindowManager.addToDisplay")
                .setParent(getParentSurface(window, attrs))
                .setParent(getParentSurface(window, attrs))
                .build();
                .build();


        final SurfaceControl sc = new SurfaceControl.Builder(mSurfaceSession)
        final SurfaceControl sc = new SurfaceControl.Builder()
                .setFormat(attrs.format)
                .setFormat(attrs.format)
                .setBLASTLayer()
                .setBLASTLayer()
                .setName(attrs.getTitle().toString())
                .setName(attrs.getTitle().toString())