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

Commit 2e812cc6 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Automerger Merge Worker
Browse files

Merge "Remove root layer when clearing mLayersPendingRemoval" into tm-dev am:...

Merge "Remove root layer when clearing mLayersPendingRemoval" into tm-dev am: b089aa57 am: 2e6d26ff

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/17837364



Change-Id: I0dcca110014e2c4526cf61801b1a881549d6f7ce
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a5d63649 2e6d26ff
Loading
Loading
Loading
Loading
+9 −8
Original line number Original line Diff line number Diff line
@@ -3475,6 +3475,15 @@ void SurfaceFlinger::doCommitTransactions() {
                l->latchAndReleaseBuffer();
                l->latchAndReleaseBuffer();
            }
            }


            // If a layer has a parent, we allow it to out-live it's handle
            // with the idea that the parent holds a reference and will eventually
            // be cleaned up. However no one cleans up the top-level so we do so
            // here.
            if (l->isAtRoot()) {
                l->setIsAtRoot(false);
                mCurrentState.layersSortedByZ.remove(l);
            }

            // If the layer has been removed and has no parent, then it will not be reachable
            // If the layer has been removed and has no parent, then it will not be reachable
            // when traversing layers on screen. Add the layer to the offscreenLayers set to
            // when traversing layers on screen. Add the layer to the offscreenLayers set to
            // ensure we can copy its current to drawing state.
            // ensure we can copy its current to drawing state.
@@ -4765,14 +4774,6 @@ void SurfaceFlinger::markLayerPendingRemovalLocked(const sp<Layer>& layer) {


void SurfaceFlinger::onHandleDestroyed(BBinder* handle, sp<Layer>& layer) {
void SurfaceFlinger::onHandleDestroyed(BBinder* handle, sp<Layer>& layer) {
    Mutex::Autolock lock(mStateLock);
    Mutex::Autolock lock(mStateLock);
    // If a layer has a parent, we allow it to out-live it's handle
    // with the idea that the parent holds a reference and will eventually
    // be cleaned up. However no one cleans up the top-level so we do so
    // here.
    if (layer->isAtRoot()) {
        layer->setIsAtRoot(false);
        mCurrentState.layersSortedByZ.remove(layer);
    }
    markLayerPendingRemovalLocked(layer);
    markLayerPendingRemovalLocked(layer);
    mBufferCountTracker.remove(handle);
    mBufferCountTracker.remove(handle);
    layer.clear();
    layer.clear();