Loading services/surfaceflinger/SurfaceFlinger.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -2777,7 +2777,14 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client, if (parent == nullptr) { mCurrentState.layersSortedByZ.add(lbc); } else { if (mCurrentState.layersSortedByZ.indexOf(parent) < 0) { bool found = false; mCurrentState.traverseInZOrder([&](Layer* layer) { if (layer == parent.get()) { found = true; } }); if (!found) { ALOGE("addClientLayer called with a removed parent"); return NAME_NOT_FOUND; } Loading services/surfaceflinger/tests/Transaction_test.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -1152,4 +1152,19 @@ TEST_F(ChildLayerTest, ReparentChild) { } } TEST_F(ChildLayerTest, NestedChildren) { sp<SurfaceControl> grandchild = mComposerClient->createSurface( String8("Grandchild surface"), 10, 10, PIXEL_FORMAT_RGBA_8888, 0, mChild.get()); fillSurfaceRGBA8(grandchild, 50, 50, 50); { ScreenCapture::captureScreen(&mCapture); // Expect the grandchild to begin at 64, 64 because it's a child of mChild layer // which begins at 64, 64 mCapture->checkPixel(64, 64, 50, 50, 50); } } } Loading
services/surfaceflinger/SurfaceFlinger.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -2777,7 +2777,14 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client, if (parent == nullptr) { mCurrentState.layersSortedByZ.add(lbc); } else { if (mCurrentState.layersSortedByZ.indexOf(parent) < 0) { bool found = false; mCurrentState.traverseInZOrder([&](Layer* layer) { if (layer == parent.get()) { found = true; } }); if (!found) { ALOGE("addClientLayer called with a removed parent"); return NAME_NOT_FOUND; } Loading
services/surfaceflinger/tests/Transaction_test.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -1152,4 +1152,19 @@ TEST_F(ChildLayerTest, ReparentChild) { } } TEST_F(ChildLayerTest, NestedChildren) { sp<SurfaceControl> grandchild = mComposerClient->createSurface( String8("Grandchild surface"), 10, 10, PIXEL_FORMAT_RGBA_8888, 0, mChild.get()); fillSurfaceRGBA8(grandchild, 50, 50, 50); { ScreenCapture::captureScreen(&mCapture); // Expect the grandchild to begin at 64, 64 because it's a child of mChild layer // which begins at 64, 64 mCapture->checkPixel(64, 64, 50, 50, 50); } } }