summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorFiona Campbell <flc@google.com>2021-08-17 10:41:11 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-08-17 10:41:11 +0000
commitbbffdece1a27523c4b91603a5cbb45f3e07de222 (patch)
tree963b7c9e5416bdc3ec01a9a9be0cd5f58052d9a0 /core/java/android
parent56f713d7c696e4069cb5e39972a44f7a94e85023 (diff)
parent910c9e55e79e269352dd6ab2476ad4809c2238a7 (diff)
Merge "Add display specific brightness configurations" into sc-v2-dev am: ec29aa264b am: 910c9e55e7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14993593 Change-Id: Ie944fed881ea10f66a9170c89012ad4e9436e428
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/hardware/display/DisplayManager.java28
-rw-r--r--core/java/android/hardware/display/DisplayManagerGlobal.java28
-rw-r--r--core/java/android/hardware/display/IDisplayManager.aidl10
3 files changed, 66 insertions, 0 deletions
diff --git a/core/java/android/hardware/display/DisplayManager.java b/core/java/android/hardware/display/DisplayManager.java
index e13a7b6eac65..5034ef1dfec5 100644
--- a/core/java/android/hardware/display/DisplayManager.java
+++ b/core/java/android/hardware/display/DisplayManager.java
@@ -940,6 +940,34 @@ public final class DisplayManager {
}
/**
+ * Sets the brightness configuration for the specified display.
+ * If the specified display doesn't exist, then this will return and do nothing.
+ *
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS)
+ public void setBrightnessConfigurationForDisplay(@NonNull BrightnessConfiguration c,
+ @NonNull String uniqueId) {
+ mGlobal.setBrightnessConfigurationForDisplay(c, uniqueId, mContext.getUserId(),
+ mContext.getPackageName());
+ }
+
+ /**
+ * Gets the brightness configuration for the specified display and default user.
+ * Returns the default configuration if unset or display is invalid.
+ *
+ * @hide
+ */
+ @Nullable
+ @SystemApi
+ @RequiresPermission(Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS)
+ public BrightnessConfiguration getBrightnessConfigurationForDisplay(
+ @NonNull String uniqueId) {
+ return mGlobal.getBrightnessConfigurationForDisplay(uniqueId, mContext.getUserId());
+ }
+
+ /**
* Sets the global display brightness configuration for a specific user.
*
* Note this requires the INTERACT_ACROSS_USERS permission if setting the configuration for a
diff --git a/core/java/android/hardware/display/DisplayManagerGlobal.java b/core/java/android/hardware/display/DisplayManagerGlobal.java
index a9b95fce8777..3e15c0ee6ebd 100644
--- a/core/java/android/hardware/display/DisplayManagerGlobal.java
+++ b/core/java/android/hardware/display/DisplayManagerGlobal.java
@@ -705,6 +705,34 @@ public final class DisplayManagerGlobal {
}
/**
+ * Sets the brightness configuration for a given display.
+ *
+ * @hide
+ */
+ public void setBrightnessConfigurationForDisplay(BrightnessConfiguration c,
+ String uniqueDisplayId, int userId, String packageName) {
+ try {
+ mDm.setBrightnessConfigurationForDisplay(c, uniqueDisplayId, userId, packageName);
+ } catch (RemoteException ex) {
+ throw ex.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Gets the brightness configuration for a given display or null if one hasn't been set.
+ *
+ * @hide
+ */
+ public BrightnessConfiguration getBrightnessConfigurationForDisplay(String uniqueDisplayId,
+ int userId) {
+ try {
+ return mDm.getBrightnessConfigurationForDisplay(uniqueDisplayId, userId);
+ } catch (RemoteException ex) {
+ throw ex.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Gets the global brightness configuration for a given user or null if one hasn't been set.
*
* @hide
diff --git a/core/java/android/hardware/display/IDisplayManager.aidl b/core/java/android/hardware/display/IDisplayManager.aidl
index 2303353ad101..116214625e26 100644
--- a/core/java/android/hardware/display/IDisplayManager.aidl
+++ b/core/java/android/hardware/display/IDisplayManager.aidl
@@ -118,6 +118,16 @@ interface IDisplayManager {
void setBrightnessConfigurationForUser(in BrightnessConfiguration c, int userId,
String packageName);
+ // Sets the global brightness configuration for a given display. Requires
+ // CONFIGURE_DISPLAY_BRIGHTNESS.
+ void setBrightnessConfigurationForDisplay(in BrightnessConfiguration c, String uniqueDisplayId,
+ int userId, String packageName);
+
+ // Gets the brightness configuration for a given display. Requires
+ // CONFIGURE_DISPLAY_BRIGHTNESS.
+ BrightnessConfiguration getBrightnessConfigurationForDisplay(String uniqueDisplayId,
+ int userId);
+
// Gets the global brightness configuration for a given user. Requires
// CONFIGURE_DISPLAY_BRIGHTNESS, and INTERACT_ACROSS_USER if the user is not
// the same as the calling user.