am c14b9ccd: Extend Intent/Uri conversion for use by Browser
Merge commit 'c14b9ccdf13163cae5ce5d21bcf377010b37594b' * commit 'c14b9ccdf13163cae5ce5d21bcf377010b37594b': Extend Intent/Uri conversion for use by Browser
This commit is contained in:
committed by
The Android Open Source Project
commit
abb01dba70
@@ -1269,28 +1269,6 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
return chooseBestActivity(intent, resolvedType, flags, query);
|
||||
}
|
||||
|
||||
public ResolveInfo resolveIntentForPackage(Intent intent, String resolvedType,
|
||||
int flags, String packageName) {
|
||||
ComponentName comp = intent.getComponent();
|
||||
if (comp != null) {
|
||||
// if this is an explicit intent, it must have the same the packageName
|
||||
if (packageName.equals(comp.getPackageName())) {
|
||||
return resolveIntent(intent, resolvedType, flags);
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
List<ResolveInfo> query = null;
|
||||
synchronized (mPackages) {
|
||||
PackageParser.Package pkg = mPackages.get(packageName);
|
||||
if (pkg != null) {
|
||||
query = (List<ResolveInfo>) mActivities.
|
||||
queryIntentForPackage(intent, resolvedType, flags, pkg.activities);
|
||||
}
|
||||
}
|
||||
return chooseBestActivity(intent, resolvedType, flags, query);
|
||||
}
|
||||
}
|
||||
|
||||
private ResolveInfo chooseBestActivity(Intent intent, String resolvedType,
|
||||
int flags, List<ResolveInfo> query) {
|
||||
if (query != null) {
|
||||
@@ -1409,8 +1387,17 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
}
|
||||
|
||||
synchronized (mPackages) {
|
||||
return (List<ResolveInfo>)mActivities.
|
||||
queryIntent(intent, resolvedType, flags);
|
||||
String pkgName = intent.getPackage();
|
||||
if (pkgName == null) {
|
||||
return (List<ResolveInfo>)mActivities.queryIntent(intent,
|
||||
resolvedType, flags);
|
||||
}
|
||||
PackageParser.Package pkg = mPackages.get(pkgName);
|
||||
if (pkg != null) {
|
||||
return (List<ResolveInfo>) mActivities.queryIntentForPackage(intent,
|
||||
resolvedType, flags, pkg.activities);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1577,9 +1564,30 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
|
||||
public List<ResolveInfo> queryIntentReceivers(Intent intent,
|
||||
String resolvedType, int flags) {
|
||||
ComponentName comp = intent.getComponent();
|
||||
if (comp != null) {
|
||||
List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
|
||||
ActivityInfo ai = getReceiverInfo(comp, flags);
|
||||
if (ai != null) {
|
||||
ResolveInfo ri = new ResolveInfo();
|
||||
ri.activityInfo = ai;
|
||||
list.add(ri);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
synchronized (mPackages) {
|
||||
return (List<ResolveInfo>)mReceivers.
|
||||
queryIntent(intent, resolvedType, flags);
|
||||
String pkgName = intent.getPackage();
|
||||
if (pkgName == null) {
|
||||
return (List<ResolveInfo>)mReceivers.queryIntent(intent,
|
||||
resolvedType, flags);
|
||||
}
|
||||
PackageParser.Package pkg = mPackages.get(pkgName);
|
||||
if (pkg != null) {
|
||||
return (List<ResolveInfo>) mReceivers.queryIntentForPackage(intent,
|
||||
resolvedType, flags, pkg.receivers);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1612,7 +1620,17 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
}
|
||||
|
||||
synchronized (mPackages) {
|
||||
return (List<ResolveInfo>)mServices.queryIntent(intent, resolvedType, flags);
|
||||
String pkgName = intent.getPackage();
|
||||
if (pkgName == null) {
|
||||
return (List<ResolveInfo>)mServices.queryIntent(intent,
|
||||
resolvedType, flags);
|
||||
}
|
||||
PackageParser.Package pkg = mPackages.get(pkgName);
|
||||
if (pkg != null) {
|
||||
return (List<ResolveInfo>)mServices.queryIntentForPackage(intent,
|
||||
resolvedType, flags, pkg.services);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3109,6 +3127,27 @@ class PackageManagerService extends IPackageManager.Stub {
|
||||
(flags&PackageManager.MATCH_DEFAULT_ONLY) != 0);
|
||||
}
|
||||
|
||||
public List queryIntentForPackage(Intent intent, String resolvedType, int flags,
|
||||
ArrayList<PackageParser.Service> packageServices) {
|
||||
if (packageServices == null) {
|
||||
return null;
|
||||
}
|
||||
mFlags = flags;
|
||||
final boolean defaultOnly = (flags&PackageManager.MATCH_DEFAULT_ONLY) != 0;
|
||||
int N = packageServices.size();
|
||||
ArrayList<ArrayList<PackageParser.ServiceIntentInfo>> listCut =
|
||||
new ArrayList<ArrayList<PackageParser.ServiceIntentInfo>>(N);
|
||||
|
||||
ArrayList<PackageParser.ServiceIntentInfo> intentFilters;
|
||||
for (int i = 0; i < N; ++i) {
|
||||
intentFilters = packageServices.get(i).intents;
|
||||
if (intentFilters != null && intentFilters.size() > 0) {
|
||||
listCut.add(intentFilters);
|
||||
}
|
||||
}
|
||||
return super.queryIntentFromList(intent, resolvedType, defaultOnly, listCut);
|
||||
}
|
||||
|
||||
public final void addService(PackageParser.Service s) {
|
||||
mServices.put(s.component, s);
|
||||
if (SHOW_INFO || Config.LOGV) Log.v(
|
||||
|
||||
Reference in New Issue
Block a user