summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/values/config.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeScreenBrightness.java12
2 files changed, 12 insertions, 3 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 38b2969265cb..6eea030ef0f3 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -273,6 +273,9 @@
<!-- Doze: the brightness value to use for the higher brightness AOD mode -->
<integer name="config_doze_aod_brightness_high">27</integer>
+ <!-- Doze: the brightness value to use for the sunlight AOD mode -->
+ <integer name="config_doze_aod_brightness_sunlight">28</integer>
+
<!-- Doze: whether the double tap sensor reports 2D touch coordinates -->
<bool name="doze_double_tap_reports_touch_coordinates">false</bool>
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeScreenBrightness.java b/packages/SystemUI/src/com/android/systemui/doze/DozeScreenBrightness.java
index 28a45aae6892..ed4b131cd83f 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeScreenBrightness.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeScreenBrightness.java
@@ -39,6 +39,7 @@ public class DozeScreenBrightness implements DozeMachine.Part, SensorEventListen
private final int mHighBrightness;
private final int mLowBrightness;
+ private final int mSunlightBrightness;
public DozeScreenBrightness(Context context, DozeMachine.Service service,
SensorManager sensorManager, Sensor lightSensor, Handler handler) {
@@ -52,6 +53,8 @@ public class DozeScreenBrightness implements DozeMachine.Part, SensorEventListen
R.integer.config_doze_aod_brightness_low);
mHighBrightness = context.getResources().getInteger(
R.integer.config_doze_aod_brightness_high);
+ mSunlightBrightness = context.getResources().getInteger(
+ R.integer.config_doze_aod_brightness_sunlight);
}
@Override
@@ -83,9 +86,12 @@ public class DozeScreenBrightness implements DozeMachine.Part, SensorEventListen
}
private int computeBrightness(int sensorValue) {
- // The sensor reports 0 for off, 1 for low brightness and 2 for high brightness.
- // We currently use DozeScreenState for screen off, so we treat off as low brightness.
- if (sensorValue >= 2) {
+ // The sensor reports 0 for off, 1 for low brightness, 2 for high brightness, and 3 for
+ // sunlight. We currently use DozeScreenState for screen off, so we treat off as low
+ // brightness.
+ if (sensorValue >= 3) {
+ return mSunlightBrightness;
+ } else if (sensorValue == 2) {
return mHighBrightness;
} else {
return mLowBrightness;