am f6794f95: Merge "Add setting to disable keyguard widgets" into klp-dev

* commit 'f6794f95d19306e0f8a1edf02670d8dabd6daa5f':
  Add setting to disable keyguard widgets
This commit is contained in:
Jim Miller
2013-08-26 15:03:23 -07:00
committed by Android Git Automerger
8 changed files with 52 additions and 0 deletions

View File

@@ -682,6 +682,10 @@
<string name="show_owner_info_on_lockscreen_label">Show owner info on lock screen</string> <string name="show_owner_info_on_lockscreen_label">Show owner info on lock screen</string>
<!-- Text shown for title of owner info setting [CHAR LIMIT=20]--> <!-- Text shown for title of owner info setting [CHAR LIMIT=20]-->
<string name="owner_info_settings_title">Owner info</string> <string name="owner_info_settings_title">Owner info</string>
<!-- Text shown for title of settings checkbox to disable widgets [CHAR LIMIT=20]-->
<string name="security_enable_widgets_title">Enable widgets</string>
<!-- Summary for settings checkbox to disable widgets when the setting has been disabled by an installed device admin [CHAR LIMIT=50] -->
<string name="security_enable_widgets_disabled_summary">Disabled by administrator</string>
<!-- Text shown for summary of owner info setting [CHAR LIMIT=40]--> <!-- Text shown for summary of owner info setting [CHAR LIMIT=40]-->
<string name="owner_info_settings_summary"></string> <string name="owner_info_settings_summary"></string>
<!-- Hint text shown in owner info edit text [CHAR LIMIT=50] --> <!-- Hint text shown in owner info edit text [CHAR LIMIT=50] -->

View File

@@ -51,6 +51,10 @@
android:key="power_button_instantly_locks" android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/> android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
<CheckBoxPreference
android:key="keyguard_enable_widgets"
android:title="@string/security_enable_widgets_title"/>
<PreferenceScreen <PreferenceScreen
android:fragment="com.android.settings.OwnerInfoSettings" android:fragment="com.android.settings.OwnerInfoSettings"
android:key="owner_info_settings" android:key="owner_info_settings"

View File

@@ -26,6 +26,10 @@
android:summary="@string/unlock_set_unlock_mode_none" android:summary="@string/unlock_set_unlock_mode_none"
android:persistent="false"/> android:persistent="false"/>
<CheckBoxPreference
android:key="keyguard_enable_widgets"
android:title="@string/security_enable_widgets_title"/>
<PreferenceScreen <PreferenceScreen
android:fragment="com.android.settings.OwnerInfoSettings" android:fragment="com.android.settings.OwnerInfoSettings"
android:key="owner_info_settings" android:key="owner_info_settings"

View File

@@ -25,6 +25,11 @@
android:title="@string/unlock_set_unlock_launch_picker_title" android:title="@string/unlock_set_unlock_launch_picker_title"
android:summary="@string/unlock_set_unlock_mode_off" android:summary="@string/unlock_set_unlock_mode_off"
android:persistent="false"/> android:persistent="false"/>
<CheckBoxPreference
android:key="keyguard_enable_widgets"
android:title="@string/security_enable_widgets_title"/>
<PreferenceScreen <PreferenceScreen
android:fragment="com.android.settings.OwnerInfoSettings" android:fragment="com.android.settings.OwnerInfoSettings"
android:key="owner_info_settings" android:key="owner_info_settings"

View File

@@ -38,6 +38,10 @@
android:key="power_button_instantly_locks" android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/> android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
<CheckBoxPreference
android:key="keyguard_enable_widgets"
android:title="@string/security_enable_widgets_title"/>
<PreferenceScreen <PreferenceScreen
android:fragment="com.android.settings.OwnerInfoSettings" android:fragment="com.android.settings.OwnerInfoSettings"
android:key="owner_info_settings" android:key="owner_info_settings"

View File

@@ -42,6 +42,10 @@
android:key="power_button_instantly_locks" android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/> android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
<CheckBoxPreference
android:key="keyguard_enable_widgets"
android:title="@string/security_enable_widgets_title"/>
<PreferenceScreen <PreferenceScreen
android:fragment="com.android.settings.OwnerInfoSettings" android:fragment="com.android.settings.OwnerInfoSettings"
android:key="owner_info_settings" android:key="owner_info_settings"

View File

@@ -38,6 +38,10 @@
android:key="power_button_instantly_locks" android:key="power_button_instantly_locks"
android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/> android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
<CheckBoxPreference
android:key="keyguard_enable_widgets"
android:title="@string/security_enable_widgets_title"/>
<PreferenceScreen <PreferenceScreen
android:fragment="com.android.settings.OwnerInfoSettings" android:fragment="com.android.settings.OwnerInfoSettings"
android:key="owner_info_settings" android:key="owner_info_settings"

View File

@@ -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_DEVICE_ADMIN_CATEGORY = "device_admin_category";
private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout"; 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_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 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_IMPROVE_REQUEST = 124;
private static final int CONFIRM_EXISTING_FOR_BIOMETRIC_WEAK_LIVELINESS_OFF = 125; 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 DialogInterface mWarnInstallApps;
private CheckBoxPreference mToggleVerifyApps; private CheckBoxPreference mToggleVerifyApps;
private CheckBoxPreference mPowerButtonInstantlyLocks; private CheckBoxPreference mPowerButtonInstantlyLocks;
private CheckBoxPreference mEnableKeyguardWidgets;
private Preference mNotificationAccess; 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 // Show password
mShowPassword = (CheckBoxPreference) root.findPreference(KEY_SHOW_PASSWORD); mShowPassword = (CheckBoxPreference) root.findPreference(KEY_SHOW_PASSWORD);
mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS); mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS);
@@ -477,6 +494,10 @@ public class SecuritySettings extends RestrictedSettingsFragment
if (mResetCredentials != null) { if (mResetCredentials != null) {
mResetCredentials.setEnabled(!mKeyStore.isEmpty()); mResetCredentials.setEnabled(!mKeyStore.isEmpty());
} }
if (mEnableKeyguardWidgets != null) {
mEnableKeyguardWidgets.setChecked(lockPatternUtils.getWidgetsEnabled());
}
} }
@Override @Override
@@ -527,6 +548,8 @@ public class SecuritySettings extends RestrictedSettingsFragment
lockPatternUtils.setVisiblePatternEnabled(isToggled(preference)); lockPatternUtils.setVisiblePatternEnabled(isToggled(preference));
} else if (KEY_POWER_INSTANTLY_LOCKS.equals(key)) { } else if (KEY_POWER_INSTANTLY_LOCKS.equals(key)) {
lockPatternUtils.setPowerButtonInstantlyLocks(isToggled(preference)); lockPatternUtils.setPowerButtonInstantlyLocks(isToggled(preference));
} else if (KEY_ENABLE_WIDGETS.equals(key)) {
lockPatternUtils.setWidgetsEnabled(mEnableKeyguardWidgets.isChecked());
} else if (preference == mShowPassword) { } else if (preference == mShowPassword) {
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
mShowPassword.isChecked() ? 1 : 0); mShowPassword.isChecked() ? 1 : 0);