Loading libs/gui/ISurfaceComposer.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -935,7 +935,8 @@ public: return NO_ERROR; } status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) override { status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness) override { Parcel data, reply; status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); if (error != NO_ERROR) { Loading @@ -947,7 +948,7 @@ public: ALOGE("setDisplayBrightness: failed to write display token: %d", error); return error; } error = data.writeFloat(brightness); error = data.writeParcelable(brightness); if (error != NO_ERROR) { ALOGE("setDisplayBrightness: failed to write brightness: %d", error); return error; Loading Loading @@ -1832,8 +1833,8 @@ status_t BnSurfaceComposer::onTransact( ALOGE("setDisplayBrightness: failed to read display token: %d", error); return error; } float brightness = -1.0f; error = data.readFloat(&brightness); gui::DisplayBrightness brightness; error = data.readParcelable(&brightness); if (error != NO_ERROR) { ALOGE("setDisplayBrightness: failed to read brightness: %d", error); return error; Loading libs/gui/SurfaceComposerClient.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1984,7 +1984,7 @@ bool SurfaceComposerClient::getDisplayBrightnessSupport(const sp<IBinder>& displ } status_t SurfaceComposerClient::setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) { const gui::DisplayBrightness& brightness) { return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); } Loading libs/gui/aidl/android/gui/DisplayBrightness.aidl 0 → 100644 +32 −0 Original line number 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 */ parcelable DisplayBrightness { // Range 0-1f, the desired sdr white point brightness float sdrWhitePoint = 0f; // The SDR white point in nits. -1 if unknown float sdrWhitePointNits = -1f; // Range 0-1f, the desired brightness of the display itself. -1f to turn the backlight off float displayBrightness = 0f; // The desired brightness of the display in nits. -1 if unknown float displayBrightnessNits = -1f; } No newline at end of file libs/gui/include/gui/ISurfaceComposer.h +4 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #include <android/gui/DisplayBrightness.h> #include <android/gui/IFpsListener.h> #include <android/gui/IScreenCaptureListener.h> #include <android/gui/ITransactionTraceListener.h> Loading Loading @@ -415,15 +416,15 @@ public: * displayToken * The token of the display whose brightness is set. * brightness * A number between 0.0f (minimum brightness) and 1.0 (maximum brightness), or -1.0f to * turn the backlight off. * The DisplayBrightness info to set on the desired display. * * Returns NO_ERROR upon success. Otherwise, * NAME_NOT_FOUND if the display is invalid, or * BAD_VALUE if the brightness is invalid, or * INVALID_OPERATION if brightness operations are not supported. */ virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) = 0; virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness) = 0; /* * Sends a power boost to the composer. This function is asynchronous. Loading libs/gui/include/gui/SurfaceComposerClient.h +2 −1 Original line number Diff line number Diff line Loading @@ -209,7 +209,8 @@ public: * BAD_VALUE if the brightness value is invalid, or * INVALID_OPERATION if brightness operaetions are not supported. */ static status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness); static status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness); /* * Sends a power boost to the composer. This function is asynchronous. Loading Loading
libs/gui/ISurfaceComposer.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -935,7 +935,8 @@ public: return NO_ERROR; } status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) override { status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness) override { Parcel data, reply; status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); if (error != NO_ERROR) { Loading @@ -947,7 +948,7 @@ public: ALOGE("setDisplayBrightness: failed to write display token: %d", error); return error; } error = data.writeFloat(brightness); error = data.writeParcelable(brightness); if (error != NO_ERROR) { ALOGE("setDisplayBrightness: failed to write brightness: %d", error); return error; Loading Loading @@ -1832,8 +1833,8 @@ status_t BnSurfaceComposer::onTransact( ALOGE("setDisplayBrightness: failed to read display token: %d", error); return error; } float brightness = -1.0f; error = data.readFloat(&brightness); gui::DisplayBrightness brightness; error = data.readParcelable(&brightness); if (error != NO_ERROR) { ALOGE("setDisplayBrightness: failed to read brightness: %d", error); return error; Loading
libs/gui/SurfaceComposerClient.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1984,7 +1984,7 @@ bool SurfaceComposerClient::getDisplayBrightnessSupport(const sp<IBinder>& displ } status_t SurfaceComposerClient::setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) { const gui::DisplayBrightness& brightness) { return ComposerService::getComposerService()->setDisplayBrightness(displayToken, brightness); } Loading
libs/gui/aidl/android/gui/DisplayBrightness.aidl 0 → 100644 +32 −0 Original line number 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 */ parcelable DisplayBrightness { // Range 0-1f, the desired sdr white point brightness float sdrWhitePoint = 0f; // The SDR white point in nits. -1 if unknown float sdrWhitePointNits = -1f; // Range 0-1f, the desired brightness of the display itself. -1f to turn the backlight off float displayBrightness = 0f; // The desired brightness of the display in nits. -1 if unknown float displayBrightnessNits = -1f; } No newline at end of file
libs/gui/include/gui/ISurfaceComposer.h +4 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #pragma once #include <android/gui/DisplayBrightness.h> #include <android/gui/IFpsListener.h> #include <android/gui/IScreenCaptureListener.h> #include <android/gui/ITransactionTraceListener.h> Loading Loading @@ -415,15 +416,15 @@ public: * displayToken * The token of the display whose brightness is set. * brightness * A number between 0.0f (minimum brightness) and 1.0 (maximum brightness), or -1.0f to * turn the backlight off. * The DisplayBrightness info to set on the desired display. * * Returns NO_ERROR upon success. Otherwise, * NAME_NOT_FOUND if the display is invalid, or * BAD_VALUE if the brightness is invalid, or * INVALID_OPERATION if brightness operations are not supported. */ virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness) = 0; virtual status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness) = 0; /* * Sends a power boost to the composer. This function is asynchronous. Loading
libs/gui/include/gui/SurfaceComposerClient.h +2 −1 Original line number Diff line number Diff line Loading @@ -209,7 +209,8 @@ public: * BAD_VALUE if the brightness value is invalid, or * INVALID_OPERATION if brightness operaetions are not supported. */ static status_t setDisplayBrightness(const sp<IBinder>& displayToken, float brightness); static status_t setDisplayBrightness(const sp<IBinder>& displayToken, const gui::DisplayBrightness& brightness); /* * Sends a power boost to the composer. This function is asynchronous. Loading