Loading core/java/android/hardware/display/DisplayManager.java +40 −0 Original line number Diff line number Diff line Loading @@ -1668,6 +1668,46 @@ public final class DisplayManager { mGlobal.requestDisplayModes(displayId, modeIds); } /** * Gets the mapping between the doze brightness sensor values and brightness values. The doze * brightness sensor is a light sensor used to determine the brightness while the device is * dozing. Light sensor values are typically integers in the rage of 0-4. The returned values * are between {@link PowerManager#BRIGHTNESS_MIN} and {@link PowerManager#BRIGHTNESS_MAX}, or * -1 meaning that the current brightness should be kept. * <p> * Requires the {@link android.Manifest.permission#CONTROL_DISPLAY_BRIGHTNESS} * permission. * </p> * * @param displayId The ID of the display * * @hide */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS) @Nullable public float[] getDozeBrightnessSensorValueToBrightness(int displayId) { return mGlobal.getDozeBrightnessSensorValueToBrightness(displayId); } /** * Gets the default doze brightness. * The returned values are between {@link PowerManager#BRIGHTNESS_MIN} and * {@link PowerManager#BRIGHTNESS_MAX}. * <p> * Requires the {@link android.Manifest.permission#CONTROL_DISPLAY_BRIGHTNESS} * permission. * </p> * * @param displayId The ID of the display * * @hide */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS) @FloatRange(from = 0f, to = 1f) public float getDefaultDozeBrightness(int displayId) { return mGlobal.getDefaultDozeBrightness(displayId); } /** * Listens for changes in available display devices. */ Loading core/java/android/hardware/display/DisplayManagerGlobal.java +27 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.hardware.display.DisplayManager.EventsMask; import static android.view.Display.HdrCapabilities.HdrType; import android.Manifest; import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -1226,6 +1227,32 @@ public final class DisplayManagerGlobal { } } /** * @see DisplayManager#getDozeBrightnessSensorValueToBrightness */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS) @Nullable public float[] getDozeBrightnessSensorValueToBrightness(int displayId) { try { return mDm.getDozeBrightnessSensorValueToBrightness(displayId); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } /** * @see DisplayManager#getDefaultDozeBrightness */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS) @FloatRange(from = 0f, to = 1f) public float getDefaultDozeBrightness(int displayId) { try { return mDm.getDefaultDozeBrightness(displayId); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } private final class DisplayManagerCallback extends IDisplayManagerCallback.Stub { @Override public void onDisplayEvent(int displayId, @DisplayEvent int event) { Loading core/java/android/hardware/display/IDisplayManager.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -246,4 +246,12 @@ interface IDisplayManager { // Restricts display modes to specified modeIds. @EnforcePermission("RESTRICT_DISPLAY_MODES") void requestDisplayModes(in IBinder token, int displayId, in @nullable int[] modeIds); // Get the mapping between the doze brightness sensor values and brightness values @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS") float[] getDozeBrightnessSensorValueToBrightness(int displayId); // Get the default doze brightness @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS") float getDefaultDozeBrightness(int displayId); } core/java/android/os/PowerManager.java +1 −8 Original line number Diff line number Diff line Loading @@ -564,8 +564,7 @@ public final class PowerManager { BRIGHTNESS_CONSTRAINT_TYPE_MINIMUM, BRIGHTNESS_CONSTRAINT_TYPE_MAXIMUM, BRIGHTNESS_CONSTRAINT_TYPE_DEFAULT, BRIGHTNESS_CONSTRAINT_TYPE_DIM, BRIGHTNESS_CONSTRAINT_TYPE_DOZE BRIGHTNESS_CONSTRAINT_TYPE_DIM }) @Retention(RetentionPolicy.SOURCE) public @interface BrightnessConstraint{} Loading Loading @@ -593,12 +592,6 @@ public final class PowerManager { */ public static final int BRIGHTNESS_CONSTRAINT_TYPE_DIM = 3; /** * Brightness constraint type: minimum allowed value. * @hide */ public static final int BRIGHTNESS_CONSTRAINT_TYPE_DOZE = 4; /** * @hide */ Loading packages/SystemUI/res/values/config.xml +2 −1 Original line number Diff line number Diff line Loading @@ -287,7 +287,8 @@ <integer name="doze_small_icon_alpha">222</integer><!-- 87% of 0xff --> <!-- Doze: Table that translates sensor values from the doze_brightness_sensor_type sensor to brightness values; -1 means keeping the current brightness. --> to brightness values in the integer scale [1, 255]; -1 means keeping the current brightness. --> <integer-array name="config_doze_brightness_sensor_to_brightness"> <item>-1</item> <!-- 0: OFF --> <item>2</item> <!-- 1: NIGHT --> Loading Loading
core/java/android/hardware/display/DisplayManager.java +40 −0 Original line number Diff line number Diff line Loading @@ -1668,6 +1668,46 @@ public final class DisplayManager { mGlobal.requestDisplayModes(displayId, modeIds); } /** * Gets the mapping between the doze brightness sensor values and brightness values. The doze * brightness sensor is a light sensor used to determine the brightness while the device is * dozing. Light sensor values are typically integers in the rage of 0-4. The returned values * are between {@link PowerManager#BRIGHTNESS_MIN} and {@link PowerManager#BRIGHTNESS_MAX}, or * -1 meaning that the current brightness should be kept. * <p> * Requires the {@link android.Manifest.permission#CONTROL_DISPLAY_BRIGHTNESS} * permission. * </p> * * @param displayId The ID of the display * * @hide */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS) @Nullable public float[] getDozeBrightnessSensorValueToBrightness(int displayId) { return mGlobal.getDozeBrightnessSensorValueToBrightness(displayId); } /** * Gets the default doze brightness. * The returned values are between {@link PowerManager#BRIGHTNESS_MIN} and * {@link PowerManager#BRIGHTNESS_MAX}. * <p> * Requires the {@link android.Manifest.permission#CONTROL_DISPLAY_BRIGHTNESS} * permission. * </p> * * @param displayId The ID of the display * * @hide */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS) @FloatRange(from = 0f, to = 1f) public float getDefaultDozeBrightness(int displayId) { return mGlobal.getDefaultDozeBrightness(displayId); } /** * Listens for changes in available display devices. */ Loading
core/java/android/hardware/display/DisplayManagerGlobal.java +27 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.hardware.display.DisplayManager.EventsMask; import static android.view.Display.HdrCapabilities.HdrType; import android.Manifest; import android.annotation.FloatRange; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -1226,6 +1227,32 @@ public final class DisplayManagerGlobal { } } /** * @see DisplayManager#getDozeBrightnessSensorValueToBrightness */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS) @Nullable public float[] getDozeBrightnessSensorValueToBrightness(int displayId) { try { return mDm.getDozeBrightnessSensorValueToBrightness(displayId); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } /** * @see DisplayManager#getDefaultDozeBrightness */ @RequiresPermission(Manifest.permission.CONTROL_DISPLAY_BRIGHTNESS) @FloatRange(from = 0f, to = 1f) public float getDefaultDozeBrightness(int displayId) { try { return mDm.getDefaultDozeBrightness(displayId); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } } private final class DisplayManagerCallback extends IDisplayManagerCallback.Stub { @Override public void onDisplayEvent(int displayId, @DisplayEvent int event) { Loading
core/java/android/hardware/display/IDisplayManager.aidl +8 −0 Original line number Diff line number Diff line Loading @@ -246,4 +246,12 @@ interface IDisplayManager { // Restricts display modes to specified modeIds. @EnforcePermission("RESTRICT_DISPLAY_MODES") void requestDisplayModes(in IBinder token, int displayId, in @nullable int[] modeIds); // Get the mapping between the doze brightness sensor values and brightness values @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS") float[] getDozeBrightnessSensorValueToBrightness(int displayId); // Get the default doze brightness @EnforcePermission("CONTROL_DISPLAY_BRIGHTNESS") float getDefaultDozeBrightness(int displayId); }
core/java/android/os/PowerManager.java +1 −8 Original line number Diff line number Diff line Loading @@ -564,8 +564,7 @@ public final class PowerManager { BRIGHTNESS_CONSTRAINT_TYPE_MINIMUM, BRIGHTNESS_CONSTRAINT_TYPE_MAXIMUM, BRIGHTNESS_CONSTRAINT_TYPE_DEFAULT, BRIGHTNESS_CONSTRAINT_TYPE_DIM, BRIGHTNESS_CONSTRAINT_TYPE_DOZE BRIGHTNESS_CONSTRAINT_TYPE_DIM }) @Retention(RetentionPolicy.SOURCE) public @interface BrightnessConstraint{} Loading Loading @@ -593,12 +592,6 @@ public final class PowerManager { */ public static final int BRIGHTNESS_CONSTRAINT_TYPE_DIM = 3; /** * Brightness constraint type: minimum allowed value. * @hide */ public static final int BRIGHTNESS_CONSTRAINT_TYPE_DOZE = 4; /** * @hide */ Loading
packages/SystemUI/res/values/config.xml +2 −1 Original line number Diff line number Diff line Loading @@ -287,7 +287,8 @@ <integer name="doze_small_icon_alpha">222</integer><!-- 87% of 0xff --> <!-- Doze: Table that translates sensor values from the doze_brightness_sensor_type sensor to brightness values; -1 means keeping the current brightness. --> to brightness values in the integer scale [1, 255]; -1 means keeping the current brightness. --> <integer-array name="config_doze_brightness_sensor_to_brightness"> <item>-1</item> <!-- 0: OFF --> <item>2</item> <!-- 1: NIGHT --> Loading