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

Commit 2fa2a07f authored by Robert Carr's avatar Robert Carr Committed by Presubmit Automerger Backend
Browse files

[automerge] SurfaceFlinger: Dump on layer leaks 2p: 26b98f42 2p: 5f8dea23

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

Bug: 227286456
Change-Id: Idb561c4b5cec6a92ae150ace7dee9ab964e51ed9
parents ca4d5e18 5f8dea23
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -3595,6 +3595,23 @@ status_t SurfaceFlinger::addClientLayer(const sp<Client>& client, const sp<IBind
    if (mNumLayers >= ISurfaceComposer::MAX_LAYERS) {
        ALOGE("AddClientLayer failed, mNumLayers (%zu) >= MAX_LAYERS (%zu)", mNumLayers.load(),
              ISurfaceComposer::MAX_LAYERS);
        static_cast<void>(mScheduler->schedule([=] {
            ALOGE("Dumping random sampling of on-screen layers: ");
            mDrawingState.traverse([&](Layer *layer) {
                // Aim to dump about 200 layers to avoid totally trashing
                // logcat. On the other hand, if there really are 4096 layers
                // something has gone totally wrong its probably the most
                // useful information in logcat.
                if (rand() % 20 == 13) {
                    ALOGE("Layer: %s", layer->getName().c_str());
                }
            });
            for (Layer* offscreenLayer : mOffscreenLayers) {
                if (rand() % 20 == 13) {
                    ALOGE("Offscreen-layer: %s", offscreenLayer->getName().c_str());
                }
            }
        }));
        return NO_MEMORY;
    }