Small fix to trust agent item in security settings.
Change-Id: Ie3157e0c9c68bbab5ba394f61c12d1bbf075bb06
This commit is contained in:
@@ -22,6 +22,7 @@ import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
@@ -43,6 +44,7 @@ import android.provider.Settings;
|
||||
import android.security.KeyStore;
|
||||
import android.service.trust.TrustAgentService;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
@@ -315,14 +317,16 @@ public class SecuritySettings extends RestrictedSettingsFragment
|
||||
PackageManager pm = getPackageManager();
|
||||
List<ResolveInfo> resolveInfos = pm.queryIntentServices(TRUST_AGENT_INTENT,
|
||||
PackageManager.GET_META_DATA);
|
||||
List<ComponentName> enabledTrustAgents = mLockPatternUtils.getEnabledTrustAgents();
|
||||
if (enabledTrustAgents != null && !enabledTrustAgents.isEmpty()) {
|
||||
for (ResolveInfo resolveInfo : resolveInfos) {
|
||||
if (resolveInfo.serviceInfo == null) continue;
|
||||
if (!TrustAgentUtils.checkProvidePermission(resolveInfo, pm)) continue;
|
||||
TrustAgentUtils.TrustAgentComponentInfo trustAgentComponentInfo =
|
||||
TrustAgentUtils.getSettingsComponent(pm, resolveInfo);
|
||||
if (trustAgentComponentInfo.componentName == null ||
|
||||
trustAgentComponentInfo.title == null ||
|
||||
trustAgentComponentInfo.title == "") continue;
|
||||
!enabledTrustAgents.contains(trustAgentComponentInfo.componentName) ||
|
||||
TextUtils.isEmpty(trustAgentComponentInfo.title)) continue;
|
||||
Preference trustAgentPreference =
|
||||
new Preference(securityCategory.getContext());
|
||||
trustAgentPreference.setKey(KEY_TRUST_AGENT);
|
||||
@@ -338,6 +342,7 @@ public class SecuritySettings extends RestrictedSettingsFragment
|
||||
break; // Only render the first one.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
Reference in New Issue
Block a user