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

Commit 7d0eb60e authored by Xin Li's avatar Xin Li
Browse files

DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into stage-aosp-master

Bug: 120502534
Change-Id: I11d008b8f4b846f39dcdd9257e9bd8829b89a462
parents e5e4501c 82fc86b8
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
@@ -332,6 +332,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;
@@ -724,6 +752,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
@@ -718,6 +718,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