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

Commit 0e3479f8 authored by chaviw's avatar chaviw
Browse files

Remove minLayer and maxLayer from screenshot code.

When taking a full display screenshot, there's no longer a need for min
and max layer. Instead, the entire display will be screenshotted. If
only some layers should be screenshotted, then use the captureLayers method
instead. This was already the case for real code, but required some
clean up in Transaction_test

Test: Transaction_test
Change-Id: I774357b284ca9e026097f79fb7146e4931fa629a
parent 92cf5f6d
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -104,16 +104,13 @@ public:

    virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer,
                                   Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
                                   int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform,
                                   ISurfaceComposer::Rotation rotation) {
                                   bool useIdentityTransform, ISurfaceComposer::Rotation rotation) {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        data.writeStrongBinder(display);
        data.write(sourceCrop);
        data.writeUint32(reqWidth);
        data.writeUint32(reqHeight);
        data.writeInt32(minLayerZ);
        data.writeInt32(maxLayerZ);
        data.writeInt32(static_cast<int32_t>(useIdentityTransform));
        data.writeInt32(static_cast<int32_t>(rotation));
        status_t result = remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply);
@@ -653,13 +650,11 @@ status_t BnSurfaceComposer::onTransact(
            data.read(sourceCrop);
            uint32_t reqWidth = data.readUint32();
            uint32_t reqHeight = data.readUint32();
            int32_t minLayerZ = data.readInt32();
            int32_t maxLayerZ = data.readInt32();
            bool useIdentityTransform = static_cast<bool>(data.readInt32());
            int32_t rotation = data.readInt32();

            status_t res = captureScreen(display, &outBuffer, sourceCrop, reqWidth, reqHeight,
                                         minLayerZ, maxLayerZ, useIdentityTransform,
                                         useIdentityTransform,
                                         static_cast<ISurfaceComposer::Rotation>(rotation));
            reply->writeInt32(res);
            if (res == NO_ERROR) {
+3 −4
Original line number Diff line number Diff line
@@ -876,13 +876,12 @@ status_t SurfaceComposerClient::getHdrCapabilities(const sp<IBinder>& display,
// ----------------------------------------------------------------------------

status_t ScreenshotClient::capture(const sp<IBinder>& display, Rect sourceCrop, uint32_t reqWidth,
                                   uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ,
                                   bool useIdentityTransform, uint32_t rotation,
                                   uint32_t reqHeight, bool useIdentityTransform, uint32_t rotation,
                                   sp<GraphicBuffer>* outBuffer) {
    sp<ISurfaceComposer> s(ComposerService::getComposerService());
    if (s == nullptr) return NO_INIT;
    status_t ret = s->captureScreen(display, outBuffer, sourceCrop, reqWidth, reqHeight, minLayerZ,
                                    maxLayerZ, useIdentityTransform,
    status_t ret = s->captureScreen(display, outBuffer, sourceCrop, reqWidth, reqHeight,
                                    useIdentityTransform,
                                    static_cast<ISurfaceComposer::Rotation>(rotation));
    if (ret != NO_ERROR) {
        return ret;
+1 −2
Original line number Diff line number Diff line
@@ -193,8 +193,7 @@ public:
     */
    virtual status_t captureScreen(const sp<IBinder>& display, sp<GraphicBuffer>* outBuffer,
                                   Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
                                   int32_t minLayerZ, int32_t maxLayerZ, bool useIdentityTransform,
                                   Rotation rotation = eRotateNone) = 0;
                                   bool useIdentityTransform, Rotation rotation = eRotateNone) = 0;

    /**
     * Capture a subtree of the layer hierarchy, potentially ignoring the root node.
+1 −2
Original line number Diff line number Diff line
@@ -326,8 +326,7 @@ public:
    // if cropping isn't required, callers may pass in a default Rect, e.g.:
    //   capture(display, producer, Rect(), reqWidth, ...);
    static status_t capture(const sp<IBinder>& display, Rect sourceCrop, uint32_t reqWidth,
                            uint32_t reqHeight, int32_t minLayerZ, int32_t maxLayerZ,
                            bool useIdentityTransform, uint32_t rotation,
                            uint32_t reqHeight, bool useIdentityTransform, uint32_t rotation,
                            sp<GraphicBuffer>* outBuffer);
    static status_t captureLayers(const sp<IBinder>& layerHandle, Rect sourceCrop, float frameScale,
                                  sp<GraphicBuffer>* outBuffer);
+2 −3
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersSucceed) {
            ISurfaceComposer::eDisplayIdMain));
    sp<GraphicBuffer> outBuffer;
    ASSERT_EQ(NO_ERROR, sf->captureScreen(display, &outBuffer, Rect(),
            64, 64, 0, 0x7fffffff, false));
            64, 64, false));

    ASSERT_EQ(NO_ERROR, native_window_api_connect(anw.get(),
            NATIVE_WINDOW_API_CPU));
@@ -166,7 +166,7 @@ TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersSucceed) {
        ASSERT_EQ(NO_ERROR, anw->queueBuffer(anw.get(), buf, -1));
    }
    ASSERT_EQ(NO_ERROR, sf->captureScreen(display, &outBuffer, Rect(),
            64, 64, 0, 0x7fffffff, false));
            64, 64, false));
}

TEST_F(SurfaceTest, ConcreteTypeIsSurface) {
@@ -599,7 +599,6 @@ public:
    status_t captureScreen(const sp<IBinder>& /*display*/,
            sp<GraphicBuffer>* /*outBuffer*/,
            Rect /*sourceCrop*/, uint32_t /*reqWidth*/, uint32_t /*reqHeight*/,
            int32_t /*minLayerZ*/, int32_t /*maxLayerZ*/,
            bool /*useIdentityTransform*/,
            Rotation /*rotation*/) override { return NO_ERROR; }
    virtual status_t captureLayers(const sp<IBinder>& /*parentHandle*/,
Loading