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

Commit 24b596a5 authored by Melody Hsu's avatar Melody Hsu
Browse files

Flush transactions to ensure new layers are added

A race condition would occur when a new layer was created, but not
yet added by LayerLifecycleManager. Screenshot functions would
attempt to access the created, but unadded layer, resulting an IME
Z-ordering test to create a null buffer in the place of the screenshot
result. Ensure that a transaction flush flag is passed in addClientLayer
so that the LayerLifecycleManager actually adds the layer before it is
accessed.

Fixes: b/424648199
Test: atest ZOrderingTests#testImeScreenshotLayer
Flag: EXEMPT, bug fix
Change-Id: I3d4cc36778f1c31479d0cff98e22e09ee10d7bcb
parent 6bbdcd82
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4809,7 +4809,7 @@ status_t SurfaceFlinger::addClientLayer(LayerCreationArgs& args, const sp<IBinde
        mNewLayerArgs.emplace_back(std::move(args));
    }

    setTransactionFlags(eTransactionNeeded);
    setTransactionFlags(eTransactionFlushNeeded | eTransactionNeeded);
    return NO_ERROR;
}