SF: Add support for boundless layers 2/2
Size is currently used to bound a layer and its child layers. There are
scenarios where we do not want to restrict a layer or its children to any
specific size but have it expand to fill its parent bounds (in the case of a
color layer) or use the size of its buffer. Currently this is achived by providing
a large enough size so that the layer or its children do not get cropped incorrectly.
To fix this, we start by modifying computeBounds and computeScreenBounds
to ignore a layer's size. We calculate the bounds by using the layer's buffer size
and/or crop. In WM, we set the layer's crop property if we want to crop the layer
or child layer to a particular bounds.
Bug: 114413815
Test: go/wm-smoke
Change-Id: I633669876ae434d996532c4d808badabfe3f6787
diff --git a/services/core/java/com/android/server/wm/BlackFrame.java b/services/core/java/com/android/server/wm/BlackFrame.java
index fff1fa4..e5db9b0 100644
--- a/services/core/java/com/android/server/wm/BlackFrame.java
+++ b/services/core/java/com/android/server/wm/BlackFrame.java
@@ -16,21 +16,18 @@
package com.android.server.wm;
-import static android.graphics.PixelFormat.OPAQUE;
-import static android.view.SurfaceControl.FX_SURFACE_DIM;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_SURFACE_ALLOC;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
-import java.io.PrintWriter;
-
import android.graphics.Matrix;
-import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.util.Slog;
import android.view.Surface.OutOfResourcesException;
import android.view.SurfaceControl;
+import java.io.PrintWriter;
+
/**
* Four black surfaces put together to make a black frame.
*/
@@ -55,7 +52,7 @@
.setColorLayer(true)
.setParent(null) // TODO: Work-around for b/69259549
.build();
-
+ transaction.setWindowCrop(surface, w, h);
transaction.setLayerStack(surface, dc.getDisplayId());
transaction.setAlpha(surface, 1);
transaction.setLayer(surface, layer);