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

Commit f3209b03 authored by Prathmesh Prabhu's avatar Prathmesh Prabhu
Browse files

Do not queue trivial buffer for unsupported screenshot request.

When screenshot is not supported, we queue an empty buffer to the
requesting producer. Besides returning a useless screenshot, this
overwrites the valuable error code, returning ERROR_OK whenever we
successfully return the trivial buffer.

Instead, refuse to queue the trivial buffer, and return the original
error code.

This replaces the workaround proposed in
I6da5d2fdecdef6c87d4dd7b353e2464678800110

BUG:27505438
Change-Id: I597a9be25071d2a6ddafb7d39cc1b09fb48d5fd0
parent 8d1a222f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3440,15 +3440,19 @@ status_t SurfaceFlinger::captureScreenImplLocked(
                    } else {
                        ALOGE("got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot");
                        result = INVALID_OPERATION;
                        window->cancelBuffer(window, buffer, syncFd);
                        buffer = NULL;
                    }
                    // destroy our image
                    eglDestroyImageKHR(mEGLDisplay, image);
                } else {
                    result = BAD_VALUE;
                }
                if (buffer) {
                    // queueBuffer takes ownership of syncFd
                    result = window->queueBuffer(window, buffer, syncFd);
                }
            }
        } else {
            result = BAD_VALUE;
        }
+6 −2
Original line number Diff line number Diff line
@@ -3478,15 +3478,19 @@ status_t SurfaceFlinger::captureScreenImplLocked(
                    } else {
                        ALOGE("got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot");
                        result = INVALID_OPERATION;
                        window->cancelBuffer(window, buffer, syncFd);
                        buffer = NULL;
                    }
                    // destroy our image
                    eglDestroyImageKHR(mEGLDisplay, image);
                } else {
                    result = BAD_VALUE;
                }
                if (buffer) {
                    // queueBuffer takes ownership of syncFd
                    result = window->queueBuffer(window, buffer, syncFd);
                }
            }
        } else {
            result = BAD_VALUE;
        }