am 3e82dff1: am 277827fb: Merge "Disable keyguard widgets on low memory devices" into klp-dev
* commit '3e82dff1a112a5e231f82f8ccc15a5fe248e9be6':
Disable keyguard widgets on low memory devices
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index f365403..e002264 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -20,6 +20,7 @@
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
import android.app.Activity;
+import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
@@ -244,15 +245,25 @@
// Enable or disable keyguard widget checkbox based on DPM state
mEnableKeyguardWidgets = (CheckBoxPreference) root.findPreference(KEY_ENABLE_WIDGETS);
if (mEnableKeyguardWidgets != null) {
- final boolean disabled = (0 != (mDPM.getKeyguardDisabledFeatures(null)
- & DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL));
- if (disabled) {
- mEnableKeyguardWidgets.setSummary(
- R.string.security_enable_widgets_disabled_summary);
+ if (ActivityManager.isLowRamDeviceStatic()) {
+ // Widgets take a lot of RAM, so disable them on low-memory devices
+ PreferenceGroup securityCategory
+ = (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY);
+ if (securityCategory != null) {
+ securityCategory.removePreference(root.findPreference(KEY_ENABLE_WIDGETS));
+ mEnableKeyguardWidgets = null;
+ }
} else {
- mEnableKeyguardWidgets.setSummary("");
+ final boolean disabled = (0 != (mDPM.getKeyguardDisabledFeatures(null)
+ & DevicePolicyManager.KEYGUARD_DISABLE_WIDGETS_ALL));
+ if (disabled) {
+ mEnableKeyguardWidgets.setSummary(
+ R.string.security_enable_widgets_disabled_summary);
+ } else {
+ mEnableKeyguardWidgets.setSummary("");
+ }
+ mEnableKeyguardWidgets.setEnabled(!disabled);
}
- mEnableKeyguardWidgets.setEnabled(!disabled);
}
// Show password