Loading services/core/java/com/android/server/pm/ComponentResolver.java +4 −13 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.content.pm.AuxiliaryResolveInfo; import android.content.pm.InstantAppResolveInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.pm.PackageManagerInternal.PrivateResolveFlags; import android.content.pm.PackageUserState; import android.content.pm.ProviderInfo; import android.content.pm.ResolveInfo; Loading Loading @@ -261,10 +260,9 @@ public class ComponentResolver { @Nullable List<ResolveInfo> queryActivities(Intent intent, String resolvedType, int flags, @PrivateResolveFlags int privateResolveFlags, int userId) { int userId) { synchronized (mLock) { return mActivities.queryIntent( intent, resolvedType, flags, privateResolveFlags, userId); return mActivities.queryIntent(intent, resolvedType, flags, userId); } } Loading Loading @@ -427,7 +425,7 @@ public class ComponentResolver { @Nullable List<ResolveInfo> queryReceivers(Intent intent, String resolvedType, int flags, int userId) { synchronized (mLock) { return mReceivers.queryIntent(intent, resolvedType, flags, 0, userId); return mReceivers.queryIntent(intent, resolvedType, flags, userId); } } Loading Loading @@ -1293,12 +1291,11 @@ public class ComponentResolver { } List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags, int privateResolveFlags, int userId) { int userId) { if (!sUserManager.exists(userId)) { return null; } mFlags = flags; mPrivateResolveFlags = privateResolveFlags; return super.queryIntent(intent, resolvedType, (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0, userId); Loading Loading @@ -1495,11 +1492,6 @@ public class ComponentResolver { } return null; } final boolean matchNonBrowserOnly = (mPrivateResolveFlags & PackageManagerInternal.RESOLVE_NON_BROWSER_ONLY) != 0; if (matchNonBrowserOnly && info.handleAllWebDataURI()) { return null; } final ResolveInfo res = new ResolveInfo(); res.activityInfo = ai; if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) { Loading Loading @@ -1579,7 +1571,6 @@ public class ComponentResolver { private final ArrayMap<ComponentName, ParsedActivity> mActivities = new ArrayMap<>(); private int mFlags; private int mPrivateResolveFlags; } // Both receivers and activities share a class, but point to different get methods Loading services/core/java/com/android/server/pm/PackageManagerService.java +17 −5 Original line number Diff line number Diff line Loading @@ -6414,6 +6414,11 @@ public class PackageManagerService extends IPackageManager.Stub final ResolveInfo bestChoice = chooseBestActivity( intent, resolvedType, flags, privateResolveFlags, query, userId); final boolean nonBrowserOnly = (privateResolveFlags & PackageManagerInternal.RESOLVE_NON_BROWSER_ONLY) != 0; if (nonBrowserOnly && bestChoice != null && bestChoice.handleAllWebDataURI) { return null; } return bestChoice; } finally { Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); Loading Loading @@ -6601,9 +6606,13 @@ public class PackageManagerService extends IPackageManager.Stub if (ri != null) { return ri; } // If we have an ephemeral app, use it int browserCount = 0; for (int i = 0; i < N; i++) { ri = query.get(i); if (ri.handleAllWebDataURI) { browserCount++; } // If we have an ephemeral app, use it if (ri.activityInfo.applicationInfo.isInstantApp()) { final String packageName = ri.activityInfo.packageName; final PackageSetting ps = mSettings.mPackages.get(packageName); Loading @@ -6619,6 +6628,9 @@ public class PackageManagerService extends IPackageManager.Stub return null; } ri = new ResolveInfo(mResolveInfo); // if all resolve options are browsers, mark the resolver's info as if it were // also a browser. ri.handleAllWebDataURI = browserCount == N; ri.activityInfo = new ActivityInfo(ri.activityInfo); ri.activityInfo.labelRes = ResolverActivity.getLabelRes(intent.getAction()); // If all of the options come from the same package, show the application's Loading Loading @@ -7129,7 +7141,7 @@ public class PackageManagerService extends IPackageManager.Stub // Check for results in the current profile. result = filterIfNotSystemUser(mComponentResolver.queryActivities( intent, resolvedType, flags, privateResolveFlags, userId), userId); intent, resolvedType, flags, userId), userId); addInstant = isInstantAppResolutionAllowed(intent, result, userId, false /*skipPackageCheck*/); // Check for cross profile results. Loading Loading @@ -7228,7 +7240,7 @@ public class PackageManagerService extends IPackageManager.Stub | PackageManager.GET_RESOLVED_FILTER | PackageManager.MATCH_INSTANT | PackageManager.MATCH_VISIBLE_TO_INSTANT_APP_ONLY, 0, userId); userId); for (int i = instantApps.size() - 1; i >= 0; --i) { final ResolveInfo info = instantApps.get(i); final String packageName = info.activityInfo.packageName; Loading Loading @@ -7332,7 +7344,7 @@ public class PackageManagerService extends IPackageManager.Stub return null; } List<ResolveInfo> resultTargetUser = mComponentResolver.queryActivities(intent, resolvedType, flags, 0, parentUserId); resolvedType, flags, parentUserId); if (resultTargetUser == null || resultTargetUser.isEmpty()) { return null; Loading Loading @@ -7780,7 +7792,7 @@ public class PackageManagerService extends IPackageManager.Stub String resolvedType, int flags, int sourceUserId) { int targetUserId = filter.getTargetUserId(); List<ResolveInfo> resultTargetUser = mComponentResolver.queryActivities(intent, resolvedType, flags, 0, targetUserId); resolvedType, flags, targetUserId); if (resultTargetUser != null && isUserEnabled(targetUserId)) { // If all the matches in the target profile are suspended, return null. for (int i = resultTargetUser.size() - 1; i >= 0; i--) { Loading
services/core/java/com/android/server/pm/ComponentResolver.java +4 −13 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.content.pm.AuxiliaryResolveInfo; import android.content.pm.InstantAppResolveInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.pm.PackageManagerInternal.PrivateResolveFlags; import android.content.pm.PackageUserState; import android.content.pm.ProviderInfo; import android.content.pm.ResolveInfo; Loading Loading @@ -261,10 +260,9 @@ public class ComponentResolver { @Nullable List<ResolveInfo> queryActivities(Intent intent, String resolvedType, int flags, @PrivateResolveFlags int privateResolveFlags, int userId) { int userId) { synchronized (mLock) { return mActivities.queryIntent( intent, resolvedType, flags, privateResolveFlags, userId); return mActivities.queryIntent(intent, resolvedType, flags, userId); } } Loading Loading @@ -427,7 +425,7 @@ public class ComponentResolver { @Nullable List<ResolveInfo> queryReceivers(Intent intent, String resolvedType, int flags, int userId) { synchronized (mLock) { return mReceivers.queryIntent(intent, resolvedType, flags, 0, userId); return mReceivers.queryIntent(intent, resolvedType, flags, userId); } } Loading Loading @@ -1293,12 +1291,11 @@ public class ComponentResolver { } List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags, int privateResolveFlags, int userId) { int userId) { if (!sUserManager.exists(userId)) { return null; } mFlags = flags; mPrivateResolveFlags = privateResolveFlags; return super.queryIntent(intent, resolvedType, (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0, userId); Loading Loading @@ -1495,11 +1492,6 @@ public class ComponentResolver { } return null; } final boolean matchNonBrowserOnly = (mPrivateResolveFlags & PackageManagerInternal.RESOLVE_NON_BROWSER_ONLY) != 0; if (matchNonBrowserOnly && info.handleAllWebDataURI()) { return null; } final ResolveInfo res = new ResolveInfo(); res.activityInfo = ai; if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) { Loading Loading @@ -1579,7 +1571,6 @@ public class ComponentResolver { private final ArrayMap<ComponentName, ParsedActivity> mActivities = new ArrayMap<>(); private int mFlags; private int mPrivateResolveFlags; } // Both receivers and activities share a class, but point to different get methods Loading
services/core/java/com/android/server/pm/PackageManagerService.java +17 −5 Original line number Diff line number Diff line Loading @@ -6414,6 +6414,11 @@ public class PackageManagerService extends IPackageManager.Stub final ResolveInfo bestChoice = chooseBestActivity( intent, resolvedType, flags, privateResolveFlags, query, userId); final boolean nonBrowserOnly = (privateResolveFlags & PackageManagerInternal.RESOLVE_NON_BROWSER_ONLY) != 0; if (nonBrowserOnly && bestChoice != null && bestChoice.handleAllWebDataURI) { return null; } return bestChoice; } finally { Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); Loading Loading @@ -6601,9 +6606,13 @@ public class PackageManagerService extends IPackageManager.Stub if (ri != null) { return ri; } // If we have an ephemeral app, use it int browserCount = 0; for (int i = 0; i < N; i++) { ri = query.get(i); if (ri.handleAllWebDataURI) { browserCount++; } // If we have an ephemeral app, use it if (ri.activityInfo.applicationInfo.isInstantApp()) { final String packageName = ri.activityInfo.packageName; final PackageSetting ps = mSettings.mPackages.get(packageName); Loading @@ -6619,6 +6628,9 @@ public class PackageManagerService extends IPackageManager.Stub return null; } ri = new ResolveInfo(mResolveInfo); // if all resolve options are browsers, mark the resolver's info as if it were // also a browser. ri.handleAllWebDataURI = browserCount == N; ri.activityInfo = new ActivityInfo(ri.activityInfo); ri.activityInfo.labelRes = ResolverActivity.getLabelRes(intent.getAction()); // If all of the options come from the same package, show the application's Loading Loading @@ -7129,7 +7141,7 @@ public class PackageManagerService extends IPackageManager.Stub // Check for results in the current profile. result = filterIfNotSystemUser(mComponentResolver.queryActivities( intent, resolvedType, flags, privateResolveFlags, userId), userId); intent, resolvedType, flags, userId), userId); addInstant = isInstantAppResolutionAllowed(intent, result, userId, false /*skipPackageCheck*/); // Check for cross profile results. Loading Loading @@ -7228,7 +7240,7 @@ public class PackageManagerService extends IPackageManager.Stub | PackageManager.GET_RESOLVED_FILTER | PackageManager.MATCH_INSTANT | PackageManager.MATCH_VISIBLE_TO_INSTANT_APP_ONLY, 0, userId); userId); for (int i = instantApps.size() - 1; i >= 0; --i) { final ResolveInfo info = instantApps.get(i); final String packageName = info.activityInfo.packageName; Loading Loading @@ -7332,7 +7344,7 @@ public class PackageManagerService extends IPackageManager.Stub return null; } List<ResolveInfo> resultTargetUser = mComponentResolver.queryActivities(intent, resolvedType, flags, 0, parentUserId); resolvedType, flags, parentUserId); if (resultTargetUser == null || resultTargetUser.isEmpty()) { return null; Loading Loading @@ -7780,7 +7792,7 @@ public class PackageManagerService extends IPackageManager.Stub String resolvedType, int flags, int sourceUserId) { int targetUserId = filter.getTargetUserId(); List<ResolveInfo> resultTargetUser = mComponentResolver.queryActivities(intent, resolvedType, flags, 0, targetUserId); resolvedType, flags, targetUserId); if (resultTargetUser != null && isUserEnabled(targetUserId)) { // If all the matches in the target profile are suspended, return null. for (int i = resultTargetUser.size() - 1; i >= 0; i--) {