diff options
author | Jim Miller <jaggies@google.com> | 2013-08-20 19:03:30 -0700 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2013-08-20 19:03:30 -0700 |
commit | ef3e701b78134baf753484c44b7d1915029faa3f (patch) | |
tree | c4c74b8c0481dc9ebb701ae57d15b8e894dfc121 /src/com/android/settings/SecuritySettings.java | |
parent | 55fe056d96bdb683dce0a4e66e7390d19f23e710 (diff) | |
download | packages_apps_Settings-ef3e701b78134baf753484c44b7d1915029faa3f.tar.gz packages_apps_Settings-ef3e701b78134baf753484c44b7d1915029faa3f.tar.bz2 packages_apps_Settings-ef3e701b78134baf753484c44b7d1915029faa3f.zip |
Add setting to disable keyguard widgets
This allows disabling keyguard widgets through Settings.
On new devices, the setting is turned off by default. If the
user currently has widgets in keyguard, then we keep them
and re-enable the setting.
Change-Id: I25f0756ac72227e13dcb491694b3ec3c2bf1d293
Diffstat (limited to 'src/com/android/settings/SecuritySettings.java')
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index f893c3645..df49cec3d 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -65,6 +65,8 @@ public class SecuritySettings extends RestrictedSettingsFragment private static final String KEY_DEVICE_ADMIN_CATEGORY = "device_admin_category"; private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout"; private static final String KEY_OWNER_INFO_SETTINGS = "owner_info_settings"; + private static final String KEY_ENABLE_WIDGETS = "keyguard_enable_widgets"; + private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123; private static final int CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_IMPROVE_REQUEST = 124; private static final int CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_LIVELINESS_OFF = 125; @@ -101,6 +103,7 @@ public class SecuritySettings extends RestrictedSettingsFragment private DialogInterface mWarnInstallApps; private CheckBoxPreference mToggleVerifyApps; private CheckBoxPreference mPowerButtonInstantlyLocks; + private CheckBoxPreference mEnableKeyguardWidgets; private Preference mNotificationAccess; @@ -241,6 +244,20 @@ 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); + } else { + mEnableKeyguardWidgets.setSummary(""); + } + mEnableKeyguardWidgets.setEnabled(!disabled); + } + // Show password mShowPassword = (CheckBoxPreference) root.findPreference(KEY_SHOW_PASSWORD); mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS); @@ -477,6 +494,10 @@ public class SecuritySettings extends RestrictedSettingsFragment if (mResetCredentials != null) { mResetCredentials.setEnabled(!mKeyStore.isEmpty()); } + + if (mEnableKeyguardWidgets != null) { + mEnableKeyguardWidgets.setChecked(lockPatternUtils.getWidgetsEnabled()); + } } @Override @@ -527,6 +548,8 @@ public class SecuritySettings extends RestrictedSettingsFragment lockPatternUtils.setVisiblePatternEnabled(isToggled(preference)); } else if (KEY_POWER_INSTANTLY_LOCKS.equals(key)) { lockPatternUtils.setPowerButtonInstantlyLocks(isToggled(preference)); + } else if (KEY_ENABLE_WIDGETS.equals(key)) { + lockPatternUtils.setWidgetsEnabled(mEnableKeyguardWidgets.isChecked()); } else if (preference == mShowPassword) { Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, mShowPassword.isChecked() ? 1 : 0); |