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

Commit dc004b3f authored by NT Tsai's avatar NT Tsai Committed by Automerger Merge Worker
Browse files

Merge "Fail gracefully when allocating screenshot buffers" into tm-d1-dev am: 4830cd6a

parents e23a168d 4830cd6a
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -6639,8 +6639,13 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::captureScreenCommon(
                                             1 /* layerCount */, usage, "screenshot");

    const status_t bufferStatus = buffer->initCheck();
    LOG_ALWAYS_FATAL_IF(bufferStatus != OK, "captureScreenCommon: Buffer failed to allocate: %d",
                        bufferStatus);
    if (bufferStatus != OK) {
        // Animations may end up being really janky, but don't crash here.
        // Otherwise an irreponsible process may cause an SF crash by allocating
        // too much.
        ALOGE("%s: Buffer failed to allocate: %d", __func__, bufferStatus);
        return ftl::yield<FenceResult>(base::unexpected(bufferStatus)).share();
    }
    const std::shared_ptr<renderengine::ExternalTexture> texture = std::make_shared<
            renderengine::impl::ExternalTexture>(buffer, getRenderEngine(),
                                                 renderengine::impl::ExternalTexture::Usage::