[packages/apps/Settings] Settings: enhance power save mode
add sub items to control if limit cpu frequency, lcd brightness, etc. Issue: GRANITEFLY-749 Change-Id: Iedd9b7fce8f2fcf01a35a4ef93365a83e9d49976
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 786 B |
Binary file not shown.
|
After Width: | Height: | Size: 663 B |
Binary file not shown.
|
After Width: | Height: | Size: 895 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@ -19,4 +19,23 @@
|
||||
<string name="auto_language_title">自动确定语言</string>
|
||||
<string name="auto_language_summaryOn">根据SIM卡国家码自动确定系统语言</string>
|
||||
<string name="auto_language_summaryOff">根据SIM卡国家码自动确定系统语言</string>
|
||||
|
||||
<!-- Power save mode -->
|
||||
<string name="power_save_basic_settings">基本设置</string>
|
||||
<string name="show_power_save_indicator">显示省电模式</string>
|
||||
<string name="show_power_save_indicator_summary">省电模式启动后在状态栏显示省电模式</string>
|
||||
<string name="turn_on_automatically">电池电量低时启动省电模式</string>
|
||||
<string name="turn_on_automatically_summary">不管省电模式是否开启,当电池电量低于15%时自动启动省电模式</string>
|
||||
<string name="power_save_sub_settings">功能设置</string>
|
||||
<string name="limit_cpu">限制CPU性能</string>
|
||||
<string name="limit_cpu_summary">限制CPU最高频率</string>
|
||||
<string name="limit_brightness">降低屏幕亮度</string>
|
||||
<string name="limit_brightness_summary">降低屏幕亮度省电</string>
|
||||
<string name="limit_location">限制定位服务</string>
|
||||
<string name="limit_location_summary">GPS定位服务不能使用</string>
|
||||
<string name="limit_network">限制网络访问</string>
|
||||
<string name="limit_network_summary">大部分后台应用不能使用网络</string>
|
||||
<string name="limit_animation">限制窗口动画效果</string>
|
||||
<string name="limit_animation_summary">不显示窗口切换的动画效果</string>
|
||||
<string name="power_save_tips">提示</string>
|
||||
</resources>
|
||||
|
||||
@ -19,4 +19,23 @@
|
||||
<string name="auto_language_title">自動確定語言</string>
|
||||
<string name="auto_language_summaryOn">根據SIM卡國家碼自動確定系統語言</string>
|
||||
<string name="auto_language_summaryOff">根據SIM卡國家碼自動確定系統語言</string>
|
||||
|
||||
<!-- Power save mode -->
|
||||
<string name="power_save_basic_settings">基本設置</string>
|
||||
<string name="show_power_save_indicator">顯示省電模式</string>
|
||||
<string name="show_power_save_indicator_summary">省電模式啟動後在狀態列顯示省電模式</string>
|
||||
<string name="turn_on_automatically">電池計量低時啟動省電模式</string>
|
||||
<string name="turn_on_automatically_summary">不管省電模式是否開啟,當電池計量低於15%時自動啟動省電模式</string>
|
||||
<string name="power_save_sub_settings">功能設置</string>
|
||||
<string name="limit_cpu">限制CPU性能</string>
|
||||
<string name="limit_cpu_summary">限制CPU最高頻率</string>
|
||||
<string name="limit_brightness">降低螢幕亮度</string>
|
||||
<string name="limit_brightness_summary">降低螢幕亮度省電</string>
|
||||
<string name="limit_location">限制定位服務</string>
|
||||
<string name="limit_location_summary">GPS定位服務不能使用</string>
|
||||
<string name="limit_network">限制網路訪問</string>
|
||||
<string name="limit_network_summary">大部分後臺應用不能使用網路</string>
|
||||
<string name="limit_animation">限制視窗動畫效果</string>
|
||||
<string name="limit_animation_summary">不顯示視窗切換的動畫效果</string>
|
||||
<string name="power_save_tips">提示</string>
|
||||
</resources>
|
||||
|
||||
@ -19,4 +19,23 @@
|
||||
<string name="auto_language_title">Automatic Language</string>
|
||||
<string name="auto_language_summaryOn">Auto set language according to SIM card country code info</string>
|
||||
<string name="auto_language_summaryOff">Auto set language according to SIM card country code info</string>
|
||||
|
||||
<!-- Power save mode -->
|
||||
<string name="power_save_basic_settings">Basic controls</string>
|
||||
<string name="show_power_save_indicator">Show indicator</string>
|
||||
<string name="show_power_save_indicator_summary">Show power save mode enabled indicator on status bar</string>
|
||||
<string name="turn_on_automatically">Turn on power save mode automatically</string>
|
||||
<string name="turn_on_automatically_summary">When battery is less than 15%, turn on power save mode</string>
|
||||
<string name="power_save_sub_settings">Feature controls</string>
|
||||
<string name="limit_cpu">Limit CPU performance</string>
|
||||
<string name="limit_cpu_summary">Limit CPU maximum frequency</string>
|
||||
<string name="limit_brightness">Reduce backlight brightness</string>
|
||||
<string name="limit_brightness_summary">Reduce brightness of backlight to save power</string>
|
||||
<string name="limit_location">Disable location services</string>
|
||||
<string name="limit_location_summary">GPS location services will be disabled</string>
|
||||
<string name="limit_network">Restrict network access</string>
|
||||
<string name="limit_network_summary">Most background data will be disabled</string>
|
||||
<string name="limit_animation">No animation transaction</string>
|
||||
<string name="limit_animation_summary">Window animation transaction will be disabled</string>
|
||||
<string name="power_save_tips">Tips</string>
|
||||
</resources>
|
||||
|
||||
@ -18,17 +18,53 @@
|
||||
android:title="@string/battery_saver"
|
||||
android:key="battery_saver">
|
||||
|
||||
<!-- Turn on automatically -->
|
||||
<com.android.settings.notification.DropDownPreference
|
||||
android:key="turn_on_automatically"
|
||||
android:title="@string/battery_saver_turn_on_automatically_title"
|
||||
android:persistent="false" />
|
||||
<PreferenceCategory
|
||||
android:title="@string/power_save_basic_settings">
|
||||
<SwitchPreference
|
||||
android:key="show_power_save_indicator"
|
||||
android:title="@string/show_power_save_indicator"
|
||||
android:summary="@string/show_power_save_indicator_summary"/>
|
||||
|
||||
<!-- Feature description text -->
|
||||
<com.android.settings.fuelgauge.WallOfTextPreference
|
||||
<SwitchPreference
|
||||
android:key="turn_on_automatically"
|
||||
android:title="@string/turn_on_automatically"
|
||||
android:summary="@string/turn_on_automatically_summary"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="sub_items"
|
||||
android:title="@string/power_save_sub_settings">
|
||||
<SwitchPreference
|
||||
android:key="limit_cpu"
|
||||
android:title="@string/limit_cpu"
|
||||
android:summary="@string/limit_cpu_summary"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="limit_brightness"
|
||||
android:title="@string/limit_brightness"
|
||||
android:summary="@string/limit_brightness_summary"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="limit_location"
|
||||
android:title="@string/limit_location"
|
||||
android:summary="@string/limit_location_summary"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="limit_network"
|
||||
android:title="@string/limit_network"
|
||||
android:summary="@string/limit_network_summary"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="limit_animation"
|
||||
android:title="@string/limit_animation"
|
||||
android:summary="@string/limit_animation_summary"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="@string/power_save_tips">
|
||||
<com.android.settings.fuelgauge.WallOfTextPreference
|
||||
android:key="description"
|
||||
android:summary="@*android:string/battery_saver_description"
|
||||
android:persistent="false"
|
||||
android:selectable="false" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
@ -124,6 +124,14 @@
|
||||
android:icon="@drawable/ic_settings_battery"
|
||||
/>
|
||||
|
||||
<!-- Power Save Mode -->
|
||||
<dashboard-tile
|
||||
android:id="@+id/power_save_settings"
|
||||
android:title="@string/battery_saver"
|
||||
android:fragment="com.android.settings.fuelgauge.BatterySaverSettings"
|
||||
android:icon="@drawable/ic_settings_power_save"
|
||||
/>
|
||||
|
||||
<!-- Application Settings -->
|
||||
<dashboard-tile
|
||||
android:id="@+id/application_settings"
|
||||
|
||||
@ -285,6 +285,7 @@ public class SettingsActivity extends Activity
|
||||
AndroidBeam.class.getName(),
|
||||
WifiDisplaySettings.class.getName(),
|
||||
PowerUsageSummary.class.getName(),
|
||||
BatterySaverSettings.class.getName(),
|
||||
AccountSyncSettings.class.getName(),
|
||||
AccountSettings.class.getName(),
|
||||
CryptKeeperSettings.class.getName(),
|
||||
|
||||
@ -30,6 +30,11 @@ import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemProperties;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.Global;
|
||||
import android.util.Log;
|
||||
import android.widget.Switch;
|
||||
@ -42,10 +47,20 @@ import com.android.settings.notification.SettingPref;
|
||||
import com.android.settings.widget.SwitchBar;
|
||||
|
||||
public class BatterySaverSettings extends SettingsPreferenceFragment
|
||||
implements SwitchBar.OnSwitchChangeListener {
|
||||
implements Preference.OnPreferenceChangeListener, SwitchBar.OnSwitchChangeListener {
|
||||
private static final String TAG = "BatterySaverSettings";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
private static final String KEY_SHOW_INDICATOR = "show_power_save_indicator";
|
||||
private static final String KEY_TURN_ON_AUTOMATICALLY = "turn_on_automatically";
|
||||
private static final String KEY_SUB_ITEMS = "sub_items";
|
||||
private static final String KEY_LIMIT_CPU = "limit_cpu";
|
||||
private static final String KEY_LIMIT_BRIGHTNESS = "limit_brightness";
|
||||
private static final String KEY_LIMIT_LOCATION = "limit_location";
|
||||
private static final String KEY_LIMIT_NETWORK = "limit_network";
|
||||
private static final String KEY_LIMIT_ANIMATION = "limit_animation";
|
||||
|
||||
private static final String PROPERTY_THERMAL_ENABLED = "persist.service.thermal";
|
||||
|
||||
private static final long WAIT_FOR_SWITCH_ANIM = 500;
|
||||
|
||||
private final Handler mHandler = new Handler();
|
||||
@ -54,12 +69,19 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
|
||||
|
||||
private Context mContext;
|
||||
private boolean mCreated;
|
||||
private SettingPref mTriggerPref;
|
||||
private SwitchBar mSwitchBar;
|
||||
private Switch mSwitch;
|
||||
private boolean mValidListener;
|
||||
private PowerManager mPowerManager;
|
||||
|
||||
private SwitchPreference mShowIndicatorPref;
|
||||
private SwitchPreference mEnableWhenLowBatteryPref;
|
||||
private SwitchPreference mLimitCPU;
|
||||
private SwitchPreference mLimitBrightness;
|
||||
private SwitchPreference mLimitLocation;
|
||||
private SwitchPreference mLimitNetwork;
|
||||
private SwitchPreference mLimitAnimation;
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
@ -75,22 +97,27 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
|
||||
mSwitch = mSwitchBar.getSwitch();
|
||||
mSwitchBar.show();
|
||||
|
||||
mTriggerPref = new SettingPref(SettingPref.TYPE_GLOBAL, KEY_TURN_ON_AUTOMATICALLY,
|
||||
Global.LOW_POWER_MODE_TRIGGER_LEVEL,
|
||||
0, /*default*/
|
||||
getResources().getIntArray(R.array.battery_saver_trigger_values)) {
|
||||
@Override
|
||||
protected String getCaption(Resources res, int value) {
|
||||
if (value > 0 && value < 100) {
|
||||
return res.getString(R.string.battery_saver_turn_on_automatically_pct,
|
||||
Utils.formatPercentage(value));
|
||||
}
|
||||
return res.getString(R.string.battery_saver_turn_on_automatically_never);
|
||||
}
|
||||
};
|
||||
mTriggerPref.init(this);
|
||||
|
||||
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
|
||||
|
||||
mShowIndicatorPref = (SwitchPreference) findPreference(KEY_SHOW_INDICATOR);
|
||||
mShowIndicatorPref.setOnPreferenceChangeListener(this);
|
||||
mEnableWhenLowBatteryPref = (SwitchPreference) findPreference(KEY_TURN_ON_AUTOMATICALLY);
|
||||
mEnableWhenLowBatteryPref.setOnPreferenceChangeListener(this);
|
||||
mLimitCPU = (SwitchPreference) findPreference(KEY_LIMIT_CPU);
|
||||
mLimitCPU.setOnPreferenceChangeListener(this);
|
||||
if (!SystemProperties.getBoolean(PROPERTY_THERMAL_ENABLED, false)) {
|
||||
final PreferenceCategory parent = (PreferenceCategory) findPreference(KEY_SUB_ITEMS);
|
||||
parent.removePreference(mLimitCPU);
|
||||
mLimitCPU = null;
|
||||
}
|
||||
mLimitBrightness = (SwitchPreference) findPreference(KEY_LIMIT_BRIGHTNESS);
|
||||
mLimitBrightness.setOnPreferenceChangeListener(this);
|
||||
mLimitLocation = (SwitchPreference) findPreference(KEY_LIMIT_LOCATION);
|
||||
mLimitLocation.setOnPreferenceChangeListener(this);
|
||||
mLimitNetwork = (SwitchPreference) findPreference(KEY_LIMIT_NETWORK);
|
||||
mLimitNetwork.setOnPreferenceChangeListener(this);
|
||||
mLimitAnimation = (SwitchPreference) findPreference(KEY_LIMIT_ANIMATION);
|
||||
mLimitAnimation.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,6 +136,35 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
|
||||
mValidListener = true;
|
||||
}
|
||||
updateSwitch();
|
||||
updateBasicItems();
|
||||
updateSubItems();
|
||||
}
|
||||
|
||||
private void updateBasicItems() {
|
||||
if (mShowIndicatorPref != null) {
|
||||
mShowIndicatorPref.setChecked(isShowPowerSaveModeIndicator());
|
||||
}
|
||||
if (mEnableWhenLowBatteryPref != null) {
|
||||
mEnableWhenLowBatteryPref.setChecked(getLowPowerModeTriggerLevel() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSubItems() {
|
||||
if (mLimitCPU != null) {
|
||||
mLimitCPU.setChecked(getLimitOnPowerSaveMode(KEY_LIMIT_CPU));
|
||||
}
|
||||
if (mLimitBrightness != null) {
|
||||
mLimitBrightness.setChecked(getLimitOnPowerSaveMode(KEY_LIMIT_BRIGHTNESS));
|
||||
}
|
||||
if (mLimitLocation != null) {
|
||||
mLimitLocation.setChecked(getLimitOnPowerSaveMode(KEY_LIMIT_LOCATION));
|
||||
}
|
||||
if (mLimitNetwork != null) {
|
||||
mLimitNetwork.setChecked(getLimitOnPowerSaveMode(KEY_LIMIT_NETWORK));
|
||||
}
|
||||
if (mLimitAnimation != null) {
|
||||
mLimitAnimation.setChecked(getLimitOnPowerSaveMode(KEY_LIMIT_ANIMATION));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -121,6 +177,42 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
|
||||
mValidListener = false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
||||
final String key = preference.getKey();
|
||||
|
||||
if (KEY_SHOW_INDICATOR.equals(key)) {
|
||||
boolean show = (Boolean) objValue;
|
||||
showPowerSaveModeIndicator(show);
|
||||
} else if (KEY_TURN_ON_AUTOMATICALLY.equals(key)) {
|
||||
boolean auto = (Boolean) objValue;
|
||||
setLowPowerModeTriggerLevel(auto ? 15 : 0);
|
||||
|
||||
if (auto) {
|
||||
if (isAllSubItemDisabled()) {
|
||||
enableAllSubItem();
|
||||
mHandler.post(mUpdateSubItems);
|
||||
}
|
||||
}
|
||||
} else if (KEY_LIMIT_CPU.equals(key)
|
||||
|| KEY_LIMIT_BRIGHTNESS.equals(key)
|
||||
|| KEY_LIMIT_LOCATION.equals(key)
|
||||
|| KEY_LIMIT_NETWORK.equals(key)
|
||||
|| KEY_LIMIT_ANIMATION.equals(key)) {
|
||||
boolean limit = (Boolean) objValue;
|
||||
setLimitOnPowerSaveMode(key, limit);
|
||||
|
||||
if (isAllSubItemDisabled()) {
|
||||
onSwitchChanged(mSwitch, false);
|
||||
setLowPowerModeTriggerLevel(0);
|
||||
if (mEnableWhenLowBatteryPref != null) {
|
||||
mEnableWhenLowBatteryPref.setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwitchChanged(Switch switchView, boolean isChecked) {
|
||||
@ -137,6 +229,13 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
|
||||
if (!mPowerManager.setPowerSaveMode(mode)) {
|
||||
if (DEBUG) Log.d(TAG, "Setting mode failed, fallback to current value");
|
||||
mHandler.post(mUpdateSwitch);
|
||||
} else {
|
||||
if (mode) {
|
||||
if (isAllSubItemDisabled()) {
|
||||
enableAllSubItem();
|
||||
mHandler.post(mUpdateSubItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +305,8 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
|
||||
@Override
|
||||
public void onChange(boolean selfChange, Uri uri) {
|
||||
if (LOW_POWER_MODE_TRIGGER_LEVEL_URI.equals(uri)) {
|
||||
mTriggerPref.update(mContext);
|
||||
int level = getLowPowerModeTriggerLevel();
|
||||
mEnableWhenLowBatteryPref.setChecked(level > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,4 +319,113 @@ public class BatterySaverSettings extends SettingsPreferenceFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isShowPowerSaveModeIndicator() {
|
||||
final ContentResolver cr = getContentResolver();
|
||||
final boolean val = Global.getInt(cr, Global.SHOW_LOW_POWER_MODE_INDICATOR, 1) != 0;
|
||||
return val;
|
||||
}
|
||||
|
||||
private void showPowerSaveModeIndicator(boolean show) {
|
||||
final ContentResolver cr = getContentResolver();
|
||||
Settings.Global.putInt(cr, Global.SHOW_LOW_POWER_MODE_INDICATOR, show ? 1 : 0);
|
||||
}
|
||||
|
||||
private int getLowPowerModeTriggerLevel() {
|
||||
final ContentResolver cr = getContentResolver();
|
||||
final int val = Global.getInt(cr, Global.LOW_POWER_MODE_TRIGGER_LEVEL, 0);
|
||||
return val;
|
||||
}
|
||||
|
||||
private void setLowPowerModeTriggerLevel(int val) {
|
||||
final ContentResolver cr = getContentResolver();
|
||||
Settings.Global.putInt(cr, Global.LOW_POWER_MODE_TRIGGER_LEVEL, val);
|
||||
}
|
||||
|
||||
private boolean getLimitOnPowerSaveMode(String key) {
|
||||
final ContentResolver cr = getContentResolver();
|
||||
final boolean val;
|
||||
switch (key) {
|
||||
case KEY_LIMIT_CPU:
|
||||
val = Settings.Global.getInt(cr, Settings.Global.LOW_POWER_MODE_LIMIT_CPU, 1) != 0;
|
||||
break;
|
||||
case KEY_LIMIT_BRIGHTNESS:
|
||||
val = Settings.Global.getInt(cr, Settings.Global.LOW_POWER_MODE_LIMIT_BRIGHTNESS, 1) != 0;
|
||||
break;
|
||||
case KEY_LIMIT_LOCATION:
|
||||
val = Settings.Secure.getInt(cr, Settings.Secure.LOW_POWER_MODE_LIMIT_LOCATION, 1) != 0;
|
||||
break;
|
||||
case KEY_LIMIT_NETWORK:
|
||||
val = Settings.Global.getInt(cr, Settings.Global.LOW_POWER_MODE_LIMIT_NETWORK, 1) != 0;
|
||||
break;
|
||||
case KEY_LIMIT_ANIMATION:
|
||||
val = Settings.Global.getInt(cr, Settings.Global.LOW_POWER_MODE_LIMIT_ANIMATION, 1) != 0;
|
||||
break;
|
||||
default:
|
||||
Log.e(TAG, "Not found settings for " + key);
|
||||
val = false;
|
||||
break;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
private void setLimitOnPowerSaveMode(String key, boolean limit) {
|
||||
final ContentResolver cr = getContentResolver();
|
||||
switch (key) {
|
||||
case KEY_LIMIT_CPU:
|
||||
Settings.Global.putInt(cr, Settings.Global.LOW_POWER_MODE_LIMIT_CPU, limit ? 1 : 0);
|
||||
break;
|
||||
case KEY_LIMIT_BRIGHTNESS:
|
||||
Settings.Global.putInt(cr, Settings.Global.LOW_POWER_MODE_LIMIT_BRIGHTNESS, limit ? 1 : 0);
|
||||
break;
|
||||
case KEY_LIMIT_LOCATION:
|
||||
Settings.Secure.putInt(cr, Settings.Secure.LOW_POWER_MODE_LIMIT_LOCATION, limit ? 1 : 0);
|
||||
break;
|
||||
case KEY_LIMIT_NETWORK:
|
||||
Settings.Global.putInt(cr, Settings.Global.LOW_POWER_MODE_LIMIT_NETWORK, limit ? 1 : 0);
|
||||
break;
|
||||
case KEY_LIMIT_ANIMATION:
|
||||
Settings.Global.putInt(cr, Settings.Global.LOW_POWER_MODE_LIMIT_ANIMATION, limit ? 1 : 0);
|
||||
break;
|
||||
default:
|
||||
Log.e(TAG, "Not found settings for " + key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAllSubItemDisabled() {
|
||||
if ((mLimitCPU == null || !getLimitOnPowerSaveMode(KEY_LIMIT_CPU))
|
||||
&& !getLimitOnPowerSaveMode(KEY_LIMIT_BRIGHTNESS)
|
||||
&& !getLimitOnPowerSaveMode(KEY_LIMIT_LOCATION)
|
||||
&& !getLimitOnPowerSaveMode(KEY_LIMIT_NETWORK)
|
||||
&& !getLimitOnPowerSaveMode(KEY_LIMIT_ANIMATION)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void enableAllSubItem() {
|
||||
if (mLimitCPU != null) {
|
||||
setLimitOnPowerSaveMode(KEY_LIMIT_CPU, true);
|
||||
}
|
||||
if (mLimitBrightness != null) {
|
||||
setLimitOnPowerSaveMode(KEY_LIMIT_BRIGHTNESS, true);
|
||||
}
|
||||
if (mLimitLocation != null) {
|
||||
setLimitOnPowerSaveMode(KEY_LIMIT_LOCATION, true);
|
||||
}
|
||||
if (mLimitNetwork != null) {
|
||||
setLimitOnPowerSaveMode(KEY_LIMIT_NETWORK, true);
|
||||
}
|
||||
if (mLimitAnimation != null) {
|
||||
setLimitOnPowerSaveMode(KEY_LIMIT_ANIMATION, true);
|
||||
}
|
||||
}
|
||||
|
||||
private final Runnable mUpdateSubItems = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateSubItems();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user