Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff3d20e1 authored by Robert Carr's avatar Robert Carr Committed by android-build-team Robot
Browse files

SurfaceFlinger: Fix removal check when adding child layers.

Traversing the current state has the same problem we had in other
CL's with relative Z. In this case if there was a parent that
was relative-Zed then it's Z relative is removed, we will be unable
to add children to it until we assign it a new layer. However there's
no reason to traverse, we can just use the new "isPendingRemoval"
flag to detect this state.

Bug: 69633137
Test: Existing tests pass.
Change-Id: I4584f051346fe77c3e6158a04dd1279a86164476
(cherry picked from commit ebd62af1)
parent 2e5c86b3
Loading
Loading
Loading
Loading
+1 −8
Original line number Original line Diff line number Diff line
@@ -2869,14 +2869,7 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client,
        if (parent == nullptr) {
        if (parent == nullptr) {
            mCurrentState.layersSortedByZ.add(lbc);
            mCurrentState.layersSortedByZ.add(lbc);
        } else {
        } else {
            bool found = false;
            if (parent->isPendingRemoval()) {
            mCurrentState.traverseInZOrder([&](Layer* layer) {
                if (layer == parent.get()) {
                    found = true;
                }
            });

            if (!found) {
                ALOGE("addClientLayer called with a removed parent");
                ALOGE("addClientLayer called with a removed parent");
                return NAME_NOT_FOUND;
                return NAME_NOT_FOUND;
            }
            }