Don't add any trust agents if the controller is not available.

TrustAgentListPreferenceController gets a list of trust agents and add
them to the security_category preference category at runtime. However,
this update process is always ran - even if the controller is explicitly
disabled/not available. This fixes this.

Bug: None
Test: Updated TrustAgentListPreferenceControllerTest.
Change-Id: Ic95d219bc1d0c7cfa0c4eed0d3dd12dec0e14df6
This commit is contained in:
Ben Lin
2018-01-17 11:40:15 -08:00
parent dd1e1e1d99
commit cf6d84109b
2 changed files with 25 additions and 0 deletions

View File

@@ -146,6 +146,10 @@ public class TrustAgentListPreferenceController extends AbstractPreferenceContro
mSecurityCategory.removePreference(oldAgent);
}
}
// If for some reason the preference is no longer available, don't proceed to add.
if (!isAvailable()) {
return;
}
// Then add new ones.
final boolean hasSecurity = mLockPatternUtils.isSecure(MY_USER_ID);
final List<TrustAgentManager.TrustAgentComponentInfo> agents =