Loading libs/gui/ISurfaceComposer.cpp +60 −0 Original line number Original line Diff line number Diff line Loading @@ -982,6 +982,34 @@ public: return NO_ERROR; return NO_ERROR; } } status_t addHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) override { Parcel data, reply; SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor()); SAFE_PARCEL(data.writeStrongBinder, displayToken); SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(listener)); const status_t error = remote()->transact(BnSurfaceComposer::ADD_HDR_LAYER_INFO_LISTENER, data, &reply); if (error != OK) { ALOGE("addHdrLayerInfoListener: Failed to transact; error = %d", error); } return error; } status_t removeHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) override { Parcel data, reply; SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor()); SAFE_PARCEL(data.writeStrongBinder, displayToken); SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(listener)); const status_t error = remote()->transact(BnSurfaceComposer::REMOVE_HDR_LAYER_INFO_LISTENER, data, &reply); if (error != OK) { ALOGE("removeHdrLayerInfoListener: Failed to transact; error = %d", error); } return error; } status_t notifyPowerBoost(int32_t boostId) override { status_t notifyPowerBoost(int32_t boostId) override { Parcel data, reply; Parcel data, reply; status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); Loading Loading @@ -1862,6 +1890,38 @@ status_t BnSurfaceComposer::onTransact( } } return setDisplayBrightness(displayToken, brightness); return setDisplayBrightness(displayToken, brightness); } } case ADD_HDR_LAYER_INFO_LISTENER: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> displayToken; status_t error = data.readNullableStrongBinder(&displayToken); if (error != NO_ERROR) { ALOGE("addHdrLayerInfoListener: Failed to read display token"); return error; } sp<gui::IHdrLayerInfoListener> listener; error = data.readNullableStrongBinder(&listener); if (error != NO_ERROR) { ALOGE("addHdrLayerInfoListener: Failed to read listener"); return error; } return addHdrLayerInfoListener(displayToken, listener); } case REMOVE_HDR_LAYER_INFO_LISTENER: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> displayToken; status_t error = data.readNullableStrongBinder(&displayToken); if (error != NO_ERROR) { ALOGE("removeHdrLayerInfoListener: Failed to read display token"); return error; } sp<gui::IHdrLayerInfoListener> listener; error = data.readNullableStrongBinder(&listener); if (error != NO_ERROR) { ALOGE("removeHdrLayerInfoListener: Failed to read listener"); return error; } return removeHdrLayerInfoListener(displayToken, listener); } case NOTIFY_POWER_BOOST: { case NOTIFY_POWER_BOOST: { CHECK_INTERFACE(ISurfaceComposer, data, reply); CHECK_INTERFACE(ISurfaceComposer, data, reply); int32_t boostId; int32_t boostId; Loading libs/gui/SurfaceComposerClient.cpp +11 −0 Original line number Original line Diff line number Diff line Loading @@ -2053,6 +2053,17 @@ status_t SurfaceComposerClient::setDisplayBrightness(const sp<IBinder>& displayT return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); } } status_t SurfaceComposerClient::addHdrLayerInfoListener( const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) { return ComposerService::getComposerService()->addHdrLayerInfoListener(displayToken, listener); } status_t SurfaceComposerClient::removeHdrLayerInfoListener( const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) { return ComposerService::getComposerService()->removeHdrLayerInfoListener(displayToken, listener); } status_t SurfaceComposerClient::notifyPowerBoost(int32_t boostId) { status_t SurfaceComposerClient::notifyPowerBoost(int32_t boostId) { return ComposerService::getComposerService()->notifyPowerBoost(boostId); return ComposerService::getComposerService()->notifyPowerBoost(boostId); } } Loading libs/gui/aidl/android/gui/IHdrLayerInfoListener.aidl 0 → 100644 +25 −0 Original line number Original line Diff line number Diff line /* * Copyright 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.gui; /** @hide */ oneway interface IHdrLayerInfoListener { // Callback with the total number of HDR layers, the dimensions of the largest layer, // and a placeholder flags // TODO (b/182312559): Define the flags (likely need an indicator that a UDFPS layer is present) void onHdrLayerInfoChanged(int numberOfHdrLayers, int maxW, int maxH, int flags); } No newline at end of file libs/gui/include/gui/ISurfaceComposer.h +22 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <android/gui/DisplayBrightness.h> #include <android/gui/DisplayBrightness.h> #include <android/gui/IFpsListener.h> #include <android/gui/IFpsListener.h> #include <android/gui/IHdrLayerInfoListener.h> #include <android/gui/IScreenCaptureListener.h> #include <android/gui/IScreenCaptureListener.h> #include <android/gui/ITransactionTraceListener.h> #include <android/gui/ITransactionTraceListener.h> #include <binder/IBinder.h> #include <binder/IBinder.h> Loading Loading @@ -430,6 +431,25 @@ public: virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness) = 0; const gui::DisplayBrightness& brightness) = 0; /* * Adds a listener that receives HDR layer information. This is used in combination * with setDisplayBrightness to adjust the display brightness depending on factors such * as whether or not HDR is in use. * * Returns NO_ERROR upon success or NAME_NOT_FOUND if the display is invalid. */ virtual status_t addHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) = 0; /* * Removes a listener that was added with addHdrLayerInfoListener. * * Returns NO_ERROR upon success, NAME_NOT_FOUND if the display is invalid, and BAD_VALUE if * the listener wasn't registered. * */ virtual status_t removeHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) = 0; /* /* * Sends a power boost to the composer. This function is asynchronous. * Sends a power boost to the composer. This function is asynchronous. * * Loading Loading @@ -578,6 +598,8 @@ public: ADD_FPS_LISTENER, ADD_FPS_LISTENER, REMOVE_FPS_LISTENER, REMOVE_FPS_LISTENER, OVERRIDE_HDR_TYPES, OVERRIDE_HDR_TYPES, ADD_HDR_LAYER_INFO_LISTENER, REMOVE_HDR_LAYER_INFO_LISTENER, // Always append new enum to the end. // Always append new enum to the end. }; }; Loading libs/gui/include/gui/SurfaceComposerClient.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -215,6 +215,11 @@ public: static status_t setDisplayBrightness(const sp<IBinder>& displayToken, static status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness); const gui::DisplayBrightness& brightness); static status_t addHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener); static status_t removeHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener); /* /* * Sends a power boost to the composer. This function is asynchronous. * Sends a power boost to the composer. This function is asynchronous. * * Loading Loading
libs/gui/ISurfaceComposer.cpp +60 −0 Original line number Original line Diff line number Diff line Loading @@ -982,6 +982,34 @@ public: return NO_ERROR; return NO_ERROR; } } status_t addHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) override { Parcel data, reply; SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor()); SAFE_PARCEL(data.writeStrongBinder, displayToken); SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(listener)); const status_t error = remote()->transact(BnSurfaceComposer::ADD_HDR_LAYER_INFO_LISTENER, data, &reply); if (error != OK) { ALOGE("addHdrLayerInfoListener: Failed to transact; error = %d", error); } return error; } status_t removeHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) override { Parcel data, reply; SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor()); SAFE_PARCEL(data.writeStrongBinder, displayToken); SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(listener)); const status_t error = remote()->transact(BnSurfaceComposer::REMOVE_HDR_LAYER_INFO_LISTENER, data, &reply); if (error != OK) { ALOGE("removeHdrLayerInfoListener: Failed to transact; error = %d", error); } return error; } status_t notifyPowerBoost(int32_t boostId) override { status_t notifyPowerBoost(int32_t boostId) override { Parcel data, reply; Parcel data, reply; status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); Loading Loading @@ -1862,6 +1890,38 @@ status_t BnSurfaceComposer::onTransact( } } return setDisplayBrightness(displayToken, brightness); return setDisplayBrightness(displayToken, brightness); } } case ADD_HDR_LAYER_INFO_LISTENER: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> displayToken; status_t error = data.readNullableStrongBinder(&displayToken); if (error != NO_ERROR) { ALOGE("addHdrLayerInfoListener: Failed to read display token"); return error; } sp<gui::IHdrLayerInfoListener> listener; error = data.readNullableStrongBinder(&listener); if (error != NO_ERROR) { ALOGE("addHdrLayerInfoListener: Failed to read listener"); return error; } return addHdrLayerInfoListener(displayToken, listener); } case REMOVE_HDR_LAYER_INFO_LISTENER: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> displayToken; status_t error = data.readNullableStrongBinder(&displayToken); if (error != NO_ERROR) { ALOGE("removeHdrLayerInfoListener: Failed to read display token"); return error; } sp<gui::IHdrLayerInfoListener> listener; error = data.readNullableStrongBinder(&listener); if (error != NO_ERROR) { ALOGE("removeHdrLayerInfoListener: Failed to read listener"); return error; } return removeHdrLayerInfoListener(displayToken, listener); } case NOTIFY_POWER_BOOST: { case NOTIFY_POWER_BOOST: { CHECK_INTERFACE(ISurfaceComposer, data, reply); CHECK_INTERFACE(ISurfaceComposer, data, reply); int32_t boostId; int32_t boostId; Loading
libs/gui/SurfaceComposerClient.cpp +11 −0 Original line number Original line Diff line number Diff line Loading @@ -2053,6 +2053,17 @@ status_t SurfaceComposerClient::setDisplayBrightness(const sp<IBinder>& displayT return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); } } status_t SurfaceComposerClient::addHdrLayerInfoListener( const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) { return ComposerService::getComposerService()->addHdrLayerInfoListener(displayToken, listener); } status_t SurfaceComposerClient::removeHdrLayerInfoListener( const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) { return ComposerService::getComposerService()->removeHdrLayerInfoListener(displayToken, listener); } status_t SurfaceComposerClient::notifyPowerBoost(int32_t boostId) { status_t SurfaceComposerClient::notifyPowerBoost(int32_t boostId) { return ComposerService::getComposerService()->notifyPowerBoost(boostId); return ComposerService::getComposerService()->notifyPowerBoost(boostId); } } Loading
libs/gui/aidl/android/gui/IHdrLayerInfoListener.aidl 0 → 100644 +25 −0 Original line number Original line Diff line number Diff line /* * Copyright 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.gui; /** @hide */ oneway interface IHdrLayerInfoListener { // Callback with the total number of HDR layers, the dimensions of the largest layer, // and a placeholder flags // TODO (b/182312559): Define the flags (likely need an indicator that a UDFPS layer is present) void onHdrLayerInfoChanged(int numberOfHdrLayers, int maxW, int maxH, int flags); } No newline at end of file
libs/gui/include/gui/ISurfaceComposer.h +22 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ #include <android/gui/DisplayBrightness.h> #include <android/gui/DisplayBrightness.h> #include <android/gui/IFpsListener.h> #include <android/gui/IFpsListener.h> #include <android/gui/IHdrLayerInfoListener.h> #include <android/gui/IScreenCaptureListener.h> #include <android/gui/IScreenCaptureListener.h> #include <android/gui/ITransactionTraceListener.h> #include <android/gui/ITransactionTraceListener.h> #include <binder/IBinder.h> #include <binder/IBinder.h> Loading Loading @@ -430,6 +431,25 @@ public: virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness) = 0; const gui::DisplayBrightness& brightness) = 0; /* * Adds a listener that receives HDR layer information. This is used in combination * with setDisplayBrightness to adjust the display brightness depending on factors such * as whether or not HDR is in use. * * Returns NO_ERROR upon success or NAME_NOT_FOUND if the display is invalid. */ virtual status_t addHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) = 0; /* * Removes a listener that was added with addHdrLayerInfoListener. * * Returns NO_ERROR upon success, NAME_NOT_FOUND if the display is invalid, and BAD_VALUE if * the listener wasn't registered. * */ virtual status_t removeHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener) = 0; /* /* * Sends a power boost to the composer. This function is asynchronous. * Sends a power boost to the composer. This function is asynchronous. * * Loading Loading @@ -578,6 +598,8 @@ public: ADD_FPS_LISTENER, ADD_FPS_LISTENER, REMOVE_FPS_LISTENER, REMOVE_FPS_LISTENER, OVERRIDE_HDR_TYPES, OVERRIDE_HDR_TYPES, ADD_HDR_LAYER_INFO_LISTENER, REMOVE_HDR_LAYER_INFO_LISTENER, // Always append new enum to the end. // Always append new enum to the end. }; }; Loading
libs/gui/include/gui/SurfaceComposerClient.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -215,6 +215,11 @@ public: static status_t setDisplayBrightness(const sp<IBinder>& displayToken, static status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness); const gui::DisplayBrightness& brightness); static status_t addHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener); static status_t removeHdrLayerInfoListener(const sp<IBinder>& displayToken, const sp<gui::IHdrLayerInfoListener>& listener); /* /* * Sends a power boost to the composer. This function is asynchronous. * Sends a power boost to the composer. This function is asynchronous. * * Loading