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