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
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user