summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/surfaceflinger/Layer.cpp2
-rw-r--r--services/surfaceflinger/Layer.h2
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp4
-rw-r--r--services/surfaceflinger/tests/Transaction_test.cpp11
4 files changed, 15 insertions, 4 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 44e60edb37..699c85caf9 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1594,7 +1594,7 @@ bool Layer::reparentChildren(const sp<IBinder>& newParentHandle) {
return true;
}
-void Layer::reparentChildrenForDrawing(const sp<Layer>& newParent) {
+void Layer::setChildrenDrawingParent(const sp<Layer>& newParent) {
for (const sp<Layer>& child : mDrawingChildren) {
child->mDrawingParent = newParent;
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 996d686371..15f4330e27 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -287,7 +287,7 @@ public:
bool setOverrideScalingMode(int32_t overrideScalingMode);
void setInfo(uint32_t type, uint32_t appId);
bool reparentChildren(const sp<IBinder>& layer);
- void reparentChildrenForDrawing(const sp<Layer>& layer);
+ void setChildrenDrawingParent(const sp<Layer>& layer);
bool reparent(const sp<IBinder>& newParentHandle);
bool detachChildren();
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 11658e8b49..ba611c6b26 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4460,9 +4460,9 @@ status_t SurfaceFlinger::captureLayers(const sp<IBinder>& layerHandleBinder,
ReparentForDrawing(const sp<Layer>& oldParent, const sp<Layer>& newParent)
: oldParent(oldParent), newParent(newParent) {
- oldParent->reparentChildrenForDrawing(newParent);
+ oldParent->setChildrenDrawingParent(newParent);
}
- ~ReparentForDrawing() { newParent->reparentChildrenForDrawing(oldParent); }
+ ~ReparentForDrawing() { oldParent->setChildrenDrawingParent(oldParent); }
};
void render(std::function<void()> drawLayers) override {
diff --git a/services/surfaceflinger/tests/Transaction_test.cpp b/services/surfaceflinger/tests/Transaction_test.cpp
index fd219913df..4e9db72268 100644
--- a/services/surfaceflinger/tests/Transaction_test.cpp
+++ b/services/surfaceflinger/tests/Transaction_test.cpp
@@ -2384,6 +2384,17 @@ TEST_F(ScreenCaptureChildOnlyTest, CaptureLayerIgnoresTransform) {
verify();
}
+TEST_F(ScreenCaptureChildOnlyTest, RegressionTest76099859) {
+ SurfaceComposerClient::Transaction().hide(mFGSurfaceControl).apply(true);
+
+ // Even though the parent is hidden we should still capture the child.
+ verify();
+
+ // Verify everything was properly hidden when rendering the full-screen.
+ screenshot()->expectBGColor(0,0);
+}
+
+
TEST_F(ScreenCaptureTest, CaptureLayerWithGrandchild) {
auto fgHandle = mFGSurfaceControl->getHandle();