diff options
| author | 2021-11-30 15:47:16 +0000 | |
|---|---|---|
| committer | 2021-11-30 15:47:16 +0000 | |
| commit | 502ab7764e25ca8b40a274e2aef31aea84c82e86 (patch) | |
| tree | 9d8c88b5c1dd1087949547ce6f8407486e29229c | |
| parent | e9273c486904571d5bc026bf6914748f611387f6 (diff) | |
| parent | 5fab45ef672814ad7dd8e4097c48215c8ebe05e9 (diff) | |
Merge "[pm] change internal flags to long"
43 files changed, 584 insertions, 504 deletions
diff --git a/boot/hiddenapi/hiddenapi-unsupported.txt b/boot/hiddenapi/hiddenapi-unsupported.txt index 002d42dbf1dc..522e88f82e25 100644 --- a/boot/hiddenapi/hiddenapi-unsupported.txt +++ b/boot/hiddenapi/hiddenapi-unsupported.txt @@ -124,10 +124,8 @@ Landroid/content/pm/IPackageInstallObserver2$Stub;->asInterface(Landroid/os/IBin Landroid/content/pm/IPackageManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V Landroid/content/pm/IPackageManager$Stub$Proxy;->checkUidPermission(Ljava/lang/String;I)I Landroid/content/pm/IPackageManager$Stub$Proxy;->getAppOpPermissionPackages(Ljava/lang/String;)[Ljava/lang/String; -Landroid/content/pm/IPackageManager$Stub$Proxy;->getInstalledPackages(II)Landroid/content/pm/ParceledListSlice; Landroid/content/pm/IPackageManager$Stub$Proxy;->getInstallLocation()I Landroid/content/pm/IPackageManager$Stub$Proxy;->getLastChosenActivity(Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/pm/ResolveInfo; -Landroid/content/pm/IPackageManager$Stub$Proxy;->getPackageInfo(Ljava/lang/String;II)Landroid/content/pm/PackageInfo; Landroid/content/pm/IPackageManager$Stub$Proxy;->getPackagesForUid(I)[Ljava/lang/String; Landroid/content/pm/IPackageManager$Stub$Proxy;->getSystemSharedLibraryNames()[Ljava/lang/String; Landroid/content/pm/IPackageManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageManager; diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 516156d136d9..1c82b38c5007 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -69,41 +69,34 @@ interface IPackageManager { void checkPackageStartable(String packageName, int userId); @UnsupportedAppUsage(trackingBug = 171933273) boolean isPackageAvailable(String packageName, int userId); - @UnsupportedAppUsage - PackageInfo getPackageInfo(String packageName, int flags, int userId); + PackageInfo getPackageInfo(String packageName, long flags, int userId); PackageInfo getPackageInfoVersioned(in VersionedPackage versionedPackage, - int flags, int userId); - @UnsupportedAppUsage - int getPackageUid(String packageName, int flags, int userId); - int[] getPackageGids(String packageName, int flags, int userId); + long flags, int userId); + int getPackageUid(String packageName, long flags, int userId); + int[] getPackageGids(String packageName, long flags, int userId); @UnsupportedAppUsage String[] currentToCanonicalPackageNames(in String[] names); @UnsupportedAppUsage String[] canonicalToCurrentPackageNames(in String[] names); - @UnsupportedAppUsage - ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId); + ApplicationInfo getApplicationInfo(String packageName, long flags, int userId); /** * @return the target SDK for the given package name, or -1 if it cannot be retrieved */ int getTargetSdkVersion(String packageName); - @UnsupportedAppUsage - ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId); + ActivityInfo getActivityInfo(in ComponentName className, long flags, int userId); boolean activitySupportsIntent(in ComponentName className, in Intent intent, String resolvedType); - @UnsupportedAppUsage - ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId); + ActivityInfo getReceiverInfo(in ComponentName className, long flags, int userId); - @UnsupportedAppUsage - ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId); + ServiceInfo getServiceInfo(in ComponentName className, long flags, int userId); - @UnsupportedAppUsage - ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId); + ProviderInfo getProviderInfo(in ComponentName className, long flags, int userId); boolean isProtectedBroadcast(String actionName); @@ -133,33 +126,31 @@ interface IPackageManager { @UnsupportedAppUsage boolean isUidPrivileged(int uid); - @UnsupportedAppUsage - ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId); + ResolveInfo resolveIntent(in Intent intent, String resolvedType, long flags, int userId); ResolveInfo findPersistentPreferredActivity(in Intent intent, int userId); boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId); - @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) ParceledListSlice queryIntentActivities(in Intent intent, - String resolvedType, int flags, int userId); + String resolvedType, long flags, int userId); ParceledListSlice queryIntentActivityOptions( in ComponentName caller, in Intent[] specifics, in String[] specificTypes, in Intent intent, - String resolvedType, int flags, int userId); + String resolvedType, long flags, int userId); ParceledListSlice queryIntentReceivers(in Intent intent, - String resolvedType, int flags, int userId); + String resolvedType, long flags, int userId); ResolveInfo resolveService(in Intent intent, - String resolvedType, int flags, int userId); + String resolvedType, long flags, int userId); ParceledListSlice queryIntentServices(in Intent intent, - String resolvedType, int flags, int userId); + String resolvedType, long flags, int userId); ParceledListSlice queryIntentContentProviders(in Intent intent, - String resolvedType, int flags, int userId); + String resolvedType, long flags, int userId); /** * This implements getInstalledPackages via a "last returned row" @@ -167,8 +158,7 @@ interface IPackageManager { * limit that kicks in when flags are included that bloat up the data * returned. */ - @UnsupportedAppUsage - ParceledListSlice getInstalledPackages(int flags, in int userId); + ParceledListSlice getInstalledPackages(long flags, in int userId); /** * This implements getPackagesHoldingPermissions via a "last returned row" @@ -177,7 +167,7 @@ interface IPackageManager { * returned. */ ParceledListSlice getPackagesHoldingPermissions(in String[] permissions, - int flags, int userId); + long flags, int userId); /** * This implements getInstalledApplications via a "last returned row" @@ -185,18 +175,17 @@ interface IPackageManager { * limit that kicks in when flags are included that bloat up the data * returned. */ - @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) - ParceledListSlice getInstalledApplications(int flags, int userId); + ParceledListSlice getInstalledApplications(long flags, int userId); /** * Retrieve all applications that are marked as persistent. * - * @return A List<applicationInfo> containing one entry for each persistent + * @return A List<ApplicationInfo> containing one entry for each persistent * application. */ ParceledListSlice getPersistentApplications(int flags); - ProviderInfo resolveContentProvider(String name, int flags, int userId); + ProviderInfo resolveContentProvider(String name, long flags, int userId); /** * Retrieve sync information for all content providers. @@ -211,7 +200,7 @@ interface IPackageManager { inout List<ProviderInfo> outInfo); ParceledListSlice queryContentProviders( - String processName, int uid, int flags, String metaDataKey); + String processName, int uid, long flags, String metaDataKey); @UnsupportedAppUsage InstrumentationInfo getInstrumentationInfo( @@ -690,9 +679,9 @@ interface IPackageManager { int getInstallReason(String packageName, int userId); - ParceledListSlice getSharedLibraries(in String packageName, int flags, int userId); + ParceledListSlice getSharedLibraries(in String packageName, long flags, int userId); - ParceledListSlice getDeclaredSharedLibraries(in String packageName, int flags, int userId); + ParceledListSlice getDeclaredSharedLibraries(in String packageName, long flags, int userId); boolean canRequestPackageInstalls(String packageName, int userId); diff --git a/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java b/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java index ef124c7e3b27..b11b38a6d788 100644 --- a/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java +++ b/core/java/android/content/pm/parsing/PackageInfoWithoutStateUtils.java @@ -76,7 +76,7 @@ public class PackageInfoWithoutStateUtils { @Nullable public static PackageInfo generate(ParsingPackageRead pkg, int[] gids, - @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime, + @PackageManager.PackageInfoFlags long flags, long firstInstallTime, long lastUpdateTime, Set<String> grantedPermissions, FrameworkPackageUserState state, int userId) { return generateWithComponents(pkg, gids, flags, firstInstallTime, lastUpdateTime, grantedPermissions, state, userId, null); @@ -90,7 +90,7 @@ public class PackageInfoWithoutStateUtils { @Nullable private static PackageInfo generateWithComponents(ParsingPackageRead pkg, int[] gids, - @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime, + @PackageManager.PackageInfoFlags long flags, long firstInstallTime, long lastUpdateTime, Set<String> grantedPermissions, FrameworkPackageUserState state, int userId, @Nullable ApexInfo apexInfo) { ApplicationInfo applicationInfo = generateApplicationInfo(pkg, flags, state, userId); @@ -190,7 +190,7 @@ public class PackageInfoWithoutStateUtils { @Nullable public static PackageInfo generateWithoutComponents(ParsingPackageRead pkg, int[] gids, - @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime, + @PackageManager.PackageInfoFlags long flags, long firstInstallTime, long lastUpdateTime, Set<String> grantedPermissions, FrameworkPackageUserState state, int userId, @Nullable ApexInfo apexInfo, @NonNull ApplicationInfo applicationInfo) { if (!checkUseInstalled(pkg, state, flags)) { @@ -210,9 +210,9 @@ public class PackageInfoWithoutStateUtils { */ @NonNull public static PackageInfo generateWithoutComponentsUnchecked(ParsingPackageRead pkg, int[] gids, - @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime, - Set<String> grantedPermissions, FrameworkPackageUserState state, int userId, - @Nullable ApexInfo apexInfo, @NonNull ApplicationInfo applicationInfo) { + @PackageManager.PackageInfoFlags long flags, long firstInstallTime, + long lastUpdateTime, Set<String> grantedPermissions, FrameworkPackageUserState state, + int userId, @Nullable ApexInfo apexInfo, @NonNull ApplicationInfo applicationInfo) { PackageInfo pi = new PackageInfo(); pi.packageName = pkg.getPackageName(); pi.splitNames = pkg.getSplitNames(); @@ -365,7 +365,8 @@ public class PackageInfoWithoutStateUtils { @Nullable public static ApplicationInfo generateApplicationInfo(ParsingPackageRead pkg, - @PackageManager.ApplicationInfoFlags int flags, FrameworkPackageUserState state, int userId) { + @PackageManager.ApplicationInfoFlags long flags, FrameworkPackageUserState state, + int userId) { if (pkg == null) { return null; } @@ -392,8 +393,8 @@ public class PackageInfoWithoutStateUtils { */ @NonNull public static ApplicationInfo generateApplicationInfoUnchecked(@NonNull ParsingPackageRead pkg, - @PackageManager.ApplicationInfoFlags int flags, @NonNull FrameworkPackageUserState state, - int userId, boolean assignUserFields) { + @PackageManager.ApplicationInfoFlags long flags, + @NonNull FrameworkPackageUserState state, int userId, boolean assignUserFields) { // Make shallow copy so we can store the metadata/libraries safely ApplicationInfo ai = ((ParsingPackageHidden) pkg).toAppInfoWithoutState(); @@ -406,7 +407,7 @@ public class PackageInfoWithoutStateUtils { return ai; } - private static void updateApplicationInfo(ApplicationInfo ai, int flags, + private static void updateApplicationInfo(ApplicationInfo ai, long flags, FrameworkPackageUserState state) { if ((flags & PackageManager.GET_META_DATA) == 0) { ai.metaData = null; @@ -452,8 +453,8 @@ public class PackageInfoWithoutStateUtils { @Nullable public static ApplicationInfo generateDelegateApplicationInfo(@Nullable ApplicationInfo ai, - @PackageManager.ApplicationInfoFlags int flags, @NonNull FrameworkPackageUserState state, - int userId) { + @PackageManager.ApplicationInfoFlags long flags, + @NonNull FrameworkPackageUserState state, int userId) { if (ai == null || !checkUseInstalledOrHidden(flags, state, ai)) { return null; } @@ -469,7 +470,7 @@ public class PackageInfoWithoutStateUtils { @Nullable public static ActivityInfo generateDelegateActivityInfo(@Nullable ActivityInfo a, - @PackageManager.ComponentInfoFlags int flags, @NonNull FrameworkPackageUserState state, + @PackageManager.ComponentInfoFlags long flags, @NonNull FrameworkPackageUserState state, int userId) { if (a == null || !checkUseInstalledOrHidden(flags, state, a.applicationInfo)) { return null; @@ -484,7 +485,7 @@ public class PackageInfoWithoutStateUtils { @Nullable public static ActivityInfo generateActivityInfo(ParsingPackageRead pkg, ParsedActivity a, - @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state, + @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state, @Nullable ApplicationInfo applicationInfo, int userId) { if (a == null) return null; if (!checkUseInstalled(pkg, state, flags)) { @@ -504,12 +505,12 @@ public class PackageInfoWithoutStateUtils { * This bypasses critical checks that are necessary for usage with data passed outside of system * server. * <p> - * Prefer {@link #generateActivityInfo(ParsingPackageRead, ParsedActivity, int, + * Prefer {@link #generateActivityInfo(ParsingPackageRead, ParsedActivity, long, * FrameworkPackageUserState, ApplicationInfo, int)}. */ @NonNull public static ActivityInfo generateActivityInfoUnchecked(@NonNull ParsedActivity a, - @PackageManager.ComponentInfoFlags int flags, + @PackageManager.ComponentInfoFlags long flags, @NonNull ApplicationInfo applicationInfo) { // Make shallow copies so we can store the metadata safely ActivityInfo ai = new ActivityInfo(); @@ -550,13 +551,14 @@ public class PackageInfoWithoutStateUtils { @Nullable public static ActivityInfo generateActivityInfo(ParsingPackageRead pkg, ParsedActivity a, - @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state, int userId) { + @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state, + int userId) { return generateActivityInfo(pkg, a, flags, state, null, userId); } @Nullable public static ServiceInfo generateServiceInfo(ParsingPackageRead pkg, ParsedService s, - @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state, + @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state, @Nullable ApplicationInfo applicationInfo, int userId) { if (s == null) return null; if (!checkUseInstalled(pkg, state, flags)) { @@ -576,12 +578,12 @@ public class PackageInfoWithoutStateUtils { * This bypasses critical checks that are necessary for usage with data passed outside of system * server. * <p> - * Prefer {@link #generateServiceInfo(ParsingPackageRead, ParsedService, int, FrameworkPackageUserState, - * ApplicationInfo, int)}. + * Prefer {@link #generateServiceInfo(ParsingPackageRead, ParsedService, long, + * FrameworkPackageUserState, ApplicationInfo, int)}. */ @NonNull public static ServiceInfo generateServiceInfoUnchecked(@NonNull ParsedService s, - @PackageManager.ComponentInfoFlags int flags, + @PackageManager.ComponentInfoFlags long flags, @NonNull ApplicationInfo applicationInfo) { // Make shallow copies so we can store the metadata safely ServiceInfo si = new ServiceInfo(); @@ -600,13 +602,14 @@ public class PackageInfoWithoutStateUtils { @Nullable public static ServiceInfo generateServiceInfo(ParsingPackageRead pkg, ParsedService s, - @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state, int userId) { + @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state, + int userId) { return generateServiceInfo(pkg, s, flags, state, null, userId); } @Nullable public static ProviderInfo generateProviderInfo(ParsingPackageRead pkg, ParsedProvider p, - @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state, + @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state, @Nullable ApplicationInfo applicationInfo, int userId) { if (p == null) return null; if (!checkUseInstalled(pkg, state, flags)) { @@ -626,12 +629,12 @@ public class PackageInfoWithoutStateUtils { * This bypasses critical checks that are necessary for usage with data passed outside of system * server. * <p> - * Prefer {@link #generateProviderInfo(ParsingPackageRead, ParsedProvider, int, + * Prefer {@link #generateProviderInfo(ParsingPackageRead, ParsedProvider, long, * FrameworkPackageUserState, ApplicationInfo, int)}. */ @NonNull public static ProviderInfo generateProviderInfoUnchecked(@NonNull ParsedProvider p, - @PackageManager.ComponentInfoFlags int flags, + @PackageManager.ComponentInfoFlags long flags, @NonNull ApplicationInfo applicationInfo) { // Make shallow copies so we can store the metadata safely ProviderInfo pi = new ProviderInfo(); @@ -661,17 +664,18 @@ public class PackageInfoWithoutStateUtils { @Nullable public static ProviderInfo generateProviderInfo(ParsingPackageRead pkg, ParsedProvider p, - @PackageManager.ComponentInfoFlags int flags, FrameworkPackageUserState state, int userId) { + @PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state, + int userId) { return generateProviderInfo(pkg, p, flags, state, null, userId); } /** - * @param assignUserFields see {@link #generateApplicationInfoUnchecked(ParsingPackageRead, int, - * FrameworkPackageUserState, int, boolean)} + * @param assignUserFields see {@link #generateApplicationInfoUnchecked(ParsingPackageRead, + * long, FrameworkPackageUserState, int, boolean)} */ @Nullable public static InstrumentationInfo generateInstrumentationInfo(ParsedInstrumentation i, - ParsingPackageRead pkg, @PackageManager.ComponentInfoFlags int flags, int userId, + ParsingPackageRead pkg, @PackageManager.ComponentInfoFlags long flags, int userId, boolean assignUserFields) { if (i == null) return null; @@ -702,7 +706,7 @@ public class PackageInfoWithoutStateUtils { @Nullable public static PermissionInfo generatePermissionInfo(ParsedPermission p, - @PackageManager.ComponentInfoFlags int flags) { + @PackageManager.ComponentInfoFlags long flags) { if (p == null) return null; PermissionInfo pi = new PermissionInfo(p.getBackgroundPermission()); @@ -725,7 +729,7 @@ public class PackageInfoWithoutStateUtils { @Nullable public static PermissionGroupInfo generatePermissionGroupInfo(ParsedPermissionGroup pg, - @PackageManager.ComponentInfoFlags int flags) { + @PackageManager.ComponentInfoFlags long flags) { if (pg == null) return null; PermissionGroupInfo pgi = new PermissionGroupInfo( @@ -753,8 +757,8 @@ public class PackageInfoWithoutStateUtils { return new Attribution(pa.getTag(), pa.getLabel()); } - private static boolean checkUseInstalledOrHidden(int flags, @NonNull FrameworkPackageUserState state, - @Nullable ApplicationInfo appInfo) { + private static boolean checkUseInstalledOrHidden(long flags, + @NonNull FrameworkPackageUserState state, @Nullable ApplicationInfo appInfo) { // Returns false if the package is hidden system app until installed. if ((flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) == 0 && !state.isInstalled() @@ -882,8 +886,8 @@ public class PackageInfoWithoutStateUtils { return privateFlagsExt; } - private static boolean checkUseInstalled(ParsingPackageRead pkg, FrameworkPackageUserState state, - @PackageManager.PackageInfoFlags int flags) { + private static boolean checkUseInstalled(ParsingPackageRead pkg, + FrameworkPackageUserState state, @PackageManager.PackageInfoFlags long flags) { // If available for the target user return PackageUserStateUtils.isAvailable(state, flags); } diff --git a/core/java/android/content/pm/parsing/component/ComponentParseUtils.java b/core/java/android/content/pm/parsing/component/ComponentParseUtils.java index 1ac9739cc460..0334601a0a06 100644 --- a/core/java/android/content/pm/parsing/component/ComponentParseUtils.java +++ b/core/java/android/content/pm/parsing/component/ComponentParseUtils.java @@ -170,13 +170,13 @@ public class ComponentParseUtils { } public static boolean isMatch(FrameworkPackageUserState state, boolean isSystem, - boolean isPackageEnabled, ParsedMainComponent component, int flags) { + boolean isPackageEnabled, ParsedMainComponent component, long flags) { return PackageUserStateUtils.isMatch(state, isSystem, isPackageEnabled, component.isEnabled(), component.isDirectBootAware(), component.getName(), flags); } public static boolean isEnabled(FrameworkPackageUserState state, boolean isPackageEnabled, - ParsedMainComponent parsedComponent, int flags) { + ParsedMainComponent parsedComponent, long flags) { return PackageUserStateUtils.isEnabled(state, isPackageEnabled, parsedComponent.isEnabled(), parsedComponent.getName(), flags); } diff --git a/core/java/android/content/pm/pkg/PackageUserStateUtils.java b/core/java/android/content/pm/pkg/PackageUserStateUtils.java index 9a800b0990fd..468bff1b53ec 100644 --- a/core/java/android/content/pm/pkg/PackageUserStateUtils.java +++ b/core/java/android/content/pm/pkg/PackageUserStateUtils.java @@ -34,15 +34,15 @@ public class PackageUserStateUtils { private static final boolean DEBUG = false; private static final String TAG = "PackageUserStateUtils"; - public static boolean isMatch(@NonNull FrameworkPackageUserState state, ComponentInfo componentInfo, - int flags) { + public static boolean isMatch(@NonNull FrameworkPackageUserState state, + ComponentInfo componentInfo, long flags) { return isMatch(state, componentInfo.applicationInfo.isSystemApp(), componentInfo.applicationInfo.enabled, componentInfo.enabled, componentInfo.directBootAware, componentInfo.name, flags); } public static boolean isMatch(@NonNull FrameworkPackageUserState state, boolean isSystem, - boolean isPackageEnabled, ParsedMainComponent component, int flags) { + boolean isPackageEnabled, ParsedMainComponent component, long flags) { return isMatch(state, isSystem, isPackageEnabled, component.isEnabled(), component.isDirectBootAware(), component.getName(), flags); } @@ -58,7 +58,7 @@ public class PackageUserStateUtils { */ public static boolean isMatch(@NonNull FrameworkPackageUserState state, boolean isSystem, boolean isPackageEnabled, boolean isComponentEnabled, - boolean isComponentDirectBootAware, String componentName, int flags) { + boolean isComponentDirectBootAware, String componentName, long flags) { final boolean matchUninstalled = (flags & PackageManager.MATCH_KNOWN_PACKAGES) != 0; if (!isAvailable(state, flags) && !(isSystem && matchUninstalled)) { return reportIfDebug(false, flags); @@ -81,7 +81,7 @@ public class PackageUserStateUtils { return reportIfDebug(matchesUnaware || matchesAware, flags); } - public static boolean isAvailable(@NonNull FrameworkPackageUserState state, int flags) { + public static boolean isAvailable(@NonNull FrameworkPackageUserState state, long flags) { // True if it is installed for this user and it is not hidden. If it is hidden, // still return true if the caller requested MATCH_UNINSTALLED_PACKAGES final boolean matchAnyUser = (flags & PackageManager.MATCH_ANY_USER) != 0; @@ -91,7 +91,7 @@ public class PackageUserStateUtils { && (!state.isHidden() || matchUninstalled)); } - public static boolean reportIfDebug(boolean result, int flags) { + public static boolean reportIfDebug(boolean result, long flags) { if (DEBUG && !result) { Slog.i(TAG, "No match!; flags: " + DebugUtils.flagsToString(PackageManager.class, "MATCH_", flags) + " " @@ -101,13 +101,13 @@ public class PackageUserStateUtils { } public static boolean isEnabled(@NonNull FrameworkPackageUserState state, ComponentInfo componentInfo, - int flags) { + long flags) { return isEnabled(state, componentInfo.applicationInfo.enabled, componentInfo.enabled, componentInfo.name, flags); } public static boolean isEnabled(@NonNull FrameworkPackageUserState state, boolean isPackageEnabled, - ParsedMainComponent parsedComponent, int flags) { + ParsedMainComponent parsedComponent, long flags) { return isEnabled(state, isPackageEnabled, parsedComponent.isEnabled(), parsedComponent.getName(), flags); } @@ -115,8 +115,9 @@ public class PackageUserStateUtils { /** * Test if the given component is considered enabled. */ - public static boolean isEnabled(@NonNull FrameworkPackageUserState state, boolean isPackageEnabled, - boolean isComponentEnabled, String componentName, int flags) { + public static boolean isEnabled(@NonNull FrameworkPackageUserState state, + boolean isPackageEnabled, boolean isComponentEnabled, String componentName, + long flags) { if ((flags & MATCH_DISABLED_COMPONENTS) != 0) { return true; } diff --git a/core/java/android/util/DebugUtils.java b/core/java/android/util/DebugUtils.java index ece6b3516f7a..bab20893a118 100644 --- a/core/java/android/util/DebugUtils.java +++ b/core/java/android/util/DebugUtils.java @@ -242,35 +242,49 @@ public class DebugUtils { * * @hide */ - public static String flagsToString(Class<?> clazz, String prefix, int flags) { + public static String flagsToString(Class<?> clazz, String prefix, long flags) { final StringBuilder res = new StringBuilder(); boolean flagsWasZero = flags == 0; for (Field field : clazz.getDeclaredFields()) { final int modifiers = field.getModifiers(); if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers) - && field.getType().equals(int.class) && field.getName().startsWith(prefix)) { - try { - final int value = field.getInt(null); - if (value == 0 && flagsWasZero) { - return constNameWithoutPrefix(prefix, field); - } - if (value != 0 && (flags & value) == value) { - flags &= ~value; - res.append(constNameWithoutPrefix(prefix, field)).append('|'); - } - } catch (IllegalAccessException ignored) { + && (field.getType().equals(int.class) || field.getType().equals(long.class)) + && field.getName().startsWith(prefix)) { + final long value = getFieldValue(field); + if (value == 0 && flagsWasZero) { + return constNameWithoutPrefix(prefix, field); + } + if (value != 0 && (flags & value) == value) { + flags &= ~value; + res.append(constNameWithoutPrefix(prefix, field)).append('|'); } } } if (flags != 0 || res.length() == 0) { - res.append(Integer.toHexString(flags)); + res.append(Long.toHexString(flags)); } else { res.deleteCharAt(res.length() - 1); } return res.toString(); } + private static long getFieldValue(Field field) { + // Field could be int or long + try { + final long longValue = field.getLong(null); + if (longValue != 0) { + return longValue; + } + final int intValue = field.getInt(null); + if (intValue != 0) { + return intValue; + } + } catch (IllegalAccessException ignored) { + } + return 0; + } + /** * Gets human-readable representation of constants (static final values). * diff --git a/services/core/java/android/content/pm/PackageManagerInternal.java b/services/core/java/android/content/pm/PackageManagerInternal.java index 6ac015b52553..f3fad84b576b 100644 --- a/services/core/java/android/content/pm/PackageManagerInternal.java +++ b/services/core/java/android/content/pm/PackageManagerInternal.java @@ -18,6 +18,7 @@ package android.content.pm; import android.annotation.AppIdInt; import android.annotation.IntDef; +import android.annotation.LongDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; @@ -108,7 +109,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP // Please note the numbers should be continuous. public static final int LAST_KNOWN_PACKAGE = PACKAGE_RECENTS; - @IntDef(flag = true, prefix = "RESOLVE_", value = { + @LongDef(flag = true, prefix = "RESOLVE_", value = { RESOLVE_NON_BROWSER_ONLY, RESOLVE_NON_RESOLVER_ONLY }) @@ -197,7 +198,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP * @see PackageManager#getPackageInfo(String, int) */ public abstract PackageInfo getPackageInfo(String packageName, - @PackageInfoFlags int flags, int filterCallingUid, int userId); + @PackageInfoFlags long flags, int filterCallingUid, int userId); /** * Retrieve CE data directory inode number of an application. @@ -226,7 +227,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP * deleted with {@code DELETE_KEEP_DATA} flag set). */ public abstract List<ApplicationInfo> getInstalledApplications( - @ApplicationInfoFlags int flags, @UserIdInt int userId, int callingUid); + @ApplicationInfoFlags long flags, @UserIdInt int userId, int callingUid); /** * Retrieve launcher extras for a suspended package provided to the system in @@ -323,7 +324,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP * @see PackageManager#getPackageUidAsUser(String, int, int) * @return The app's uid, or < 0 if the package was not found in that user */ - public abstract int getPackageUid(String packageName, @PackageInfoFlags int flags, int userId); + public abstract int getPackageUid(String packageName, @PackageInfoFlags long flags, int userId); /** * Retrieve all of the information we know about a particular package/application. @@ -332,7 +333,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP * @see PackageManager#getApplicationInfo(String, int) */ public abstract ApplicationInfo getApplicationInfo(String packageName, - @ApplicationInfoFlags int flags, int filterCallingUid, int userId); + @ApplicationInfoFlags long flags, int filterCallingUid, int userId); /** * Retrieve all of the information we know about a particular activity class. @@ -341,7 +342,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP * @see PackageManager#getActivityInfo(ComponentName, int) */ public abstract ActivityInfo getActivityInfo(ComponentName component, - @ComponentInfoFlags int flags, int filterCallingUid, int userId); + @ComponentInfoFlags long flags, int filterCallingUid, int userId); /** * Retrieve all activities that can be performed for the given intent. @@ -352,7 +353,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP * @see PackageManager#queryIntentActivities(Intent, int) */ public abstract List<ResolveInfo> queryIntentActivities( - Intent intent, @Nullable String resolvedType, @ResolveInfoFlags int flags, + Intent intent, @Nullable String resolvedType, @ResolveInfoFlags long flags, int filterCallingUid, int userId); @@ -360,14 +361,14 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP * Retrieve all receivers that can handle a broadcast of the given intent. */ public abstract List<ResolveInfo> queryIntentReceivers(Intent intent, - String resolvedType, int flags, int filterCallingUid, int userId); + String resolvedType, @ResolveInfoFlags long flags, int filterCallingUid, int userId); /** * Retrieve all services that can be performed for the given intent. * @see PackageManager#queryIntentServices(Intent, int) */ public abstract List<ResolveInfo> queryIntentServices( - Intent intent, int flags, int callingUid, int userId); + Intent intent, @ResolveInfoFlags long flags, int callingUid, int userId); /** * Interface to {@link com.android.server.pm.PackageManagerService#getHomeActivitiesAsUser}. @@ -591,20 +592,20 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP * Resolves an activity intent, allowing instant apps to be resolved. */ public abstract ResolveInfo resolveIntent(Intent intent, String resolvedType, - int flags, @PrivateResolveFlags int privateResolveFlags, int userId, + @ResolveInfoFlags long flags, @PrivateResolveFlags long privateResolveFlags, int userId, boolean resolveForStart, int filterCallingUid); /** * Resolves a service intent, allowing instant apps to be resolved. */ public abstract ResolveInfo resolveService(Intent intent, String resolvedType, - int flags, int userId, int callingUid); + @ResolveInfoFlags long flags, int userId, int callingUid); /** * Resolves a content provider intent. */ - public abstract ProviderInfo resolveContentProvider(String name, int flags, int userId, - int callingUid); + public abstract ProviderInfo resolveContentProvider(String name, @ComponentInfoFlags long flags, + int userId, int callingUid); /** * Track the creator of a new isolated uid. @@ -875,8 +876,8 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP throws IOException; /** Returns {@code true} if the specified component is enabled and matches the given flags. */ - public abstract boolean isEnabledAndMatches(@NonNull ParsedMainComponent component, int flags, - int userId); + public abstract boolean isEnabledAndMatches(@NonNull ParsedMainComponent component, + @ComponentInfoFlags long flags, int userId); /** Returns {@code true} if the given user requires extra badging for icons. */ public abstract boolean userNeedsBadging(int userId); @@ -1024,7 +1025,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP * @param flags flags about the uninstall. */ public abstract void uninstallApex(String packageName, long versionCode, int userId, - IntentSender intentSender, int flags); + IntentSender intentSender, @PackageManager.InstallFlags int installFlags); /** * Update fingerprint of build that updated the runtime permissions for a user. @@ -1260,5 +1261,5 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP /** * Reconcile all app data for the given user. */ - public abstract void reconcileAppsData(int userId, int flags, boolean migrateAppsData); + public abstract void reconcileAppsData(int userId, int storageFlags, boolean migrateAppsData); } diff --git a/services/core/java/com/android/server/pm/ComponentResolver.java b/services/core/java/com/android/server/pm/ComponentResolver.java index dca86544b3c8..6ec3405727eb 100644 --- a/services/core/java/com/android/server/pm/ComponentResolver.java +++ b/services/core/java/com/android/server/pm/ComponentResolver.java @@ -318,7 +318,7 @@ public class ComponentResolver } @Nullable - List<ResolveInfo> queryActivities(Intent intent, String resolvedType, int flags, + List<ResolveInfo> queryActivities(Intent intent, String resolvedType, long flags, int userId) { synchronized (mLock) { return mActivities.queryIntent(intent, resolvedType, flags, userId); @@ -326,7 +326,7 @@ public class ComponentResolver } @Nullable - List<ResolveInfo> queryActivities(Intent intent, String resolvedType, int flags, + List<ResolveInfo> queryActivities(Intent intent, String resolvedType, long flags, List<ParsedActivity> activities, int userId) { synchronized (mLock) { return mActivities.queryIntentForPackage( @@ -335,14 +335,14 @@ public class ComponentResolver } @Nullable - List<ResolveInfo> queryProviders(Intent intent, String resolvedType, int flags, int userId) { + List<ResolveInfo> queryProviders(Intent intent, String resolvedType, long flags, int userId) { synchronized (mLock) { return mProviders.queryIntent(intent, resolvedType, flags, userId); } } @Nullable - List<ResolveInfo> queryProviders(Intent intent, String resolvedType, int flags, + List<ResolveInfo> queryProviders(Intent intent, String resolvedType, long flags, List<ParsedProvider> providers, int userId) { synchronized (mLock) { return mProviders.queryIntentForPackage(intent, resolvedType, flags, providers, userId); @@ -350,7 +350,7 @@ public class ComponentResolver } @Nullable - List<ProviderInfo> queryProviders(String processName, String metaDataKey, int uid, int flags, + List<ProviderInfo> queryProviders(String processName, String metaDataKey, int uid, long flags, int userId) { if (!sUserManager.exists(userId)) { return null; @@ -409,7 +409,7 @@ public class ComponentResolver } @Nullable - ProviderInfo queryProvider(String authority, int flags, int userId) { + ProviderInfo queryProvider(String authority, long flags, int userId) { synchronized (mLock) { final ParsedProvider p = mProvidersByAuthority.get(authority); if (p == null) { @@ -480,14 +480,14 @@ public class ComponentResolver } @Nullable - List<ResolveInfo> queryReceivers(Intent intent, String resolvedType, int flags, int userId) { + List<ResolveInfo> queryReceivers(Intent intent, String resolvedType, long flags, int userId) { synchronized (mLock) { return mReceivers.queryIntent(intent, resolvedType, flags, userId); } } @Nullable - List<ResolveInfo> queryReceivers(Intent intent, String resolvedType, int flags, + List<ResolveInfo> queryReceivers(Intent intent, String resolvedType, long flags, List<ParsedActivity> receivers, int userId) { synchronized (mLock) { return mReceivers.queryIntentForPackage(intent, resolvedType, flags, receivers, userId); @@ -495,14 +495,14 @@ public class ComponentResolver } @Nullable - List<ResolveInfo> queryServices(Intent intent, String resolvedType, int flags, int userId) { + List<ResolveInfo> queryServices(Intent intent, String resolvedType, long flags, int userId) { synchronized (mLock) { return mServices.queryIntent(intent, resolvedType, flags, userId); } } @Nullable - List<ResolveInfo> queryServices(Intent intent, String resolvedType, int flags, + List<ResolveInfo> queryServices(Intent intent, String resolvedType, long flags, List<ParsedService> services, int userId) { synchronized (mLock) { return mServices.queryIntentForPackage(intent, resolvedType, flags, services, userId); @@ -1380,7 +1380,7 @@ public class ComponentResolver return super.queryIntent(intent, resolvedType, defaultOnly, userId); } - List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags, + List<ResolveInfo> queryIntent(Intent intent, String resolvedType, long flags, int userId) { if (!sUserManager.exists(userId)) { return null; @@ -1392,7 +1392,7 @@ public class ComponentResolver } List<ResolveInfo> queryIntentForPackage(Intent intent, String resolvedType, - int flags, List<ParsedActivity> packageActivities, int userId) { + long flags, List<ParsedActivity> packageActivities, int userId) { if (!sUserManager.exists(userId)) { return null; } @@ -1669,7 +1669,7 @@ public class ComponentResolver // ActivityIntentResolver. protected final ArrayMap<ComponentName, ParsedActivity> mActivities = new ArrayMap<>(); - private int mFlags; + private long mFlags; } // Both receivers and activities share a class, but point to different get methods @@ -1711,7 +1711,7 @@ public class ComponentResolver } @Nullable - List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags, + List<ResolveInfo> queryIntent(Intent intent, String resolvedType, long flags, int userId) { if (!sUserManager.exists(userId)) { return null; @@ -1724,7 +1724,7 @@ public class ComponentResolver @Nullable List<ResolveInfo> queryIntentForPackage(Intent intent, String resolvedType, - int flags, List<ParsedProvider> packageProviders, int userId) { + long flags, List<ParsedProvider> packageProviders, int userId) { if (!sUserManager.exists(userId)) { return null; } @@ -1946,7 +1946,7 @@ public class ComponentResolver } private final ArrayMap<ComponentName, ParsedProvider> mProviders = new ArrayMap<>(); - private int mFlags; + private long mFlags; } private static final class ServiceIntentResolver @@ -1969,7 +1969,7 @@ public class ComponentResolver return super.queryIntent(intent, resolvedType, defaultOnly, userId); } - List<ResolveInfo> queryIntent(Intent intent, String resolvedType, int flags, + List<ResolveInfo> queryIntent(Intent intent, String resolvedType, long flags, int userId) { if (!sUserManager.exists(userId)) return null; mFlags = flags; @@ -1979,7 +1979,7 @@ public class ComponentResolver } List<ResolveInfo> queryIntentForPackage(Intent intent, String resolvedType, - int flags, List<ParsedService> packageServices, int userId) { + long flags, List<ParsedService> packageServices, int userId) { if (!sUserManager.exists(userId)) return null; if (packageServices == null) { return Collections.emptyList(); @@ -2190,7 +2190,7 @@ public class ComponentResolver // Keys are String (activity class name), values are Activity. private final ArrayMap<ComponentName, ParsedService> mServices = new ArrayMap<>(); - private int mFlags; + private long mFlags; } static final class InstantAppIntentResolver diff --git a/services/core/java/com/android/server/pm/Computer.java b/services/core/java/com/android/server/pm/Computer.java index a9df4bab6fd8..3e849f811594 100644 --- a/services/core/java/com/android/server/pm/Computer.java +++ b/services/core/java/com/android/server/pm/Computer.java @@ -133,35 +133,36 @@ public interface Computer { } @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent, String resolvedType, - int flags, @PackageManagerInternal.PrivateResolveFlags int privateResolveFlags, + @PackageManager.ResolveInfoFlags long flags, + @PackageManagerInternal.PrivateResolveFlags long privateResolveFlags, int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent, String resolvedType, - int flags, int userId); + long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) @NonNull List<ResolveInfo> queryIntentServicesInternal(Intent intent, String resolvedType, - int flags, int userId, int callingUid, boolean includeInstantApps); + long flags, int userId, int callingUid, boolean includeInstantApps); @Computer.LiveImplementation(override = Computer.LiveImplementation.MANDATORY) @NonNull QueryIntentActivitiesResult queryIntentActivitiesInternalBody(Intent intent, - String resolvedType, int flags, int filterCallingUid, int userId, + String resolvedType, long flags, int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits, String pkgName, String instantAppPkgName); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - ActivityInfo getActivityInfo(ComponentName component, int flags, int userId); + ActivityInfo getActivityInfo(ComponentName component, long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - ActivityInfo getActivityInfoInternal(ComponentName component, int flags, + ActivityInfo getActivityInfoInternal(ComponentName component, long flags, int filterCallingUid, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.MANDATORY) AndroidPackage getPackage(String packageName); @Computer.LiveImplementation(override = Computer.LiveImplementation.MANDATORY) AndroidPackage getPackage(int uid); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - ApplicationInfo generateApplicationInfoFromSettings(String packageName, int flags, + ApplicationInfo generateApplicationInfoFromSettings(String packageName, long flags, int filterCallingUid, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - ApplicationInfo getApplicationInfo(String packageName, int flags, int userId); + ApplicationInfo getApplicationInfo(String packageName, long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - ApplicationInfo getApplicationInfoInternal(String packageName, int flags, + ApplicationInfo getApplicationInfoInternal(String packageName, long flags, int filterCallingUid, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) ComponentName getDefaultHomeActivity(int userId); @@ -169,7 +170,7 @@ public interface Computer { ComponentName getHomeActivitiesAsUser(List<ResolveInfo> allHomeCandidates, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent, String resolvedType, - int flags, int sourceUserId, int parentUserId); + long flags, int sourceUserId, int parentUserId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) Intent getHomeIntent(); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) @@ -180,11 +181,11 @@ public interface Computer { String ephemeralPkgName, boolean allowDynamicSplits, int filterCallingUid, boolean resolveForStart, int userId, Intent intent); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - PackageInfo generatePackageInfo(PackageStateInternal ps, int flags, int userId); + PackageInfo generatePackageInfo(PackageStateInternal ps, long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - PackageInfo getPackageInfo(String packageName, int flags, int userId); + PackageInfo getPackageInfo(String packageName, long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - PackageInfo getPackageInfoInternal(String packageName, long versionCode, int flags, + PackageInfo getPackageInfoInternal(String packageName, long versionCode, long flags, int filterCallingUid, int userId); /** @@ -202,12 +203,12 @@ public interface Computer { @Computer.LiveImplementation(override = Computer.LiveImplementation.MANDATORY) @Nullable PackageState getPackageStateCopied(@NonNull String packageName); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - ParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId); + ParceledListSlice<PackageInfo> getInstalledPackages(long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) ResolveInfo createForwardingResolveInfoUnchecked(WatchedIntentFilter filter, int sourceUserId, int targetUserId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - ServiceInfo getServiceInfo(ComponentName component, int flags, int userId); + ServiceInfo getServiceInfo(ComponentName component, long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) SharedLibraryInfo getSharedLibraryInfo(String name, long version); @Computer.LiveImplementation(override = Computer.LiveImplementation.MANDATORY) @@ -224,7 +225,7 @@ public interface Computer { boolean canViewInstantApps(int callingUid, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) boolean filterSharedLibPackage(@Nullable PackageStateInternal ps, int uid, int userId, - int flags); + long flags); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) boolean isCallerSameApp(String packageName, int uid); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) @@ -234,7 +235,7 @@ public interface Computer { @PackageManager.ComponentType int type); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) boolean isImplicitImageCaptureIntentAndNotSetByDpcLocked(Intent intent, int userId, - String resolvedType, int flags); + String resolvedType, long flags); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) boolean isInstantApp(String packageName, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) @@ -254,18 +255,18 @@ public interface Computer { @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) int checkUidPermission(String permName, int uid); @Computer.LiveImplementation(override = Computer.LiveImplementation.MANDATORY) - int getPackageUidInternal(String packageName, int flags, int userId, int callingUid); + int getPackageUidInternal(String packageName, long flags, int userId, int callingUid); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - int updateFlagsForApplication(int flags, int userId); + long updateFlagsForApplication(long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - int updateFlagsForComponent(int flags, int userId); + long updateFlagsForComponent(long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - int updateFlagsForPackage(int flags, int userId); + long updateFlagsForPackage(long flags, int userId); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - int updateFlagsForResolve(int flags, int userId, int callingUid, boolean wantInstantApps, + long updateFlagsForResolve(long flags, int userId, int callingUid, boolean wantInstantApps, boolean isImplicitImageCaptureIntentAndNotSetByDpc); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - int updateFlagsForResolve(int flags, int userId, int callingUid, boolean wantInstantApps, + long updateFlagsForResolve(long flags, int userId, int callingUid, boolean wantInstantApps, boolean onlyExposedExplicitly, boolean isImplicitImageCaptureIntentAndNotSetByDpc); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) void enforceCrossUserOrProfilePermission(int callingUid, @UserIdInt int userId, @@ -291,10 +292,10 @@ public interface Computer { void dump(int type, FileDescriptor fd, PrintWriter pw, DumpState dumpState); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) PackageManagerService.FindPreferredActivityBodyResult findPreferredActivityInternal( - Intent intent, String resolvedType, int flags, List<ResolveInfo> query, boolean always, + Intent intent, String resolvedType, long flags, List<ResolveInfo> query, boolean always, boolean removeMatches, boolean debug, int userId, boolean queryMayBeFiltered); @Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED) - ResolveInfo findPersistentPreferredActivityLP(Intent intent, String resolvedType, int flags, + ResolveInfo findPersistentPreferredActivityLP(Intent intent, String resolvedType, long flags, List<ResolveInfo> query, boolean debug, int userId); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @@ -337,7 +338,8 @@ public interface Computer { @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @NonNull - int[] getPackageGids(@NonNull String packageName, int flags, @UserIdInt int userId); + int[] getPackageGids(@NonNull String packageName, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) int getTargetSdkVersion(@NonNull String packageName); @@ -348,13 +350,13 @@ public interface Computer { @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @Nullable - ActivityInfo getReceiverInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId); + ActivityInfo getReceiverInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @Nullable ParceledListSlice<SharedLibraryInfo> getSharedLibraries(@NonNull String packageName, - int flags, @UserIdInt int userId); + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) boolean canRequestPackageInstalls(@NonNull String packageName, int callingUid, @@ -367,17 +369,18 @@ public interface Computer { @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @Nullable List<VersionedPackage> getPackagesUsingSharedLibrary(@NonNull SharedLibraryInfo libInfo, - int flags, int callingUid, @UserIdInt int userId); + @PackageManager.PackageInfoFlags long flags, int callingUid, @UserIdInt int userId); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @Nullable ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries( - @NonNull String packageName, int flags, @UserIdInt int userId); + @NonNull String packageName, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @Nullable - ProviderInfo getProviderInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId); + ProviderInfo getProviderInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @Nullable @@ -436,17 +439,17 @@ public interface Computer { @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @NonNull ParceledListSlice<PackageInfo> getPackagesHoldingPermissions(@NonNull String[] permissions, - int flags, @UserIdInt int userId); + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @NonNull - List<ApplicationInfo> getInstalledApplications(int flags, @UserIdInt int userId, - int callingUid); + List<ApplicationInfo> getInstalledApplications(@PackageManager.ApplicationInfoFlags long flags, + @UserIdInt int userId, int callingUid); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @Nullable - ProviderInfo resolveContentProvider(@NonNull String name, int flags, - @UserIdInt int userId, int callingUid); + ProviderInfo resolveContentProvider(@NonNull String name, + @PackageManager.ResolveInfoFlags long flags, @UserIdInt int userId, int callingUid); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @Nullable @@ -460,7 +463,7 @@ public interface Computer { @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @NonNull ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName, int uid, - int flags, @Nullable String metaDataKey); + @PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) @Nullable @@ -557,7 +560,8 @@ public interface Computer { boolean canQueryPackage(int callingUid, @Nullable String targetPackageName); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) - int getPackageUid(@NonNull String packageName, int flags, @UserIdInt int userId); + int getPackageUid(@NonNull String packageName, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId); @Computer.LiveImplementation(override = LiveImplementation.MANDATORY) boolean canAccessComponent(int callingUid, @NonNull ComponentName component, diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java index 887dfff41384..2d61773e6796 100644 --- a/services/core/java/com/android/server/pm/ComputerEngine.java +++ b/services/core/java/com/android/server/pm/ComputerEngine.java @@ -125,7 +125,6 @@ import android.util.SparseBooleanArray; import android.util.TypedXmlSerializer; import android.util.Xml; -import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ArrayUtils; import com.android.internal.util.CollectionUtils; @@ -165,7 +164,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; @@ -215,7 +213,7 @@ public class ComputerEngine implements Computer { @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public boolean isEnabledAndMatch(AndroidPackage pkg, ParsedMainComponent component, - int flags, int userId) { + long flags, int userId) { PackageStateInternal pkgState = getPackage(component.getPackageName()); if (pkgState == null) { return false; @@ -431,8 +429,8 @@ public class ComputerEngine implements Computer { } public final @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent, - String resolvedType, int flags, - @PackageManagerInternal.PrivateResolveFlags int privateResolveFlags, + String resolvedType, @PackageManager.ResolveInfoFlags long flags, + @PackageManagerInternal.PrivateResolveFlags long privateResolveFlags, int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits) { if (!mUserManager.exists(userId)) return Collections.emptyList(); @@ -543,15 +541,15 @@ public class ComputerEngine implements Computer { } public final @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent, - String resolvedType, int flags, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) { return queryIntentActivitiesInternal( intent, resolvedType, flags, 0 /*privateResolveFlags*/, Binder.getCallingUid(), userId, false /*resolveForStart*/, true /*allowDynamicSplits*/); } public final @NonNull List<ResolveInfo> queryIntentServicesInternal(Intent intent, - String resolvedType, int flags, int userId, int callingUid, - boolean includeInstantApps) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId, + int callingUid, boolean includeInstantApps) { if (!mUserManager.exists(userId)) return Collections.emptyList(); enforceCrossUserOrProfilePermission(callingUid, userId, @@ -627,8 +625,8 @@ public class ComputerEngine implements Computer { } protected @NonNull List<ResolveInfo> queryIntentServicesInternalBody(Intent intent, - String resolvedType, int flags, int userId, int callingUid, - String instantAppPkgName) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId, + int callingUid, String instantAppPkgName) { // reader String pkgName = intent.getPackage(); if (pkgName == null) { @@ -655,9 +653,9 @@ public class ComputerEngine implements Computer { } public @NonNull QueryIntentActivitiesResult queryIntentActivitiesInternalBody( - Intent intent, String resolvedType, int flags, int filterCallingUid, int userId, - boolean resolveForStart, boolean allowDynamicSplits, String pkgName, - String instantAppPkgName) { + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, + int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits, + String pkgName, String instantAppPkgName) { // reader boolean sortResult = false; boolean addInstant = false; @@ -787,7 +785,8 @@ public class ComputerEngine implements Computer { return null; } - public final ActivityInfo getActivityInfo(ComponentName component, int flags, int userId) { + public final ActivityInfo getActivityInfo(ComponentName component, + @PackageManager.ResolveInfoFlags long flags, int userId) { return getActivityInfoInternal(component, flags, Binder.getCallingUid(), userId); } @@ -797,8 +796,8 @@ public class ComputerEngine implements Computer { * to clearing. Because it can only be provided by trusted code, its value can be * trusted and will be used as-is; unlike userId which will be validated by this method. */ - public final ActivityInfo getActivityInfoInternal(ComponentName component, int flags, - int filterCallingUid, int userId) { + public final ActivityInfo getActivityInfoInternal(ComponentName component, + @PackageManager.ResolveInfoFlags long flags, int filterCallingUid, int userId) { if (!mUserManager.exists(userId)) return null; flags = updateFlagsForComponent(flags, userId); @@ -811,8 +810,8 @@ public class ComputerEngine implements Computer { return getActivityInfoInternalBody(component, flags, filterCallingUid, userId); } - protected ActivityInfo getActivityInfoInternalBody(ComponentName component, int flags, - int filterCallingUid, int userId) { + protected ActivityInfo getActivityInfoInternalBody(ComponentName component, + @PackageManager.ResolveInfoFlags long flags, int filterCallingUid, int userId) { ParsedActivity a = mComponentResolver.getActivity(component); if (DEBUG_PACKAGE_INFO) Log.v(TAG, "getActivityInfo " + component + ": " + a); @@ -852,7 +851,7 @@ public class ComputerEngine implements Computer { } public final ApplicationInfo generateApplicationInfoFromSettings(String packageName, - int flags, int filterCallingUid, int userId) { + long flags, int filterCallingUid, int userId) { if (!mUserManager.exists(userId)) return null; PackageStateInternal ps = mSettings.getPackage(packageName); if (ps != null) { @@ -879,7 +878,8 @@ public class ComputerEngine implements Computer { return null; } - public final ApplicationInfo getApplicationInfo(String packageName, int flags, int userId) { + public final ApplicationInfo getApplicationInfo(String packageName, + @PackageManager.ApplicationInfoFlags long flags, int userId) { return getApplicationInfoInternal(packageName, flags, Binder.getCallingUid(), userId); } @@ -889,7 +889,8 @@ public class ComputerEngine implements Computer { * to clearing. Because it can only be provided by trusted code, its value can be * trusted and will be used as-is; unlike userId which will be validated by this method. */ - public final ApplicationInfo getApplicationInfoInternal(String packageName, int flags, + public final ApplicationInfo getApplicationInfoInternal(String packageName, + @PackageManager.ApplicationInfoFlags long flags, int filterCallingUid, int userId) { if (!mUserManager.exists(userId)) return null; flags = updateFlagsForApplication(flags, userId); @@ -903,7 +904,8 @@ public class ComputerEngine implements Computer { return getApplicationInfoInternalBody(packageName, flags, filterCallingUid, userId); } - protected ApplicationInfo getApplicationInfoInternalBody(String packageName, int flags, + protected ApplicationInfo getApplicationInfoInternalBody(String packageName, + @PackageManager.ApplicationInfoFlags long flags, int filterCallingUid, int userId) { // writer // Normalize package name to handle renamed packages and static libs @@ -960,7 +962,7 @@ public class ComputerEngine implements Computer { } protected ArrayList<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPrBody( - Intent intent, int matchFlags, List<ResolveInfo> candidates, + Intent intent, long matchFlags, List<ResolveInfo> candidates, CrossProfileDomainInfo xpDomainInfo, int userId, boolean debug) { final ArrayList<ResolveInfo> result = new ArrayList<>(); final ArrayList<ResolveInfo> matchAllList = new ArrayList<>(); @@ -1159,7 +1161,8 @@ public class ComputerEngine implements Computer { } public final CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent, - String resolvedType, int flags, int sourceUserId, int parentUserId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int sourceUserId, + int parentUserId) { if (!mUserManager.hasUserRestriction(UserManager.ALLOW_PARENT_PROFILE_APP_LINKING, sourceUserId)) { return null; @@ -1380,7 +1383,7 @@ public class ComputerEngine implements Computer { } private List<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPr(Intent intent, - int matchFlags, List<ResolveInfo> candidates, CrossProfileDomainInfo xpDomainInfo, + long matchFlags, List<ResolveInfo> candidates, CrossProfileDomainInfo xpDomainInfo, int userId) { final boolean debug = (intent.getFlags() & Intent.FLAG_DEBUG_LOG_RESOLUTION) != 0; @@ -1423,9 +1426,8 @@ public class ComputerEngine implements Computer { } private List<ResolveInfo> maybeAddInstantAppInstaller(List<ResolveInfo> result, - Intent intent, - String resolvedType, int flags, int userId, boolean resolveForStart, - boolean isRequesterInstantApp) { + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, + int userId, boolean resolveForStart, boolean isRequesterInstantApp) { // first, check to see if we've got an instant app already installed final boolean alreadyResolvedLocally = (flags & PackageManager.MATCH_INSTANT) != 0; ResolveInfo localInstantApp = null; @@ -1529,7 +1531,8 @@ public class ComputerEngine implements Computer { return result; } - public final PackageInfo generatePackageInfo(PackageStateInternal ps, int flags, int userId) { + public final PackageInfo generatePackageInfo(PackageStateInternal ps, + @PackageManager.PackageInfoFlags long flags, int userId) { if (!mUserManager.exists(userId)) return null; if (ps == null) { return null; @@ -1603,7 +1606,8 @@ public class ComputerEngine implements Computer { } } - public final PackageInfo getPackageInfo(String packageName, int flags, int userId) { + public final PackageInfo getPackageInfo(String packageName, + @PackageManager.PackageInfoFlags long flags, int userId) { return getPackageInfoInternal(packageName, PackageManager.VERSION_CODE_HIGHEST, flags, Binder.getCallingUid(), userId); } @@ -1615,7 +1619,7 @@ public class ComputerEngine implements Computer { * trusted and will be used as-is; unlike userId which will be validated by this method. */ public final PackageInfo getPackageInfoInternal(String packageName, long versionCode, - int flags, int filterCallingUid, int userId) { + long flags, int filterCallingUid, int userId) { if (!mUserManager.exists(userId)) return null; flags = updateFlagsForPackage(flags, userId); enforceCrossUserPermission(Binder.getCallingUid(), userId, @@ -1626,7 +1630,7 @@ public class ComputerEngine implements Computer { } protected PackageInfo getPackageInfoInternalBody(String packageName, long versionCode, - int flags, int filterCallingUid, int userId) { + long flags, int filterCallingUid, int userId) { // reader // Normalize package name to handle renamed packages and static libs packageName = resolveInternalPackageNameLPr(packageName, versionCode); @@ -1711,7 +1715,7 @@ public class ComputerEngine implements Computer { return pkgSetting == null ? null : PackageStateImpl.copy(pkgSetting); } - public final ParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId) { + public final ParceledListSlice<PackageInfo> getInstalledPackages(long flags, int userId) { final int callingUid = Binder.getCallingUid(); if (getInstantAppPackageName(callingUid) != null) { return ParceledListSlice.emptyList(); @@ -1725,7 +1729,7 @@ public class ComputerEngine implements Computer { return getInstalledPackagesBody(flags, userId, callingUid); } - protected ParceledListSlice<PackageInfo> getInstalledPackagesBody(int flags, int userId, + protected ParceledListSlice<PackageInfo> getInstalledPackagesBody(long flags, int userId, int callingUid) { // writer final boolean listUninstalled = (flags & MATCH_KNOWN_PACKAGES) != 0; @@ -1804,7 +1808,8 @@ public class ComputerEngine implements Computer { @Nullable private CrossProfileDomainInfo createForwardingResolveInfo( @NonNull CrossProfileIntentFilter filter, @NonNull Intent intent, - @Nullable String resolvedType, int flags, int sourceUserId) { + @Nullable String resolvedType, @PackageManager.ResolveInfoFlags long flags, + int sourceUserId) { int targetUserId = filter.getTargetUserId(); if (!isUserEnabled(targetUserId)) { return null; @@ -1891,7 +1896,7 @@ public class ComputerEngine implements Computer { @Nullable private CrossProfileDomainInfo queryCrossProfileIntents( List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType, - int flags, int sourceUserId, boolean matchInCurrentProfile) { + long flags, int sourceUserId, boolean matchInCurrentProfile) { if (matchingFilters == null) { return null; } @@ -1945,7 +1950,7 @@ public class ComputerEngine implements Computer { private ResolveInfo querySkipCurrentProfileIntents( List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType, - int flags, int sourceUserId) { + long flags, int sourceUserId) { if (matchingFilters != null) { int size = matchingFilters.size(); for (int i = 0; i < size; i++) { @@ -1964,7 +1969,8 @@ public class ComputerEngine implements Computer { return null; } - public final ServiceInfo getServiceInfo(ComponentName component, int flags, int userId) { + public final ServiceInfo getServiceInfo(ComponentName component, + @PackageManager.ResolveInfoFlags long flags, int userId) { if (!mUserManager.exists(userId)) return null; final int callingUid = Binder.getCallingUid(); flags = updateFlagsForComponent(flags, userId); @@ -1974,8 +1980,8 @@ public class ComputerEngine implements Computer { return getServiceInfoBody(component, flags, userId, callingUid); } - protected ServiceInfo getServiceInfoBody(ComponentName component, int flags, int userId, - int callingUid) { + protected ServiceInfo getServiceInfoBody(ComponentName component, + @PackageManager.ResolveInfoFlags long flags, int userId, int callingUid) { ParsedService s = mComponentResolver.getService(component); if (DEBUG_PACKAGE_INFO) { Log.v( @@ -2227,7 +2233,7 @@ public class ComputerEngine implements Computer { } public final boolean filterSharedLibPackage(@Nullable PackageStateInternal ps, int uid, - int userId, int flags) { + int userId, @PackageManager.ComponentInfoFlags long flags) { // Callers can access only the libs they depend on, otherwise they need to explicitly // ask for the shared libraries given the caller is allowed to access all static libs. if ((flags & PackageManager.MATCH_STATIC_SHARED_LIBRARIES) != 0) { @@ -2375,7 +2381,7 @@ public class ComputerEngine implements Computer { * activity was not set by the DPC. */ public final boolean isImplicitImageCaptureIntentAndNotSetByDpcLocked(Intent intent, - int userId, String resolvedType, int flags) { + int userId, String resolvedType, @PackageManager.ResolveInfoFlags long flags) { return intent.isImplicitImageCaptureIntent() && !isPersistentPreferredActivitySetByDpm( intent, userId, resolvedType, flags); } @@ -2416,7 +2422,7 @@ public class ComputerEngine implements Computer { private boolean isInstantAppResolutionAllowed( Intent intent, List<ResolveInfo> resolvedActivities, int userId, - boolean skipPackageCheck, int flags) { + boolean skipPackageCheck, @PackageManager.ResolveInfoFlags long flags) { if (mInstantAppResolverConnection == null) { return false; } @@ -2456,7 +2462,7 @@ public class ComputerEngine implements Computer { // Or if there's already an ephemeral app installed that handles the action protected boolean isInstantAppResolutionAllowedBody( Intent intent, List<ResolveInfo> resolvedActivities, int userId, - boolean skipPackageCheck, int flags) { + boolean skipPackageCheck, @PackageManager.ResolveInfoFlags long flags) { final int count = (resolvedActivities == null ? 0 : resolvedActivities.size()); for (int n = 0; n < count; n++) { final ResolveInfo info = resolvedActivities.get(n); @@ -2488,7 +2494,7 @@ public class ComputerEngine implements Computer { } private boolean isPersistentPreferredActivitySetByDpm(Intent intent, int userId, - String resolvedType, int flags) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags) { PersistentPreferredIntentResolver ppir = mSettings.getPersistentPreferredActivities(userId); //TODO(b/158003772): Remove double query @@ -2645,8 +2651,8 @@ public class ComputerEngine implements Computer { return mPermissionManager.checkUidPermission(uid, permName); } - public int getPackageUidInternal(String packageName, int flags, int userId, - int callingUid) { + public int getPackageUidInternal(String packageName, + @PackageManager.PackageInfoFlags long flags, int userId, int callingUid) { // reader final AndroidPackage p = mPackages.get(packageName); if (p != null && AndroidPackageUtils.isMatchForSystemOnly(p, flags)) { @@ -2670,7 +2676,7 @@ public class ComputerEngine implements Computer { /** * Update given flags based on encryption status of current user. */ - private int updateFlags(int flags, int userId) { + private long updateFlags(long flags, int userId) { if ((flags & (PackageManager.MATCH_DIRECT_BOOT_UNAWARE | PackageManager.MATCH_DIRECT_BOOT_AWARE)) != 0) { // Caller expressed an explicit opinion about what encryption @@ -2691,21 +2697,21 @@ public class ComputerEngine implements Computer { /** * Update given flags when being used to request {@link ApplicationInfo}. */ - public final int updateFlagsForApplication(int flags, int userId) { + public final long updateFlagsForApplication(long flags, int userId) { return updateFlagsForPackage(flags, userId); } /** * Update given flags when being used to request {@link ComponentInfo}. */ - public final int updateFlagsForComponent(int flags, int userId) { + public final long updateFlagsForComponent(long flags, int userId) { return updateFlags(flags, userId); } /** * Update given flags when being used to request {@link PackageInfo}. */ - public final int updateFlagsForPackage(int flags, int userId) { + public final long updateFlagsForPackage(long flags, int userId) { final boolean isCallerSystemUser = UserHandle.getCallingUserId() == UserHandle.USER_SYSTEM; if ((flags & PackageManager.MATCH_ANY_USER) != 0) { @@ -2741,14 +2747,14 @@ public class ComputerEngine implements Computer { * action and a {@code android.intent.category.BROWSABLE} category</li> * </ul> */ - public final int updateFlagsForResolve(int flags, int userId, int callingUid, + public final long updateFlagsForResolve(long flags, int userId, int callingUid, boolean wantInstantApps, boolean isImplicitImageCaptureIntentAndNotSetByDpc) { return updateFlagsForResolve(flags, userId, callingUid, wantInstantApps, false /*onlyExposedExplicitly*/, isImplicitImageCaptureIntentAndNotSetByDpc); } - public final int updateFlagsForResolve(int flags, int userId, int callingUid, + public final long updateFlagsForResolve(long flags, int userId, int callingUid, boolean wantInstantApps, boolean onlyExposedExplicitly, boolean isImplicitImageCaptureIntentAndNotSetByDpc) { // Safe mode means we shouldn't match any third-party components @@ -3169,7 +3175,7 @@ public class ComputerEngine implements Computer { // The body of findPreferredActivity. protected PackageManagerService.FindPreferredActivityBodyResult findPreferredActivityBody( - Intent intent, String resolvedType, int flags, + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, List<ResolveInfo> query, boolean always, boolean removeMatches, boolean debug, int userId, boolean queryMayBeFiltered, int callingUid, boolean isDeviceProvisioned) { @@ -3378,7 +3384,7 @@ public class ComputerEngine implements Computer { } public final PackageManagerService.FindPreferredActivityBodyResult findPreferredActivityInternal( - Intent intent, String resolvedType, int flags, + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, List<ResolveInfo> query, boolean always, boolean removeMatches, boolean debug, int userId, boolean queryMayBeFiltered) { @@ -3395,8 +3401,8 @@ public class ComputerEngine implements Computer { } public final ResolveInfo findPersistentPreferredActivityLP(Intent intent, - String resolvedType, - int flags, List<ResolveInfo> query, boolean debug, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, + List<ResolveInfo> query, boolean debug, int userId) { final int n = query.size(); PersistentPreferredIntentResolver ppir = mSettings.getPersistentPreferredActivities(userId); @@ -3592,7 +3598,8 @@ public class ComputerEngine implements Computer { } @Override - public int[] getPackageGids(@NonNull String packageName, int flags, @UserIdInt int userId) { + public int[] getPackageGids(@NonNull String packageName, + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { if (!mUserManager.exists(userId)) return null; final int callingUid = Binder.getCallingUid(); flags = updateFlagsForPackage(flags, userId); @@ -3668,8 +3675,8 @@ public class ComputerEngine implements Computer { @Nullable @Override - public ActivityInfo getReceiverInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId) { + public ActivityInfo getReceiverInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) { if (!mUserManager.exists(userId)) return null; final int callingUid = Binder.getCallingUid(); flags = updateFlagsForComponent(flags, userId); @@ -3702,7 +3709,7 @@ public class ComputerEngine implements Computer { @Nullable @Override public ParceledListSlice<SharedLibraryInfo> getSharedLibraries(@NonNull String packageName, - int flags, @UserIdInt int userId) { + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { if (!mUserManager.exists(userId)) return null; Preconditions.checkArgumentNonnegative(userId, "userId must be >= 0"); final int callingUid = Binder.getCallingUid(); @@ -3831,7 +3838,7 @@ public class ComputerEngine implements Computer { @Override public List<VersionedPackage> getPackagesUsingSharedLibrary(@NonNull SharedLibraryInfo libInfo, - int flags, int callingUid, @UserIdInt int userId) { + @PackageManager.PackageInfoFlags long flags, int callingUid, @UserIdInt int userId) { List<VersionedPackage> versionedPackages = null; final ArrayMap<String, ? extends PackageStateInternal> packageStates = getPackageStates(); final int packageCount = packageStates.size(); @@ -3888,7 +3895,8 @@ public class ComputerEngine implements Computer { @Nullable @Override public ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries( - @NonNull String packageName, int flags, @UserIdInt int userId) { + @NonNull String packageName, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId) { mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_SHARED_LIBRARIES, "getDeclaredSharedLibraries"); int callingUid = Binder.getCallingUid(); @@ -3963,8 +3971,8 @@ public class ComputerEngine implements Computer { @Nullable @Override - public ProviderInfo getProviderInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId) { + public ProviderInfo getProviderInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) { if (!mUserManager.exists(userId)) return null; final int callingUid = Binder.getCallingUid(); flags = updateFlagsForComponent(flags, userId); @@ -4438,7 +4446,8 @@ public class ComputerEngine implements Computer { @NonNull @Override public ParceledListSlice<PackageInfo> getPackagesHoldingPermissions( - @NonNull String[] permissions, int flags, @UserIdInt int userId) { + @NonNull String[] permissions, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId) { if (!mUserManager.exists(userId)) return ParceledListSlice.emptyList(); flags = updateFlagsForPackage(flags, userId); enforceCrossUserPermission(Binder.getCallingUid(), userId, true /* requireFullPermission */, @@ -4458,7 +4467,8 @@ public class ComputerEngine implements Computer { } private void addPackageHoldingPermissions(ArrayList<PackageInfo> list, PackageStateInternal ps, - String[] permissions, boolean[] tmp, int flags, int userId) { + String[] permissions, boolean[] tmp, @PackageManager.PackageInfoFlags long flags, + int userId) { int numMatch = 0; for (int i=0; i<permissions.length; i++) { final String permission = permissions[i]; @@ -4478,7 +4488,7 @@ public class ComputerEngine implements Computer { // The above might return null in cases of uninstalled apps or install-state // skew across users/profiles. if (pi != null) { - if ((flags&PackageManager.GET_PERMISSIONS) == 0) { + if ((flags & PackageManager.GET_PERMISSIONS) == 0) { if (numMatch == permissions.length) { pi.requestedPermissions = permissions; } else { @@ -4498,7 +4508,8 @@ public class ComputerEngine implements Computer { @NonNull @Override - public List<ApplicationInfo> getInstalledApplications(int flags, @UserIdInt int userId, + public List<ApplicationInfo> getInstalledApplications( + @PackageManager.ApplicationInfoFlags long flags, @UserIdInt int userId, int callingUid) { if (getInstantAppPackageName(callingUid) != null) { return Collections.emptyList(); @@ -4521,7 +4532,7 @@ public class ComputerEngine implements Computer { list = new ArrayList<>(packageStates.size()); for (PackageStateInternal ps : packageStates.values()) { ApplicationInfo ai; - int effectiveFlags = flags; + long effectiveFlags = flags; if (ps.isSystem()) { effectiveFlags |= PackageManager.MATCH_ANY_USER; } @@ -4574,8 +4585,8 @@ public class ComputerEngine implements Computer { @Nullable @Override - public ProviderInfo resolveContentProvider(@NonNull String name, int flags, - @UserIdInt int userId, int callingUid) { + public ProviderInfo resolveContentProvider(@NonNull String name, + @PackageManager.ResolveInfoFlags long flags, @UserIdInt int userId, int callingUid) { if (!mUserManager.exists(userId)) return null; flags = updateFlagsForComponent(flags, userId); final ProviderInfo providerInfo = mComponentResolver.queryProvider(name, flags, userId); @@ -4664,7 +4675,7 @@ public class ComputerEngine implements Computer { @NonNull @Override public ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName, - int uid, int flags, @Nullable String metaDataKey) { + int uid, @PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey) { final int callingUid = Binder.getCallingUid(); final int userId = processName != null ? UserHandle.getUserId(uid) : UserHandle.getCallingUserId(); @@ -5209,7 +5220,8 @@ public class ComputerEngine implements Computer { } @Override - public int getPackageUid(@NonNull String packageName, int flags, @UserIdInt int userId) { + public int getPackageUid(@NonNull String packageName, + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { if (!mUserManager.exists(userId)) return -1; final int callingUid = Binder.getCallingUid(); flags = updateFlagsForPackage(flags, userId); @@ -5312,7 +5324,7 @@ public class ComputerEngine implements Computer { if (parent == null) { return false; } - int flags = updateFlagsForResolve(0, parent.id, callingUid, + long flags = updateFlagsForResolve(0, parent.id, callingUid, false /*includeInstantApps*/, isImplicitImageCaptureIntentAndNotSetByDpcLocked(intent, parent.id, resolvedType, 0)); diff --git a/services/core/java/com/android/server/pm/ComputerLocked.java b/services/core/java/com/android/server/pm/ComputerLocked.java index 801aaeff8ada..f180d19a36d7 100644 --- a/services/core/java/com/android/server/pm/ComputerLocked.java +++ b/services/core/java/com/android/server/pm/ComputerLocked.java @@ -29,6 +29,7 @@ import android.content.pm.InstallSourceInfo; import android.content.pm.InstrumentationInfo; import android.content.pm.KeySet; import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; import android.content.pm.ParceledListSlice; import android.content.pm.ProcessInfo; import android.content.pm.ProviderInfo; @@ -89,7 +90,7 @@ public final class ComputerLocked extends ComputerEngine { } } public @NonNull QueryIntentActivitiesResult queryIntentActivitiesInternalBody( - Intent intent, String resolvedType, int flags, int filterCallingUid, int userId, + Intent intent, String resolvedType, long flags, int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits, String pkgName, String instantAppPkgName) { synchronized (mLock) { @@ -312,7 +313,8 @@ public final class ComputerLocked extends ComputerEngine { } @Override - public int[] getPackageGids(@NonNull String packageName, int flags, @UserIdInt int userId) { + public int[] getPackageGids(@NonNull String packageName, + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { synchronized (mLock) { return super.getPackageGids(packageName, flags, userId); } @@ -336,8 +338,8 @@ public final class ComputerLocked extends ComputerEngine { @Nullable @Override - public ActivityInfo getReceiverInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId) { + public ActivityInfo getReceiverInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) { synchronized (mLock) { return super.getReceiverInfo(component, flags, userId); } @@ -346,7 +348,7 @@ public final class ComputerLocked extends ComputerEngine { @Nullable @Override public ParceledListSlice<SharedLibraryInfo> getSharedLibraries(@NonNull String packageName, - int flags, @UserIdInt int userId) { + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { synchronized (mLock) { return super.getSharedLibraries(packageName, flags, userId); } @@ -363,7 +365,7 @@ public final class ComputerLocked extends ComputerEngine { @Override public List<VersionedPackage> getPackagesUsingSharedLibrary(@NonNull SharedLibraryInfo libInfo, - int flags, int callingUid, @UserIdInt int userId) { + @PackageManager.PackageInfoFlags long flags, int callingUid, @UserIdInt int userId) { synchronized (mLock) { return super.getPackagesUsingSharedLibrary(libInfo, flags, callingUid, userId); } @@ -372,7 +374,8 @@ public final class ComputerLocked extends ComputerEngine { @Nullable @Override public ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries( - @NonNull String packageName, int flags, @UserIdInt int userId) { + @NonNull String packageName, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId) { synchronized (mLock) { return super.getDeclaredSharedLibraries(packageName, flags, userId); } @@ -380,8 +383,8 @@ public final class ComputerLocked extends ComputerEngine { @Nullable @Override - public ProviderInfo getProviderInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId) { + public ProviderInfo getProviderInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) { synchronized (mLock) { return super.getProviderInfo(component, flags, userId); } @@ -495,7 +498,8 @@ public final class ComputerLocked extends ComputerEngine { @NonNull @Override public ParceledListSlice<PackageInfo> getPackagesHoldingPermissions( - @NonNull String[] permissions, int flags, @UserIdInt int userId) { + @NonNull String[] permissions, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId) { synchronized (mLock) { return super.getPackagesHoldingPermissions(permissions, flags, userId); } @@ -503,7 +507,8 @@ public final class ComputerLocked extends ComputerEngine { @NonNull @Override - public List<ApplicationInfo> getInstalledApplications(int flags, @UserIdInt int userId, + public List<ApplicationInfo> getInstalledApplications( + @PackageManager.ApplicationInfoFlags long flags, @UserIdInt int userId, int callingUid) { synchronized (mLock) { return super.getInstalledApplications(flags, userId, callingUid); @@ -512,8 +517,8 @@ public final class ComputerLocked extends ComputerEngine { @Nullable @Override - public ProviderInfo resolveContentProvider(@NonNull String name, int flags, - @UserIdInt int userId, int callingUid) { + public ProviderInfo resolveContentProvider(@NonNull String name, + @PackageManager.ResolveInfoFlags long flags, @UserIdInt int userId, int callingUid) { synchronized (mLock) { return super.resolveContentProvider(name, flags, userId, callingUid); } @@ -539,7 +544,7 @@ public final class ComputerLocked extends ComputerEngine { @NonNull @Override public ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName, - int uid, int flags, @Nullable String metaDataKey) { + int uid, @PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey) { synchronized (mLock) { return super.queryContentProviders(processName, uid, flags, metaDataKey); } @@ -711,7 +716,8 @@ public final class ComputerLocked extends ComputerEngine { } @Override - public int getPackageUid(@NonNull String packageName, int flags, @UserIdInt int userId) { + public int getPackageUid(@NonNull String packageName, + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { synchronized (mLock) { return super.getPackageUid(packageName, flags, userId); } diff --git a/services/core/java/com/android/server/pm/ComputerTracker.java b/services/core/java/com/android/server/pm/ComputerTracker.java index ca17d66f4e25..a3cd0929dd65 100644 --- a/services/core/java/com/android/server/pm/ComputerTracker.java +++ b/services/core/java/com/android/server/pm/ComputerTracker.java @@ -97,8 +97,8 @@ public final class ComputerTracker implements Computer { } public @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent, - String resolvedType, int flags, - @PackageManagerInternal.PrivateResolveFlags int privateResolveFlags, + String resolvedType, @PackageManager.ResolveInfoFlags long flags, + @PackageManagerInternal.PrivateResolveFlags long privateResolveFlags, int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits) { ThreadComputer current = snapshot(); @@ -111,7 +111,7 @@ public final class ComputerTracker implements Computer { } } public @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent, - String resolvedType, int flags, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) { ThreadComputer current = snapshot(); try { return current.mComputer.queryIntentActivitiesInternal(intent, resolvedType, flags, @@ -121,8 +121,8 @@ public final class ComputerTracker implements Computer { } } public @NonNull List<ResolveInfo> queryIntentServicesInternal(Intent intent, - String resolvedType, int flags, int userId, int callingUid, - boolean includeInstantApps) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId, + int callingUid, boolean includeInstantApps) { ThreadComputer current = snapshot(); try { return current.mComputer.queryIntentServicesInternal(intent, resolvedType, flags, @@ -132,10 +132,9 @@ public final class ComputerTracker implements Computer { } } public @NonNull QueryIntentActivitiesResult queryIntentActivitiesInternalBody( - Intent intent, - String resolvedType, int flags, int filterCallingUid, int userId, - boolean resolveForStart, boolean allowDynamicSplits, String pkgName, - String instantAppPkgName) { + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, + int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits, + String pkgName, String instantAppPkgName) { ThreadComputer current = live(); try { return current.mComputer.queryIntentActivitiesInternalBody(intent, resolvedType, @@ -145,7 +144,8 @@ public final class ComputerTracker implements Computer { current.release(); } } - public ActivityInfo getActivityInfo(ComponentName component, int flags, int userId) { + public ActivityInfo getActivityInfo(ComponentName component, + @PackageManager.ComponentInfoFlags long flags, int userId) { ThreadComputer current = snapshot(); try { return current.mComputer.getActivityInfo(component, flags, userId); @@ -153,7 +153,8 @@ public final class ComputerTracker implements Computer { current.release(); } } - public ActivityInfo getActivityInfoInternal(ComponentName component, int flags, + public ActivityInfo getActivityInfoInternal(ComponentName component, + @PackageManager.ComponentInfoFlags long flags, int filterCallingUid, int userId) { ThreadComputer current = live(); try { @@ -180,7 +181,7 @@ public final class ComputerTracker implements Computer { } } public ApplicationInfo generateApplicationInfoFromSettings(String packageName, - int flags, int filterCallingUid, int userId) { + long flags, int filterCallingUid, int userId) { ThreadComputer current = live(); try { return current.mComputer.generateApplicationInfoFromSettings(packageName, flags, @@ -189,7 +190,8 @@ public final class ComputerTracker implements Computer { current.release(); } } - public ApplicationInfo getApplicationInfo(String packageName, int flags, int userId) { + public ApplicationInfo getApplicationInfo(String packageName, + @PackageManager.ApplicationInfoFlags long flags, int userId) { ThreadComputer current = snapshot(); try { return current.mComputer.getApplicationInfo(packageName, flags, userId); @@ -197,8 +199,8 @@ public final class ComputerTracker implements Computer { current.release(); } } - public ApplicationInfo getApplicationInfoInternal(String packageName, int flags, - int filterCallingUid, int userId) { + public ApplicationInfo getApplicationInfoInternal(String packageName, + @PackageManager.ApplicationInfoFlags long flags, int filterCallingUid, int userId) { ThreadComputer current = live(); try { return current.mComputer.getApplicationInfoInternal(packageName, flags, @@ -225,7 +227,8 @@ public final class ComputerTracker implements Computer { } } public CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent, - String resolvedType, int flags, int sourceUserId, int parentUserId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int sourceUserId, + int parentUserId) { ThreadComputer current = live(); try { return current.mComputer.getCrossProfileDomainPreferredLpr(intent, resolvedType, @@ -264,7 +267,8 @@ public final class ComputerTracker implements Computer { current.release(); } } - public PackageInfo generatePackageInfo(PackageStateInternal ps, int flags, int userId) { + public PackageInfo generatePackageInfo(PackageStateInternal ps, + @PackageManager.PackageInfoFlags long flags, int userId) { ThreadComputer current = live(); try { return current.mComputer.generatePackageInfo(ps, flags, userId); @@ -272,7 +276,8 @@ public final class ComputerTracker implements Computer { current.release(); } } - public PackageInfo getPackageInfo(String packageName, int flags, int userId) { + public PackageInfo getPackageInfo(String packageName, + @PackageManager.PackageInfoFlags long flags, int userId) { ThreadComputer current = snapshot(); try { return current.mComputer.getPackageInfo(packageName, flags, userId); @@ -281,7 +286,7 @@ public final class ComputerTracker implements Computer { } } public PackageInfo getPackageInfoInternal(String packageName, long versionCode, - int flags, int filterCallingUid, int userId) { + long flags, int filterCallingUid, int userId) { ThreadComputer current = live(); try { return current.mComputer.getPackageInfoInternal(packageName, versionCode, flags, @@ -317,7 +322,7 @@ public final class ComputerTracker implements Computer { } } - public ParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId) { + public ParceledListSlice<PackageInfo> getInstalledPackages(long flags, int userId) { ThreadComputer current = snapshot(); try { return current.mComputer.getInstalledPackages(flags, userId); @@ -335,7 +340,8 @@ public final class ComputerTracker implements Computer { current.release(); } } - public ServiceInfo getServiceInfo(ComponentName component, int flags, int userId) { + public ServiceInfo getServiceInfo(ComponentName component, + @PackageManager.ComponentInfoFlags long flags, int userId) { ThreadComputer current = live(); try { return current.mComputer.getServiceInfo(component, flags, userId); @@ -440,7 +446,7 @@ public final class ComputerTracker implements Computer { } } public boolean filterSharedLibPackage(@Nullable PackageStateInternal ps, int uid, - int userId, int flags) { + int userId, @PackageManager.ComponentInfoFlags long flags) { ThreadComputer current = live(); try { return current.mComputer.filterSharedLibPackage(ps, uid, userId, flags); @@ -474,7 +480,7 @@ public final class ComputerTracker implements Computer { } } public boolean isImplicitImageCaptureIntentAndNotSetByDpcLocked(Intent intent, - int userId, String resolvedType, int flags) { + int userId, String resolvedType, @PackageManager.ResolveInfoFlags long flags) { ThreadComputer current = live(); try { return current.mComputer.isImplicitImageCaptureIntentAndNotSetByDpcLocked(intent, @@ -546,8 +552,8 @@ public final class ComputerTracker implements Computer { current.release(); } } - public int getPackageUidInternal(String packageName, int flags, int userId, - int callingUid) { + public int getPackageUidInternal(String packageName, + @PackageManager.PackageInfoFlags long flags, int userId, int callingUid) { ThreadComputer current = live(); try { return current.mComputer.getPackageUidInternal(packageName, flags, userId, @@ -556,7 +562,7 @@ public final class ComputerTracker implements Computer { current.release(); } } - public int updateFlagsForApplication(int flags, int userId) { + public long updateFlagsForApplication(long flags, int userId) { ThreadComputer current = live(); try { return current.mComputer.updateFlagsForApplication(flags, userId); @@ -564,7 +570,7 @@ public final class ComputerTracker implements Computer { current.release(); } } - public int updateFlagsForComponent(int flags, int userId) { + public long updateFlagsForComponent(long flags, int userId) { ThreadComputer current = live(); try { return current.mComputer.updateFlagsForComponent(flags, userId); @@ -572,7 +578,7 @@ public final class ComputerTracker implements Computer { current.release(); } } - public int updateFlagsForPackage(int flags, int userId) { + public long updateFlagsForPackage(long flags, int userId) { ThreadComputer current = live(); try { return current.mComputer.updateFlagsForPackage(flags, userId); @@ -580,7 +586,7 @@ public final class ComputerTracker implements Computer { current.release(); } } - public int updateFlagsForResolve(int flags, int userId, int callingUid, + public long updateFlagsForResolve(long flags, int userId, int callingUid, boolean wantInstantApps, boolean isImplicitImageCaptureIntentAndNotSetByDpc) { ThreadComputer current = snapshot(); try { @@ -590,7 +596,7 @@ public final class ComputerTracker implements Computer { current.release(); } } - public int updateFlagsForResolve(int flags, int userId, int callingUid, + public long updateFlagsForResolve(long flags, int userId, int callingUid, boolean wantInstantApps, boolean onlyExposedExplicitly, boolean isImplicitImageCaptureIntentAndNotSetByDpc) { ThreadComputer current = live(); @@ -642,8 +648,9 @@ public final class ComputerTracker implements Computer { } } public PackageManagerService.FindPreferredActivityBodyResult findPreferredActivityInternal( - Intent intent, String resolvedType, int flags, List<ResolveInfo> query, boolean always, - boolean removeMatches, boolean debug, int userId, boolean queryMayBeFiltered) { + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, + List<ResolveInfo> query, boolean always, boolean removeMatches, boolean debug, + int userId, boolean queryMayBeFiltered) { ThreadComputer current = live(); try { return current.mComputer.findPreferredActivityInternal(intent, resolvedType, flags, @@ -653,8 +660,8 @@ public final class ComputerTracker implements Computer { } } public ResolveInfo findPersistentPreferredActivityLP(Intent intent, - String resolvedType, int flags, List<ResolveInfo> query, boolean debug, - int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, + List<ResolveInfo> query, boolean debug, int userId) { ThreadComputer current = live(); try { return current.mComputer.findPersistentPreferredActivityLP(intent, resolvedType, @@ -741,7 +748,8 @@ public final class ComputerTracker implements Computer { } @Override - public int[] getPackageGids(@NonNull String packageName, int flags, @UserIdInt int userId) { + public int[] getPackageGids(@NonNull String packageName, + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { try (ThreadComputer current = snapshot()) { return current.mComputer.getPackageGids(packageName, flags, userId); } @@ -765,8 +773,8 @@ public final class ComputerTracker implements Computer { @Nullable @Override - public ActivityInfo getReceiverInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId) { + public ActivityInfo getReceiverInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) { try (ThreadComputer current = snapshot()) { return current.mComputer.getReceiverInfo(component, flags, userId); } @@ -775,7 +783,7 @@ public final class ComputerTracker implements Computer { @Nullable @Override public ParceledListSlice<SharedLibraryInfo> getSharedLibraries(@NonNull String packageName, - int flags, @UserIdInt int userId) { + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { try (ThreadComputer current = snapshot()) { return current.mComputer.getSharedLibraries(packageName, flags, userId); } @@ -800,7 +808,7 @@ public final class ComputerTracker implements Computer { @Override public List<VersionedPackage> getPackagesUsingSharedLibrary(@NonNull SharedLibraryInfo libInfo, - int flags, int callingUid, @UserIdInt int userId) { + @PackageManager.PackageInfoFlags long flags, int callingUid, @UserIdInt int userId) { try (ThreadComputer current = snapshot()) { return current.mComputer.getPackagesUsingSharedLibrary(libInfo, flags, callingUid, userId); @@ -810,7 +818,8 @@ public final class ComputerTracker implements Computer { @Nullable @Override public ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries( - @NonNull String packageName, int flags, @UserIdInt int userId) { + @NonNull String packageName, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId) { try (ThreadComputer current = snapshot()) { return current.mComputer.getDeclaredSharedLibraries(packageName, flags, userId); } @@ -818,8 +827,8 @@ public final class ComputerTracker implements Computer { @Nullable @Override - public ProviderInfo getProviderInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId) { + public ProviderInfo getProviderInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) { try (ThreadComputer current = snapshot()) { return current.mComputer.getProviderInfo(component, flags, userId); } @@ -934,7 +943,8 @@ public final class ComputerTracker implements Computer { @NonNull @Override public ParceledListSlice<PackageInfo> getPackagesHoldingPermissions( - @NonNull String[] permissions, int flags, @UserIdInt int userId) { + @NonNull String[] permissions, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId) { try (ThreadComputer current = snapshot()) { return current.mComputer.getPackagesHoldingPermissions(permissions, flags, userId); } @@ -942,7 +952,8 @@ public final class ComputerTracker implements Computer { @NonNull @Override - public List<ApplicationInfo> getInstalledApplications(int flags, @UserIdInt int userId, + public List<ApplicationInfo> getInstalledApplications( + @PackageManager.ApplicationInfoFlags long flags, @UserIdInt int userId, int callingUid) { try (ThreadComputer current = snapshot()) { return current.mComputer.getInstalledApplications(flags, userId, callingUid); @@ -951,8 +962,8 @@ public final class ComputerTracker implements Computer { @Nullable @Override - public ProviderInfo resolveContentProvider(@NonNull String name, int flags, - @UserIdInt int userId, int callingUid) { + public ProviderInfo resolveContentProvider(@NonNull String name, + @PackageManager.ResolveInfoFlags long flags, @UserIdInt int userId, int callingUid) { try (ThreadComputer current = snapshot()) { return current.mComputer.resolveContentProvider(name, flags, userId, callingUid); } @@ -979,7 +990,7 @@ public final class ComputerTracker implements Computer { @NonNull @Override public ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName, - int uid, int flags, @Nullable String metaDataKey) { + int uid, @PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey) { try (ThreadComputer current = snapshot()) { return current.mComputer.queryContentProviders(processName, uid, flags, metaDataKey); } @@ -1152,7 +1163,8 @@ public final class ComputerTracker implements Computer { } @Override - public int getPackageUid(@NonNull String packageName, int flags, @UserIdInt int userId) { + public int getPackageUid(@NonNull String packageName, + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { try (ThreadComputer current = snapshot()) { return current.mComputer.getPackageUid(packageName, flags, userId); } diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index b6649786e310..9f5adcb6f16f 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -2576,8 +2576,8 @@ public class PackageManagerService extends IPackageManager.Stub return mComputer.canViewInstantApps(callingUid, userId); } - private PackageInfo generatePackageInfo(@NonNull PackageStateInternal ps, int flags, - int userId) { + private PackageInfo generatePackageInfo(@NonNull PackageStateInternal ps, + @PackageManager.PackageInfoFlags long flags, int userId) { return mComputer.generatePackageInfo(ps, flags, userId); } @@ -2616,13 +2616,14 @@ public class PackageManagerService extends IPackageManager.Stub } @Override - public PackageInfo getPackageInfo(String packageName, int flags, int userId) { + public PackageInfo getPackageInfo(String packageName, + @PackageManager.PackageInfoFlags long flags, int userId) { return mComputer.getPackageInfo(packageName, flags, userId); } @Override public PackageInfo getPackageInfoVersioned(VersionedPackage versionedPackage, - int flags, int userId) { + @PackageManager.PackageInfoFlags long flags, int userId) { return mComputer.getPackageInfoInternal(versionedPackage.getPackageName(), versionedPackage.getLongVersionCode(), flags, Binder.getCallingUid(), userId); } @@ -2659,7 +2660,7 @@ public class PackageManagerService extends IPackageManager.Stub } private boolean filterSharedLibPackage(@Nullable PackageStateInternal ps, int uid, - int userId, int flags) { + int userId, @PackageManager.ComponentInfoFlags long flags) { return mComputer.filterSharedLibPackage(ps, uid, userId, flags); } @@ -2674,16 +2675,19 @@ public class PackageManagerService extends IPackageManager.Stub } @Override - public int getPackageUid(@NonNull String packageName, int flags, @UserIdInt int userId) { + public int getPackageUid(@NonNull String packageName, + @PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) { return mComputer.getPackageUid(packageName, flags, userId); } - private int getPackageUidInternal(String packageName, int flags, int userId, int callingUid) { + private int getPackageUidInternal(String packageName, + @PackageManager.PackageInfoFlags long flags, int userId, int callingUid) { return mComputer.getPackageUidInternal(packageName, flags, userId, callingUid); } @Override - public int[] getPackageGids(String packageName, int flags, int userId) { + public int[] getPackageGids(String packageName, @PackageManager.PackageInfoFlags long flags, + int userId) { return mComputer.getPackageGids(packageName, flags, userId); } @@ -2696,14 +2700,15 @@ public class PackageManagerService extends IPackageManager.Stub .getPermissionGroupInfo(groupName, flags); } - private ApplicationInfo generateApplicationInfoFromSettings(String packageName, int flags, - int filterCallingUid, int userId) { - return mComputer.generateApplicationInfoFromSettings(packageName, flags, - filterCallingUid, userId); + private ApplicationInfo generateApplicationInfoFromSettings(String packageName, + @PackageManager.ApplicationInfoFlags long flags, int filterCallingUid, int userId) { + return mComputer.generateApplicationInfoFromSettings(packageName, flags, filterCallingUid, + userId); } @Override - public ApplicationInfo getApplicationInfo(String packageName, int flags, int userId) { + public ApplicationInfo getApplicationInfo(String packageName, + @PackageManager.ApplicationInfoFlags long flags, int userId) { return mComputer.getApplicationInfo(packageName, flags, userId); } @@ -2713,7 +2718,8 @@ public class PackageManagerService extends IPackageManager.Stub * to clearing. Because it can only be provided by trusted code, its value can be * trusted and will be used as-is; unlike userId which will be validated by this method. */ - private ApplicationInfo getApplicationInfoInternal(String packageName, int flags, + private ApplicationInfo getApplicationInfoInternal(String packageName, + @PackageManager.ApplicationInfoFlags long flags, int filterCallingUid, int userId) { return mComputer.getApplicationInfoInternal(packageName, flags, filterCallingUid, userId); @@ -2948,21 +2954,21 @@ public class PackageManagerService extends IPackageManager.Stub /** * Update given flags when being used to request {@link PackageInfo}. */ - private int updateFlagsForPackage(int flags, int userId) { + private long updateFlagsForPackage(long flags, int userId) { return mComputer.updateFlagsForPackage(flags, userId); } /** * Update given flags when being used to request {@link ApplicationInfo}. */ - private int updateFlagsForApplication(int flags, int userId) { + private long updateFlagsForApplication(long flags, int userId) { return mComputer.updateFlagsForApplication(flags, userId); } /** * Update given flags when being used to request {@link ComponentInfo}. */ - private int updateFlagsForComponent(int flags, int userId) { + private long updateFlagsForComponent(long flags, int userId) { return mComputer.updateFlagsForComponent(flags, userId); } @@ -2978,7 +2984,7 @@ public class PackageManagerService extends IPackageManager.Stub * action and a {@code android.intent.category.BROWSABLE} category</li> * </ul> */ - int updateFlagsForResolve(int flags, int userId, int callingUid, + long updateFlagsForResolve(long flags, int userId, int callingUid, boolean wantInstantApps, boolean isImplicitImageCaptureIntentAndNotSetByDpc) { return mComputer.updateFlagsForResolve(flags, userId, callingUid, wantInstantApps, isImplicitImageCaptureIntentAndNotSetByDpc); @@ -2990,7 +2996,8 @@ public class PackageManagerService extends IPackageManager.Stub } @Override - public ActivityInfo getActivityInfo(ComponentName component, int flags, int userId) { + public ActivityInfo getActivityInfo(ComponentName component, + @PackageManager.ComponentInfoFlags long flags, int userId) { return mComputer.getActivityInfo(component, flags, userId); } @@ -3000,8 +3007,8 @@ public class PackageManagerService extends IPackageManager.Stub * to clearing. Because it can only be provided by trusted code, its value can be * trusted and will be used as-is; unlike userId which will be validated by this method. */ - private ActivityInfo getActivityInfoInternal(ComponentName component, int flags, - int filterCallingUid, int userId) { + private ActivityInfo getActivityInfoInternal(ComponentName component, + @PackageManager.ComponentInfoFlags long flags, int filterCallingUid, int userId) { return mComputer.getActivityInfoInternal(component, flags, filterCallingUid, userId); } @@ -3014,40 +3021,43 @@ public class PackageManagerService extends IPackageManager.Stub } @Override - public ActivityInfo getReceiverInfo(ComponentName component, int flags, int userId) { + public ActivityInfo getReceiverInfo(ComponentName component, + @PackageManager.ComponentInfoFlags long flags, int userId) { return mComputer.getReceiverInfo(component, flags, userId); } @Override public ParceledListSlice<SharedLibraryInfo> getSharedLibraries(String packageName, - int flags, int userId) { + @PackageManager.PackageInfoFlags long flags, int userId) { return mComputer.getSharedLibraries(packageName, flags, userId); } @Nullable @Override public ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries( - @NonNull String packageName, int flags, @UserIdInt int userId) { + @NonNull String packageName, @PackageManager.PackageInfoFlags long flags, + @NonNull int userId) { return mComputer.getDeclaredSharedLibraries(packageName, flags, userId); } @Nullable List<VersionedPackage> getPackagesUsingSharedLibrary( - SharedLibraryInfo libInfo, int flags, int callingUid, int userId) { + SharedLibraryInfo libInfo, @PackageManager.PackageInfoFlags long flags, int callingUid, + int userId) { return mComputer.getPackagesUsingSharedLibrary(libInfo, flags, callingUid, userId); } @Nullable @Override - public ServiceInfo getServiceInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId) { + public ServiceInfo getServiceInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) { return mComputer.getServiceInfo(component, flags, userId); } @Nullable @Override - public ProviderInfo getProviderInfo(@NonNull ComponentName component, int flags, - @UserIdInt int userId) { + public ProviderInfo getProviderInfo(@NonNull ComponentName component, + @PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) { return mComputer.getProviderInfo(component, flags, userId); } @@ -3336,7 +3346,7 @@ public class PackageManagerService extends IPackageManager.Stub @Override public ResolveInfo resolveIntent(Intent intent, String resolvedType, - int flags, int userId) { + @PackageManager.ResolveInfoFlags long flags, int userId) { return mResolveIntentHelper.resolveIntentInternal(intent, resolvedType, flags, 0 /*privateResolveFlags*/, userId, false, Binder.getCallingUid()); } @@ -3381,7 +3391,7 @@ public class PackageManagerService extends IPackageManager.Stub */ @GuardedBy("mLock") boolean isImplicitImageCaptureIntentAndNotSetByDpcLocked(Intent intent, int userId, - String resolvedType, int flags) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags) { return mComputer.isImplicitImageCaptureIntentAndNotSetByDpcLocked(intent, userId, resolvedType, flags); } @@ -3389,10 +3399,10 @@ public class PackageManagerService extends IPackageManager.Stub @GuardedBy("mLock") ResolveInfo findPersistentPreferredActivityLP(Intent intent, String resolvedType, - int flags, List<ResolveInfo> query, boolean debug, int userId) { + @PackageManager.ResolveInfoFlags long flags, List<ResolveInfo> query, boolean debug, + int userId) { return mComputer.findPersistentPreferredActivityLP(intent, - resolvedType, - flags, query, debug, userId); + resolvedType, flags, query, debug, userId); } // findPreferredActivityBody returns two items: a "things changed" flag and a @@ -3403,7 +3413,7 @@ public class PackageManagerService extends IPackageManager.Stub } FindPreferredActivityBodyResult findPreferredActivityInternal( - Intent intent, String resolvedType, int flags, + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, List<ResolveInfo> query, boolean always, boolean removeMatches, boolean debug, int userId, boolean queryMayBeFiltered) { return mComputer.findPreferredActivityInternal( @@ -3433,7 +3443,7 @@ public class PackageManagerService extends IPackageManager.Stub @Override public @NonNull ParceledListSlice<ResolveInfo> queryIntentActivities(Intent intent, - String resolvedType, int flags, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) { try { Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "queryIntentActivities"); @@ -3453,21 +3463,23 @@ public class PackageManagerService extends IPackageManager.Stub } @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent, - String resolvedType, int flags, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) { return mComputer.queryIntentActivitiesInternal(intent, resolvedType, flags, userId); } @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent, - String resolvedType, int flags, @PrivateResolveFlags int privateResolveFlags, - int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, + @PrivateResolveFlags long privateResolveFlags, int filterCallingUid, int userId, + boolean resolveForStart, boolean allowDynamicSplits) { return mComputer.queryIntentActivitiesInternal(intent, resolvedType, flags, privateResolveFlags, filterCallingUid, userId, resolveForStart, allowDynamicSplits); } private CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent, - String resolvedType, int flags, int sourceUserId, int parentUserId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int sourceUserId, + int parentUserId) { return mComputer.getCrossProfileDomainPreferredLpr(intent, resolvedType, flags, sourceUserId, parentUserId); } @@ -3494,20 +3506,21 @@ public class PackageManagerService extends IPackageManager.Stub @Override public @NonNull ParceledListSlice<ResolveInfo> queryIntentActivityOptions(ComponentName caller, Intent[] specifics, String[] specificTypes, Intent intent, - String resolvedType, int flags, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) { return new ParceledListSlice<>(mResolveIntentHelper.queryIntentActivityOptionsInternal( caller, specifics, specificTypes, intent, resolvedType, flags, userId)); } @Override public @NonNull ParceledListSlice<ResolveInfo> queryIntentReceivers(Intent intent, - String resolvedType, int flags, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) { return new ParceledListSlice<>(mResolveIntentHelper.queryIntentReceiversInternal(intent, resolvedType, flags, userId, Binder.getCallingUid())); } @Override - public ResolveInfo resolveService(Intent intent, String resolvedType, int flags, int userId) { + public ResolveInfo resolveService(Intent intent, String resolvedType, + @PackageManager.ResolveInfoFlags long flags, int userId) { final int callingUid = Binder.getCallingUid(); return mResolveIntentHelper.resolveServiceInternal(intent, resolvedType, flags, userId, callingUid); @@ -3515,15 +3528,15 @@ public class PackageManagerService extends IPackageManager.Stub @Override public @NonNull ParceledListSlice<ResolveInfo> queryIntentServices(Intent intent, - String resolvedType, int flags, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) { final int callingUid = Binder.getCallingUid(); return new ParceledListSlice<>(queryIntentServicesInternal( intent, resolvedType, flags, userId, callingUid, false /*includeInstantApps*/)); } @NonNull List<ResolveInfo> queryIntentServicesInternal(Intent intent, - String resolvedType, int flags, int userId, int callingUid, - boolean includeInstantApps) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId, + int callingUid, boolean includeInstantApps) { return mComputer.queryIntentServicesInternal(intent, resolvedType, flags, userId, callingUid, includeInstantApps); @@ -3531,24 +3544,27 @@ public class PackageManagerService extends IPackageManager.Stub @Override public @NonNull ParceledListSlice<ResolveInfo> queryIntentContentProviders(Intent intent, - String resolvedType, int flags, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) { return new ParceledListSlice<>(mResolveIntentHelper.queryIntentContentProvidersInternal( intent, resolvedType, flags, userId)); } @Override - public ParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId) { + public ParceledListSlice<PackageInfo> getInstalledPackages( + @PackageManager.PackageInfoFlags long flags, int userId) { return mComputer.getInstalledPackages(flags, userId); } @Override public ParceledListSlice<PackageInfo> getPackagesHoldingPermissions( - @NonNull String[] permissions, int flags, @UserIdInt int userId) { + @NonNull String[] permissions, @PackageManager.PackageInfoFlags long flags, + @UserIdInt int userId) { return mComputer.getPackagesHoldingPermissions(permissions, flags, userId); } @Override - public ParceledListSlice<ApplicationInfo> getInstalledApplications(int flags, int userId) { + public ParceledListSlice<ApplicationInfo> getInstalledApplications( + @PackageManager.ApplicationInfoFlags long flags, int userId) { final int callingUid = Binder.getCallingUid(); return new ParceledListSlice<>( mComputer.getInstalledApplications(flags, userId, callingUid)); @@ -3652,7 +3668,8 @@ public class PackageManagerService extends IPackageManager.Stub } @Override - public ProviderInfo resolveContentProvider(String name, int flags, int userId) { + public ProviderInfo resolveContentProvider(String name, + @PackageManager.ResolveInfoFlags long flags, int userId) { return mComputer.resolveContentProvider(name, flags, userId, Binder.getCallingUid()); } @@ -3664,7 +3681,7 @@ public class PackageManagerService extends IPackageManager.Stub @NonNull @Override public ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName, - int uid, int flags, @Nullable String metaDataKey) { + int uid, @PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey) { return mComputer.queryContentProviders(processName, uid, flags, metaDataKey); } @@ -7509,8 +7526,8 @@ public class PackageManagerService extends IPackageManager.Stub private class PackageManagerInternalImpl extends PackageManagerInternal { @Override - public List<ApplicationInfo> getInstalledApplications(int flags, int userId, - int callingUid) { + public List<ApplicationInfo> getInstalledApplications( + @PackageManager.ApplicationInfoFlags long flags, int userId, int callingUid) { return PackageManagerService.this.mComputer.getInstalledApplications(flags, userId, callingUid); } @@ -7705,7 +7722,8 @@ public class PackageManagerService extends IPackageManager.Stub @Override public PackageInfo getPackageInfo( - String packageName, int flags, int filterCallingUid, int userId) { + String packageName, @PackageManager.PackageInfoFlags long flags, + int filterCallingUid, int userId) { return PackageManagerService.this.mComputer .getPackageInfoInternal(packageName, PackageManager.VERSION_CODE_HIGHEST, flags, filterCallingUid, userId); @@ -7833,28 +7851,32 @@ public class PackageManagerService extends IPackageManager.Stub } @Override - public int getPackageUid(String packageName, int flags, int userId) { + public int getPackageUid(String packageName, @PackageManager.PackageInfoFlags long flags, + int userId) { return PackageManagerService.this .getPackageUidInternal(packageName, flags, userId, Process.SYSTEM_UID); } @Override public ApplicationInfo getApplicationInfo( - String packageName, int flags, int filterCallingUid, int userId) { + String packageName, @PackageManager.ApplicationInfoFlags long flags, + int filterCallingUid, int userId) { return PackageManagerService.this .getApplicationInfoInternal(packageName, flags, filterCallingUid, userId); } @Override public ActivityInfo getActivityInfo( - ComponentName component, int flags, int filterCallingUid, int userId) { + ComponentName component, @PackageManager.ComponentInfoFlags long flags, + int filterCallingUid, int userId) { return PackageManagerService.this .getActivityInfoInternal(component, flags, filterCallingUid, userId); } @Override public List<ResolveInfo> queryIntentActivities( - Intent intent, String resolvedType, int flags, int filterCallingUid, int userId) { + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, + int filterCallingUid, int userId) { return PackageManagerService.this .queryIntentActivitiesInternal(intent, resolvedType, flags, 0, filterCallingUid, userId, false /*resolveForStart*/, true /*allowDynamicSplits*/); @@ -7862,14 +7884,16 @@ public class PackageManagerService extends IPackageManager.Stub @Override public List<ResolveInfo> queryIntentReceivers(Intent intent, - String resolvedType, int flags, int filterCallingUid, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, + int filterCallingUid, int userId) { return PackageManagerService.this.mResolveIntentHelper.queryIntentReceiversInternal( intent, resolvedType, flags, userId, filterCallingUid); } @Override public List<ResolveInfo> queryIntentServices( - Intent intent, int flags, int callingUid, int userId) { + Intent intent, @PackageManager.ResolveInfoFlags long flags, int callingUid, + int userId) { final String resolvedType = intent.resolveTypeIfNeeded(mContext.getContentResolver()); return PackageManagerService.this .queryIntentServicesInternal(intent, resolvedType, flags, userId, callingUid, @@ -7935,7 +7959,7 @@ public class PackageManagerService extends IPackageManager.Stub } @Override - public boolean isEnabledAndMatches(ParsedMainComponent component, int flags, int userId) { + public boolean isEnabledAndMatches(ParsedMainComponent component, long flags, int userId) { return PackageStateUtils.isEnabledAndMatches( getPackageStateInternal(component.getPackageName()), component, flags, userId); } @@ -8137,8 +8161,9 @@ public class PackageManagerService extends IPackageManager.Stub @Override public ResolveInfo resolveIntent(Intent intent, String resolvedType, - int flags, int privateResolveFlags, int userId, boolean resolveForStart, - int filterCallingUid) { + @PackageManager.ResolveInfoFlags long flags, + @PackageManagerInternal.PrivateResolveFlags long privateResolveFlags, int userId, + boolean resolveForStart, int filterCallingUid) { return mResolveIntentHelper.resolveIntentInternal( intent, resolvedType, flags, privateResolveFlags, userId, resolveForStart, filterCallingUid); @@ -8146,14 +8171,14 @@ public class PackageManagerService extends IPackageManager.Stub @Override public ResolveInfo resolveService(Intent intent, String resolvedType, - int flags, int userId, int callingUid) { + @PackageManager.ResolveInfoFlags long flags, int userId, int callingUid) { return mResolveIntentHelper.resolveServiceInternal(intent, resolvedType, flags, userId, callingUid); } @Override - public ProviderInfo resolveContentProvider(String name, int flags, int userId, - int callingUid) { + public ProviderInfo resolveContentProvider(String name, + @PackageManager.ResolveInfoFlags long flags, int userId, int callingUid) { return PackageManagerService.this.mComputer .resolveContentProvider(name, flags, userId,callingUid); } diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java index 1848ef5b9c12..3b643b5c982f 100644 --- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java @@ -1079,7 +1079,7 @@ public class PackageManagerServiceUtils { public static boolean hasAnyDomainApproval( @NonNull DomainVerificationManagerInternal manager, @NonNull PackageStateInternal pkgSetting, @NonNull Intent intent, - @PackageManager.ResolveInfoFlags int resolveInfoFlags, @UserIdInt int userId) { + @PackageManager.ResolveInfoFlags long resolveInfoFlags, @UserIdInt int userId) { return manager.approvalLevelForDomain(pkgSetting, intent, resolveInfoFlags, userId) > DomainVerificationManagerInternal.APPROVAL_LEVEL_NONE; } diff --git a/services/core/java/com/android/server/pm/PreferredActivityHelper.java b/services/core/java/com/android/server/pm/PreferredActivityHelper.java index cb97e2ab8e6f..8c91b16f2d83 100644 --- a/services/core/java/com/android/server/pm/PreferredActivityHelper.java +++ b/services/core/java/com/android/server/pm/PreferredActivityHelper.java @@ -75,8 +75,8 @@ final class PreferredActivityHelper { } private ResolveInfo findPreferredActivityNotLocked(Intent intent, String resolvedType, - int flags, List<ResolveInfo> query, boolean always, boolean removeMatches, - boolean debug, int userId) { + @PackageManager.ResolveInfoFlags long flags, List<ResolveInfo> query, boolean always, + boolean removeMatches, boolean debug, int userId) { return findPreferredActivityNotLocked( intent, resolvedType, flags, query, always, removeMatches, debug, userId, UserHandle.getAppId(Binder.getCallingUid()) >= Process.FIRST_APPLICATION_UID); @@ -85,8 +85,9 @@ final class PreferredActivityHelper { // TODO: handle preferred activities missing while user has amnesia /** <b>must not hold {@link PackageManagerService.mLock}</b> */ public ResolveInfo findPreferredActivityNotLocked( - Intent intent, String resolvedType, int flags, List<ResolveInfo> query, boolean always, - boolean removeMatches, boolean debug, int userId, boolean queryMayBeFiltered) { + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, + List<ResolveInfo> query, boolean always, boolean removeMatches, boolean debug, + int userId, boolean queryMayBeFiltered) { if (Thread.holdsLock(mPm.mLock)) { Slog.wtf(TAG, "Calling thread " + Thread.currentThread().getName() + " is holding mLock", new Throwable()); @@ -675,7 +676,7 @@ final class PreferredActivityHelper { final int callingUid = Binder.getCallingUid(); intent = PackageManagerServiceUtils.updateIntentForResolve(intent); final String resolvedType = intent.resolveTypeIfNeeded(mPm.mContext.getContentResolver()); - final int flags = mPm.updateFlagsForResolve( + final long flags = mPm.updateFlagsForResolve( 0, userId, callingUid, false /*includeInstantApps*/, mPm.isImplicitImageCaptureIntentAndNotSetByDpcLocked(intent, userId, resolvedType, 0)); diff --git a/services/core/java/com/android/server/pm/ResolveIntentHelper.java b/services/core/java/com/android/server/pm/ResolveIntentHelper.java index 70855a9bf430..0ee1f894573f 100644 --- a/services/core/java/com/android/server/pm/ResolveIntentHelper.java +++ b/services/core/java/com/android/server/pm/ResolveIntentHelper.java @@ -74,8 +74,9 @@ final class ResolveIntentHelper { * However, if {@code resolveForStart} is {@code true}, all instant apps are visible * since we need to allow the system to start any installed application. */ - public ResolveInfo resolveIntentInternal(Intent intent, String resolvedType, int flags, - @PackageManagerInternal.PrivateResolveFlags int privateResolveFlags, int userId, + public ResolveInfo resolveIntentInternal(Intent intent, String resolvedType, + @PackageManager.ResolveInfoFlags long flags, + @PackageManagerInternal.PrivateResolveFlags long privateResolveFlags, int userId, boolean resolveForStart, int filterCallingUid) { try { Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "resolveIntent"); @@ -114,8 +115,9 @@ final class ResolveIntentHelper { } private ResolveInfo chooseBestActivity(Intent intent, String resolvedType, - int flags, int privateResolveFlags, List<ResolveInfo> query, int userId, - boolean queryMayBeFiltered) { + @PackageManager.ResolveInfoFlags long flags, + @PackageManagerInternal.PrivateResolveFlags long privateResolveFlags, + List<ResolveInfo> query, int userId, boolean queryMayBeFiltered) { if (query != null) { final int n = query.size(); if (n == 1) { @@ -276,7 +278,8 @@ final class ResolveIntentHelper { // In this method, we have to know the actual calling UID, but in some cases Binder's // call identity is removed, so the UID has to be passed in explicitly. public @NonNull List<ResolveInfo> queryIntentReceiversInternal(Intent intent, - String resolvedType, int flags, int userId, int filterCallingUid) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId, + int filterCallingUid) { if (!mPm.mUserManager.exists(userId)) return Collections.emptyList(); mPm.enforceCrossUserPermission(filterCallingUid, userId, false /*requireFullPermission*/, false /*checkShell*/, "query intent receivers"); @@ -370,8 +373,8 @@ final class ResolveIntentHelper { } - public ResolveInfo resolveServiceInternal(Intent intent, String resolvedType, int flags, - int userId, int callingUid) { + public ResolveInfo resolveServiceInternal(Intent intent, String resolvedType, + @PackageManager.ResolveInfoFlags long flags, int userId, int callingUid) { if (!mPm.mUserManager.exists(userId)) return null; flags = mPm.updateFlagsForResolve(flags, userId, callingUid, false /*includeInstantApps*/, false /* isImplicitImageCaptureIntentAndNotSetByDpc */); @@ -388,7 +391,8 @@ final class ResolveIntentHelper { } public @NonNull List<ResolveInfo> queryIntentContentProvidersInternal( - Intent intent, String resolvedType, int flags, int userId) { + Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags, + int userId) { if (!mPm.mUserManager.exists(userId)) return Collections.emptyList(); final int callingUid = Binder.getCallingUid(); final String instantAppPkgName = mPm.getInstantAppPackageName(callingUid); @@ -529,7 +533,7 @@ final class ResolveIntentHelper { public @NonNull List<ResolveInfo> queryIntentActivityOptionsInternal(ComponentName caller, Intent[] specifics, String[] specificTypes, Intent intent, - String resolvedType, int flags, int userId) { + String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) { if (!mPm.mUserManager.exists(userId)) return Collections.emptyList(); final int callingUid = Binder.getCallingUid(); flags = mPm.updateFlagsForResolve(flags, userId, callingUid, false /*includeInstantApps*/, diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java index 1f5d79ca3093..6a163b2fdacb 100644 --- a/services/core/java/com/android/server/pm/Settings.java +++ b/services/core/java/com/android/server/pm/Settings.java @@ -154,7 +154,6 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.Date; import java.util.Iterator; import java.util.List; @@ -4150,7 +4149,7 @@ public final class Settings implements Watchable, Snappable { return getDisabledSystemPkgLPr(enabledPackageSetting.getPackageName()); } - boolean isEnabledAndMatchLPr(ComponentInfo componentInfo, int flags, int userId) { + boolean isEnabledAndMatchLPr(ComponentInfo componentInfo, long flags, int userId) { final PackageSetting ps = mPackages.get(componentInfo.packageName); if (ps == null) return false; @@ -4160,7 +4159,7 @@ public final class Settings implements Watchable, Snappable { @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public boolean isEnabledAndMatchLPr(AndroidPackage pkg, ParsedMainComponent component, - int flags, int userId) { + long flags, int userId) { final PackageSetting ps = mPackages.get(component.getPackageName()); if (ps == null) return false; diff --git a/services/core/java/com/android/server/pm/parsing/PackageInfoUtils.java b/services/core/java/com/android/server/pm/parsing/PackageInfoUtils.java index 0ab1d36582b1..bcb5e722a969 100644 --- a/services/core/java/com/android/server/pm/parsing/PackageInfoUtils.java +++ b/services/core/java/com/android/server/pm/parsing/PackageInfoUtils.java @@ -84,8 +84,8 @@ public class PackageInfoUtils { */ @Nullable public static PackageInfo generate(AndroidPackage pkg, int[] gids, - @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime, - Set<String> grantedPermissions, PackageUserState state, int userId, + @PackageManager.PackageInfoFlags long flags, long firstInstallTime, + long lastUpdateTime, Set<String> grantedPermissions, PackageUserState state, int userId, @Nullable PackageStateInternal pkgSetting) { return generateWithComponents(pkg, gids, flags, firstInstallTime, lastUpdateTime, grantedPermissions, state, userId, null, pkgSetting); @@ -105,8 +105,8 @@ public class PackageInfoUtils { * @param pkgSetting See {@link PackageInfoUtils} for description of pkgSetting usage. */ private static PackageInfo generateWithComponents(AndroidPackage pkg, int[] gids, - @PackageManager.PackageInfoFlags int flags, long firstInstallTime, long lastUpdateTime, - Set<String> grantedPermissions, PackageUserState state, int userId, + @PackageManager.PackageInfoFlags long flags, long firstInstallTime, + long lastUpdateTime, Set<String> grantedPermissions, PackageUserState state, int userId, @Nullable ApexInfo apexInfo, @Nullable PackageStateInternal pkgSetting) { ApplicationInfo applicationInfo = generateApplicationInfo(pkg, flags, state, userId, pkgSetting); @@ -209,7 +209,7 @@ public class PackageInfoUtils { */ @Nullable public static ApplicationInfo generateApplicationInfo(AndroidPackage pkg, - @PackageManager.ApplicationInfoFlags int flags, @NonNull PackageUserState state, + @PackageManager.ApplicationInfoFlags long flags, @NonNull PackageUserState state, int userId, @Nullable PackageStateInternal pkgSetting) { if (pkg == null) { return null; @@ -255,7 +255,7 @@ public class PackageInfoUtils { */ @Nullable public static ActivityInfo generateActivityInfo(AndroidPackage pkg, ParsedActivity a, - @PackageManager.ComponentInfoFlags int flags, PackageUserState state, int userId, + @PackageManager.ComponentInfoFlags long flags, PackageUserState state, int userId, @Nullable PackageStateInternal pkgSetting) { return generateActivityInfo(pkg, a, flags, state, null, userId, pkgSetting); } @@ -265,7 +265,7 @@ public class PackageInfoUtils { */ @Nullable private static ActivityInfo generateActivityInfo(AndroidPackage pkg, ParsedActivity a, - @PackageManager.ComponentInfoFlags int flags, PackageUserState state, + @PackageManager.ComponentInfoFlags long flags, PackageUserState state, @Nullable ApplicationInfo applicationInfo, int userId, @Nullable PackageStateInternal pkgSetting) { if (a == null) return null; @@ -291,7 +291,7 @@ public class PackageInfoUtils { */ @Nullable public static ServiceInfo generateServiceInfo(AndroidPackage pkg, ParsedService s, - @PackageManager.ComponentInfoFlags int flags, PackageUserState state, int userId, + @PackageManager.ComponentInfoFlags long flags, PackageUserState state, int userId, @Nullable PackageStateInternal pkgSetting) { return generateServiceInfo(pkg, s, flags, state, null, userId, pkgSetting); } @@ -301,7 +301,7 @@ public class PackageInfoUtils { */ @Nullable private static ServiceInfo generateServiceInfo(AndroidPackage pkg, ParsedService s, - @PackageManager.ComponentInfoFlags int flags, PackageUserState state, + @PackageManager.ComponentInfoFlags long flags, PackageUserState state, @Nullable ApplicationInfo applicationInfo, int userId, @Nullable PackageStateInternal pkgSetting) { if (s == null) return null; @@ -326,7 +326,7 @@ public class PackageInfoUtils { */ @Nullable public static ProviderInfo generateProviderInfo(AndroidPackage pkg, ParsedProvider p, - @PackageManager.ComponentInfoFlags int flags, PackageUserState state, + @PackageManager.ComponentInfoFlags long flags, PackageUserState state, @NonNull ApplicationInfo applicationInfo, int userId, @Nullable PackageStateInternal pkgSetting) { if (p == null) return null; @@ -353,7 +353,7 @@ public class PackageInfoUtils { */ @Nullable public static InstrumentationInfo generateInstrumentationInfo(ParsedInstrumentation i, - AndroidPackage pkg, @PackageManager.ComponentInfoFlags int flags, int userId, + AndroidPackage pkg, @PackageManager.ComponentInfoFlags long flags, int userId, @Nullable PackageStateInternal pkgSetting) { if (i == null) return null; @@ -381,7 +381,7 @@ public class PackageInfoUtils { // PackageStateInternal os that checkUseInstalledOrHidden filter can apply @Nullable public static PermissionInfo generatePermissionInfo(ParsedPermission p, - @PackageManager.ComponentInfoFlags int flags) { + @PackageManager.ComponentInfoFlags long flags) { // TODO(b/135203078): Remove null checks and make all usages @NonNull if (p == null) return null; @@ -391,7 +391,7 @@ public class PackageInfoUtils { @Nullable public static PermissionGroupInfo generatePermissionGroupInfo(ParsedPermissionGroup pg, - @PackageManager.ComponentInfoFlags int flags) { + @PackageManager.ComponentInfoFlags long flags) { if (pg == null) return null; // For now, permissions don't have state-adjustable fields; return directly @@ -400,7 +400,7 @@ public class PackageInfoUtils { @Nullable public static ArrayMap<String, ProcessInfo> generateProcessInfo( - Map<String, ParsedProcess> procs, @PackageManager.ComponentInfoFlags int flags) { + Map<String, ParsedProcess> procs, @PackageManager.ComponentInfoFlags long flags) { if (procs == null) { return null; } @@ -423,7 +423,7 @@ public class PackageInfoUtils { */ public static boolean checkUseInstalledOrHidden(AndroidPackage pkg, PackageStateInternal pkgSetting, PackageUserState state, - @PackageManager.PackageInfoFlags int flags) { + @PackageManager.PackageInfoFlags long flags) { // Returns false if the package is hidden system app until installed. if ((flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) == 0 && !state.isInstalled() @@ -628,7 +628,7 @@ public class PackageInfoUtils { */ @Nullable public ApplicationInfo generate(AndroidPackage pkg, - @PackageManager.ApplicationInfoFlags int flags, PackageUserState state, int userId, + @PackageManager.ApplicationInfoFlags long flags, PackageUserState state, int userId, @Nullable PackageStateInternal pkgSetting) { ApplicationInfo appInfo = mCache.get(pkg.getPackageName()); if (appInfo != null) { diff --git a/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java b/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java index 61fd5ee01658..32b1e5dbd3db 100644 --- a/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java +++ b/services/core/java/com/android/server/pm/parsing/pkg/AndroidPackageUtils.java @@ -256,7 +256,7 @@ public class AndroidPackageUtils { * Returns false iff the provided flags include the {@link PackageManager#MATCH_SYSTEM_ONLY} * flag and the provided package is not a system package. Otherwise returns {@code true}. */ - public static boolean isMatchForSystemOnly(AndroidPackage pkg, int flags) { + public static boolean isMatchForSystemOnly(AndroidPackage pkg, long flags) { if ((flags & PackageManager.MATCH_SYSTEM_ONLY) != 0) { return pkg.isSystem(); } diff --git a/services/core/java/com/android/server/pm/pkg/PackageStateUtils.java b/services/core/java/com/android/server/pm/pkg/PackageStateUtils.java index 6744ff597e20..09b9d31e2fe2 100644 --- a/services/core/java/com/android/server/pm/pkg/PackageStateUtils.java +++ b/services/core/java/com/android/server/pm/pkg/PackageStateUtils.java @@ -27,7 +27,7 @@ import com.android.server.pm.parsing.pkg.AndroidPackage; public class PackageStateUtils { - public static boolean isMatch(PackageState packageState, int flags) { + public static boolean isMatch(PackageState packageState, long flags) { if ((flags & PackageManager.MATCH_SYSTEM_ONLY) != 0) { return packageState.isSystem(); } @@ -54,7 +54,7 @@ public class PackageStateUtils { } public static boolean isEnabledAndMatches(@Nullable PackageStateInternal packageState, - ComponentInfo componentInfo, int flags, int userId) { + ComponentInfo componentInfo, long flags, int userId) { if (packageState == null) return false; final PackageUserState userState = packageState.getUserStateOrDefault(userId); @@ -62,7 +62,7 @@ public class PackageStateUtils { } public static boolean isEnabledAndMatches(@Nullable PackageStateInternal packageState, - @NonNull ParsedMainComponent component, int flags, int userId) { + @NonNull ParsedMainComponent component, long flags, int userId) { if (packageState == null) { return false; } diff --git a/services/core/java/com/android/server/pm/verify/domain/DomainVerificationManagerInternal.java b/services/core/java/com/android/server/pm/verify/domain/DomainVerificationManagerInternal.java index 1f024eaa52e4..471f38ad49ac 100644 --- a/services/core/java/com/android/server/pm/verify/domain/DomainVerificationManagerInternal.java +++ b/services/core/java/com/android/server/pm/verify/domain/DomainVerificationManagerInternal.java @@ -391,7 +391,7 @@ public interface DomainVerificationManagerInternal { */ @ApprovalLevel int approvalLevelForDomain(@NonNull PackageStateInternal pkgSetting, @NonNull Intent intent, - @PackageManager.ResolveInfoFlags int resolveInfoFlags, @UserIdInt int userId); + @PackageManager.ResolveInfoFlags long resolveInfoFlags, @UserIdInt int userId); /** * @return the domain verification set ID for the given package, or null if the ID is diff --git a/services/core/java/com/android/server/pm/verify/domain/DomainVerificationService.java b/services/core/java/com/android/server/pm/verify/domain/DomainVerificationService.java index 0fb8475bc3af..661e67d424ae 100644 --- a/services/core/java/com/android/server/pm/verify/domain/DomainVerificationService.java +++ b/services/core/java/com/android/server/pm/verify/domain/DomainVerificationService.java @@ -1721,7 +1721,7 @@ public class DomainVerificationService extends SystemService @Override public int approvalLevelForDomain(@NonNull PackageStateInternal pkgSetting, - @NonNull Intent intent, @PackageManager.ResolveInfoFlags int resolveInfoFlags, + @NonNull Intent intent, @PackageManager.ResolveInfoFlags long resolveInfoFlags, @UserIdInt int userId) { String packageName = pkgSetting.getPackageName(); if (!DomainVerificationUtils.isDomainVerificationIntent(intent, resolveInfoFlags)) { diff --git a/services/core/java/com/android/server/pm/verify/domain/DomainVerificationUtils.java b/services/core/java/com/android/server/pm/verify/domain/DomainVerificationUtils.java index 246810f4d796..12cce0d9ac70 100644 --- a/services/core/java/com/android/server/pm/verify/domain/DomainVerificationUtils.java +++ b/services/core/java/com/android/server/pm/verify/domain/DomainVerificationUtils.java @@ -49,7 +49,7 @@ public final class DomainVerificationUtils { } public static boolean isDomainVerificationIntent(Intent intent, - @PackageManager.ResolveInfoFlags int resolveInfoFlags) { + @PackageManager.ResolveInfoFlags long resolveInfoFlags) { if (!intent.isWebIntent()) { return false; } diff --git a/services/robotests/src/com/android/server/pm/CrossProfileAppsServiceImplRoboTest.java b/services/robotests/src/com/android/server/pm/CrossProfileAppsServiceImplRoboTest.java index adf892aa12ab..5dc048b9d7c6 100644 --- a/services/robotests/src/com/android/server/pm/CrossProfileAppsServiceImplRoboTest.java +++ b/services/robotests/src/com/android/server/pm/CrossProfileAppsServiceImplRoboTest.java @@ -28,6 +28,7 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import static org.robolectric.Shadows.shadowOf; @@ -150,7 +151,7 @@ public class CrossProfileAppsServiceImplRoboTest { PackageInfo packageInfo, @UserIdInt int userId, int uid) { when(mPackageManagerInternal.getPackageInfo( eq(CROSS_PROFILE_APP_PACKAGE_NAME), - /* flags= */ anyInt(), + /* flags= */ anyLong(), /* filterCallingUid= */ anyInt(), eq(userId))) .thenReturn(packageInfo); @@ -469,7 +470,7 @@ public class CrossProfileAppsServiceImplRoboTest { private void mockUninstallCrossProfileAppFromWorkProfile() { when(mPackageManagerInternal.getPackageInfo( eq(CROSS_PROFILE_APP_PACKAGE_NAME), - /* flags= */ anyInt(), + /* flags= */ anyLong(), /* filterCallingUid= */ anyInt(), eq(WORK_PROFILE_USER_ID))) .thenReturn(null); diff --git a/services/tests/PackageManagerServiceTests/unit/src/com/android/server/pm/test/verify/domain/DomainVerificationValidIntentTest.kt b/services/tests/PackageManagerServiceTests/unit/src/com/android/server/pm/test/verify/domain/DomainVerificationValidIntentTest.kt index 98634b28ea9d..ac6b6790e519 100644 --- a/services/tests/PackageManagerServiceTests/unit/src/com/android/server/pm/test/verify/domain/DomainVerificationValidIntentTest.kt +++ b/services/tests/PackageManagerServiceTests/unit/src/com/android/server/pm/test/verify/domain/DomainVerificationValidIntentTest.kt @@ -120,7 +120,7 @@ class DomainVerificationValidIntentTest { @Test fun verify() { val flags = if (params.matchDefaultOnly) PackageManager.MATCH_DEFAULT_ONLY else 0 - assertThat(DomainVerificationUtils.isDomainVerificationIntent(params.intent, flags)) - .isEqualTo(params.expected) + assertThat(DomainVerificationUtils.isDomainVerificationIntent(params.intent, + flags.toLong())).isEqualTo(params.expected) } } diff --git a/services/tests/mockingservicestests/src/com/android/server/alarm/AlarmManagerServiceTest.java b/services/tests/mockingservicestests/src/com/android/server/alarm/AlarmManagerServiceTest.java index a9099ae35b75..58854706f837 100644 --- a/services/tests/mockingservicestests/src/com/android/server/alarm/AlarmManagerServiceTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/alarm/AlarmManagerServiceTest.java @@ -2961,7 +2961,7 @@ public class AlarmManagerServiceTest { private void registerAppIds(String[] packages, Integer[] ids) { assertEquals(packages.length, ids.length); - when(mPackageManagerInternal.getPackageUid(anyString(), anyInt(), anyInt())).thenAnswer( + when(mPackageManagerInternal.getPackageUid(anyString(), anyLong(), anyInt())).thenAnswer( invocation -> { final String pkg = invocation.getArgument(0); final int index = ArrayUtils.indexOf(packages, pkg); diff --git a/services/tests/mockingservicestests/src/com/android/server/am/PendingIntentControllerTest.java b/services/tests/mockingservicestests/src/com/android/server/am/PendingIntentControllerTest.java index b2847ce88a2c..783971a1afe4 100644 --- a/services/tests/mockingservicestests/src/com/android/server/am/PendingIntentControllerTest.java +++ b/services/tests/mockingservicestests/src/com/android/server/am/PendingIntentControllerTest.java @@ -22,6 +22,7 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -80,7 +81,7 @@ public class PendingIntentControllerTest { doReturn(mActivityManagerInternal).when( () -> LocalServices.getService(ActivityManagerInternal.class)); doReturn(mIPackageManager).when(() -> AppGlobals.getPackageManager()); - when(mIPackageManager.getPackageUid(eq(TEST_PACKAGE_NAME), anyInt(), anyInt())).thenReturn( + when(mIPackageManager.getPackageUid(eq(TEST_PACKAGE_NAME), anyLong(), anyInt())).thenReturn( TEST_CALLING_UID); ActivityManagerConstants constants = mock(ActivityManagerConstants.class); constants.PENDINGINTENT_WARNING_THRESHOLD = 2000; diff --git a/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt b/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt index 63416c97afa9..0e5640aa85dd 100644 --- a/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt +++ b/services/tests/mockingservicestests/src/com/android/server/pm/MockSystem.kt @@ -47,6 +47,7 @@ import com.android.dx.mockito.inline.extended.ExtendedMockito import com.android.dx.mockito.inline.extended.ExtendedMockito.any import com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean import com.android.dx.mockito.inline.extended.ExtendedMockito.anyInt +import com.android.dx.mockito.inline.extended.ExtendedMockito.anyLong import com.android.dx.mockito.inline.extended.ExtendedMockito.anyString import com.android.dx.mockito.inline.extended.ExtendedMockito.argThat import com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn @@ -617,7 +618,7 @@ class MockSystem(withSession: (StaticMockitoSessionBuilder) -> Unit = {}) { private fun mockQueryActivities(action: String, vararg activities: ActivityInfo) { whenever(mocks.componentResolver.queryActivities( argThat { intent: Intent? -> intent != null && (action == intent.action) }, - nullable(), anyInt(), anyInt())) { + nullable(), anyLong(), anyInt())) { ArrayList(activities.asList().map { info: ActivityInfo? -> ResolveInfo().apply { activityInfo = info } }) @@ -627,7 +628,7 @@ class MockSystem(withSession: (StaticMockitoSessionBuilder) -> Unit = {}) { private fun mockQueryServices(action: String, vararg services: ServiceInfo) { whenever(mocks.componentResolver.queryServices( argThat { intent: Intent? -> intent != null && (action == intent.action) }, - nullable(), anyInt(), anyInt())) { + nullable(), anyLong(), anyInt())) { ArrayList(services.asList().map { info -> ResolveInfo().apply { serviceInfo = info } }) diff --git a/services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java b/services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java index fe23c14a0b95..966675819069 100644 --- a/services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java +++ b/services/tests/mockingservicestests/src/com/android/server/wallpaper/WallpaperManagerServiceTests.java @@ -41,6 +41,7 @@ import static org.junit.Assume.assumeThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; @@ -316,14 +317,14 @@ public class WallpaperManagerServiceTests { final int lastUserId = 5; final ServiceInfo pi = mIpm.getServiceInfo(sDefaultWallpaperComponent, PackageManager.GET_META_DATA | PackageManager.GET_PERMISSIONS, 0); - doReturn(pi).when(mIpm).getServiceInfo(any(), anyInt(), anyInt()); + doReturn(pi).when(mIpm).getServiceInfo(any(), anyLong(), anyInt()); final Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE); final ParceledListSlice ris = mIpm.queryIntentServices(intent, intent.resolveTypeIfNeeded(sContext.getContentResolver()), PackageManager.GET_META_DATA, 0); - doReturn(ris).when(mIpm).queryIntentServices(any(), any(), anyInt(), anyInt()); + doReturn(ris).when(mIpm).queryIntentServices(any(), any(), anyLong(), anyInt()); doReturn(PackageManager.PERMISSION_GRANTED).when(mIpm).checkPermission( eq(android.Manifest.permission.AMBIENT_WALLPAPER), any(), anyInt()); @@ -348,7 +349,7 @@ public class WallpaperManagerServiceTests { final int lastUserId = 5; final ServiceInfo pi = mIpm.getServiceInfo(sDefaultWallpaperComponent, PackageManager.GET_META_DATA | PackageManager.GET_PERMISSIONS, 0); - doReturn(pi).when(mIpm).getServiceInfo(any(), anyInt(), anyInt()); + doReturn(pi).when(mIpm).getServiceInfo(any(), anyLong(), anyInt()); final Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE); final ParceledListSlice ris = @@ -362,7 +363,7 @@ public class WallpaperManagerServiceTests { mService.switchUser(userId, null); verifyLastWallpaperData(userId, sImageWallpaperComponentName); // Simulate user unlocked - doReturn(ris).when(mIpm).queryIntentServices(any(), any(), anyInt(), eq(userId)); + doReturn(ris).when(mIpm).queryIntentServices(any(), any(), anyLong(), eq(userId)); mService.onUnlockUser(userId); verifyLastWallpaperData(userId, sDefaultWallpaperComponent); verifyCurrentSystemData(userId); diff --git a/services/tests/servicestests/src/com/android/server/apphibernation/AppHibernationServiceTest.java b/services/tests/servicestests/src/com/android/server/apphibernation/AppHibernationServiceTest.java index 1c49e6e64dd8..e40f5439d0c2 100644 --- a/services/tests/servicestests/src/com/android/server/apphibernation/AppHibernationServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/apphibernation/AppHibernationServiceTest.java @@ -29,7 +29,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.intThat; +import static org.mockito.ArgumentMatchers.longThat; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -135,7 +135,7 @@ public final class AppHibernationServiceTest { packages.add(makePackageInfo(PACKAGE_NAME_2)); packages.add(makePackageInfo(PACKAGE_NAME_3)); doReturn(new ParceledListSlice<>(packages)).when(mIPackageManager).getInstalledPackages( - intThat(arg -> (arg & MATCH_ANY_USER) != 0), anyInt()); + longThat(arg -> (arg & MATCH_ANY_USER) != 0), anyInt()); mAppHibernationService.onBootPhase(SystemService.PHASE_BOOT_COMPLETED); UserInfo userInfo = addUser(USER_ID_1); @@ -412,7 +412,7 @@ public final class AppHibernationServiceTest { UserInfo userInfo = new UserInfo(userId, "user_" + userId, 0 /* flags */); mUserInfos.add(userInfo); doReturn(new ParceledListSlice<>(userPackages)).when(mIPackageManager) - .getInstalledPackages(intThat(arg -> (arg & MATCH_ANY_USER) == 0), eq(userId)); + .getInstalledPackages(longThat(arg -> (arg & MATCH_ANY_USER) == 0), eq(userId)); return userInfo; } diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java index 2777bdf910b7..3c809f9e4814 100644 --- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java @@ -1735,11 +1735,11 @@ public class DevicePolicyManagerTest extends DpmTestBase { pi.applicationInfo.flags = flags; doReturn(pi).when(getServices().ipackageManager).getPackageInfo( eq(packageName), - anyInt(), + anyLong(), eq(userId)); doReturn(pi.applicationInfo).when(getServices().ipackageManager).getApplicationInfo( eq(packageName), - anyInt(), + anyLong(), eq(userId)); doReturn(true).when(getServices().ipackageManager).isPackageAvailable(packageName, userId); // Setup application UID with the PackageManager @@ -4708,11 +4708,11 @@ public class DevicePolicyManagerTest extends DpmTestBase { // Ensure packages are *not* flagged as test_only. doReturn(new ApplicationInfo()).when(getServices().ipackageManager).getApplicationInfo( eq(admin1.getPackageName()), - anyInt(), + anyLong(), eq(CALLER_USER_HANDLE)); doReturn(new ApplicationInfo()).when(getServices().ipackageManager).getApplicationInfo( eq(admin2.getPackageName()), - anyInt(), + anyLong(), eq(CALLER_USER_HANDLE)); // Initial state is disabled. @@ -7078,7 +7078,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { doReturn(ai).when(getServices().ipackageManager).getApplicationInfo( eq(admin1.getPackageName()), - anyInt(), + anyLong(), eq(CALLER_USER_HANDLE)); } diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java index fe0df5818651..b8824c3d8268 100644 --- a/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java +++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DpmTestBase.java @@ -21,7 +21,6 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; @@ -221,7 +220,7 @@ public abstract class DpmTestBase { doReturn(ai).when(mServices.ipackageManager).getApplicationInfo( eq(admin.getPackageName()), - anyInt(), + anyLong(), eq(UserHandle.getUserId(packageUid))); // Set up queryBroadcastReceivers(). @@ -248,7 +247,7 @@ public abstract class DpmTestBase { doReturn(aci).when(mServices.ipackageManager).getReceiverInfo( eq(admin), - anyInt(), + anyLong(), eq(UserHandle.getUserId(packageUid))); doReturn(new String[] {admin.getPackageName()}).when(mServices.ipackageManager) diff --git a/services/tests/servicestests/src/com/android/server/locales/LocaleManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/locales/LocaleManagerServiceTest.java index b3a513fb3b57..ddc58b23f635 100644 --- a/services/tests/servicestests/src/com/android/server/locales/LocaleManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/locales/LocaleManagerServiceTest.java @@ -23,6 +23,7 @@ import static junit.framework.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; @@ -110,7 +111,7 @@ public class LocaleManagerServiceTest { @Test(expected = SecurityException.class) public void testSetApplicationLocales_arbitraryAppWithoutPermissions_fails() throws Exception { doReturn(DEFAULT_UID) - .when(mMockPackageManagerInternal).getPackageUid(anyString(), anyInt(), anyInt()); + .when(mMockPackageManagerInternal).getPackageUid(anyString(), anyLong(), anyInt()); setUpFailingPermissionCheckFor(Manifest.permission.CHANGE_CONFIGURATION); try { @@ -153,7 +154,7 @@ public class LocaleManagerServiceTest { @Test public void testSetApplicationLocales_arbitraryAppWithPermission_succeeds() throws Exception { doReturn(DEFAULT_UID) - .when(mMockPackageManagerInternal).getPackageUid(anyString(), anyInt(), anyInt()); + .when(mMockPackageManagerInternal).getPackageUid(anyString(), anyLong(), anyInt()); // if package is not owned by the caller, the calling app should have the following // permission. We will mock this to succeed to imitate that. setUpPassingPermissionCheckFor(Manifest.permission.CHANGE_CONFIGURATION); @@ -168,7 +169,7 @@ public class LocaleManagerServiceTest { @Test public void testSetApplicationLocales_callerOwnsPackage_succeeds() throws Exception { doReturn(Binder.getCallingUid()) - .when(mMockPackageManagerInternal).getPackageUid(anyString(), anyInt(), anyInt()); + .when(mMockPackageManagerInternal).getPackageUid(anyString(), anyLong(), anyInt()); mLocaleManagerService.setApplicationLocales(DEFAULT_PACKAGE_NAME, DEFAULT_USER_ID, DEFAULT_LOCALES); @@ -179,7 +180,7 @@ public class LocaleManagerServiceTest { @Test(expected = IllegalArgumentException.class) public void testSetApplicationLocales_invalidPackageOrUserId_fails() throws Exception { doReturn(INVALID_UID) - .when(mMockPackageManagerInternal).getPackageUid(anyString(), anyInt(), anyInt()); + .when(mMockPackageManagerInternal).getPackageUid(anyString(), anyLong(), anyInt()); try { mLocaleManagerService.setApplicationLocales(DEFAULT_PACKAGE_NAME, DEFAULT_USER_ID, LocaleList.getEmptyLocaleList()); @@ -192,7 +193,7 @@ public class LocaleManagerServiceTest { @Test(expected = SecurityException.class) public void testGetApplicationLocales_arbitraryAppWithoutPermission_fails() throws Exception { doReturn(DEFAULT_UID).when(mMockPackageManagerInternal) - .getPackageUid(anyString(), anyInt(), anyInt()); + .getPackageUid(anyString(), anyLong(), anyInt()); setUpFailingPermissionCheckFor(Manifest.permission.READ_APP_SPECIFIC_LOCALES); try { @@ -210,7 +211,7 @@ public class LocaleManagerServiceTest { throws Exception { // any valid app calling for its own package or having appropriate permission doReturn(DEFAULT_UID).when(mMockPackageManagerInternal) - .getPackageUid(anyString(), anyInt(), anyInt()); + .getPackageUid(anyString(), anyLong(), anyInt()); setUpPassingPermissionCheckFor(Manifest.permission.READ_APP_SPECIFIC_LOCALES); doReturn(null) .when(mMockActivityTaskManager).getApplicationConfig(anyString(), anyInt()); @@ -225,7 +226,7 @@ public class LocaleManagerServiceTest { public void testGetApplicationLocales_appSpecificLocalesAbsent_returnsEmptyList() throws Exception { doReturn(DEFAULT_UID).when(mMockPackageManagerInternal) - .getPackageUid(anyString(), anyInt(), anyInt()); + .getPackageUid(anyString(), anyLong(), anyInt()); setUpPassingPermissionCheckFor(Manifest.permission.READ_APP_SPECIFIC_LOCALES); doReturn(new PackageConfig(/* nightMode = */ 0, /* locales = */ null)) .when(mMockActivityTaskManager).getApplicationConfig(any(), anyInt()); @@ -240,7 +241,7 @@ public class LocaleManagerServiceTest { public void testGetApplicationLocales_callerOwnsAppAndConfigPresent_returnsLocales() throws Exception { doReturn(Binder.getCallingUid()).when(mMockPackageManagerInternal) - .getPackageUid(anyString(), anyInt(), anyInt()); + .getPackageUid(anyString(), anyLong(), anyInt()); doReturn(new PackageConfig(/* nightMode = */ 0, DEFAULT_LOCALES)) .when(mMockActivityTaskManager).getApplicationConfig(anyString(), anyInt()); @@ -254,7 +255,7 @@ public class LocaleManagerServiceTest { public void testGetApplicationLocales_arbitraryCallerWithPermissions_returnsLocales() throws Exception { doReturn(DEFAULT_UID).when(mMockPackageManagerInternal) - .getPackageUid(anyString(), anyInt(), anyInt()); + .getPackageUid(anyString(), anyLong(), anyInt()); setUpPassingPermissionCheckFor(Manifest.permission.READ_APP_SPECIFIC_LOCALES); doReturn(new PackageConfig(/* nightMode = */ 0, DEFAULT_LOCALES)) .when(mMockActivityTaskManager).getApplicationConfig(anyString(), anyInt()); diff --git a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java index f45c869949b5..3722ba4ec468 100644 --- a/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/BaseShortcutManagerTest.java @@ -27,6 +27,7 @@ import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyLong; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doAnswer; @@ -2357,7 +2358,7 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase { protected void prepareIntentActivities(ComponentName cn) { when(mMockPackageManagerInternal.queryIntentActivities( - anyOrNull(Intent.class), anyStringOrNull(), anyInt(), anyInt(), anyInt())) + anyOrNull(Intent.class), anyStringOrNull(), anyLong(), anyInt(), anyInt())) .thenReturn(Collections.singletonList( ri(cn.getPackageName(), cn.getClassName(), false, 0))); } diff --git a/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java b/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java index e811c1f315fe..3cb5d5f92810 100644 --- a/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/CrossProfileAppsServiceImplTest.java @@ -3,9 +3,10 @@ package com.android.server.pm; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.nullable; import static org.mockito.Mockito.doAnswer; @@ -14,7 +15,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; - import static org.testng.Assert.assertThrows; import android.Manifest; @@ -581,7 +581,7 @@ public class CrossProfileAppsServiceImplTest { private void mockAppsInstalled(String packageName, int user, boolean installed) { when(mPackageManagerInternal.getPackageInfo( eq(packageName), - anyInt(), + anyLong(), anyInt(), eq(user))) .thenReturn(installed ? createInstalledPackageInfo() : null); @@ -604,7 +604,7 @@ public class CrossProfileAppsServiceImplTest { mActivityInfo = activityInfo; when(mPackageManagerInternal.queryIntentActivities( - any(Intent.class), nullable(String.class), anyInt(), anyInt(), anyInt())) + any(Intent.class), nullable(String.class), anyLong(), anyInt(), anyInt())) .thenReturn(Collections.singletonList(resolveInfo)); } diff --git a/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageParsingTestBase.kt b/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageParsingTestBase.kt index 0ae5ecbd28c0..122661ea93da 100644 --- a/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageParsingTestBase.kt +++ b/services/tests/servicestests/src/com/android/server/pm/parsing/AndroidPackageParsingTestBase.kt @@ -147,8 +147,8 @@ open class AndroidPackageParsingTestBase { flags: Int = 0, userId: Int = 0 ): ApplicationInfo? { - return PackageInfoUtils.generateApplicationInfo(pkg, flags, dummyUserState, userId, - mockPkgSetting(pkg)) + return PackageInfoUtils.generateApplicationInfo(pkg, flags.toLong(), dummyUserState, + userId, mockPkgSetting(pkg)) } fun newAppInfoWithoutState( @@ -156,8 +156,8 @@ open class AndroidPackageParsingTestBase { flags: Int = 0, userId: Int = 0 ): ApplicationInfo? { - return PackageInfoUtils.generateApplicationInfo(pkg, flags, dummyUserState, userId, - mockPkgSetting(pkg)) + return PackageInfoUtils.generateApplicationInfo(pkg, flags.toLong(), dummyUserState, + userId, mockPkgSetting(pkg)) } fun oldPackageInfo(pkg: PackageParser.Package, flags: Int = 0): PackageInfo? { @@ -166,7 +166,7 @@ open class AndroidPackageParsingTestBase { } fun newPackageInfo(pkg: AndroidPackage, flags: Int = 0): PackageInfo? { - return PackageInfoUtils.generate(pkg, intArrayOf(), flags, 5, 6, emptySet(), + return PackageInfoUtils.generate(pkg, intArrayOf(), flags.toLong(), 5, 6, emptySet(), dummyUserState, 0, mockPkgSetting(pkg)) } diff --git a/services/tests/servicestests/src/com/android/server/uri/UriGrantsMockContext.java b/services/tests/servicestests/src/com/android/server/uri/UriGrantsMockContext.java index 37165075e1ba..7eb6c9789fe4 100644 --- a/services/tests/servicestests/src/com/android/server/uri/UriGrantsMockContext.java +++ b/services/tests/servicestests/src/com/android/server/uri/UriGrantsMockContext.java @@ -16,7 +16,7 @@ package com.android.server.uri; -import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -121,47 +121,47 @@ public class UriGrantsMockContext extends ContextWrapper { LocalServices.addService(PackageManagerInternal.class, mPmInternal); for (int userId : new int[] { USER_PRIMARY, USER_SECONDARY }) { - when(mPmInternal.getPackageUid(eq(PKG_SOCIAL), anyInt(), eq(userId))) + when(mPmInternal.getPackageUid(eq(PKG_SOCIAL), anyLong(), eq(userId))) .thenReturn(UserHandle.getUid(userId, UID_SOCIAL)); - when(mPmInternal.getPackageUid(eq(PKG_CAMERA), anyInt(), eq(userId))) + when(mPmInternal.getPackageUid(eq(PKG_CAMERA), anyLong(), eq(userId))) .thenReturn(UserHandle.getUid(userId, UID_CAMERA)); - when(mPmInternal.getPackageUid(eq(PKG_PRIVATE), anyInt(), eq(userId))) + when(mPmInternal.getPackageUid(eq(PKG_PRIVATE), anyLong(), eq(userId))) .thenReturn(UserHandle.getUid(userId, UID_PRIVATE)); - when(mPmInternal.getPackageUid(eq(PKG_PUBLIC), anyInt(), eq(userId))) + when(mPmInternal.getPackageUid(eq(PKG_PUBLIC), anyLong(), eq(userId))) .thenReturn(UserHandle.getUid(userId, UID_PUBLIC)); - when(mPmInternal.getPackageUid(eq(PKG_FORCE), anyInt(), eq(userId))) + when(mPmInternal.getPackageUid(eq(PKG_FORCE), anyLong(), eq(userId))) .thenReturn(UserHandle.getUid(userId, UID_FORCE)); - when(mPmInternal.getPackageUid(eq(PKG_COMPLEX), anyInt(), eq(userId))) + when(mPmInternal.getPackageUid(eq(PKG_COMPLEX), anyLong(), eq(userId))) .thenReturn(UserHandle.getUid(userId, UID_COMPLEX)); - when(mPmInternal.resolveContentProvider(eq(PKG_CAMERA), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_CAMERA), anyLong(), eq(userId), eq(Process.SYSTEM_UID))) .thenReturn(buildCameraProvider(userId)); - when(mPmInternal.resolveContentProvider(eq(PKG_CAMERA), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_CAMERA), anyLong(), eq(userId), eq(UserHandle.getUid(userId, UID_CAMERA)))) .thenReturn(buildCameraProvider(userId)); - when(mPmInternal.resolveContentProvider(eq(PKG_PRIVATE), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_PRIVATE), anyLong(), eq(userId), eq(Process.SYSTEM_UID))) .thenReturn(buildPrivateProvider(userId)); - when(mPmInternal.resolveContentProvider(eq(PKG_PRIVATE), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_PRIVATE), anyLong(), eq(userId), eq(UserHandle.getUid(userId, UID_PRIVATE)))) .thenReturn(buildPrivateProvider(userId)); - when(mPmInternal.resolveContentProvider(eq(PKG_PUBLIC), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_PUBLIC), anyLong(), eq(userId), eq(Process.SYSTEM_UID))) .thenReturn(buildPublicProvider(userId)); - when(mPmInternal.resolveContentProvider(eq(PKG_PUBLIC), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_PUBLIC), anyLong(), eq(userId), eq(UserHandle.getUid(userId, UID_PUBLIC)))) .thenReturn(buildPublicProvider(userId)); - when(mPmInternal.resolveContentProvider(eq(PKG_FORCE), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_FORCE), anyLong(), eq(userId), eq(Process.SYSTEM_UID))) .thenReturn(buildForceProvider(userId)); - when(mPmInternal.resolveContentProvider(eq(PKG_FORCE), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_FORCE), anyLong(), eq(userId), eq(UserHandle.getUid(userId, UID_FORCE)))) .thenReturn(buildForceProvider(userId)); - when(mPmInternal.resolveContentProvider(eq(PKG_COMPLEX), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_COMPLEX), anyLong(), eq(userId), eq(Process.SYSTEM_UID))) .thenReturn(buildComplexProvider(userId)); - when(mPmInternal.resolveContentProvider(eq(PKG_COMPLEX), anyInt(), eq(userId), + when(mPmInternal.resolveContentProvider(eq(PKG_COMPLEX), anyLong(), eq(userId), eq(UserHandle.getUid(userId, UID_COMPLEX)))) .thenReturn(buildComplexProvider(userId)); } diff --git a/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java b/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java index 9e46e1f2be92..949ee01d6872 100644 --- a/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java +++ b/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java @@ -63,6 +63,7 @@ import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyLong; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; @@ -530,8 +531,8 @@ public class AppStandbyControllerTests { eq(UserHandle.getAppId(ai.uid)), eq(userIdForTest), anyLong())) .thenReturn(idle[i]); } - when(mInjector.mPackageManagerInternal.getInstalledApplications(anyInt(), eq(userIdForTest), - anyInt())).thenReturn(installedApps); + when(mInjector.mPackageManagerInternal.getInstalledApplications(anyLong(), + eq(userIdForTest), anyInt())).thenReturn(installedApps); final int[] returnedIdleUids = controllerUnderTest.getIdleUidsForUser(userIdForTest); assertEquals(expectedIdleUids.length, returnedIdleUids.length); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java index cdb7230a66cb..2f054b004d42 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/ManagedServicesTest.java @@ -26,6 +26,7 @@ import static junit.framework.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyLong; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -809,7 +810,7 @@ public class ManagedServicesTest extends UiServiceTestCase { service.isComponentEnabledForCurrentProfiles( unapprovedAdditionalComponent)); verify(mIpm, never()).getServiceInfo( - eq(unapprovedAdditionalComponent), anyInt(), anyInt()); + eq(unapprovedAdditionalComponent), anyLong(), anyInt()); } } @@ -953,7 +954,7 @@ public class ManagedServicesTest extends UiServiceTestCase { service.isComponentEnabledForCurrentProfiles( unapprovedAdditionalComponent)); verify(mIpm, never()).getServiceInfo( - eq(unapprovedAdditionalComponent), anyInt(), anyInt()); + eq(unapprovedAdditionalComponent), anyLong(), anyInt()); } } @@ -1702,14 +1703,14 @@ public class ManagedServicesTest extends UiServiceTestCase { assertTrue(service.isComponentEnabledForCurrentProfiles( componentName)); verify(mIpm, times(1)).getServiceInfo( - eq(componentName), anyInt(), anyInt()); + eq(componentName), anyLong(), anyInt()); } } else { ComponentName componentName = ComponentName.unflattenFromString(packageOrComponent); assertTrue(service.isComponentEnabledForCurrentProfiles(componentName)); verify(mIpm, times(1)).getServiceInfo( - eq(componentName), anyInt(), anyInt()); + eq(componentName), anyLong(), anyInt()); } } } diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 622669aab8e4..837850fc1011 100755 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -397,7 +397,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { // MockPackageManager - default returns ApplicationInfo with matching calling UID mContext.setMockPackageManager(mPackageManagerClient); - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), anyInt())) + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), anyInt())) .thenAnswer((Answer<ApplicationInfo>) invocation -> { Object[] args = invocation.getArguments(); return getApplicationInfo((String) args[0], mUid); @@ -5043,7 +5043,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testIsCallerInstantApp_primaryUser() throws Exception { ApplicationInfo info = new ApplicationInfo(); info.privateFlags = ApplicationInfo.PRIVATE_FLAG_INSTANT; - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), eq(0))).thenReturn(info); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), eq(0))).thenReturn(info); when(mPackageManager.getPackagesForUid(anyInt())).thenReturn(new String[]{"any"}); assertTrue(mService.isCallerInstantApp(45770, 0)); @@ -5056,8 +5056,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testIsCallerInstantApp_secondaryUser() throws Exception { ApplicationInfo info = new ApplicationInfo(); info.privateFlags = ApplicationInfo.PRIVATE_FLAG_INSTANT; - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), eq(10))).thenReturn(info); - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), eq(0))).thenReturn(null); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), eq(10))).thenReturn(info); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), eq(0))).thenReturn(null); when(mPackageManager.getPackagesForUid(anyInt())).thenReturn(new String[]{"any"}); assertTrue(mService.isCallerInstantApp(68638450, 10)); @@ -5067,7 +5067,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testIsCallerInstantApp_userAllNotification() throws Exception { ApplicationInfo info = new ApplicationInfo(); info.privateFlags = ApplicationInfo.PRIVATE_FLAG_INSTANT; - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), eq(USER_SYSTEM))) + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), eq(USER_SYSTEM))) .thenReturn(info); when(mPackageManager.getPackagesForUid(anyInt())).thenReturn(new String[]{"any"}); @@ -5081,8 +5081,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testResolveNotificationUid_sameApp_nonSystemUser() throws Exception { ApplicationInfo info = new ApplicationInfo(); info.uid = Binder.getCallingUid(); - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), eq(10))).thenReturn(info); - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), eq(0))).thenReturn(null); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), eq(10))).thenReturn(info); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), eq(0))).thenReturn(null); int actualUid = mService.resolveNotificationUid("caller", "caller", info.uid, 10); @@ -5093,7 +5093,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testResolveNotificationUid_sameApp() throws Exception { ApplicationInfo info = new ApplicationInfo(); info.uid = Binder.getCallingUid(); - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), eq(0))).thenReturn(info); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), eq(0))).thenReturn(info); int actualUid = mService.resolveNotificationUid("caller", "caller", info.uid, 0); @@ -5104,7 +5104,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testResolveNotificationUid_sameAppDiffPackage() throws Exception { ApplicationInfo info = new ApplicationInfo(); info.uid = Binder.getCallingUid(); - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), eq(0))).thenReturn(info); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), eq(0))).thenReturn(info); int actualUid = mService.resolveNotificationUid("caller", "callerAlso", info.uid, 0); @@ -5115,7 +5115,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { public void testResolveNotificationUid_sameAppWrongUid() throws Exception { ApplicationInfo info = new ApplicationInfo(); info.uid = 1356347; - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), anyInt())).thenReturn(info); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), anyInt())).thenReturn(info); try { mService.resolveNotificationUid("caller", "caller", 9, 0); @@ -5154,7 +5154,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { PackageManager.NameNotFoundException.class); ApplicationInfo ai = new ApplicationInfo(); ai.uid = -1; - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), anyInt())).thenReturn(ai); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), anyInt())).thenReturn(ai); final StatusBarNotification sbn = generateNotificationRecord(null).getSbn(); try { @@ -5174,7 +5174,7 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { PackageManager.NameNotFoundException.class); ApplicationInfo ai = new ApplicationInfo(); ai.uid = -1; - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), anyInt())).thenReturn(ai); + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), anyInt())).thenReturn(ai); // unlike the post case, ignore instead of throwing final StatusBarNotification sbn = generateNotificationRecord(null).getSbn(); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationPermissionMigrationTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationPermissionMigrationTest.java index 29ef339a6382..2e5cf3c2d98f 100755 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationPermissionMigrationTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationPermissionMigrationTest.java @@ -44,6 +44,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.anyLong; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doNothing; @@ -307,7 +308,7 @@ public class NotificationPermissionMigrationTest extends UiServiceTestCase { // MockPackageManager - default returns ApplicationInfo with matching calling UID mContext.setMockPackageManager(mPackageManagerClient); - when(mPackageManager.getApplicationInfo(anyString(), anyInt(), anyInt())) + when(mPackageManager.getApplicationInfo(anyString(), anyLong(), anyInt())) .thenAnswer((Answer<ApplicationInfo>) invocation -> { Object[] args = invocation.getArguments(); return getApplicationInfo((String) args[0], mUid); diff --git a/services/tests/uiservicestests/src/com/android/server/notification/PermissionHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/PermissionHelperTest.java index 4cdae8860409..5800400e3745 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/PermissionHelperTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/PermissionHelperTest.java @@ -28,6 +28,7 @@ import static junit.framework.Assert.fail; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.never; @@ -42,7 +43,6 @@ import android.content.pm.ParceledListSlice; import android.permission.IPermissionManager; import android.test.suitebuilder.annotation.SmallTest; import android.util.Pair; -import android.util.Slog; import androidx.test.runner.AndroidJUnit4; @@ -169,7 +169,8 @@ public class PermissionHelperTest extends UiServiceTestCase { ParceledListSlice<PackageInfo> infos = new ParceledListSlice<>( ImmutableList.of(notThis, none, first, second)); - when(mPackageManager.getInstalledPackages(eq(GET_PERMISSIONS), anyInt())).thenReturn(infos); + when(mPackageManager.getInstalledPackages(eq((long) GET_PERMISSIONS), anyInt())) + .thenReturn(infos); Set<Pair<Integer, String>> actual = mPermissionHelper.getAppsRequestingPermission(0); @@ -181,7 +182,7 @@ public class PermissionHelperTest extends UiServiceTestCase { int userId = 1; ParceledListSlice<PackageInfo> infos = ParceledListSlice.emptyList(); when(mPackageManager.getPackagesHoldingPermissions( - eq(new String[] {Manifest.permission.POST_NOTIFICATIONS}), anyInt(), eq(userId))) + eq(new String[] {Manifest.permission.POST_NOTIFICATIONS}), anyLong(), eq(userId))) .thenReturn(infos); assertThat(mPermissionHelper.getAppsGrantedPermission(userId)).isNotNull(); } @@ -206,7 +207,7 @@ public class PermissionHelperTest extends UiServiceTestCase { ParceledListSlice<PackageInfo> infos = new ParceledListSlice<>( ImmutableList.of(first, second)); when(mPackageManager.getPackagesHoldingPermissions( - eq(new String[] {Manifest.permission.POST_NOTIFICATIONS}), anyInt(), eq(userId))) + eq(new String[] {Manifest.permission.POST_NOTIFICATIONS}), anyLong(), eq(userId))) .thenReturn(infos); Set<Pair<Integer, String>> expected = @@ -305,11 +306,11 @@ public class PermissionHelperTest extends UiServiceTestCase { ParceledListSlice<PackageInfo> infos = new ParceledListSlice<>( ImmutableList.of(first, second)); when(mPackageManager.getPackagesHoldingPermissions( - eq(new String[] {Manifest.permission.POST_NOTIFICATIONS}), anyInt(), eq(userId))) + eq(new String[] {Manifest.permission.POST_NOTIFICATIONS}), anyLong(), eq(userId))) .thenReturn(infos); ParceledListSlice<PackageInfo> requesting = new ParceledListSlice<>( ImmutableList.of(first, second, third)); - when(mPackageManager.getInstalledPackages(eq(GET_PERMISSIONS), anyInt())) + when(mPackageManager.getInstalledPackages(eq((long) GET_PERMISSIONS), anyInt())) .thenReturn(requesting); Map<Pair<Integer, String>, Boolean> expected = ImmutableMap.of(new Pair(1, "first"), true, diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java index 0cab9119a5f7..e2f0658f3da3 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityStarterTests.java @@ -63,6 +63,7 @@ import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.notNull; @@ -352,7 +353,7 @@ public class ActivityStarterTests extends WindowTestsBase { doReturn(null).when(mMockPackageManager).getDefaultHomeActivity(anyInt()); doReturn(mMockPackageManager).when(mAtm).getPackageManagerInternalLocked(); doReturn(false).when(mMockPackageManager).isInstantAppInstallerComponent(any()); - doReturn(null).when(mMockPackageManager).resolveIntent(any(), any(), anyInt(), anyInt(), + doReturn(null).when(mMockPackageManager).resolveIntent(any(), any(), anyLong(), anyLong(), anyInt(), anyBoolean(), anyInt()); doReturn(new ComponentName("", "")).when(mMockPackageManager).getSystemUiServiceComponent(); |