Identify a PIP window and implement hole punch
Bug: 163076219
Test: manual
Test: I53fc851eca876d44ba7cb9347f1c62d659c38932
In order to use a hole punch + device compositing to render a PIP, we
need to find a PIP that follows a CachedSet. A PIP (or, more generally,
a layer that we can render in this way in order to use device
composition more frequently) must have rounded corners and a buffer.
Add LayerFE::hasRoundedCorners (and implement in Layer) to allow
identifying whether a layer has rounded corners.
If a CachedSet has a hole punch layer, use a modified version of its
LayerSettings to draw a transparent round rect into its buffer.
Only active if caching and debug.sf.enable_hole_punch_pip are enabled
and PIPs use rounded corners (as in frameworks/base change
Ib0f61bbcbee6ead82beec2b149b0892836492b78).
Change-Id: I56e2a6debce6ede4bebfcbd32bffa01c20461542
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 9f3ea9a..688a2c3 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -600,6 +600,8 @@
// ignored.
virtual RoundedCornerState getRoundedCornerState() const;
+ bool hasRoundedCorners() const override { return getRoundedCornerState().radius > .0f; }
+
virtual PixelFormat getPixelFormat() const { return PIXEL_FORMAT_NONE; }
/**
* Return whether this layer needs an input info. For most layer types