Setting: Developer Option: Adds a low power mode checkbox
Change-Id: I489f74bd3822f64acb8becd6e5eda716d8bd722c Signed-off-by: Ruchi Kandoi<kandoiruchi@google.com>
This commit is contained in:
@@ -4421,6 +4421,11 @@
|
||||
<!-- UI debug setting: force right to left layout summary [CHAR LIMIT=100] -->
|
||||
<string name="force_rtl_layout_all_locales_summary">Force screen layout direction to RTL for all locales</string>
|
||||
|
||||
<!-- UI debug setting: start low power mode [CHAR LIMIT=25] -->
|
||||
<string name="low_power_mode">Low Power Mode</string>
|
||||
<!-- UI debug setting: start low power mode summary[CHAR LIMIT=50] -->
|
||||
<string name="low_power_mode_summary">Enable battery saving settings</string>
|
||||
|
||||
<!-- UI debug setting: show how CPU is being used? [CHAR LIMIT=25] -->
|
||||
<string name="show_cpu_usage">Show CPU usage</string>
|
||||
<!-- UI debug setting: show cpu usage summary [CHAR LIMIT=50] -->
|
||||
|
@@ -240,6 +240,11 @@
|
||||
android:title="@string/strict_mode"
|
||||
android:summary="@string/strict_mode_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="low_power_mode"
|
||||
android:title="@string/low_power_mode"
|
||||
android:summary="@string/low_power_mode_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="show_cpu_usage"
|
||||
android:title="@string/show_cpu_usage"
|
||||
|
@@ -118,6 +118,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
private static final String USE_NUPLAYER_KEY = "use_nuplayer";
|
||||
private static final String USE_NUPLAYER_PROPERTY = "persist.sys.media.use-nuplayer";
|
||||
private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage";
|
||||
private static final String LOW_POWER_MODE_KEY = "low_power_mode";
|
||||
private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
|
||||
private static final String FORCE_MSAA_KEY = "force_msaa";
|
||||
private static final String TRACK_FRAME_TIME_KEY = "track_frame_time";
|
||||
@@ -184,6 +185,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
private CheckBoxPreference mShowScreenUpdates;
|
||||
private CheckBoxPreference mDisableOverlays;
|
||||
private CheckBoxPreference mShowCpuUsage;
|
||||
private CheckBoxPreference mLowPowerMode;
|
||||
private CheckBoxPreference mForceHardwareUi;
|
||||
private CheckBoxPreference mForceMsaa;
|
||||
private CheckBoxPreference mShowHwScreenUpdates;
|
||||
@@ -293,6 +295,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
mShowScreenUpdates = findAndInitCheckboxPref(SHOW_SCREEN_UPDATES_KEY);
|
||||
mDisableOverlays = findAndInitCheckboxPref(DISABLE_OVERLAYS_KEY);
|
||||
mShowCpuUsage = findAndInitCheckboxPref(SHOW_CPU_USAGE_KEY);
|
||||
mLowPowerMode = findAndInitCheckboxPref(LOW_POWER_MODE_KEY);
|
||||
mForceHardwareUi = findAndInitCheckboxPref(FORCE_HARDWARE_UI_KEY);
|
||||
mForceMsaa = findAndInitCheckboxPref(FORCE_MSAA_KEY);
|
||||
mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
|
||||
@@ -497,6 +500,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
updateShowTouchesOptions();
|
||||
updateFlingerOptions();
|
||||
updateCpuUsageOptions();
|
||||
updateLowPowerModeOptions();
|
||||
updateHardwareUiOptions();
|
||||
updateMsaaOptions();
|
||||
updateTrackFrameTimeOptions();
|
||||
@@ -1021,11 +1025,22 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
mWifiDisplayCertification.isChecked() ? 1 : 0);
|
||||
}
|
||||
|
||||
private void updateLowPowerModeOptions() {
|
||||
updateCheckBox(mLowPowerMode, Settings.Global.getInt(getActivity().getContentResolver(),
|
||||
Settings.Global.LOW_POWER_MODE, 0) != 0);
|
||||
}
|
||||
|
||||
private void updateCpuUsageOptions() {
|
||||
updateCheckBox(mShowCpuUsage, Settings.Global.getInt(getActivity().getContentResolver(),
|
||||
Settings.Global.SHOW_PROCESSES, 0) != 0);
|
||||
}
|
||||
|
||||
private void writeLowPowerModeOptions() {
|
||||
boolean value = mLowPowerMode.isChecked();
|
||||
Settings.Global.putInt(getActivity().getContentResolver(),
|
||||
Settings.Global.LOW_POWER_MODE, value ? 1 : 0);
|
||||
}
|
||||
|
||||
private void writeCpuUsageOptions() {
|
||||
boolean value = mShowCpuUsage.isChecked();
|
||||
Settings.Global.putInt(getActivity().getContentResolver(),
|
||||
@@ -1286,6 +1301,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
writeShowUpdatesOption();
|
||||
} else if (preference == mDisableOverlays) {
|
||||
writeDisableOverlaysOption();
|
||||
} else if (preference == mLowPowerMode) {
|
||||
writeLowPowerModeOptions();
|
||||
} else if (preference == mShowCpuUsage) {
|
||||
writeCpuUsageOptions();
|
||||
} else if (preference == mImmediatelyDestroyActivities) {
|
||||
|
Reference in New Issue
Block a user