Disable keyguard widgets on low memory devices
Fixes bug 10784493 Change-Id: Idc1c35faf0715814fa1a257319888945c82527c6
This commit is contained in:
@@ -20,6 +20,7 @@ package com.android.settings;
|
||||
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 @@ public class SecuritySettings extends RestrictedSettingsFragment
|
||||
// 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
|
||||
|
Reference in New Issue
Block a user