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 Diff line number Diff line
@@ -755,11 +755,10 @@ public:
        return error;
    }

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

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

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

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