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

Commit 704cc2f6 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Deal correctly with an unset brightness adjustment.

Change-Id: I191051989bad68f31210bbc717fbabd59d4585a1
parent f1e26a1b
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);
    }