diff options
author | Adrian Roos <roosa@google.com> | 2014-06-04 21:43:46 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-06-04 21:43:47 +0000 |
commit | fe8572a056fe02fbb384c47d0de617f9a350ebf6 (patch) | |
tree | a7f8c4d931c796958f2f898bab0eb63ef51091ee /src | |
parent | 6430ac5c1eeca8c67e99b820bcfa641e002e537f (diff) | |
parent | 4c8fd9e0cf9b4df38a7c9cef79eca3e43f1fa8bf (diff) | |
download | packages_apps_Settings-fe8572a056fe02fbb384c47d0de617f9a350ebf6.tar.gz packages_apps_Settings-fe8572a056fe02fbb384c47d0de617f9a350ebf6.tar.bz2 packages_apps_Settings-fe8572a056fe02fbb384c47d0de617f9a350ebf6.zip |
Merge "Ensure trust agents are only provided by platform packages - DO NOT MERGE" into lmp-preview-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/TrustAgentSettings.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/settings/TrustAgentSettings.java b/src/com/android/settings/TrustAgentSettings.java index d31436dae..79cccaedf 100644 --- a/src/com/android/settings/TrustAgentSettings.java +++ b/src/com/android/settings/TrustAgentSettings.java @@ -21,6 +21,7 @@ import com.android.internal.widget.LockPatternUtils; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; +import android.Manifest; import android.app.ListFragment; import android.content.ComponentName; import android.content.Context; @@ -36,6 +37,7 @@ import android.service.trust.TrustAgentService; import android.util.ArrayMap; import android.util.ArraySet; import android.util.AttributeSet; +import android.util.Log; import android.util.Slog; import android.util.Xml; import android.view.LayoutInflater; @@ -55,6 +57,8 @@ public class TrustAgentSettings extends ListFragment implements View.OnClickList private static final String SERVICE_INTERFACE = TrustAgentService.SERVICE_INTERFACE; private static final String TRUST_AGENT_META_DATA = TrustAgentService.TRUST_AGENT_META_DATA; + private static final String PERMISSION_PROVIDE_AGENT = Manifest.permission.PROVIDE_TRUST_AGENT; + private final ArraySet<ComponentName> mActiveAgents = new ArraySet<ComponentName>(); private final ArrayMap<ComponentName, AgentInfo> mAvailableAgents @@ -121,6 +125,15 @@ public class TrustAgentSettings extends ListFragment implements View.OnClickList for (ResolveInfo resolveInfo : resolveInfos) { if (resolveInfo.serviceInfo == null) continue; + + String packageName = resolveInfo.serviceInfo.packageName; + if (pm.checkPermission(PERMISSION_PROVIDE_AGENT, packageName) + != PackageManager.PERMISSION_GRANTED) { + Log.w(TAG, "Skipping agent because package " + packageName + + " does not have permission " + PERMISSION_PROVIDE_AGENT + "."); + continue; + } + ComponentName name = getComponentName(resolveInfo); if (!mAvailableAgents.containsKey(name)) { AgentInfo agentInfo = new AgentInfo(); |