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

Commit 5898d521 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents cb423e42 648ea2df
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -273,6 +273,9 @@
    <!-- Doze: the brightness value to use for the higher brightness AOD mode -->
    <!-- Doze: the brightness value to use for the higher brightness AOD mode -->
    <integer name="config_doze_aod_brightness_high">27</integer>
    <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 -->
    <!-- Doze: whether the double tap sensor reports 2D touch coordinates -->
    <bool name="doze_double_tap_reports_touch_coordinates">false</bool>
    <bool name="doze_double_tap_reports_touch_coordinates">false</bool>


+9 −3
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ public class DozeScreenBrightness implements DozeMachine.Part, SensorEventListen


    private final int mHighBrightness;
    private final int mHighBrightness;
    private final int mLowBrightness;
    private final int mLowBrightness;
    private final int mSunlightBrightness;


    public DozeScreenBrightness(Context context, DozeMachine.Service service,
    public DozeScreenBrightness(Context context, DozeMachine.Service service,
            SensorManager sensorManager, Sensor lightSensor, Handler handler) {
            SensorManager sensorManager, Sensor lightSensor, Handler handler) {
@@ -52,6 +53,8 @@ public class DozeScreenBrightness implements DozeMachine.Part, SensorEventListen
                R.integer.config_doze_aod_brightness_low);
                R.integer.config_doze_aod_brightness_low);
        mHighBrightness = context.getResources().getInteger(
        mHighBrightness = context.getResources().getInteger(
                R.integer.config_doze_aod_brightness_high);
                R.integer.config_doze_aod_brightness_high);
        mSunlightBrightness = context.getResources().getInteger(
                R.integer.config_doze_aod_brightness_sunlight);
    }
    }


    @Override
    @Override
@@ -83,9 +86,12 @@ public class DozeScreenBrightness implements DozeMachine.Part, SensorEventListen
    }
    }


    private int computeBrightness(int sensorValue) {
    private int computeBrightness(int sensorValue) {
        // The sensor reports 0 for off, 1 for low brightness and 2 for high brightness.
        // The sensor reports 0 for off, 1 for low brightness, 2 for high brightness, and 3 for
        // We currently use DozeScreenState for screen off, so we treat off as low brightness.
        // sunlight. We currently use DozeScreenState for screen off, so we treat off as low
        if (sensorValue >= 2) {
        // brightness.
        if (sensorValue >= 3) {
            return mSunlightBrightness;
        } else if (sensorValue == 2) {
            return mHighBrightness;
            return mHighBrightness;
        } else {
        } else {
            return mLowBrightness;
            return mLowBrightness;