summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2021-03-10 12:59:54 -0500
committer John Reck <jreck@google.com> 2021-03-12 13:34:22 -0500
commit22be6961e9d4579e926124c5b972c62a45da2451 (patch)
treefca673d7ef87947c9ab33bd216160551022c7530 /libs
parent9281250cbb191a3862bad5b1b740f2e0031c887d (diff)
Expand setBrightness to take BrightnessInfo object
Pass SDR & HDR brightness independently along with calibrated nits value Bug: 182312559 Test: builds & boots Change-Id: If6119c06a30c8f709e1f3982da035a9e088c4e87
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/ISurfaceComposer.cpp9
-rw-r--r--libs/gui/SurfaceComposerClient.cpp2
-rw-r--r--libs/gui/aidl/android/gui/DisplayBrightness.aidl32
-rw-r--r--libs/gui/include/gui/ISurfaceComposer.h7
-rw-r--r--libs/gui/include/gui/SurfaceComposerClient.h3
-rw-r--r--libs/gui/tests/Surface_test.cpp2
6 files changed, 45 insertions, 10 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 989abd9a15..bb8124b65e 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -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) {
@@ -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;
@@ -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;
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 5e8ab929f5..6639440050 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -1998,7 +1998,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);
}
diff --git a/libs/gui/aidl/android/gui/DisplayBrightness.aidl b/libs/gui/aidl/android/gui/DisplayBrightness.aidl
new file mode 100644
index 0000000000..bdb8c63dba
--- /dev/null
+++ b/libs/gui/aidl/android/gui/DisplayBrightness.aidl
@@ -0,0 +1,32 @@
+/*
+ * 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
diff --git a/libs/gui/include/gui/ISurfaceComposer.h b/libs/gui/include/gui/ISurfaceComposer.h
index 88cfe4b9ac..2a9e3f7923 100644
--- a/libs/gui/include/gui/ISurfaceComposer.h
+++ b/libs/gui/include/gui/ISurfaceComposer.h
@@ -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>
@@ -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.
diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h
index de88943cde..df377809ef 100644
--- a/libs/gui/include/gui/SurfaceComposerClient.h
+++ b/libs/gui/include/gui/SurfaceComposerClient.h
@@ -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.
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index e8fb71dc1d..8d7f8c97f4 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -811,7 +811,7 @@ public:
return NO_ERROR;
}
status_t setDisplayBrightness(const sp<IBinder>& /*displayToken*/,
- float /*brightness*/) override {
+ const gui::DisplayBrightness& /*brightness*/) override {
return NO_ERROR;
}