First <provider> always wins.

In scanPackageLI(), the first provider to claim an authority wins
over any other later providers.  To match this behavior, this changes
ProviderIntentResolver to ignore later providers with the same
ComponentName.

Without this behavior, AM.getContentProvider() could end up wedged
waiting for a provider that generateApplicationProvidersLocked()
never decided to spin up.

Bug: 12956224
Change-Id: I37d3e6e9cf3eea2cac4c0e914134f6c83b2fc2bf
This commit is contained in:
Jeff Sharkey
2014-02-11 12:22:15 -08:00
parent b341a24b2a
commit c6809bb685

View File

@@ -6106,6 +6106,11 @@ public class PackageManagerService extends IPackageManager.Stub {
}
public final void addProvider(PackageParser.Provider p) {
if (mProviders.containsKey(p.getComponentName())) {
Slog.w(TAG, "Provider " + p.getComponentName() + " already defined; ignoring");
return;
}
mProviders.put(p.getComponentName(), p);
if (DEBUG_SHOW_INFO) {
Log.v(TAG, " "