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

Commit a1e8046c authored by Yiwei Zhang's avatar Yiwei Zhang Committed by android-build-merger
Browse files

Get screenshot to exclude black cutout

am: f4e02874

Change-Id: I6e3151be8124b9fe8ec743a0a93ad9b8703f973c
parents 1b2f4baf f4e02874
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -4828,6 +4828,16 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display, sp<GraphicBuf
    const sp<const DisplayDevice> device(getDisplayDeviceLocked(display));
    if (CC_UNLIKELY(device == 0)) return BAD_VALUE;

    const Rect& dispScissor = device->getScissor();
    if (!dispScissor.isEmpty()) {
        sourceCrop.set(dispScissor);
        // adb shell screencap will default reqWidth and reqHeight to zeros.
        if (reqWidth == 0 || reqHeight == 0) {
            reqWidth = uint32_t(dispScissor.width());
            reqHeight = uint32_t(dispScissor.height());
        }
    }

    DisplayRenderArea renderArea(device, sourceCrop, reqHeight, reqWidth, rotation);

    auto traverseLayers = std::bind(std::mem_fn(&SurfaceFlinger::traverseLayersInDisplay), this,