Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e92c48e6 authored by Michael Wright's avatar Michael Wright Committed by android-build-merger
Browse files

Merge "Add new bucket above high brightness for "sunlight"." into oc-dr1-dev

am: 5898d521

Change-Id: I5bc6a34975e5b044122998a05ab573a9ed431ecd
parents f0613cda 5898d521
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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>

+9 −3
Original line number Diff line number Diff line
@@ -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;