Merge "Make night display auto mode system API"
diff --git a/api/system-current.txt b/api/system-current.txt
index 327006e..fe2b4d9 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1812,9 +1812,16 @@
}
public final class ColorDisplayManager {
+ method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public int getNightDisplayAutoMode();
method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public int getTransformCapabilities();
method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setAppSaturationLevel(@NonNull String, @IntRange(from=0, to=100) int);
+ method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setNightDisplayAutoMode(int);
+ method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setNightDisplayCustomEndTime(@NonNull java.time.LocalTime);
+ method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setNightDisplayCustomStartTime(@NonNull java.time.LocalTime);
method @RequiresPermission(android.Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS) public boolean setSaturationLevel(@IntRange(from=0, to=100) int);
+ field public static final int AUTO_MODE_CUSTOM_TIME = 1; // 0x1
+ field public static final int AUTO_MODE_DISABLED = 0; // 0x0
+ field public static final int AUTO_MODE_TWILIGHT = 2; // 0x2
field public static final int CAPABILITY_HARDWARE_ACCELERATION_GLOBAL = 2; // 0x2
field public static final int CAPABILITY_HARDWARE_ACCELERATION_PER_APP = 4; // 0x4
field public static final int CAPABILITY_NONE = 0; // 0x0
diff --git a/core/java/android/hardware/display/ColorDisplayManager.java b/core/java/android/hardware/display/ColorDisplayManager.java
index ae5b003..28e9535 100644
--- a/core/java/android/hardware/display/ColorDisplayManager.java
+++ b/core/java/android/hardware/display/ColorDisplayManager.java
@@ -100,6 +100,7 @@
*
* @hide
*/
+ @SystemApi
public static final int AUTO_MODE_DISABLED = 0;
/**
* Auto mode value to automatically activate Night display at a specific start and end time.
@@ -110,6 +111,7 @@
*
* @hide
*/
+ @SystemApi
public static final int AUTO_MODE_CUSTOM_TIME = 1;
/**
* Auto mode value to automatically activate Night display from sunset to sunrise.
@@ -118,6 +120,7 @@
*
* @hide
*/
+ @SystemApi
public static final int AUTO_MODE_TWILIGHT = 2;
private final ColorDisplayManagerInternal mManager;
@@ -175,6 +178,8 @@
*
* @hide
*/
+ @SystemApi
+ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS)
public @AutoMode int getNightDisplayAutoMode() {
return mManager.getNightDisplayAutoMode();
}
@@ -199,6 +204,8 @@
*
* @hide
*/
+ @SystemApi
+ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS)
public boolean setNightDisplayAutoMode(@AutoMode int autoMode) {
if (autoMode != AUTO_MODE_DISABLED
&& autoMode != AUTO_MODE_CUSTOM_TIME
@@ -233,6 +240,8 @@
*
* @hide
*/
+ @SystemApi
+ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS)
public boolean setNightDisplayCustomStartTime(@NonNull LocalTime startTime) {
if (startTime == null) {
throw new IllegalArgumentException("startTime cannot be null");
@@ -263,6 +272,8 @@
*
* @hide
*/
+ @SystemApi
+ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS)
public boolean setNightDisplayCustomEndTime(@NonNull LocalTime endTime) {
if (endTime == null) {
throw new IllegalArgumentException("endTime cannot be null");