<!-- Title of preference to manage trust agents -->
<string name="manage_trust_agents">Trust agents</string>
+ <!-- Summary shown when trust agent settings is disabled because the user hasn't set up primary security -->
+ <string name="disabled_because_no_backup_security">To use, first set a screen lock</string>
+
<!-- Summary of preference to manage device policies -->
<string name="manage_trust_agents_summary">View or deactivate trust agents</string>
// Trust Agent preferences
PreferenceGroup securityCategory = (PreferenceGroup)
root.findPreference(KEY_SECURITY_CATEGORY);
- if (securityCategory != null && mLockPatternUtils.isSecure()) {
+ if (securityCategory != null) {
+ final boolean hasSecurity = mLockPatternUtils.isSecure();
ArrayList<TrustAgentComponentInfo> agents =
getActiveTrustAgents(getPackageManager(), mLockPatternUtils);
for (int i = 0; i < agents.size(); i++) {
trustAgentPreference.setIntent(intent);
// Add preference to the settings menu.
securityCategory.addPreference(trustAgentPreference);
+ if (!hasSecurity) {
+ trustAgentPreference.setEnabled(false);
+ trustAgentPreference.setSummary(R.string.disabled_because_no_backup_security);
+ }
}
}
// Advanced Security features
PreferenceGroup advancedCategory =
(PreferenceGroup)root.findPreference(KEY_ADVANCED_SECURITY);
- if (advancedCategory != null && !mLockPatternUtils.isSecure()) {
+ if (advancedCategory != null) {
Preference manageAgents = advancedCategory.findPreference(KEY_MANAGE_TRUST_AGENTS);
- if (manageAgents != null) advancedCategory.removePreference(manageAgents);
+ if (manageAgents != null && !mLockPatternUtils.isSecure()) {
+ manageAgents.setEnabled(false);
+ manageAgents.setSummary(R.string.disabled_because_no_backup_security);
+ }
}
// The above preferences come and go based on security state, so we need to update