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

Commit 321b208f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "fw_container"

* changes:
  DO NOT MERGE Set ContainerLayer for buffer-less surface
  DO NOT MERGE: WM: Restrict SC Builder to set a single surface type
  Implement construction of container layers
parents 0d7970f4 ff674ee4
Loading
Loading
Loading
Loading
+39 −2
Original line number Diff line number Diff line
@@ -267,6 +267,13 @@ public class SurfaceControl implements Parcelable {
     */
    public static final int FX_SURFACE_DIM = 0x00020000;

    /**
     * Surface creation flag: Creates a container surface.
     * This surface will have no buffers and will only be used
     * as a container for other surfaces, or for its InputInfo.
     */
    public static final int FX_SURFACE_CONTAINER = 0x00080000;

    /**
     * Mask used for FX values above.
     *
@@ -523,13 +530,38 @@ public class SurfaceControl implements Parcelable {
         */
        public Builder setColorLayer(boolean isColorLayer) {
            if (isColorLayer) {
                mFlags |= FX_SURFACE_DIM;
                setFlags(FX_SURFACE_DIM, FX_SURFACE_MASK);
            } else {
                setBufferLayer();
            }
            return this;
        }

        /**
         * Indicates whether a 'ContainerLayer' is to be constructed.
         *
         * Container layers will not be rendered in any fashion and instead are used
         * as a parent of renderable layers.
         *
         * @param isContainerLayer Whether to create a container layer.
         */
        public Builder setContainerLayer(boolean isContainerLayer) {
            if (isContainerLayer) {
                setFlags(FX_SURFACE_CONTAINER, FX_SURFACE_MASK);
            } else {
                mFlags &= ~FX_SURFACE_DIM;
                setBufferLayer();
            }
            return this;
        }

        /**
         * Indicates whether a buffer layer is to be constructed.
         *
         */
        public Builder setBufferLayer() {
            return setFlags(FX_SURFACE_NORMAL, FX_SURFACE_MASK);
        }

        /**
         * Set 'Surface creation flags' such as {@link HIDDEN}, {@link SECURE}.
         *
@@ -540,6 +572,11 @@ public class SurfaceControl implements Parcelable {
            mFlags = flags;
            return this;
        }

        private Builder setFlags(int flags, int mask) {
            mFlags = (mFlags & ~mask) | flags;
            return this;
        }
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ class AppWindowThumbnail implements Animatable {
                .setFormat(PixelFormat.TRANSLUCENT)
                .setMetadata(appToken.windowType,
                        window != null ? window.mOwnerUid : Binder.getCallingUid())
                .setBufferLayer()
                .build();

        if (SHOW_TRANSACTIONS) {
+3 −2
Original line number Diff line number Diff line
@@ -773,7 +773,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo

        final SurfaceControl.Builder b = mService.makeSurfaceBuilder(mSession)
                .setSize(mSurfaceSize, mSurfaceSize)
                .setOpaque(true);
                .setOpaque(true)
                .setContainerLayer(true);
        mWindowingLayer = b.setName("Display Root").build();
        mOverlayLayer = b.setName("Display Overlays").build();

@@ -3890,7 +3891,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        SurfaceSession s = child != null ? child.getSession() : getSession();
        final SurfaceControl.Builder b = mService.makeSurfaceBuilder(s);
        b.setSize(mSurfaceSize, mSurfaceSize);

        b.setContainerLayer(true);
        if (child == null) {
            return b;
        }
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ class WindowSurfaceController {

        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "new SurfaceControl");
        final SurfaceControl.Builder b = win.makeSurface()
                .setBufferLayer()
                .setParent(win.getSurfaceControl())
                .setName(name)
                .setSize(w, h)