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

Commit 164aee81 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add getDisplayViewport for screenrecord tool"

parents 8ed0c6f0 cd3f9e92
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
@@ -331,6 +331,34 @@ public:
        return result;
    }

    virtual status_t getDisplayViewport(const sp<IBinder>& display, Rect* outViewport) {
        Parcel data, reply;
        status_t result = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (result != NO_ERROR) {
            ALOGE("getDisplayViewport failed to writeInterfaceToken: %d", result);
            return result;
        }
        result = data.writeStrongBinder(display);
        if (result != NO_ERROR) {
            ALOGE("getDisplayViewport failed to writeStrongBinder: %d", result);
            return result;
        }
        result = remote()->transact(BnSurfaceComposer::GET_DISPLAY_VIEWPORT, data, &reply);
        if (result != NO_ERROR) {
            ALOGE("getDisplayViewport failed to transact: %d", result);
            return result;
        }
        result = reply.readInt32();
        if (result == NO_ERROR) {
            result = reply.read(*outViewport);
            if (result != NO_ERROR) {
                ALOGE("getDisplayViewport failed to read: %d", result);
                return result;
            }
        }
        return result;
    }

    virtual int getActiveConfig(const sp<IBinder>& display)
    {
        Parcel data, reply;
@@ -747,6 +775,26 @@ status_t BnSurfaceComposer::onTransact(
            }
            return NO_ERROR;
        }
        case GET_DISPLAY_VIEWPORT: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            Rect outViewport;
            sp<IBinder> display = nullptr;
            status_t result = data.readStrongBinder(&display);
            if (result != NO_ERROR) {
                ALOGE("getDisplayViewport failed to readStrongBinder: %d", result);
                return result;
            }
            result = getDisplayViewport(display, &outViewport);
            result = reply->writeInt32(result);
            if (result == NO_ERROR) {
                result = reply->write(outViewport);
                if (result != NO_ERROR) {
                    ALOGE("getDisplayViewport failed to write: %d", result);
                    return result;
                }
            }
            return NO_ERROR;
        }
        case GET_ACTIVE_CONFIG: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> display = data.readStrongBinder();
+4 −0
Original line number Diff line number Diff line
@@ -842,6 +842,10 @@ status_t SurfaceComposerClient::getDisplayInfo(const sp<IBinder>& display,
    return NO_ERROR;
}

status_t SurfaceComposerClient::getDisplayViewport(const sp<IBinder>& display, Rect* outViewport) {
    return ComposerService::getComposerService()->getDisplayViewport(display, outViewport);
}

int SurfaceComposerClient::getActiveConfig(const sp<IBinder>& display) {
    return ComposerService::getComposerService()->getActiveConfig(display);
}
+5 −1
Original line number Diff line number Diff line
@@ -157,6 +157,9 @@ public:
    virtual status_t getDisplayStats(const sp<IBinder>& display,
            DisplayStatInfo* stats) = 0;

    /* returns display viewport information of the given display */
    virtual status_t getDisplayViewport(const sp<IBinder>& display, Rect* outViewport) = 0;

    /* indicates which of the configurations returned by getDisplayInfo is
     * currently active */
    virtual int getActiveConfig(const sp<IBinder>& display) = 0;
@@ -250,7 +253,8 @@ public:
        ENABLE_VSYNC_INJECTIONS,
        INJECT_VSYNC,
        GET_LAYER_DEBUG_INFO,
        CREATE_SCOPED_CONNECTION
        CREATE_SCOPED_CONNECTION,
        GET_DISPLAY_VIEWPORT
    };

    virtual status_t onTransact(uint32_t code, const Parcel& data,
+3 −0
Original line number Diff line number Diff line
@@ -79,6 +79,9 @@ public:
    static status_t getDisplayInfo(const sp<IBinder>& display,
            DisplayInfo* info);

    // Get the display viewport for the given display
    static status_t getDisplayViewport(const sp<IBinder>& display, Rect* outViewport);

    // Get the index of the current active configuration (relative to the list
    // returned by getDisplayInfo)
    static int getActiveConfig(const sp<IBinder>& display);
+3 −0
Original line number Diff line number Diff line
@@ -581,6 +581,9 @@ public:
            Vector<DisplayInfo>* /*configs*/) override { return NO_ERROR; }
    status_t getDisplayStats(const sp<IBinder>& /*display*/,
            DisplayStatInfo* /*stats*/) override { return NO_ERROR; }
    status_t getDisplayViewport(const sp<IBinder>& /*display*/, Rect* /*outViewport*/) override {
        return NO_ERROR;
    }
    int getActiveConfig(const sp<IBinder>& /*display*/) override { return 0; }
    status_t setActiveConfig(const sp<IBinder>& /*display*/, int /*id*/)
            override {
Loading