b/2491823 Fixed brightness toggle for phones w/o auto-brightness
Logic didn't allow a transition from max to min brightness when used on
a phone that didn't support auto-brightness.
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
index 4ec5b82..005fc13 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -435,6 +435,7 @@
brightness = MAXIMUM_BACKLIGHT;
} else {
brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
+ brightness = MINIMUM_BACKLIGHT;
}
if (context.getResources().getBoolean(
@@ -443,6 +444,9 @@
Settings.System.putInt(context.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE,
brightnessMode);
+ } else {
+ // Make sure we set the brightness if automatic mode isn't available
+ brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
}
if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL) {
power.setBacklightBrightness(brightness);