libsurfaceflinger: handle WINDOW_TYPE_DONT_SCREENSHOT
When a layer has type WINDOW_TYPE_DONT_SCREENSHOT, hide it from
everywhere but the primary display. This should be reverted when we
switch to use layer hierarchy properly.
Bug: 63311708
Test: screencap, screenrecord, android.view.cts.SurfaceViewSyncTest
Change-Id: I6a8d6b93399b0dc42832588f9a6c5e8879a8b754
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 392479f..2306d1a 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -166,6 +166,8 @@
virtual ~Layer();
+ void setPrimaryDisplayOnly() { mPrimaryDisplayOnly = true; }
+
// the this layer's size and format
status_t setBuffers(uint32_t w, uint32_t h, PixelFormat format, uint32_t flags);
@@ -249,6 +251,10 @@
uint32_t getTransactionFlags(uint32_t flags);
uint32_t setTransactionFlags(uint32_t flags);
+ bool belongsToDisplay(uint32_t layerStack, bool isPrimaryDisplay) const {
+ return getLayerStack() == layerStack && (!mPrimaryDisplayOnly || isPrimaryDisplay);
+ }
+
void computeGeometry(const sp<const DisplayDevice>& hw, Mesh& mesh,
bool useIdentityTransform) const;
Rect computeBounds(const Region& activeTransparentRegion) const;
@@ -701,6 +707,8 @@
String8 mTransactionName; // A cached version of "TX - " + mName for systraces
PixelFormat mFormat;
+ bool mPrimaryDisplayOnly = false;
+
// these are protected by an external lock
State mCurrentState;
State mDrawingState;