Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1351b0fb authored by Jim Miller's avatar Jim Miller Committed by Android (Google) Code Review
Browse files

Merge "Show trust agent entries as disabled rather than removing them." into lmp-dev

parents d5ee3bc8 9d25005e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1103,6 +1103,9 @@
    <!-- 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>

+11 −3
Original line number Diff line number Diff line
@@ -225,7 +225,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
        // 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++) {
@@ -242,6 +243,10 @@ public class SecuritySettings extends SettingsPreferenceFragment
                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);
                }
            }
        }

@@ -340,9 +345,12 @@ public class SecuritySettings extends SettingsPreferenceFragment
        // 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