am c3b392d0: Merge "Removing the NO_CROSS_PROFILE flag for intent forwarding" into lmp-dev

* commit 'c3b392d02693f8236fdc6ebc90412e3c4aaa5843':
  Removing the NO_CROSS_PROFILE flag for intent forwarding
This commit is contained in:
Alexandra Gherghina
2014-09-09 17:52:46 +00:00
committed by Android Git Automerger
3 changed files with 30 additions and 42 deletions

View File

@@ -200,12 +200,6 @@ public abstract class PackageManager {
*/
public static final int MATCH_DEFAULT_ONLY = 0x00010000;
/**
* Resolution and querying flag: do not resolve intents cross-profile.
* @hide
*/
public static final int NO_CROSS_PROFILE = 0x00020000;
/**
* Flag for {@link addCrossProfileIntentFilter}: if this flag is set:
* when resolving an intent that matches the {@link CrossProfileIntentFilter}, the current
@@ -2440,7 +2434,6 @@ public abstract class PackageManager {
* @see #MATCH_DEFAULT_ONLY
* @see #GET_INTENT_FILTERS
* @see #GET_RESOLVED_FILTER
* @see #NO_CROSS_PROFILE
* @hide
*/
public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,

View File

@@ -199,8 +199,7 @@ public class LauncherAppsService extends SystemService {
mainIntent.setPackage(packageName);
long ident = Binder.clearCallingIdentity();
try {
List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(mainIntent,
PackageManager.NO_CROSS_PROFILE, // We only want the apps for this user
List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(mainIntent, 0 /* flags */,
user.getIdentifier());
return apps;
} finally {
@@ -288,8 +287,7 @@ public class LauncherAppsService extends SystemService {
// as calling startActivityAsUser ignores the category and just
// resolves based on the component if present.
List<ResolveInfo> apps = mPm.queryIntentActivitiesAsUser(launchIntent,
PackageManager.NO_CROSS_PROFILE, // We only want the apps for this user
user.getIdentifier());
0 /* flags */, user.getIdentifier());
final int size = apps.size();
for (int i = 0; i < size; ++i) {
ActivityInfo activityInfo = apps.get(i).activityInfo;

View File

@@ -3240,32 +3240,31 @@ public class PackageManagerService extends IPackageManager.Stub {
// reader
synchronized (mPackages) {
final String pkgName = intent.getPackage();
boolean queryCrossProfile = (flags & PackageManager.NO_CROSS_PROFILE) == 0;
if (pkgName == null) {
ResolveInfo resolveInfo = null;
if (queryCrossProfile) {
// Check if the intent needs to be forwarded to another user for this package
ArrayList<ResolveInfo> crossProfileResult =
queryIntentActivitiesCrossProfilePackage(
intent, resolvedType, flags, userId);
if (!crossProfileResult.isEmpty()) {
// Skip the current profile
return crossProfileResult;
}
List<CrossProfileIntentFilter> matchingFilters =
getMatchingCrossProfileIntentFilters(intent, resolvedType, userId);
// Check for results that need to skip the current profile.
resolveInfo = querySkipCurrentProfileIntents(matchingFilters, intent,
resolvedType, flags, userId);
if (resolveInfo != null) {
List<ResolveInfo> result = new ArrayList<ResolveInfo>(1);
result.add(resolveInfo);
return result;
}
// Check for cross profile results.
resolveInfo = queryCrossProfileIntents(
matchingFilters, intent, resolvedType, flags, userId);
// Check if the intent needs to be forwarded to another user for this package
ArrayList<ResolveInfo> crossProfileResult =
queryIntentActivitiesCrossProfilePackage(
intent, resolvedType, flags, userId);
if (!crossProfileResult.isEmpty()) {
// Skip the current profile
return crossProfileResult;
}
List<CrossProfileIntentFilter> matchingFilters =
getMatchingCrossProfileIntentFilters(intent, resolvedType, userId);
// Check for results that need to skip the current profile.
resolveInfo = querySkipCurrentProfileIntents(matchingFilters, intent,
resolvedType, flags, userId);
if (resolveInfo != null) {
List<ResolveInfo> result = new ArrayList<ResolveInfo>(1);
result.add(resolveInfo);
return result;
}
// Check for cross profile results.
resolveInfo = queryCrossProfileIntents(
matchingFilters, intent, resolvedType, flags, userId);
// Check for results in the current profile.
List<ResolveInfo> result = mActivities.queryIntent(
intent, resolvedType, flags, userId);
@@ -3277,14 +3276,12 @@ public class PackageManagerService extends IPackageManager.Stub {
}
final PackageParser.Package pkg = mPackages.get(pkgName);
if (pkg != null) {
if (queryCrossProfile) {
ArrayList<ResolveInfo> crossProfileResult =
queryIntentActivitiesCrossProfilePackage(
intent, resolvedType, flags, userId, pkg, pkgName);
if (!crossProfileResult.isEmpty()) {
// Skip the current profile
return crossProfileResult;
}
ArrayList<ResolveInfo> crossProfileResult =
queryIntentActivitiesCrossProfilePackage(
intent, resolvedType, flags, userId, pkg, pkgName);
if (!crossProfileResult.isEmpty()) {
// Skip the current profile
return crossProfileResult;
}
return mActivities.queryIntentForPackage(intent, resolvedType, flags,
pkg.activities, userId);