Loading libs/gui/ISurfaceComposer.cpp +31 −0 Original line number Original line Diff line number Diff line Loading @@ -955,6 +955,27 @@ public: } } return NO_ERROR; return NO_ERROR; } } virtual status_t notifyPowerHint(int32_t hintId) { Parcel data, reply; status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); if (error != NO_ERROR) { ALOGE("notifyPowerHint: failed to write interface token: %d", error); return error; } error = data.writeInt32(hintId); if (error != NO_ERROR) { ALOGE("notifyPowerHint: failed to write hintId: %d", error); return error; } error = remote()->transact(BnSurfaceComposer::NOTIFY_POWER_HINT, data, &reply, IBinder::FLAG_ONEWAY); if (error != NO_ERROR) { ALOGE("notifyPowerHint: failed to transact: %d", error); return error; } return NO_ERROR; } }; }; // Out-of-line virtual method definition to trigger vtable emission in this // Out-of-line virtual method definition to trigger vtable emission in this Loading Loading @@ -1556,6 +1577,16 @@ status_t BnSurfaceComposer::onTransact( } } return setDisplayBrightness(displayToken, brightness); return setDisplayBrightness(displayToken, brightness); } } case NOTIFY_POWER_HINT: { CHECK_INTERFACE(ISurfaceComposer, data, reply); int32_t hintId; status_t error = data.readInt32(&hintId); if (error != NO_ERROR) { ALOGE("notifyPowerHint: failed to read hintId: %d", error); return error; } return notifyPowerHint(hintId); } default: { default: { return BBinder::onTransact(code, data, reply, flags); return BBinder::onTransact(code, data, reply, flags); } } Loading libs/gui/SurfaceComposerClient.cpp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -1543,6 +1543,10 @@ status_t SurfaceComposerClient::setDisplayBrightness(const sp<IBinder>& displayT return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); } } status_t SurfaceComposerClient::notifyPowerHint(int32_t hintId) { return ComposerService::getComposerService()->notifyPowerHint(hintId); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- status_t ScreenshotClient::capture(const sp<IBinder>& display, const ui::Dataspace reqDataSpace, status_t ScreenshotClient::capture(const sp<IBinder>& display, const ui::Dataspace reqDataSpace, Loading libs/gui/include/gui/ISurfaceComposer.h +11 −0 Original line number Original line Diff line number Diff line Loading @@ -425,6 +425,16 @@ public: */ */ virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) const = 0; float brightness) const = 0; /* * Sends a power hint to the composer. This function is asynchronous. * * hintId * hint id according to android::hardware::power::V1_0::PowerHint * * Returns NO_ERROR upon success. */ virtual status_t notifyPowerHint(int32_t hintId) = 0; }; }; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading Loading @@ -477,6 +487,7 @@ public: GET_DISPLAY_BRIGHTNESS_SUPPORT, GET_DISPLAY_BRIGHTNESS_SUPPORT, SET_DISPLAY_BRIGHTNESS, SET_DISPLAY_BRIGHTNESS, CAPTURE_SCREEN_BY_ID, CAPTURE_SCREEN_BY_ID, NOTIFY_POWER_HINT, // Always append new enum to the end. // Always append new enum to the end. }; }; Loading libs/gui/include/gui/SurfaceComposerClient.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -201,6 +201,16 @@ public: */ */ static status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness); static status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness); /* * Sends a power hint to the composer. This function is asynchronous. * * hintId * hint id according to android::hardware::power::V1_0::PowerHint * * Returns NO_ERROR upon success. */ static status_t notifyPowerHint(int32_t hintId); // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // surface creation / destruction // surface creation / destruction Loading libs/gui/tests/Surface_test.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -704,6 +704,7 @@ public: std::vector<int32_t>* /*outAllowedConfigs*/) override { std::vector<int32_t>* /*outAllowedConfigs*/) override { return NO_ERROR; return NO_ERROR; } } status_t notifyPowerHint(int32_t /*hintId*/) override { return NO_ERROR; } protected: protected: IBinder* onAsBinder() override { return nullptr; } IBinder* onAsBinder() override { return nullptr; } Loading Loading
libs/gui/ISurfaceComposer.cpp +31 −0 Original line number Original line Diff line number Diff line Loading @@ -955,6 +955,27 @@ public: } } return NO_ERROR; return NO_ERROR; } } virtual status_t notifyPowerHint(int32_t hintId) { Parcel data, reply; status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); if (error != NO_ERROR) { ALOGE("notifyPowerHint: failed to write interface token: %d", error); return error; } error = data.writeInt32(hintId); if (error != NO_ERROR) { ALOGE("notifyPowerHint: failed to write hintId: %d", error); return error; } error = remote()->transact(BnSurfaceComposer::NOTIFY_POWER_HINT, data, &reply, IBinder::FLAG_ONEWAY); if (error != NO_ERROR) { ALOGE("notifyPowerHint: failed to transact: %d", error); return error; } return NO_ERROR; } }; }; // Out-of-line virtual method definition to trigger vtable emission in this // Out-of-line virtual method definition to trigger vtable emission in this Loading Loading @@ -1556,6 +1577,16 @@ status_t BnSurfaceComposer::onTransact( } } return setDisplayBrightness(displayToken, brightness); return setDisplayBrightness(displayToken, brightness); } } case NOTIFY_POWER_HINT: { CHECK_INTERFACE(ISurfaceComposer, data, reply); int32_t hintId; status_t error = data.readInt32(&hintId); if (error != NO_ERROR) { ALOGE("notifyPowerHint: failed to read hintId: %d", error); return error; } return notifyPowerHint(hintId); } default: { default: { return BBinder::onTransact(code, data, reply, flags); return BBinder::onTransact(code, data, reply, flags); } } Loading
libs/gui/SurfaceComposerClient.cpp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -1543,6 +1543,10 @@ status_t SurfaceComposerClient::setDisplayBrightness(const sp<IBinder>& displayT return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); } } status_t SurfaceComposerClient::notifyPowerHint(int32_t hintId) { return ComposerService::getComposerService()->notifyPowerHint(hintId); } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- status_t ScreenshotClient::capture(const sp<IBinder>& display, const ui::Dataspace reqDataSpace, status_t ScreenshotClient::capture(const sp<IBinder>& display, const ui::Dataspace reqDataSpace, Loading
libs/gui/include/gui/ISurfaceComposer.h +11 −0 Original line number Original line Diff line number Diff line Loading @@ -425,6 +425,16 @@ public: */ */ virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) const = 0; float brightness) const = 0; /* * Sends a power hint to the composer. This function is asynchronous. * * hintId * hint id according to android::hardware::power::V1_0::PowerHint * * Returns NO_ERROR upon success. */ virtual status_t notifyPowerHint(int32_t hintId) = 0; }; }; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading Loading @@ -477,6 +487,7 @@ public: GET_DISPLAY_BRIGHTNESS_SUPPORT, GET_DISPLAY_BRIGHTNESS_SUPPORT, SET_DISPLAY_BRIGHTNESS, SET_DISPLAY_BRIGHTNESS, CAPTURE_SCREEN_BY_ID, CAPTURE_SCREEN_BY_ID, NOTIFY_POWER_HINT, // Always append new enum to the end. // Always append new enum to the end. }; }; Loading
libs/gui/include/gui/SurfaceComposerClient.h +10 −0 Original line number Original line Diff line number Diff line Loading @@ -201,6 +201,16 @@ public: */ */ static status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness); static status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness); /* * Sends a power hint to the composer. This function is asynchronous. * * hintId * hint id according to android::hardware::power::V1_0::PowerHint * * Returns NO_ERROR upon success. */ static status_t notifyPowerHint(int32_t hintId); // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // surface creation / destruction // surface creation / destruction Loading
libs/gui/tests/Surface_test.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -704,6 +704,7 @@ public: std::vector<int32_t>* /*outAllowedConfigs*/) override { std::vector<int32_t>* /*outAllowedConfigs*/) override { return NO_ERROR; return NO_ERROR; } } status_t notifyPowerHint(int32_t /*hintId*/) override { return NO_ERROR; } protected: protected: IBinder* onAsBinder() override { return nullptr; } IBinder* onAsBinder() override { return nullptr; } Loading