Add child layer to parent even if parent is removedFromCurrentState
Test: Open ActivityViewTest and lock screen. App appears the same after
unlocking.
Fixes: 122962243
Change-Id: I1842084db83f77d017851dcd536e7f20ec81c18b
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index bd16d64..a4ef24e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3337,9 +3337,11 @@
}
if (parent == nullptr && addToCurrentState) {
mCurrentState.layersSortedByZ.add(lbc);
- } else if (parent == nullptr || parent->isRemovedFromCurrentState()) {
- ALOGE("addClientLayer called with a removed parent");
- lbc->onRemovedFromCurrentState();
+ } else if (parent == nullptr) {
+ lbc->onRemovedFromCurrentState();
+ } else if (parent->isRemovedFromCurrentState()) {
+ parent->addChild(lbc);
+ lbc->onRemovedFromCurrentState();
} else {
parent->addChild(lbc);
}