Merge commit 'ee693a120ac57a84268d70447f12920827fbea6e' into eclair-mr2-plus-aosp * commit 'ee693a120ac57a84268d70447f12920827fbea6e': Remove PowerManager.setAutoBrightness()
This commit is contained in:
@@ -101,7 +101,8 @@ public class BrightnessPreference extends SeekBarPreference implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
setMode(isChecked ? 1 : 0);
|
setMode(isChecked ? Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC
|
||||||
|
: Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
|
||||||
if (!isChecked) {
|
if (!isChecked) {
|
||||||
setBrightness(mSeekBar.getProgress() + MINIMUM_BACKLIGHT);
|
setBrightness(mSeekBar.getProgress() + MINIMUM_BACKLIGHT);
|
||||||
}
|
}
|
||||||
@@ -115,11 +116,6 @@ public class BrightnessPreference extends SeekBarPreference implements
|
|||||||
Settings.System.putInt(getContext().getContentResolver(),
|
Settings.System.putInt(getContext().getContentResolver(),
|
||||||
Settings.System.SCREEN_BRIGHTNESS,
|
Settings.System.SCREEN_BRIGHTNESS,
|
||||||
mSeekBar.getProgress() + MINIMUM_BACKLIGHT);
|
mSeekBar.getProgress() + MINIMUM_BACKLIGHT);
|
||||||
if (mAutomaticAvailable) {
|
|
||||||
Settings.System.putInt(getContext().getContentResolver(),
|
|
||||||
Settings.System.SCREEN_BRIGHTNESS_MODE,
|
|
||||||
mCheckBox.isChecked() ? 1 : 0);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (mAutomaticAvailable) {
|
if (mAutomaticAvailable) {
|
||||||
setMode(mOldAutomatic);
|
setMode(mOldAutomatic);
|
||||||
@@ -141,20 +137,14 @@ public class BrightnessPreference extends SeekBarPreference implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMode(int automatic) {
|
private void setMode(int mode) {
|
||||||
if (automatic != 0) {
|
if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
|
||||||
mSeekBar.setVisibility(View.GONE);
|
mSeekBar.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
mSeekBar.setVisibility(View.VISIBLE);
|
mSeekBar.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
try {
|
Settings.System.putInt(getContext().getContentResolver(),
|
||||||
IPowerManager power = IPowerManager.Stub.asInterface(
|
Settings.System.SCREEN_BRIGHTNESS_MODE, mode);
|
||||||
ServiceManager.getService("power"));
|
|
||||||
if (power != null) {
|
|
||||||
power.setAutoBrightness(automatic != 0);
|
|
||||||
}
|
|
||||||
} catch (RemoteException doe) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -393,10 +393,9 @@ public class SettingsAppWidgetProvider extends AppWidgetProvider {
|
|||||||
if (context.getResources().getBoolean(
|
if (context.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_automatic_brightness_available)) {
|
com.android.internal.R.bool.config_automatic_brightness_available)) {
|
||||||
// Disable automatic brightness
|
// Disable automatic brightness
|
||||||
power.setAutoBrightness(false);
|
|
||||||
Settings.System.putInt(context.getContentResolver(),
|
Settings.System.putInt(context.getContentResolver(),
|
||||||
Settings.System.SCREEN_BRIGHTNESS_MODE,
|
Settings.System.SCREEN_BRIGHTNESS_MODE,
|
||||||
0);
|
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
|
||||||
// Set it again in case auto brightness was on
|
// Set it again in case auto brightness was on
|
||||||
power.setBacklightBrightness(brightness);
|
power.setBacklightBrightness(brightness);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user