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

Commit 335c73a4 authored by Yiwei Zhang's avatar Yiwei Zhang Committed by Android (Google) Code Review
Browse files

Merge "Support task ID for fps listener rather than SurfaceControl." into sc-dev

parents 7aba0545 a9a68a69
Loading
Loading
Loading
Loading
+5 −6
Original line number Original line Diff line number Diff line
@@ -755,11 +755,10 @@ public:
        return error;
        return error;
    }
    }


    virtual status_t addFpsListener(const sp<IBinder>& layerHandle,
    virtual status_t addFpsListener(int32_t taskId, const sp<gui::IFpsListener>& listener) {
                                    const sp<gui::IFpsListener>& listener) {
        Parcel data, reply;
        Parcel data, reply;
        SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor());
        SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor());
        SAFE_PARCEL(data.writeStrongBinder, layerHandle);
        SAFE_PARCEL(data.writeInt32, taskId);
        SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(listener));
        SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(listener));
        const status_t error =
        const status_t error =
                remote()->transact(BnSurfaceComposer::ADD_FPS_LISTENER, data, &reply);
                remote()->transact(BnSurfaceComposer::ADD_FPS_LISTENER, data, &reply);
@@ -1669,8 +1668,8 @@ status_t BnSurfaceComposer::onTransact(
        }
        }
        case ADD_FPS_LISTENER: {
        case ADD_FPS_LISTENER: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> layerHandle;
            int32_t taskId;
            status_t result = data.readNullableStrongBinder(&layerHandle);
            status_t result = data.readInt32(&taskId);
            if (result != NO_ERROR) {
            if (result != NO_ERROR) {
                ALOGE("addFpsListener: Failed to read layer handle");
                ALOGE("addFpsListener: Failed to read layer handle");
                return result;
                return result;
@@ -1681,7 +1680,7 @@ status_t BnSurfaceComposer::onTransact(
                ALOGE("addFpsListener: Failed to read listener");
                ALOGE("addFpsListener: Failed to read listener");
                return result;
                return result;
            }
            }
            return addFpsListener(layerHandle, listener);
            return addFpsListener(taskId, listener);
        }
        }
        case REMOVE_FPS_LISTENER: {
        case REMOVE_FPS_LISTENER: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
+2 −2
Original line number Original line Diff line number Diff line
@@ -1982,9 +1982,9 @@ status_t SurfaceComposerClient::removeRegionSamplingListener(
    return ComposerService::getComposerService()->removeRegionSamplingListener(listener);
    return ComposerService::getComposerService()->removeRegionSamplingListener(listener);
}
}


status_t SurfaceComposerClient::addFpsListener(const sp<IBinder>& layerHandle,
status_t SurfaceComposerClient::addFpsListener(int32_t taskId,
                                               const sp<gui::IFpsListener>& listener) {
                                               const sp<gui::IFpsListener>& listener) {
    return ComposerService::getComposerService()->addFpsListener(layerHandle, listener);
    return ComposerService::getComposerService()->addFpsListener(taskId, listener);
}
}


status_t SurfaceComposerClient::removeFpsListener(const sp<gui::IFpsListener>& listener) {
status_t SurfaceComposerClient::removeFpsListener(const sp<gui::IFpsListener>& listener) {
+5 −6
Original line number Original line Diff line number Diff line
@@ -351,16 +351,15 @@ public:


    /* Registers a listener that streams fps updates from SurfaceFlinger.
    /* Registers a listener that streams fps updates from SurfaceFlinger.
     *
     *
     * The listener will stream fps updates for the layer tree rooted at layerHandle. Usually, this
     * The listener will stream fps updates for the layer tree rooted at the layer denoted by the
     * should be tied to a task. Layers that are not descendants of that task are out of scope for
     * task ID, i.e., the layer must have the task ID as part of its layer metadata with key
     * FPS computations.
     * METADATA_TASK_ID. If there is no such layer, then no fps is expected to be reported.
     *
     *
     * Multiple listeners may be supported.
     * Multiple listeners may be supported.
     *
     *
     * Requires the ACCESS_SURFACE_FLINGER permission.
     * Requires the READ_FRAME_BUFFER permission.
     */
     */
    virtual status_t addFpsListener(const sp<IBinder>& layerHandle,
    virtual status_t addFpsListener(int32_t taskId, const sp<gui::IFpsListener>& listener) = 0;
                                    const sp<gui::IFpsListener>& listener) = 0;
    /*
    /*
     * Removes a listener that was streaming fps updates from SurfaceFlinger.
     * Removes a listener that was streaming fps updates from SurfaceFlinger.
     */
     */
+1 −2
Original line number Original line Diff line number Diff line
@@ -589,8 +589,7 @@ public:
                                              const sp<IBinder>& stopLayerHandle,
                                              const sp<IBinder>& stopLayerHandle,
                                              const sp<IRegionSamplingListener>& listener);
                                              const sp<IRegionSamplingListener>& listener);
    static status_t removeRegionSamplingListener(const sp<IRegionSamplingListener>& listener);
    static status_t removeRegionSamplingListener(const sp<IRegionSamplingListener>& listener);
    static status_t addFpsListener(const sp<IBinder>& layerHandle,
    static status_t addFpsListener(int32_t taskId, const sp<gui::IFpsListener>& listener);
                                   const sp<gui::IFpsListener>& listener);
    static status_t removeFpsListener(const sp<gui::IFpsListener>& listener);
    static status_t removeFpsListener(const sp<gui::IFpsListener>& listener);


private:
private:
+1 −2
Original line number Original line Diff line number Diff line
@@ -824,8 +824,7 @@ public:
            const sp<IRegionSamplingListener>& /*listener*/) override {
            const sp<IRegionSamplingListener>& /*listener*/) override {
        return NO_ERROR;
        return NO_ERROR;
    }
    }
    status_t addFpsListener(const sp<IBinder>& /*layerHandle*/,
    status_t addFpsListener(int32_t /*taskId*/, const sp<gui::IFpsListener>& /*listener*/) {
                            const sp<gui::IFpsListener>& /*listener*/) {
        return NO_ERROR;
        return NO_ERROR;
    }
    }
    status_t removeFpsListener(const sp<gui::IFpsListener>& /*listener*/) { return NO_ERROR; }
    status_t removeFpsListener(const sp<gui::IFpsListener>& /*listener*/) { return NO_ERROR; }
Loading