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

Commit 3e9263a9 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Deal correctly with an unset brightness adjustment."

parents b3a593eb 704cc2f6
Loading
Loading
Loading
Loading
+10 −13
Original line number Diff line number Diff line
@@ -134,20 +134,17 @@ public class BrightnessPreference extends SeekBarDialogPreference implements
    private int getBrightness() {
        int mode = getBrightnessMode(0);
        float brightness = 0;
        try {
        if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
            brightness = Settings.System.getFloat(getContext().getContentResolver(),
                        Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ);
                    Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0);
            brightness = (brightness+1)/2;
        } else {
            brightness = Settings.System.getInt(getContext().getContentResolver(),
                        Settings.System.SCREEN_BRIGHTNESS);
                    Settings.System.SCREEN_BRIGHTNESS, 100);
            brightness = (MAXIMUM_BACKLIGHT - mScreenBrightnessDim)
                    / (brightness - mScreenBrightnessDim);
            
        }
        } catch (SettingNotFoundException snfe) {
        }
        return (int)(brightness*10000);
    }