final IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
mRootSurfaceControl = new SurfaceControl.Builder(surfaceSession)
- .setContainerLayer(true)
+ .setContainerLayer()
.setParent(mSurfaceView.getSurfaceControl())
.setName(DISPLAY_NAME)
.build();
}
mWidth = width;
mHeight = height;
- return this;
+ // set this as a buffer layer since we are specifying a buffer size.
+ return setFlags(FX_SURFACE_NORMAL, FX_SURFACE_MASK);
+ }
+
+ /**
+ * Set the initial size of the controlled surface's buffers in pixels.
+ */
+ private void unsetBufferSize() {
+ mWidth = 0;
+ mHeight = 0;
}
/**
* Color layers will not have an associated BufferQueue and will instead always render a
* solid color (that is, solid before plane alpha). Currently that color is black.
*
- * @param isColorLayer Whether to create a color layer.
* @hide
*/
- public Builder setColorLayer(boolean isColorLayer) {
- if (isColorLayer) {
- mFlags |= FX_SURFACE_DIM;
- } else {
- mFlags &= ~FX_SURFACE_DIM;
- }
- return this;
+ public Builder setColorLayer() {
+ unsetBufferSize();
+ return setFlags(FX_SURFACE_DIM, FX_SURFACE_MASK);
}
private boolean isColorLayerSet() {
* 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.
* @hide
*/
- public Builder setContainerLayer(boolean isContainerLayer) {
- if (isContainerLayer) {
- mFlags |= FX_SURFACE_CONTAINER;
- } else {
- mFlags &= ~FX_SURFACE_CONTAINER;
- }
- return this;
+ public Builder setContainerLayer() {
+ unsetBufferSize();
+ return setFlags(FX_SURFACE_CONTAINER, FX_SURFACE_MASK);
}
private boolean isContainerLayerSet() {
}
/**
- * Set 'Surface creation flags' such as {@link HIDDEN}, {@link SECURE}.
+ * Set 'Surface creation flags' such as {@link #HIDDEN}, {@link #SECURE}.
*
* TODO: Finish conversion to individual builder methods?
* @param flags The combined flags
mFlags = flags;
return this;
}
+
+ private Builder setFlags(int flags, int mask) {
+ mFlags = (mFlags & ~mask) | flags;
+ return this;
+ }
}
/**
import android.graphics.RenderNode;
import android.os.Build;
import android.os.Handler;
-import android.os.IBinder;
import android.os.Looper;
import android.os.SystemClock;
import android.util.AttributeSet;
mBackgroundControl = new SurfaceControl.Builder(mSurfaceSession)
.setName("Background for -" + name)
.setOpaque(true)
- .setColorLayer(true)
+ .setColorLayer()
.setParent(mSurfaceControl)
.build();
final SurfaceControl.Builder builder =
new SurfaceControl.Builder(mSurfaceSession).setName("ColorFade");
if (mMode == MODE_FADE) {
- builder.setColorLayer(true);
+ builder.setColorLayer();
} else {
builder.setBufferSize(mDisplayWidth, mDisplayHeight);
}
surface = dc.makeOverlay()
.setName("BlackSurface")
- .setColorLayer(true)
+ .setColorLayer()
.setParent(null) // TODO: Work-around for b/69259549
.build();
transaction.setWindowCrop(surface, w, h);
private SurfaceControl makeDimLayer() {
return mHost.makeChildSurface(null)
.setParent(mHost.getSurfaceControl())
- .setColorLayer(true)
+ .setColorLayer()
.setName("Dim Layer for - " + mHost.getName())
.build();
}
mDividerControllerLocked = new DockedStackDividerController(service, this);
mPinnedStackControllerLocked = new PinnedStackController(service, this);
- final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(mSession).setOpaque(true);
+ final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(mSession)
+ .setOpaque(true)
+ .setContainerLayer();
mWindowingLayer = b.setName("Display Root").build();
mOverlayLayer = b.setName("Display Overlays").build();
@Override
SurfaceControl.Builder makeChildSurface(WindowContainer child) {
SurfaceSession s = child != null ? child.getSession() : getSession();
- final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(s);
+ final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(s).setContainerLayer();
if (child == null) {
return b;
}
if (mInputSurface == null) {
mInputSurface = mService.makeSurfaceBuilder(mService.mRoot.getDisplayContent(displayId)
- .getSession()).setContainerLayer(true)
+ .getSession()).setContainerLayer()
.setName("Drag and Drop Input Consumer").build();
}
final InputWindowHandle h = getInputWindowHandle();
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
-import android.view.InputChannel;
-import android.view.WindowManager;
-
import android.view.InputApplicationHandle;
+import android.view.InputChannel;
import android.view.InputWindowHandle;
import android.view.SurfaceControl;
-import android.util.Slog;
+import android.view.WindowManager;
import java.io.PrintWriter;
mWindowHandle.scaleFactor = 1.0f;
mInputSurface = mService.makeSurfaceBuilder(mService.mRoot.getDisplayContent(displayId)
- .getSession()).setContainerLayer(true).setName("Input Consumer " + name)
+ .getSession()).setContainerLayer().setName("Input Consumer " + name)
.build();
}
private void createSurface() {
mSurface = mFactory.get().setName("Letterbox - " + mType)
- .setFlags(HIDDEN).setColorLayer(true).build();
+ .setFlags(HIDDEN).setColorLayer().build();
mSurface.setLayer(-1);
mSurface.setColor(new float[]{0, 0, 0});
}
final DisplayContent dc = mService.mRoot.getDisplayContent(displayId);
if (mInputSurface == null) {
mInputSurface = mService.makeSurfaceBuilder(dc.getSession())
- .setContainerLayer(true)
+ .setContainerLayer()
.setName("Drag and Drop Input Consumer").build();
}
import android.util.Slog;
import android.view.DisplayCutout;
import android.view.IWindowSession;
+import android.view.InsetsState;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
-import android.view.InsetsState;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
updateSurfaceBounds();
if (mAnimationBackgroundSurface == null) {
- mAnimationBackgroundSurface = makeChildSurface(null).setColorLayer(true)
+ mAnimationBackgroundSurface = makeChildSurface(null).setColorLayer()
.setName("animation background stackId=" + mStackId)
.build();
}