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

Commit 16d88528 authored by Chetan Kalyan's avatar Chetan Kalyan Committed by Giulio Cervera
Browse files

SurfaceFlinger: Prevent screencap command from failure

For secure windows, screen capture fails, and the screencap command
falls back to reading from the framebuffer directly.

Instead, draw a black screen on the framebuffer object if there is a
secure session, so that secure layers cannot be captured.

Change-Id: Ic14ee3f119f622b41f1af3861237204805fb3ca2
CRs-Fixed: 338570
parent a59ff8f9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2481,7 +2481,12 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
        glClear(GL_COLOR_BUFFER_BIT);

        const LayerVector& layers(mDrawingState.layersSortedByZ);
#ifdef QCOM_HARDWARE
        //if we have secure windows, do not draw any layers.
        const size_t count = mSecureFrameBuffer ? 0: layers.size();
#else
        const size_t count = layers.size();
#endif
        for (size_t i=0 ; i<count ; ++i) {
            const sp<LayerBase>& layer(layers[i]);
            const uint32_t flags = layer->drawingState().flags;
@@ -2585,9 +2590,11 @@ status_t SurfaceFlinger::captureScreen(DisplayID dpy,
        virtual bool handler() {
            Mutex::Autolock _l(flinger->mStateLock);

#ifndef QCOM_HARDWARE
            // if we have secure windows, never allow the screen capture
            if (flinger->mSecureFrameBuffer)
                return true;
#endif

            result = flinger->captureScreenImplLocked(dpy,
                    heap, w, h, f, sw, sh, minLayerZ, maxLayerZ);