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

Commit 3a6e47d2 authored by Lais Andrade's avatar Lais Andrade
Browse files

Replace PowerHint with Boost in SurfaceComposer callback

The current implementation of this callback is only interested in the
PowerHint::INTERACTION, which maps to the new Boost::INTERACTION.

Bug: 150878220
Test: atest DisplayTransactionTest
Change-Id: I9280def43fd3b1f6cb59673a593709dcbed5b53d
parent 103fb09b
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -1060,22 +1060,22 @@ public:
        return NO_ERROR;
    }

    virtual status_t notifyPowerHint(int32_t hintId) {
    virtual status_t notifyPowerBoost(int32_t boostId) {
        Parcel data, reply;
        status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (error != NO_ERROR) {
            ALOGE("notifyPowerHint: failed to write interface token: %d", error);
            ALOGE("notifyPowerBoost: failed to write interface token: %d", error);
            return error;
        }
        error = data.writeInt32(hintId);
        error = data.writeInt32(boostId);
        if (error != NO_ERROR) {
            ALOGE("notifyPowerHint: failed to write hintId: %d", error);
            ALOGE("notifyPowerBoost: failed to write boostId: %d", error);
            return error;
        }
        error = remote()->transact(BnSurfaceComposer::NOTIFY_POWER_HINT, data, &reply,
        error = remote()->transact(BnSurfaceComposer::NOTIFY_POWER_BOOST, data, &reply,
                                   IBinder::FLAG_ONEWAY);
        if (error != NO_ERROR) {
            ALOGE("notifyPowerHint: failed to transact: %d", error);
            ALOGE("notifyPowerBoost: failed to transact: %d", error);
            return error;
        }
        return NO_ERROR;
@@ -1917,15 +1917,15 @@ status_t BnSurfaceComposer::onTransact(
            }
            return setDisplayBrightness(displayToken, brightness);
        }
        case NOTIFY_POWER_HINT: {
        case NOTIFY_POWER_BOOST: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            int32_t hintId;
            status_t error = data.readInt32(&hintId);
            int32_t boostId;
            status_t error = data.readInt32(&boostId);
            if (error != NO_ERROR) {
                ALOGE("notifyPowerHint: failed to read hintId: %d", error);
                ALOGE("notifyPowerBoost: failed to read boostId: %d", error);
                return error;
            }
            return notifyPowerHint(hintId);
            return notifyPowerBoost(boostId);
        }
        case SET_GLOBAL_SHADOW_SETTINGS: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
+2 −2
Original line number Diff line number Diff line
@@ -1842,8 +1842,8 @@ status_t SurfaceComposerClient::setDisplayBrightness(const sp<IBinder>& displayT
    return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness);
}

status_t SurfaceComposerClient::notifyPowerHint(int32_t hintId) {
    return ComposerService::getComposerService()->notifyPowerHint(hintId);
status_t SurfaceComposerClient::notifyPowerBoost(int32_t boostId) {
    return ComposerService::getComposerService()->notifyPowerBoost(boostId);
}

status_t SurfaceComposerClient::setGlobalShadowSettings(const half4& ambientColor,
+5 −5
Original line number Diff line number Diff line
@@ -471,14 +471,14 @@ public:
    virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) = 0;

    /*
     * Sends a power hint to the composer. This function is asynchronous.
     * Sends a power boost to the composer. This function is asynchronous.
     *
     * hintId
     *      hint id according to android::hardware::power::V1_0::PowerHint
     * boostId
     *      boost id according to android::hardware::power::Boost
     *
     * Returns NO_ERROR upon success.
     */
    virtual status_t notifyPowerHint(int32_t hintId) = 0;
    virtual status_t notifyPowerBoost(int32_t boostId) = 0;

    /*
     * Sets the global configuration for all the shadows drawn by SurfaceFlinger. Shadow follows
@@ -566,7 +566,7 @@ public:
        GET_DISPLAY_BRIGHTNESS_SUPPORT,
        SET_DISPLAY_BRIGHTNESS,
        CAPTURE_SCREEN_BY_ID,
        NOTIFY_POWER_HINT,
        NOTIFY_POWER_BOOST,
        SET_GLOBAL_SHADOW_SETTINGS,
        GET_AUTO_LOW_LATENCY_MODE_SUPPORT,
        SET_AUTO_LOW_LATENCY_MODE,
+4 −4
Original line number Diff line number Diff line
@@ -219,14 +219,14 @@ public:
    static status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness);

    /*
     * Sends a power hint to the composer. This function is asynchronous.
     * Sends a power boost to the composer. This function is asynchronous.
     *
     * hintId
     *      hint id according to android::hardware::power::V1_0::PowerHint
     * boostId
     *      boost id according to android::hardware::power::Boost
     *
     * Returns NO_ERROR upon success.
     */
    static status_t notifyPowerHint(int32_t hintId);
    static status_t notifyPowerBoost(int32_t boostId);

    /*
     * Sets the global configuration for all the shadows drawn by SurfaceFlinger. Shadow follows
+1 −1
Original line number Diff line number Diff line
@@ -846,7 +846,7 @@ public:
                                          float* /*outMaxRefreshRate*/) override {
        return NO_ERROR;
    };
    status_t notifyPowerHint(int32_t /*hintId*/) override { return NO_ERROR; }
    status_t notifyPowerBoost(int32_t /*boostId*/) override { return NO_ERROR; }

    status_t setGlobalShadowSettings(const half4& /*ambientColor*/, const half4& /*spotColor*/,
                                     float /*lightPosY*/, float /*lightPosZ*/,
Loading