summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/BrightnessPreference.java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-08-21 21:13:48 -0700
committerJeff Brown <jeffbrown@google.com>2012-08-21 21:13:48 -0700
commit9674b32324fb9135e5c43f3f2fd8df2c2b919ede (patch)
treee287db528fcf7e31c7ea4a869d02bb86114bfea6 /src/com/android/settings/BrightnessPreference.java
parentc76bfb9243d7fae3f2f6f785685f709c28b41097 (diff)
downloadpackages_apps_settings-9674b32324fb9135e5c43f3f2fd8df2c2b919ede.zip
packages_apps_settings-9674b32324fb9135e5c43f3f2fd8df2c2b919ede.tar.gz
packages_apps_settings-9674b32324fb9135e5c43f3f2fd8df2c2b919ede.tar.bz2
Add a flag to control auto-brightness adjustment.
The feature is still disabled, it's just disabled using a flag now. Change-Id: I43ceaa5ab9b7252e3882c8b2d48c9844afb806c3
Diffstat (limited to 'src/com/android/settings/BrightnessPreference.java')
-rw-r--r--src/com/android/settings/BrightnessPreference.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/com/android/settings/BrightnessPreference.java b/src/com/android/settings/BrightnessPreference.java
index a80ceb9..858d50f 100644
--- a/src/com/android/settings/BrightnessPreference.java
+++ b/src/com/android/settings/BrightnessPreference.java
@@ -38,6 +38,9 @@ import android.widget.SeekBar;
public class BrightnessPreference extends SeekBarDialogPreference implements
SeekBar.OnSeekBarChangeListener, CheckBox.OnCheckedChangeListener {
+ // If true, enables the use of the screen auto-brightness adjustment setting.
+ private static final boolean USE_SCREEN_AUTO_BRIGHTNESS_ADJUSTMENT = false;
+
private final int mScreenBrightnessMinimum;
private final int mScreenBrightnessMaximum;
@@ -114,7 +117,7 @@ public class BrightnessPreference extends SeekBarDialogPreference implements
mOldAutomatic = getBrightnessMode(0);
mAutomaticMode = mOldAutomatic == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
mCheckBox.setChecked(mAutomaticMode);
- mSeekBar.setEnabled(!mAutomaticMode);
+ mSeekBar.setEnabled(!mAutomaticMode || USE_SCREEN_AUTO_BRIGHTNESS_ADJUSTMENT);
} else {
mSeekBar.setEnabled(true);
}
@@ -138,14 +141,15 @@ public class BrightnessPreference extends SeekBarDialogPreference implements
setMode(isChecked ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC
: Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
mSeekBar.setProgress(getBrightness());
- mSeekBar.setEnabled(!mAutomaticMode);
+ mSeekBar.setEnabled(!mAutomaticMode || USE_SCREEN_AUTO_BRIGHTNESS_ADJUSTMENT);
setBrightness(mSeekBar.getProgress(), false);
}
private int getBrightness() {
int mode = getBrightnessMode(0);
float brightness = 0;
- if (false && mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
+ if (USE_SCREEN_AUTO_BRIGHTNESS_ADJUSTMENT
+ && mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
brightness = Settings.System.getFloat(getContext().getContentResolver(),
Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, 0);
brightness = (brightness+1)/2;
@@ -181,7 +185,7 @@ public class BrightnessPreference extends SeekBarDialogPreference implements
== Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
mCheckBox.setChecked(checked);
mSeekBar.setProgress(getBrightness());
- mSeekBar.setEnabled(!checked);
+ mSeekBar.setEnabled(!checked || USE_SCREEN_AUTO_BRIGHTNESS_ADJUSTMENT);
}
@Override
@@ -213,7 +217,7 @@ public class BrightnessPreference extends SeekBarDialogPreference implements
private void setBrightness(int brightness, boolean write) {
if (mAutomaticMode) {
- if (false) {
+ if (USE_SCREEN_AUTO_BRIGHTNESS_ADJUSTMENT) {
float valf = (((float)brightness*2)/SEEK_BAR_RANGE) - 1.0f;
try {
IPowerManager power = IPowerManager.Stub.asInterface(