summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/BrightnessPreference.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-04-23 18:22:13 -0700
committerDianne Hackborn <hackbod@google.com>2012-04-23 18:22:13 -0700
commit704cc2f600c8d754efe25d3672dcd773cc16c49f (patch)
treeb0b61a3628cbbabd05d49004173684b40b365b0d /src/com/android/settings/BrightnessPreference.java
parentf1e26a1bb3b200d3db7fc3dbabf09f4b5a143568 (diff)
downloadpackages_apps_Settings-704cc2f600c8d754efe25d3672dcd773cc16c49f.tar.gz
packages_apps_Settings-704cc2f600c8d754efe25d3672dcd773cc16c49f.tar.bz2
packages_apps_Settings-704cc2f600c8d754efe25d3672dcd773cc16c49f.zip
Deal correctly with an unset brightness adjustment.
Change-Id: I191051989bad68f31210bbc717fbabd59d4585a1
Diffstat (limited to 'src/com/android/settings/BrightnessPreference.java')
-rw-r--r--src/com/android/settings/BrightnessPreference.java23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/com/android/settings/BrightnessPreference.java b/src/com/android/settings/BrightnessPreference.java
index fb25e9b00..e015914aa 100644
--- a/src/com/android/settings/BrightnessPreference.java
+++ b/src/com/android/settings/BrightnessPreference.java
@@ -134,19 +134,16 @@ 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);
- brightness = (brightness+1)/2;
- } else {
- brightness = Settings.System.getInt(getContext().getContentResolver(),
- Settings.System.SCREEN_BRIGHTNESS);
- brightness = (MAXIMUM_BACKLIGHT - mScreenBrightnessDim)
- / (brightness - mScreenBrightnessDim);
-
- }
- } catch (SettingNotFoundException snfe) {
+ if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
+ brightness = Settings.System.getFloat(getContext().getContentResolver(),
+ Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0);
+ brightness = (brightness+1)/2;
+ } else {
+ brightness = Settings.System.getInt(getContext().getContentResolver(),
+ Settings.System.SCREEN_BRIGHTNESS, 100);
+ brightness = (MAXIMUM_BACKLIGHT - mScreenBrightnessDim)
+ / (brightness - mScreenBrightnessDim);
+
}
return (int)(brightness*10000);
}