[pm] new APIs for ApplictaionInfo/PackageInfo/ComponentInfo/ResolveInfo flags

We are running out of int flags for public API methods such as
PackageManager.getPackageInfo(String packageName, int flags). As a
solution, we will change the flags param to Flags objects. At the
same time, we deprecate the old methods that directly use int flags.

The new flags classes are: ApplicationInfoFlags, PackageInfoFlags,
ComponentInfoFlags and ResolveInfoFlags. Because there are already
annotations of the same names, we renamed the annotations to *FlagsBits.

Old API usage example:
getPackageInfo(pkgName, MATCH_UNINSTALLED_PACKAGES)

New API usage example:
getPackageInfo(pkgName, PackageInfoFlags.of(MATCH_UNINSTALLED_PACKAGES))

See b/204433742 for discussions.

CTS-Coverage-Bug: 206147270
BUG: 204432643
BUG: 204433659
Test: manual
Change-Id: I8ab2adad6907670c5879c043d170c950afefe46c
This commit is contained in:
Songchun Fan 2021-11-17 16:33:13 -08:00
parent 06e067bd3f
commit cf3f673b48
27 changed files with 1321 additions and 404 deletions

View File

@ -12732,7 +12732,8 @@ package android.content.pm {
method @Nullable public abstract android.graphics.drawable.Drawable getActivityBanner(@NonNull android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.graphics.drawable.Drawable getActivityIcon(@NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.graphics.drawable.Drawable getActivityIcon(@NonNull android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.content.pm.ActivityInfo getActivityInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated @NonNull public abstract android.content.pm.ActivityInfo getActivityInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.pm.ActivityInfo getActivityInfo(@NonNull android.content.ComponentName, @NonNull android.content.pm.PackageManager.ComponentInfoFlags) throws android.content.pm.PackageManager.NameNotFoundException;
method @Nullable public abstract android.graphics.drawable.Drawable getActivityLogo(@NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
method @Nullable public abstract android.graphics.drawable.Drawable getActivityLogo(@NonNull android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract java.util.List<android.content.pm.PermissionGroupInfo> getAllPermissionGroups(int);
@ -12741,7 +12742,8 @@ package android.content.pm {
method public abstract int getApplicationEnabledSetting(@NonNull String);
method @NonNull public abstract android.graphics.drawable.Drawable getApplicationIcon(@NonNull android.content.pm.ApplicationInfo);
method @NonNull public abstract android.graphics.drawable.Drawable getApplicationIcon(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.content.pm.ApplicationInfo getApplicationInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated @NonNull public abstract android.content.pm.ApplicationInfo getApplicationInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.pm.ApplicationInfo getApplicationInfo(@NonNull String, @NonNull android.content.pm.PackageManager.ApplicationInfoFlags) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract CharSequence getApplicationLabel(@NonNull android.content.pm.ApplicationInfo);
method @Nullable public abstract android.graphics.drawable.Drawable getApplicationLogo(@NonNull android.content.pm.ApplicationInfo);
method @Nullable public abstract android.graphics.drawable.Drawable getApplicationLogo(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
@ -12752,9 +12754,11 @@ package android.content.pm {
method @Nullable public abstract android.graphics.drawable.Drawable getDrawable(@NonNull String, @DrawableRes int, @Nullable android.content.pm.ApplicationInfo);
method public void getGroupOfPlatformPermission(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.String>);
method @NonNull public android.content.pm.InstallSourceInfo getInstallSourceInfo(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract java.util.List<android.content.pm.ApplicationInfo> getInstalledApplications(int);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.ApplicationInfo> getInstalledApplications(int);
method @NonNull public java.util.List<android.content.pm.ApplicationInfo> getInstalledApplications(@NonNull android.content.pm.PackageManager.ApplicationInfoFlags);
method @NonNull public java.util.List<android.content.pm.ModuleInfo> getInstalledModules(int);
method @NonNull public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackages(int);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackages(int);
method @NonNull public java.util.List<android.content.pm.PackageInfo> getInstalledPackages(@NonNull android.content.pm.PackageManager.PackageInfoFlags);
method @Deprecated @Nullable public abstract String getInstallerPackageName(@NonNull String);
method @NonNull public abstract byte[] getInstantAppCookie();
method public abstract int getInstantAppCookieMaxBytes();
@ -12765,15 +12769,21 @@ package android.content.pm {
method @NonNull public java.util.Set<java.lang.String> getMimeGroup(@NonNull String);
method @NonNull public android.content.pm.ModuleInfo getModuleInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @Nullable public abstract String getNameForUid(int);
method @Nullable public android.content.pm.PackageInfo getPackageArchiveInfo(@NonNull String, int);
method @Deprecated @Nullable public android.content.pm.PackageInfo getPackageArchiveInfo(@NonNull String, int);
method @Nullable public android.content.pm.PackageInfo getPackageArchiveInfo(@NonNull String, @NonNull android.content.pm.PackageManager.PackageInfoFlags);
method public abstract int[] getPackageGids(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
method public abstract int[] getPackageGids(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method public abstract android.content.pm.PackageInfo getPackageInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method public abstract android.content.pm.PackageInfo getPackageInfo(@NonNull android.content.pm.VersionedPackage, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated public abstract int[] getPackageGids(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @Nullable public int[] getPackageGids(@NonNull String, @NonNull android.content.pm.PackageManager.PackageInfoFlags) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated public abstract android.content.pm.PackageInfo getPackageInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.pm.PackageInfo getPackageInfo(@NonNull String, @NonNull android.content.pm.PackageManager.PackageInfoFlags) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated public abstract android.content.pm.PackageInfo getPackageInfo(@NonNull android.content.pm.VersionedPackage, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.pm.PackageInfo getPackageInfo(@NonNull android.content.pm.VersionedPackage, @NonNull android.content.pm.PackageManager.PackageInfoFlags) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.content.pm.PackageInstaller getPackageInstaller();
method public abstract int getPackageUid(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated public abstract int getPackageUid(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method public int getPackageUid(@NonNull String, @NonNull android.content.pm.PackageManager.PackageInfoFlags) throws android.content.pm.PackageManager.NameNotFoundException;
method @Nullable public abstract String[] getPackagesForUid(int);
method @NonNull public abstract java.util.List<android.content.pm.PackageInfo> getPackagesHoldingPermissions(@NonNull String[], int);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.PackageInfo> getPackagesHoldingPermissions(@NonNull String[], int);
method @NonNull public java.util.List<android.content.pm.PackageInfo> getPackagesHoldingPermissions(@NonNull String[], @NonNull android.content.pm.PackageManager.PackageInfoFlags);
method @NonNull public abstract android.content.pm.PermissionGroupInfo getPermissionGroupInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method public abstract android.content.pm.PermissionInfo getPermissionInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method public void getPlatformPermissionsForGroup(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.util.List<java.lang.String>>);
@ -12781,14 +12791,18 @@ package android.content.pm {
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.PackageInfo> getPreferredPackages(int);
method @NonNull public android.content.pm.PackageManager.Property getProperty(@NonNull String, @NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.pm.PackageManager.Property getProperty(@NonNull String, @NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.content.pm.ProviderInfo getProviderInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.content.pm.ActivityInfo getReceiverInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated @NonNull public abstract android.content.pm.ProviderInfo getProviderInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.pm.ProviderInfo getProviderInfo(@NonNull android.content.ComponentName, @NonNull android.content.pm.PackageManager.ComponentInfoFlags) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated @NonNull public abstract android.content.pm.ActivityInfo getReceiverInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.pm.ActivityInfo getReceiverInfo(@NonNull android.content.ComponentName, @NonNull android.content.pm.PackageManager.ComponentInfoFlags) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.content.res.Resources getResourcesForActivity(@NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.content.res.Resources getResourcesForApplication(@NonNull android.content.pm.ApplicationInfo) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.res.Resources getResourcesForApplication(@NonNull android.content.pm.ApplicationInfo, @Nullable android.content.res.Configuration) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.content.res.Resources getResourcesForApplication(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract android.content.pm.ServiceInfo getServiceInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public abstract java.util.List<android.content.pm.SharedLibraryInfo> getSharedLibraries(int);
method @Deprecated @NonNull public abstract android.content.pm.ServiceInfo getServiceInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.pm.ServiceInfo getServiceInfo(@NonNull android.content.ComponentName, @NonNull android.content.pm.PackageManager.ComponentInfoFlags) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.SharedLibraryInfo> getSharedLibraries(int);
method @NonNull public java.util.List<android.content.pm.SharedLibraryInfo> getSharedLibraries(@NonNull android.content.pm.PackageManager.PackageInfoFlags);
method @Nullable public android.os.Bundle getSuspendedPackageAppExtras();
method public boolean getSyntheticAppDetailsActivityEnabled(@NonNull String);
method @NonNull public abstract android.content.pm.FeatureInfo[] getSystemAvailableFeatures();
@ -12816,13 +12830,19 @@ package android.content.pm {
method public abstract boolean isSafeMode();
method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryActivityProperty(@NonNull String);
method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryApplicationProperty(@NonNull String);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(@NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ProviderInfo> queryContentProviders(@Nullable String, int, int);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(@NonNull android.content.Intent, int);
method @NonNull public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.ProviderInfo> queryContentProviders(@Nullable String, int, int);
method @NonNull public java.util.List<android.content.pm.ProviderInfo> queryContentProviders(@Nullable String, int, @NonNull android.content.pm.PackageManager.ComponentInfoFlags);
method @NonNull public abstract java.util.List<android.content.pm.InstrumentationInfo> queryInstrumentation(@NonNull String, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivities(@NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivityOptions(@Nullable android.content.ComponentName, @Nullable android.content.Intent[], @NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentContentProviders(@NonNull android.content.Intent, int);
method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentServices(@NonNull android.content.Intent, int);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivities(@NonNull android.content.Intent, int);
method @NonNull public java.util.List<android.content.pm.ResolveInfo> queryIntentActivities(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivityOptions(@Nullable android.content.ComponentName, @Nullable android.content.Intent[], @NonNull android.content.Intent, int);
method @NonNull public java.util.List<android.content.pm.ResolveInfo> queryIntentActivityOptions(@Nullable android.content.ComponentName, @Nullable java.util.List<android.content.Intent>, @NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentContentProviders(@NonNull android.content.Intent, int);
method @NonNull public java.util.List<android.content.pm.ResolveInfo> queryIntentContentProviders(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentServices(@NonNull android.content.Intent, int);
method @NonNull public java.util.List<android.content.pm.ResolveInfo> queryIntentServices(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags);
method @NonNull public abstract java.util.List<android.content.pm.PermissionInfo> queryPermissionsByGroup(@Nullable String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryProviderProperty(@NonNull String);
method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryReceiverProperty(@NonNull String);
@ -12831,9 +12851,12 @@ package android.content.pm {
method public abstract void removePermission(@NonNull String);
method @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) public boolean removeWhitelistedRestrictedPermission(@NonNull String, @NonNull String, int);
method public void requestChecksums(@NonNull String, boolean, int, @NonNull java.util.List<java.security.cert.Certificate>, @NonNull android.content.pm.PackageManager.OnChecksumsReadyListener) throws java.security.cert.CertificateEncodingException, android.content.pm.PackageManager.NameNotFoundException;
method @Nullable public abstract android.content.pm.ResolveInfo resolveActivity(@NonNull android.content.Intent, int);
method @Nullable public abstract android.content.pm.ProviderInfo resolveContentProvider(@NonNull String, int);
method @Nullable public abstract android.content.pm.ResolveInfo resolveService(@NonNull android.content.Intent, int);
method @Deprecated @Nullable public abstract android.content.pm.ResolveInfo resolveActivity(@NonNull android.content.Intent, int);
method @Nullable public android.content.pm.ResolveInfo resolveActivity(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags);
method @Deprecated @Nullable public abstract android.content.pm.ProviderInfo resolveContentProvider(@NonNull String, int);
method @Nullable public android.content.pm.ProviderInfo resolveContentProvider(@NonNull String, @NonNull android.content.pm.PackageManager.ComponentInfoFlags);
method @Deprecated @Nullable public abstract android.content.pm.ResolveInfo resolveService(@NonNull android.content.Intent, int);
method @Nullable public android.content.pm.ResolveInfo resolveService(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags);
method public abstract void setApplicationCategoryHint(@NonNull String, int);
method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public abstract void setApplicationEnabledSetting(@NonNull String, int, int);
method @RequiresPermission(value="android.permission.WHITELIST_AUTO_REVOKE_PERMISSIONS", conditional=true) public boolean setAutoRevokeWhitelisted(@NonNull String, boolean);
@ -13035,6 +13058,11 @@ package android.content.pm {
field public static final int VERSION_CODE_HIGHEST = -1; // 0xffffffff
}
public static final class PackageManager.ApplicationInfoFlags {
method public long getValue();
method @NonNull public static android.content.pm.PackageManager.ApplicationInfoFlags of(long);
}
public static final class PackageManager.ComponentEnabledSetting implements android.os.Parcelable {
ctor public PackageManager.ComponentEnabledSetting(@NonNull android.content.ComponentName, int, int);
method public int describeContents();
@ -13045,6 +13073,11 @@ package android.content.pm {
field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PackageManager.ComponentEnabledSetting> CREATOR;
}
public static final class PackageManager.ComponentInfoFlags {
method public long getValue();
method @NonNull public static android.content.pm.PackageManager.ComponentInfoFlags of(long);
}
public static class PackageManager.NameNotFoundException extends android.util.AndroidException {
ctor public PackageManager.NameNotFoundException();
ctor public PackageManager.NameNotFoundException(String);
@ -13054,6 +13087,11 @@ package android.content.pm {
method public void onChecksumsReady(@NonNull java.util.List<android.content.pm.ApkChecksum>);
}
public static final class PackageManager.PackageInfoFlags {
method public long getValue();
method @NonNull public static android.content.pm.PackageManager.PackageInfoFlags of(long);
}
public static final class PackageManager.Property implements android.os.Parcelable {
method public int describeContents();
method public boolean getBoolean();
@ -13073,6 +13111,11 @@ package android.content.pm {
field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PackageManager.Property> CREATOR;
}
public static final class PackageManager.ResolveInfoFlags {
method public long getValue();
method @NonNull public static android.content.pm.PackageManager.ResolveInfoFlags of(long);
}
@Deprecated public class PackageStats implements android.os.Parcelable {
ctor @Deprecated public PackageStats(String);
ctor @Deprecated public PackageStats(android.os.Parcel);

View File

@ -2854,13 +2854,16 @@ package android.content.pm {
method @RequiresPermission("android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS") public abstract void addOnPermissionsChangeListener(@NonNull android.content.pm.PackageManager.OnPermissionsChangedListener);
method public abstract boolean arePermissionsIndividuallyControlled();
method @NonNull public abstract java.util.List<android.content.IntentFilter> getAllIntentFilters(@NonNull String);
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.pm.ApplicationInfo getApplicationInfoAsUser(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.pm.ApplicationInfo getApplicationInfoAsUser(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.pm.ApplicationInfo getApplicationInfoAsUser(@NonNull String, @NonNull android.content.pm.PackageManager.ApplicationInfoFlags, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull public android.content.pm.dex.ArtManager getArtManager();
method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_SHARED_LIBRARIES) public java.util.List<android.content.pm.SharedLibraryInfo> getDeclaredSharedLibraries(@NonNull String, int);
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_SHARED_LIBRARIES) public java.util.List<android.content.pm.SharedLibraryInfo> getDeclaredSharedLibraries(@NonNull String, int);
method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_SHARED_LIBRARIES) public java.util.List<android.content.pm.SharedLibraryInfo> getDeclaredSharedLibraries(@NonNull String, @NonNull android.content.pm.PackageManager.PackageInfoFlags);
method @Nullable @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public abstract String getDefaultBrowserPackageNameAsUser(int);
method @Nullable @RequiresPermission(android.Manifest.permission.SET_HARMFUL_APP_WARNINGS) public CharSequence getHarmfulAppWarning(@NonNull String);
method @Nullable public String getIncidentReportApproverPackageName();
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackagesAsUser(int, int);
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackagesAsUser(int, int);
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public java.util.List<android.content.pm.PackageInfo> getInstalledPackagesAsUser(@NonNull android.content.pm.PackageManager.PackageInfoFlags, int);
method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_INSTANT_APPS) public abstract android.graphics.drawable.Drawable getInstantAppIcon(String);
method @Nullable public abstract android.content.ComponentName getInstantAppInstallerComponent();
method @Nullable public abstract android.content.ComponentName getInstantAppResolverSettingsComponent();
@ -2872,10 +2875,14 @@ package android.content.pm {
method @RequiresPermission(android.Manifest.permission.GRANT_RUNTIME_PERMISSIONS) public abstract void grantRuntimePermission(@NonNull String, @NonNull String, @NonNull android.os.UserHandle);
method @Deprecated public abstract int installExistingPackage(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated public abstract int installExistingPackage(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceiversAsUser(@NonNull android.content.Intent, int, android.os.UserHandle);
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentActivitiesAsUser(@NonNull android.content.Intent, int, @NonNull android.os.UserHandle);
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentContentProvidersAsUser(@NonNull android.content.Intent, int, @NonNull android.os.UserHandle);
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentServicesAsUser(@NonNull android.content.Intent, int, @NonNull android.os.UserHandle);
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceiversAsUser(@NonNull android.content.Intent, int, android.os.UserHandle);
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceiversAsUser(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags, @NonNull android.os.UserHandle);
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentActivitiesAsUser(@NonNull android.content.Intent, int, @NonNull android.os.UserHandle);
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentActivitiesAsUser(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags, @NonNull android.os.UserHandle);
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentContentProvidersAsUser(@NonNull android.content.Intent, int, @NonNull android.os.UserHandle);
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentContentProvidersAsUser(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags, @NonNull android.os.UserHandle);
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentServicesAsUser(@NonNull android.content.Intent, int, @NonNull android.os.UserHandle);
method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public java.util.List<android.content.pm.ResolveInfo> queryIntentServicesAsUser(@NonNull android.content.Intent, @NonNull android.content.pm.PackageManager.ResolveInfoFlags, @NonNull android.os.UserHandle);
method public abstract void registerDexModule(@NonNull String, @Nullable android.content.pm.PackageManager.DexModuleRegisterCallback);
method @RequiresPermission("android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS") public abstract void removeOnPermissionsChangeListener(@NonNull android.content.pm.PackageManager.OnPermissionsChangedListener);
method public void replacePreferredActivity(@NonNull android.content.IntentFilter, int, @NonNull java.util.List<android.content.ComponentName>, @NonNull android.content.ComponentName);

View File

@ -825,7 +825,8 @@ package android.content.pm {
method @Nullable public String getDefaultTextClassifierPackageName();
method @RequiresPermission(android.Manifest.permission.INJECT_EVENTS) public android.os.IBinder getHoldLockToken();
method public abstract int getInstallReason(@NonNull String, @NonNull android.os.UserHandle);
method @NonNull public abstract java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(int, int);
method @Deprecated @NonNull public abstract java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(int, int);
method @NonNull public java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(@NonNull android.content.pm.PackageManager.ApplicationInfoFlags, int);
method @Nullable public abstract String[] getNamesForUids(int[]);
method @NonNull public String getPermissionControllerPackageName();
method @NonNull public abstract String getServicesSystemSharedLibraryPackageName();

View File

@ -210,16 +210,28 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public PackageInfo getPackageInfo(String packageName, int flags)
throws NameNotFoundException {
return getPackageInfo(packageName, PackageInfoFlags.of(flags));
}
@Override
public PackageInfo getPackageInfo(String packageName, PackageInfoFlags flags)
throws NameNotFoundException {
return getPackageInfoAsUser(packageName, flags, getUserId());
}
@Override
public PackageInfo getPackageInfo(VersionedPackage versionedPackage, int flags)
throws NameNotFoundException {
return getPackageInfo(versionedPackage, PackageInfoFlags.of(flags));
}
@Override
public PackageInfo getPackageInfo(VersionedPackage versionedPackage, PackageInfoFlags flags)
throws NameNotFoundException {
final int userId = getUserId();
try {
PackageInfo pi = mPM.getPackageInfoVersioned(versionedPackage,
updateFlagsForPackage(flags, userId), userId);
updateFlagsForPackage(flags.getValue(), userId), userId);
if (pi != null) {
return pi;
}
@ -232,10 +244,16 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public PackageInfo getPackageInfoAsUser(String packageName, int flags, int userId)
throws NameNotFoundException {
return getPackageInfoAsUser(packageName, PackageInfoFlags.of(flags), userId);
}
@Override
public PackageInfo getPackageInfoAsUser(String packageName, PackageInfoFlags flags, int userId)
throws NameNotFoundException {
PackageInfo pi =
getPackageInfoAsUserCached(
packageName,
updateFlagsForPackage(flags, userId),
updateFlagsForPackage(flags.getValue(), userId),
userId);
if (pi == null) {
throw new NameNotFoundException(packageName);
@ -334,10 +352,16 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public int[] getPackageGids(String packageName, int flags)
throws NameNotFoundException {
return getPackageGids(packageName, PackageInfoFlags.of(flags));
}
@Override
public int[] getPackageGids(String packageName, PackageInfoFlags flags)
throws NameNotFoundException {
final int userId = getUserId();
try {
int[] gids = mPM.getPackageGids(packageName,
updateFlagsForPackage(flags, userId), userId);
updateFlagsForPackage(flags.getValue(), userId), userId);
if (gids != null) {
return gids;
}
@ -350,6 +374,12 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public int getPackageUid(String packageName, int flags) throws NameNotFoundException {
return getPackageUid(packageName, PackageInfoFlags.of(flags));
}
@Override
public int getPackageUid(String packageName, PackageInfoFlags flags)
throws NameNotFoundException {
return getPackageUidAsUser(packageName, flags, getUserId());
}
@ -361,9 +391,15 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public int getPackageUidAsUser(String packageName, int flags, int userId)
throws NameNotFoundException {
return getPackageUidAsUser(packageName, PackageInfoFlags.of(flags), userId);
}
@Override
public int getPackageUidAsUser(String packageName, PackageInfoFlags flags, int userId)
throws NameNotFoundException {
try {
int uid = mPM.getPackageUid(packageName,
updateFlagsForPackage(flags, userId), userId);
updateFlagsForPackage(flags.getValue(), userId), userId);
if (uid >= 0) {
return uid;
}
@ -448,15 +484,27 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public ApplicationInfo getApplicationInfo(String packageName, int flags)
throws NameNotFoundException {
return getApplicationInfo(packageName, ApplicationInfoFlags.of(flags));
}
@Override
public ApplicationInfo getApplicationInfo(String packageName, ApplicationInfoFlags flags)
throws NameNotFoundException {
return getApplicationInfoAsUser(packageName, flags, getUserId());
}
@Override
public ApplicationInfo getApplicationInfoAsUser(String packageName, int flags, int userId)
throws NameNotFoundException {
return getApplicationInfoAsUser(packageName, ApplicationInfoFlags.of(flags), userId);
}
@Override
public ApplicationInfo getApplicationInfoAsUser(String packageName, ApplicationInfoFlags flags,
int userId) throws NameNotFoundException {
ApplicationInfo ai = getApplicationInfoAsUserCached(
packageName,
updateFlagsForApplication(flags, userId),
updateFlagsForApplication(flags.getValue(), userId),
userId);
if (ai == null) {
throw new NameNotFoundException(packageName);
@ -505,10 +553,16 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public ActivityInfo getActivityInfo(ComponentName className, int flags)
throws NameNotFoundException {
return getActivityInfo(className, ComponentInfoFlags.of(flags));
}
@Override
public ActivityInfo getActivityInfo(ComponentName className, ComponentInfoFlags flags)
throws NameNotFoundException {
final int userId = getUserId();
try {
ActivityInfo ai = mPM.getActivityInfo(className,
updateFlagsForComponent(flags, userId, null), userId);
updateFlagsForComponent(flags.getValue(), userId, null), userId);
if (ai != null) {
return ai;
}
@ -522,10 +576,16 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public ActivityInfo getReceiverInfo(ComponentName className, int flags)
throws NameNotFoundException {
return getReceiverInfo(className, ComponentInfoFlags.of(flags));
}
@Override
public ActivityInfo getReceiverInfo(ComponentName className, ComponentInfoFlags flags)
throws NameNotFoundException {
final int userId = getUserId();
try {
ActivityInfo ai = mPM.getReceiverInfo(className,
updateFlagsForComponent(flags, userId, null), userId);
updateFlagsForComponent(flags.getValue(), userId, null), userId);
if (ai != null) {
return ai;
}
@ -539,10 +599,16 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public ServiceInfo getServiceInfo(ComponentName className, int flags)
throws NameNotFoundException {
return getServiceInfo(className, ComponentInfoFlags.of(flags));
}
@Override
public ServiceInfo getServiceInfo(ComponentName className, ComponentInfoFlags flags)
throws NameNotFoundException {
final int userId = getUserId();
try {
ServiceInfo si = mPM.getServiceInfo(className,
updateFlagsForComponent(flags, userId, null), userId);
updateFlagsForComponent(flags.getValue(), userId, null), userId);
if (si != null) {
return si;
}
@ -556,10 +622,16 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public ProviderInfo getProviderInfo(ComponentName className, int flags)
throws NameNotFoundException {
return getProviderInfo(className, ComponentInfoFlags.of(flags));
}
@Override
public ProviderInfo getProviderInfo(ComponentName className, ComponentInfoFlags flags)
throws NameNotFoundException {
final int userId = getUserId();
try {
ProviderInfo pi = mPM.getProviderInfo(className,
updateFlagsForComponent(flags, userId, null), userId);
updateFlagsForComponent(flags.getValue(), userId, null), userId);
if (pi != null) {
return pi;
}
@ -582,16 +654,30 @@ public class ApplicationPackageManager extends PackageManager {
/** @hide */
@Override
public @NonNull List<SharedLibraryInfo> getSharedLibraries(int flags) {
return this.getSharedLibraries(PackageInfoFlags.of(flags));
}
/** @hide
* @param flags */
@Override
public @NonNull List<SharedLibraryInfo> getSharedLibraries(PackageInfoFlags flags) {
return getSharedLibrariesAsUser(flags, getUserId());
}
/** @hide */
@Override
@SuppressWarnings("unchecked")
public @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser(int flags, int userId) {
return getSharedLibrariesAsUser(PackageInfoFlags.of(flags), userId);
}
/** @hide */
@Override
@SuppressWarnings("unchecked")
public @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser(PackageInfoFlags flags,
int userId) {
try {
ParceledListSlice<SharedLibraryInfo> sharedLibs = mPM.getSharedLibraries(
mContext.getOpPackageName(), flags, userId);
mContext.getOpPackageName(), flags.getValue(), userId);
if (sharedLibs == null) {
return Collections.emptyList();
}
@ -604,10 +690,18 @@ public class ApplicationPackageManager extends PackageManager {
@NonNull
@Override
public List<SharedLibraryInfo> getDeclaredSharedLibraries(@NonNull String packageName,
@InstallFlags int flags) {
int flags) {
return getDeclaredSharedLibraries(packageName, PackageInfoFlags.of(flags));
}
@NonNull
@Override
@SuppressWarnings("unchecked")
public List<SharedLibraryInfo> getDeclaredSharedLibraries(@NonNull String packageName,
PackageInfoFlags flags) {
try {
ParceledListSlice<SharedLibraryInfo> sharedLibraries = mPM.getDeclaredSharedLibraries(
packageName, flags, mContext.getUserId());
packageName, flags.getValue(), mContext.getUserId());
return sharedLibraries != null ? sharedLibraries.getList() : Collections.emptyList();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@ -1092,6 +1186,12 @@ public class ApplicationPackageManager extends PackageManager {
@SuppressWarnings("unchecked")
@Override
public List<PackageInfo> getInstalledPackages(int flags) {
return getInstalledPackages(PackageInfoFlags.of(flags));
}
@SuppressWarnings("unchecked")
@Override
public List<PackageInfo> getInstalledPackages(PackageInfoFlags flags) {
return getInstalledPackagesAsUser(flags, getUserId());
}
@ -1099,9 +1199,17 @@ public class ApplicationPackageManager extends PackageManager {
@Override
@SuppressWarnings("unchecked")
public List<PackageInfo> getInstalledPackagesAsUser(int flags, int userId) {
return getInstalledPackagesAsUser(PackageInfoFlags.of(flags), userId);
}
/** @hide */
@Override
@SuppressWarnings("unchecked")
public List<PackageInfo> getInstalledPackagesAsUser(PackageInfoFlags flags, int userId) {
try {
ParceledListSlice<PackageInfo> parceledList =
mPM.getInstalledPackages(updateFlagsForPackage(flags, userId), userId);
mPM.getInstalledPackages(updateFlagsForPackage(flags.getValue(), userId),
userId);
if (parceledList == null) {
return Collections.emptyList();
}
@ -1113,13 +1221,19 @@ public class ApplicationPackageManager extends PackageManager {
@SuppressWarnings("unchecked")
@Override
public List<PackageInfo> getPackagesHoldingPermissions(
String[] permissions, int flags) {
public List<PackageInfo> getPackagesHoldingPermissions(String[] permissions, int flags) {
return this.getPackagesHoldingPermissions(permissions, PackageInfoFlags.of(flags));
}
@SuppressWarnings("unchecked")
@Override
public List<PackageInfo> getPackagesHoldingPermissions(String[] permissions,
PackageInfoFlags flags) {
final int userId = getUserId();
try {
ParceledListSlice<PackageInfo> parceledList =
mPM.getPackagesHoldingPermissions(permissions,
updateFlagsForPackage(flags, userId), userId);
updateFlagsForPackage(flags.getValue(), userId), userId);
if (parceledList == null) {
return Collections.emptyList();
}
@ -1135,13 +1249,27 @@ public class ApplicationPackageManager extends PackageManager {
return getInstalledApplicationsAsUser(flags, getUserId());
}
@Override
public List<ApplicationInfo> getInstalledApplications(ApplicationInfoFlags flags) {
return getInstalledApplicationsAsUser(flags, getUserId());
}
/** @hide */
@SuppressWarnings("unchecked")
@Override
public List<ApplicationInfo> getInstalledApplicationsAsUser(int flags, int userId) {
return getInstalledApplicationsAsUser(ApplicationInfoFlags.of(flags), userId);
}
/** @hide */
@SuppressWarnings("unchecked")
@Override
public List<ApplicationInfo> getInstalledApplicationsAsUser(ApplicationInfoFlags flags,
int userId) {
try {
ParceledListSlice<ApplicationInfo> parceledList =
mPM.getInstalledApplications(updateFlagsForApplication(flags, userId), userId);
mPM.getInstalledApplications(updateFlagsForApplication(
flags.getValue(), userId), userId);
if (parceledList == null) {
return Collections.emptyList();
}
@ -1249,16 +1377,26 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public ResolveInfo resolveActivity(Intent intent, int flags) {
return resolveActivity(intent, ResolveInfoFlags.of(flags));
}
@Override
public ResolveInfo resolveActivity(Intent intent, ResolveInfoFlags flags) {
return resolveActivityAsUser(intent, flags, getUserId());
}
@Override
public ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId) {
return resolveActivityAsUser(intent, ResolveInfoFlags.of(flags), userId);
}
@Override
public ResolveInfo resolveActivityAsUser(Intent intent, ResolveInfoFlags flags, int userId) {
try {
return mPM.resolveIntent(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
updateFlagsForComponent(flags, userId, intent),
updateFlagsForComponent(flags.getValue(), userId, intent),
userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@ -1266,21 +1404,31 @@ public class ApplicationPackageManager extends PackageManager {
}
@Override
public List<ResolveInfo> queryIntentActivities(Intent intent,
int flags) {
public List<ResolveInfo> queryIntentActivities(Intent intent, int flags) {
return queryIntentActivities(intent, ResolveInfoFlags.of(flags));
}
@Override
public List<ResolveInfo> queryIntentActivities(Intent intent, ResolveInfoFlags flags) {
return queryIntentActivitiesAsUser(intent, flags, getUserId());
}
/** @hide Same as above but for a specific user */
@Override
public List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId) {
return queryIntentActivitiesAsUser(intent, ResolveInfoFlags.of(flags), userId);
}
/** @hide Same as above but for a specific user */
@Override
@SuppressWarnings("unchecked")
public List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
int flags, int userId) {
public List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, ResolveInfoFlags flags,
int userId) {
try {
ParceledListSlice<ResolveInfo> parceledList = mPM.queryIntentActivities(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
updateFlagsForComponent(flags, userId, intent),
updateFlagsForComponent(flags.getValue(), userId, intent),
userId);
if (parceledList == null) {
return Collections.emptyList();
@ -1292,22 +1440,30 @@ public class ApplicationPackageManager extends PackageManager {
}
@Override
@SuppressWarnings("unchecked")
public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller, Intent[] specifics,
Intent intent, int flags) {
return queryIntentActivityOptions(caller,
specifics == null ? null : new ArrayList<>(Arrays.asList(specifics)),
intent, ResolveInfoFlags.of(flags));
}
@Override
@SuppressWarnings("unchecked")
public List<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
List<Intent> specifics, Intent intent, ResolveInfoFlags flags) {
final int userId = getUserId();
final ContentResolver resolver = mContext.getContentResolver();
String[] specificTypes = null;
if (specifics != null) {
final int N = specifics.length;
for (int i=0; i<N; i++) {
Intent sp = specifics[i];
final int numSpecifics = specifics.size();
for (int i = 0; i < numSpecifics; i++) {
Intent sp = specifics.get(i);
if (sp != null) {
String t = sp.resolveTypeIfNeeded(resolver);
if (t != null) {
if (specificTypes == null) {
specificTypes = new String[N];
specificTypes = new String[numSpecifics];
}
specificTypes[i] = t;
}
@ -1318,11 +1474,11 @@ public class ApplicationPackageManager extends PackageManager {
try {
ParceledListSlice<ResolveInfo> parceledList = mPM.queryIntentActivityOptions(
caller,
specifics,
specifics == null ? null : specifics.toArray(new Intent[0]),
specificTypes,
intent,
intent.resolveTypeIfNeeded(resolver),
updateFlagsForComponent(flags, userId, intent),
updateFlagsForComponent(flags.getValue(), userId, intent),
userId);
if (parceledList == null) {
return Collections.emptyList();
@ -1337,13 +1493,22 @@ public class ApplicationPackageManager extends PackageManager {
* @hide
*/
@Override
@SuppressWarnings("unchecked")
public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, int flags, int userId) {
return queryBroadcastReceiversAsUser(intent, ResolveInfoFlags.of(flags), userId);
}
/**
* @hide
*/
@Override
@SuppressWarnings("unchecked")
public List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, ResolveInfoFlags flags,
int userId) {
try {
ParceledListSlice<ResolveInfo> parceledList = mPM.queryIntentReceivers(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
updateFlagsForComponent(flags, userId, intent),
updateFlagsForComponent(flags.getValue(), userId, intent),
userId);
if (parceledList == null) {
return Collections.emptyList();
@ -1356,17 +1521,27 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags) {
return queryBroadcastReceivers(intent, ResolveInfoFlags.of(flags));
}
@Override
public List<ResolveInfo> queryBroadcastReceivers(Intent intent, ResolveInfoFlags flags) {
return queryBroadcastReceiversAsUser(intent, flags, getUserId());
}
@Override
public ResolveInfo resolveServiceAsUser(Intent intent, @ResolveInfoFlags int flags,
public ResolveInfo resolveServiceAsUser(Intent intent, int flags, @UserIdInt int userId) {
return resolveServiceAsUser(intent, ResolveInfoFlags.of(flags), userId);
}
@Override
public ResolveInfo resolveServiceAsUser(Intent intent, ResolveInfoFlags flags,
@UserIdInt int userId) {
try {
return mPM.resolveService(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
updateFlagsForComponent(flags, userId, intent),
updateFlagsForComponent(flags.getValue(), userId, intent),
userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
@ -1375,17 +1550,28 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public ResolveInfo resolveService(Intent intent, int flags) {
return resolveService(intent, ResolveInfoFlags.of(flags));
}
@Override
public ResolveInfo resolveService(Intent intent, ResolveInfoFlags flags) {
return resolveServiceAsUser(intent, flags, getUserId());
}
@Override
@SuppressWarnings("unchecked")
public List<ResolveInfo> queryIntentServicesAsUser(Intent intent, int flags, int userId) {
return queryIntentServicesAsUser(intent, ResolveInfoFlags.of(flags), userId);
}
@Override
@SuppressWarnings("unchecked")
public List<ResolveInfo> queryIntentServicesAsUser(Intent intent, ResolveInfoFlags flags,
int userId) {
try {
ParceledListSlice<ResolveInfo> parceledList = mPM.queryIntentServices(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
updateFlagsForComponent(flags, userId, intent),
updateFlagsForComponent(flags.getValue(), userId, intent),
userId);
if (parceledList == null) {
return Collections.emptyList();
@ -1398,18 +1584,29 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public List<ResolveInfo> queryIntentServices(Intent intent, int flags) {
return queryIntentServices(intent, ResolveInfoFlags.of(flags));
}
@Override
public List<ResolveInfo> queryIntentServices(Intent intent, ResolveInfoFlags flags) {
return queryIntentServicesAsUser(intent, flags, getUserId());
}
@Override
public List<ResolveInfo> queryIntentContentProvidersAsUser(
Intent intent, int flags, int userId) {
return queryIntentContentProvidersAsUser(intent, ResolveInfoFlags.of(flags), userId);
}
@Override
@SuppressWarnings("unchecked")
public List<ResolveInfo> queryIntentContentProvidersAsUser(
Intent intent, int flags, int userId) {
Intent intent, ResolveInfoFlags flags, int userId) {
try {
ParceledListSlice<ResolveInfo> parceledList = mPM.queryIntentContentProviders(
intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
updateFlagsForComponent(flags, userId, intent),
updateFlagsForComponent(flags.getValue(), userId, intent),
userId);
if (parceledList == null) {
return Collections.emptyList();
@ -1422,39 +1619,68 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags) {
return queryIntentContentProviders(intent, ResolveInfoFlags.of(flags));
}
@Override
public List<ResolveInfo> queryIntentContentProviders(Intent intent, ResolveInfoFlags flags) {
return queryIntentContentProvidersAsUser(intent, flags, getUserId());
}
@Override
public ProviderInfo resolveContentProvider(String name, int flags) {
return resolveContentProvider(name, ComponentInfoFlags.of(flags));
}
@Override
public ProviderInfo resolveContentProvider(String name, ComponentInfoFlags flags) {
return resolveContentProviderAsUser(name, flags, getUserId());
}
/** @hide **/
@Override
public ProviderInfo resolveContentProviderAsUser(String name, int flags, int userId) {
return resolveContentProviderAsUser(name, ComponentInfoFlags.of(flags), userId);
}
/** @hide **/
@Override
public ProviderInfo resolveContentProviderAsUser(String name, ComponentInfoFlags flags,
int userId) {
try {
return mPM.resolveContentProvider(name,
updateFlagsForComponent(flags, userId, null), userId);
updateFlagsForComponent(flags.getValue(), userId, null), userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
@Override
public List<ProviderInfo> queryContentProviders(String processName,
int uid, int flags) {
public List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) {
return queryContentProviders(processName, uid, ComponentInfoFlags.of(flags));
}
@Override
public List<ProviderInfo> queryContentProviders(String processName, int uid,
ComponentInfoFlags flags) {
return queryContentProviders(processName, uid, flags, null);
}
@Override
public List<ProviderInfo> queryContentProviders(String processName,
int uid, int flags, String metaDataKey) {
return queryContentProviders(processName, uid, ComponentInfoFlags.of(flags), metaDataKey);
}
@Override
@SuppressWarnings("unchecked")
public List<ProviderInfo> queryContentProviders(String processName,
int uid, int flags, String metaDataKey) {
int uid, ComponentInfoFlags flags, String metaDataKey) {
try {
ParceledListSlice<ProviderInfo> slice = mPM.queryContentProviders(processName, uid,
updateFlagsForComponent(flags, UserHandle.getUserId(uid), null), metaDataKey);
return slice != null ? slice.getList() : Collections.<ProviderInfo>emptyList();
updateFlagsForComponent(flags.getValue(), UserHandle.getUserId(uid),
null), metaDataKey);
return slice != null ? slice.getList() : Collections.emptyList();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@ -1839,7 +2065,7 @@ public class ApplicationPackageManager extends PackageManager {
/**
* Update given flags when being used to request {@link PackageInfo}.
*/
private int updateFlagsForPackage(int flags, int userId) {
private long updateFlagsForPackage(long flags, int userId) {
if ((flags & (GET_ACTIVITIES | GET_RECEIVERS | GET_SERVICES | GET_PROVIDERS)) != 0) {
// Caller is asking for component details, so they'd better be
// asking for specific Direct Boot matching behavior
@ -1855,14 +2081,15 @@ public class ApplicationPackageManager extends PackageManager {
/**
* 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 updateFlagsForPackage(flags, userId);
}
/**
* Update given flags when being used to request {@link ComponentInfo}.
*/
private int updateFlagsForComponent(int flags, int userId, Intent intent) {
private long updateFlagsForComponent(@ComponentInfoFlagsBits long flags, int userId,
Intent intent) {
if (intent != null) {
if ((intent.getFlags() & Intent.FLAG_DIRECT_BOOT_AUTO) != 0) {
flags |= MATCH_DIRECT_BOOT_AUTO;
@ -2108,19 +2335,25 @@ public class ApplicationPackageManager extends PackageManager {
return info.loadLabel(this);
}
@Nullable
public PackageInfo getPackageArchiveInfo(@NonNull String archiveFilePath, int flags) {
return getPackageArchiveInfo(archiveFilePath, PackageInfoFlags.of(flags));
}
@Nullable
public PackageInfo getPackageArchiveInfo(@NonNull String archiveFilePath,
@PackageInfoFlags int flags) {
if ((flags & (PackageManager.MATCH_DIRECT_BOOT_UNAWARE
PackageInfoFlags flags) {
long flagsBits = flags.getValue();
if ((flagsBits & (PackageManager.MATCH_DIRECT_BOOT_UNAWARE
| PackageManager.MATCH_DIRECT_BOOT_AWARE)) == 0) {
// Caller expressed no opinion about what encryption
// aware/unaware components they want to see, so match both
flags |= PackageManager.MATCH_DIRECT_BOOT_AWARE
flagsBits |= PackageManager.MATCH_DIRECT_BOOT_AWARE
| PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
}
boolean collectCertificates = (flags & PackageManager.GET_SIGNATURES) != 0
|| (flags & PackageManager.GET_SIGNING_CERTIFICATES) != 0;
boolean collectCertificates = (flagsBits & PackageManager.GET_SIGNATURES) != 0
|| (flagsBits & PackageManager.GET_SIGNING_CERTIFICATES) != 0;
ParseInput input = ParseTypeImpl.forParsingWithoutPlatformCompat().reset();
ParseResult<ParsingPackage> result = ParsingPackageUtils.parseDefault(input,
@ -2129,8 +2362,8 @@ public class ApplicationPackageManager extends PackageManager {
if (result.isError()) {
return null;
}
return PackageInfoWithoutStateUtils.generate(result.getResult(), null, flags, 0, 0, null,
FrameworkPackageUserState.DEFAULT, UserHandle.getCallingUserId());
return PackageInfoWithoutStateUtils.generate(result.getResult(), null, flagsBits, 0, 0,
null, FrameworkPackageUserState.DEFAULT, UserHandle.getCallingUserId());
}
@Override

View File

@ -39,7 +39,7 @@ import android.content.IIntentReceiver;
import android.content.IIntentSender;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager.ResolveInfoFlags;
import android.content.pm.PackageManager.ResolveInfoFlagsBits;
import android.content.pm.ParceledListSlice;
import android.content.pm.ResolveInfo;
import android.os.Build;
@ -1296,7 +1296,7 @@ public final class PendingIntent implements Parcelable {
@RequiresPermission(permission.GET_INTENT_SENDER_INTENT)
@SystemApi(client = Client.MODULE_LIBRARIES)
@TestApi
public @NonNull List<ResolveInfo> queryIntentComponents(@ResolveInfoFlags int flags) {
public @NonNull List<ResolveInfo> queryIntentComponents(@ResolveInfoFlagsBits int flags) {
try {
ParceledListSlice<ResolveInfo> parceledList = ActivityManager.getService()
.queryIntentComponentsForIntentSender(mTarget, flags);

View File

@ -9220,7 +9220,7 @@ public class Intent implements Parcelable, Cloneable {
* @see #resolveActivity
*/
public ActivityInfo resolveActivityInfo(@NonNull PackageManager pm,
@PackageManager.ComponentInfoFlags int flags) {
@PackageManager.ComponentInfoFlagsBits int flags) {
ActivityInfo ai = null;
if (mComponent != null) {
try {
@ -9248,7 +9248,7 @@ public class Intent implements Parcelable, Cloneable {
*/
@UnsupportedAppUsage
public @Nullable ComponentName resolveSystemService(@NonNull PackageManager pm,
@PackageManager.ComponentInfoFlags int flags) {
@PackageManager.ComponentInfoFlagsBits int flags) {
if (mComponent != null) {
return mComponent;
}

View File

@ -41,7 +41,7 @@ import android.content.LocusId;
import android.content.pm.PackageInstaller.SessionCallback;
import android.content.pm.PackageInstaller.SessionCallbackDelegate;
import android.content.pm.PackageInstaller.SessionInfo;
import android.content.pm.PackageManager.ApplicationInfoFlags;
import android.content.pm.PackageManager.ApplicationInfoFlagsBits;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.graphics.Bitmap;
@ -1012,7 +1012,7 @@ public class LauncherApps {
* isn't enabled.
*/
public ApplicationInfo getApplicationInfo(@NonNull String packageName,
@ApplicationInfoFlags int flags, @NonNull UserHandle user)
@ApplicationInfoFlagsBits int flags, @NonNull UserHandle user)
throws PackageManager.NameNotFoundException {
Objects.requireNonNull(packageName, "packageName");
Objects.requireNonNull(user, "user");

File diff suppressed because it is too large Load Diff

View File

@ -76,8 +76,9 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static PackageInfo generate(ParsingPackageRead pkg, int[] gids,
@PackageManager.PackageInfoFlags long flags, long firstInstallTime, long lastUpdateTime,
Set<String> grantedPermissions, FrameworkPackageUserState state, int userId) {
@PackageManager.PackageInfoFlagsBits 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,9 +91,9 @@ public class PackageInfoWithoutStateUtils {
@Nullable
private static PackageInfo generateWithComponents(ParsingPackageRead pkg, int[] gids,
@PackageManager.PackageInfoFlags long flags, long firstInstallTime, long lastUpdateTime,
Set<String> grantedPermissions, FrameworkPackageUserState state, int userId,
@Nullable ApexInfo apexInfo) {
@PackageManager.PackageInfoFlagsBits long flags, long firstInstallTime,
long lastUpdateTime, Set<String> grantedPermissions, FrameworkPackageUserState state,
int userId, @Nullable ApexInfo apexInfo) {
ApplicationInfo applicationInfo = generateApplicationInfo(pkg, flags, state, userId);
if (applicationInfo == null) {
return null;
@ -190,9 +191,9 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static PackageInfo generateWithoutComponents(ParsingPackageRead pkg, int[] gids,
@PackageManager.PackageInfoFlags long flags, long firstInstallTime, long lastUpdateTime,
Set<String> grantedPermissions, FrameworkPackageUserState state, int userId,
@Nullable ApexInfo apexInfo, @NonNull ApplicationInfo applicationInfo) {
@PackageManager.PackageInfoFlagsBits long flags, long firstInstallTime,
long lastUpdateTime, Set<String> grantedPermissions, FrameworkPackageUserState state,
int userId, @Nullable ApexInfo apexInfo, @NonNull ApplicationInfo applicationInfo) {
if (!checkUseInstalled(pkg, state, flags)) {
return null;
}
@ -210,7 +211,7 @@ public class PackageInfoWithoutStateUtils {
*/
@NonNull
public static PackageInfo generateWithoutComponentsUnchecked(ParsingPackageRead pkg, int[] gids,
@PackageManager.PackageInfoFlags long flags, long firstInstallTime,
@PackageManager.PackageInfoFlagsBits long flags, long firstInstallTime,
long lastUpdateTime, Set<String> grantedPermissions, FrameworkPackageUserState state,
int userId, @Nullable ApexInfo apexInfo, @NonNull ApplicationInfo applicationInfo) {
PackageInfo pi = new PackageInfo();
@ -365,7 +366,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ApplicationInfo generateApplicationInfo(ParsingPackageRead pkg,
@PackageManager.ApplicationInfoFlags long flags, FrameworkPackageUserState state,
@PackageManager.ApplicationInfoFlagsBits long flags, FrameworkPackageUserState state,
int userId) {
if (pkg == null) {
return null;
@ -393,7 +394,7 @@ public class PackageInfoWithoutStateUtils {
*/
@NonNull
public static ApplicationInfo generateApplicationInfoUnchecked(@NonNull ParsingPackageRead pkg,
@PackageManager.ApplicationInfoFlags long flags,
@PackageManager.ApplicationInfoFlagsBits 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();
@ -453,7 +454,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ApplicationInfo generateDelegateApplicationInfo(@Nullable ApplicationInfo ai,
@PackageManager.ApplicationInfoFlags long flags,
@PackageManager.ApplicationInfoFlagsBits long flags,
@NonNull FrameworkPackageUserState state, int userId) {
if (ai == null || !checkUseInstalledOrHidden(flags, state, ai)) {
return null;
@ -470,8 +471,8 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ActivityInfo generateDelegateActivityInfo(@Nullable ActivityInfo a,
@PackageManager.ComponentInfoFlags long flags, @NonNull FrameworkPackageUserState state,
int userId) {
@PackageManager.ComponentInfoFlagsBits long flags,
@NonNull FrameworkPackageUserState state, int userId) {
if (a == null || !checkUseInstalledOrHidden(flags, state, a.applicationInfo)) {
return null;
}
@ -485,7 +486,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ActivityInfo generateActivityInfo(ParsingPackageRead pkg, ParsedActivity a,
@PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
@PackageManager.ComponentInfoFlagsBits long flags, FrameworkPackageUserState state,
@Nullable ApplicationInfo applicationInfo, int userId) {
if (a == null) return null;
if (!checkUseInstalled(pkg, state, flags)) {
@ -510,7 +511,7 @@ public class PackageInfoWithoutStateUtils {
*/
@NonNull
public static ActivityInfo generateActivityInfoUnchecked(@NonNull ParsedActivity a,
@PackageManager.ComponentInfoFlags long flags,
@PackageManager.ComponentInfoFlagsBits long flags,
@NonNull ApplicationInfo applicationInfo) {
// Make shallow copies so we can store the metadata safely
ActivityInfo ai = new ActivityInfo();
@ -551,14 +552,14 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ActivityInfo generateActivityInfo(ParsingPackageRead pkg, ParsedActivity a,
@PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
@PackageManager.ComponentInfoFlagsBits 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 long flags, FrameworkPackageUserState state,
@PackageManager.ComponentInfoFlagsBits long flags, FrameworkPackageUserState state,
@Nullable ApplicationInfo applicationInfo, int userId) {
if (s == null) return null;
if (!checkUseInstalled(pkg, state, flags)) {
@ -583,7 +584,7 @@ public class PackageInfoWithoutStateUtils {
*/
@NonNull
public static ServiceInfo generateServiceInfoUnchecked(@NonNull ParsedService s,
@PackageManager.ComponentInfoFlags long flags,
@PackageManager.ComponentInfoFlagsBits long flags,
@NonNull ApplicationInfo applicationInfo) {
// Make shallow copies so we can store the metadata safely
ServiceInfo si = new ServiceInfo();
@ -602,14 +603,14 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ServiceInfo generateServiceInfo(ParsingPackageRead pkg, ParsedService s,
@PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
@PackageManager.ComponentInfoFlagsBits 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 long flags, FrameworkPackageUserState state,
@PackageManager.ComponentInfoFlagsBits long flags, FrameworkPackageUserState state,
@Nullable ApplicationInfo applicationInfo, int userId) {
if (p == null) return null;
if (!checkUseInstalled(pkg, state, flags)) {
@ -634,7 +635,7 @@ public class PackageInfoWithoutStateUtils {
*/
@NonNull
public static ProviderInfo generateProviderInfoUnchecked(@NonNull ParsedProvider p,
@PackageManager.ComponentInfoFlags long flags,
@PackageManager.ComponentInfoFlagsBits long flags,
@NonNull ApplicationInfo applicationInfo) {
// Make shallow copies so we can store the metadata safely
ProviderInfo pi = new ProviderInfo();
@ -664,7 +665,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static ProviderInfo generateProviderInfo(ParsingPackageRead pkg, ParsedProvider p,
@PackageManager.ComponentInfoFlags long flags, FrameworkPackageUserState state,
@PackageManager.ComponentInfoFlagsBits long flags, FrameworkPackageUserState state,
int userId) {
return generateProviderInfo(pkg, p, flags, state, null, userId);
}
@ -675,7 +676,7 @@ public class PackageInfoWithoutStateUtils {
*/
@Nullable
public static InstrumentationInfo generateInstrumentationInfo(ParsedInstrumentation i,
ParsingPackageRead pkg, @PackageManager.ComponentInfoFlags long flags, int userId,
ParsingPackageRead pkg, @PackageManager.ComponentInfoFlagsBits long flags, int userId,
boolean assignUserFields) {
if (i == null) return null;
@ -706,7 +707,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static PermissionInfo generatePermissionInfo(ParsedPermission p,
@PackageManager.ComponentInfoFlags long flags) {
@PackageManager.ComponentInfoFlagsBits long flags) {
if (p == null) return null;
PermissionInfo pi = new PermissionInfo(p.getBackgroundPermission());
@ -729,7 +730,7 @@ public class PackageInfoWithoutStateUtils {
@Nullable
public static PermissionGroupInfo generatePermissionGroupInfo(ParsedPermissionGroup pg,
@PackageManager.ComponentInfoFlags long flags) {
@PackageManager.ComponentInfoFlagsBits long flags) {
if (pg == null) return null;
PermissionGroupInfo pgi = new PermissionGroupInfo(
@ -887,7 +888,7 @@ public class PackageInfoWithoutStateUtils {
}
private static boolean checkUseInstalled(ParsingPackageRead pkg,
FrameworkPackageUserState state, @PackageManager.PackageInfoFlags long flags) {
FrameworkPackageUserState state, @PackageManager.PackageInfoFlagsBits long flags) {
// If available for the target user
return PackageUserStateUtils.isAvailable(state, flags);
}

View File

@ -26,7 +26,7 @@ import android.annotation.Size;
import android.annotation.UserIdInt;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.PackageInfoFlags;
import android.content.pm.PackageManager.PackageInfoFlagsBits;
import android.content.pm.PackageManager.PermissionResult;
import android.os.UserHandle;
@ -160,8 +160,8 @@ public class AnnotationValidations {
}
public static void validate(
Class<PackageInfoFlags> annotation, PackageInfoFlags ignored, int value) {
validateIntFlags(annotation, value,
Class<PackageInfoFlagsBits> annotation, PackageInfoFlagsBits ignored, long value) {
validateLongFlags(annotation, value,
flagsUpTo(PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS));
}
@ -212,7 +212,12 @@ public class AnnotationValidations {
invalid(annotation, "0x" + Integer.toHexString(value));
}
}
private static void validateLongFlags(
Class<? extends Annotation> annotation, long value, int validBits) {
if ((validBits & value) != validBits) {
invalid(annotation, "0x" + Long.toHexString(value));
}
}
private static void invalid(Class<? extends Annotation> annotation, Object value) {
invalid("@" + annotation.getSimpleName(), value);
}

View File

@ -159,7 +159,7 @@ public class ApplicationsStateRoboTest {
}
public List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
@PackageManager.ResolveInfoFlags int flags, @UserIdInt int userId) {
@PackageManager.ResolveInfoFlagsBits int flags, @UserIdInt int userId) {
List<ResolveInfo> resolveInfos = new ArrayList<>();
ResolveInfo resolveInfo = new ResolveInfo();
resolveInfo.activityInfo = new ActivityInfo();

View File

@ -22,7 +22,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.ResolveInfoFlags;
import android.content.pm.PackageManager.ResolveInfoFlagsBits;
import android.content.pm.ResolveInfo;
import android.os.RemoteException;
import android.os.UserHandle;
@ -73,7 +73,7 @@ public class PackageManagerWrapper {
/**
* Determine the best Activity to perform for a given Intent.
*/
public ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlags int flags) {
public ResolveInfo resolveActivity(Intent intent, @ResolveInfoFlagsBits int flags) {
final String resolvedType =
intent.resolveTypeIfNeeded(AppGlobals.getInitialApplication().getContentResolver());
try {

View File

@ -28,10 +28,6 @@ import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager.ApplicationInfoFlags;
import android.content.pm.PackageManager.ComponentInfoFlags;
import android.content.pm.PackageManager.PackageInfoFlags;
import android.content.pm.PackageManager.ResolveInfoFlags;
import android.content.pm.SigningDetails.CertCapabilities;
import android.content.pm.overlay.OverlayPaths;
import android.content.pm.parsing.component.ParsedMainComponent;
@ -198,7 +194,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP
* @see PackageManager#getPackageInfo(String, int)
*/
public abstract PackageInfo getPackageInfo(String packageName,
@PackageInfoFlags long flags, int filterCallingUid, int userId);
@PackageManager.PackageInfoFlagsBits long flags, int filterCallingUid, int userId);
/**
* Retrieve CE data directory inode number of an application.
@ -227,7 +223,8 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP
* deleted with {@code DELETE_KEEP_DATA} flag set).
*/
public abstract List<ApplicationInfo> getInstalledApplications(
@ApplicationInfoFlags long flags, @UserIdInt int userId, int callingUid);
@PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId,
int callingUid);
/**
* Retrieve launcher extras for a suspended package provided to the system in
@ -324,7 +321,8 @@ 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 long flags, int userId);
public abstract int getPackageUid(String packageName,
@PackageManager.PackageInfoFlagsBits long flags, int userId);
/**
* Retrieve all of the information we know about a particular package/application.
@ -333,7 +331,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP
* @see PackageManager#getApplicationInfo(String, int)
*/
public abstract ApplicationInfo getApplicationInfo(String packageName,
@ApplicationInfoFlags long flags, int filterCallingUid, int userId);
@PackageManager.ApplicationInfoFlagsBits long flags, int filterCallingUid, int userId);
/**
* Retrieve all of the information we know about a particular activity class.
@ -342,7 +340,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP
* @see PackageManager#getActivityInfo(ComponentName, int)
*/
public abstract ActivityInfo getActivityInfo(ComponentName component,
@ComponentInfoFlags long flags, int filterCallingUid, int userId);
@PackageManager.ComponentInfoFlagsBits long flags, int filterCallingUid, int userId);
/**
* Retrieve all activities that can be performed for the given intent.
@ -353,22 +351,24 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP
* @see PackageManager#queryIntentActivities(Intent, int)
*/
public abstract List<ResolveInfo> queryIntentActivities(
Intent intent, @Nullable String resolvedType, @ResolveInfoFlags long flags,
int filterCallingUid, int userId);
Intent intent, @Nullable String resolvedType,
@PackageManager.ResolveInfoFlagsBits long flags, int filterCallingUid, int userId);
/**
* Retrieve all receivers that can handle a broadcast of the given intent.
*/
public abstract List<ResolveInfo> queryIntentReceivers(Intent intent,
String resolvedType, @ResolveInfoFlags long flags, int filterCallingUid, int userId);
String resolvedType, @PackageManager.ResolveInfoFlagsBits 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, @ResolveInfoFlags long flags, int callingUid, int userId);
Intent intent, @PackageManager.ResolveInfoFlagsBits long flags, int callingUid,
int userId);
/**
* Interface to {@link com.android.server.pm.PackageManagerService#getHomeActivitiesAsUser}.
@ -592,20 +592,21 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP
* Resolves an activity intent, allowing instant apps to be resolved.
*/
public abstract ResolveInfo resolveIntent(Intent intent, String resolvedType,
@ResolveInfoFlags long flags, @PrivateResolveFlags long privateResolveFlags, int userId,
boolean resolveForStart, int filterCallingUid);
@PackageManager.ResolveInfoFlagsBits 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,
@ResolveInfoFlags long flags, int userId, int callingUid);
@PackageManager.ResolveInfoFlagsBits long flags, int userId, int callingUid);
/**
* Resolves a content provider intent.
*/
public abstract ProviderInfo resolveContentProvider(String name, @ComponentInfoFlags long flags,
int userId, int callingUid);
public abstract ProviderInfo resolveContentProvider(String name,
@PackageManager.ComponentInfoFlagsBits long flags, int userId, int callingUid);
/**
* Track the creator of a new isolated uid.
@ -877,7 +878,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP
/** Returns {@code true} if the specified component is enabled and matches the given flags. */
public abstract boolean isEnabledAndMatches(@NonNull ParsedMainComponent component,
@ComponentInfoFlags long flags, int userId);
@PackageManager.ComponentInfoFlagsBits long flags, int userId);
/** Returns {@code true} if the given user requires extra badging for icons. */
public abstract boolean userNeedsBadging(int userId);

View File

@ -133,7 +133,7 @@ public interface Computer {
}
@Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED)
@NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent, String resolvedType,
@PackageManager.ResolveInfoFlags long flags,
@PackageManager.ResolveInfoFlagsBits long flags,
@PackageManagerInternal.PrivateResolveFlags long privateResolveFlags,
int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits);
@Computer.LiveImplementation(override = Computer.LiveImplementation.NOT_ALLOWED)
@ -338,8 +338,8 @@ public interface Computer {
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@NonNull
int[] getPackageGids(@NonNull String packageName, @PackageManager.PackageInfoFlags long flags,
@UserIdInt int userId);
int[] getPackageGids(@NonNull String packageName,
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
int getTargetSdkVersion(@NonNull String packageName);
@ -351,12 +351,12 @@ public interface Computer {
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@Nullable
ActivityInfo getReceiverInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId);
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@Nullable
ParceledListSlice<SharedLibraryInfo> getSharedLibraries(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId);
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
boolean canRequestPackageInstalls(@NonNull String packageName, int callingUid,
@ -369,18 +369,18 @@ public interface Computer {
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@Nullable
List<VersionedPackage> getPackagesUsingSharedLibrary(@NonNull SharedLibraryInfo libInfo,
@PackageManager.PackageInfoFlags long flags, int callingUid, @UserIdInt int userId);
@PackageManager.PackageInfoFlagsBits long flags, int callingUid, @UserIdInt int userId);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@Nullable
ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries(
@NonNull String packageName, @PackageManager.PackageInfoFlags long flags,
@NonNull String packageName, @PackageManager.PackageInfoFlagsBits long flags,
@UserIdInt int userId);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@Nullable
ProviderInfo getProviderInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId);
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@Nullable
@ -439,17 +439,18 @@ public interface Computer {
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@NonNull
ParceledListSlice<PackageInfo> getPackagesHoldingPermissions(@NonNull String[] permissions,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId);
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@NonNull
List<ApplicationInfo> getInstalledApplications(@PackageManager.ApplicationInfoFlags long flags,
@UserIdInt int userId, int callingUid);
List<ApplicationInfo> getInstalledApplications(
@PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId,
int callingUid);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@Nullable
ProviderInfo resolveContentProvider(@NonNull String name,
@PackageManager.ResolveInfoFlags long flags, @UserIdInt int userId, int callingUid);
@PackageManager.ResolveInfoFlagsBits long flags, @UserIdInt int userId, int callingUid);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@Nullable
@ -463,7 +464,7 @@ public interface Computer {
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@NonNull
ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName, int uid,
@PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey);
@PackageManager.ComponentInfoFlagsBits long flags, @Nullable String metaDataKey);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
@Nullable
@ -560,7 +561,7 @@ public interface Computer {
boolean canQueryPackage(int callingUid, @Nullable String targetPackageName);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)
int getPackageUid(@NonNull String packageName, @PackageManager.PackageInfoFlags long flags,
int getPackageUid(@NonNull String packageName, @PackageManager.PackageInfoFlagsBits long flags,
@UserIdInt int userId);
@Computer.LiveImplementation(override = LiveImplementation.MANDATORY)

View File

@ -429,7 +429,7 @@ public class ComputerEngine implements Computer {
}
public final @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
@PackageManagerInternal.PrivateResolveFlags long privateResolveFlags,
int filterCallingUid, int userId, boolean resolveForStart,
boolean allowDynamicSplits) {
@ -541,14 +541,14 @@ public class ComputerEngine implements Computer {
}
public final @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits 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, @PackageManager.ResolveInfoFlags long flags, int userId,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId,
int callingUid, boolean includeInstantApps) {
if (!mUserManager.exists(userId)) return Collections.emptyList();
enforceCrossUserOrProfilePermission(callingUid,
@ -625,7 +625,7 @@ public class ComputerEngine implements Computer {
}
protected @NonNull List<ResolveInfo> queryIntentServicesInternalBody(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId,
int callingUid, String instantAppPkgName) {
// reader
String pkgName = intent.getPackage();
@ -653,7 +653,7 @@ public class ComputerEngine implements Computer {
}
public @NonNull QueryIntentActivitiesResult queryIntentActivitiesInternalBody(
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits,
String pkgName, String instantAppPkgName) {
// reader
@ -786,7 +786,7 @@ public class ComputerEngine implements Computer {
}
public final ActivityInfo getActivityInfo(ComponentName component,
@PackageManager.ResolveInfoFlags long flags, int userId) {
@PackageManager.ResolveInfoFlagsBits long flags, int userId) {
return getActivityInfoInternal(component, flags, Binder.getCallingUid(), userId);
}
@ -797,7 +797,7 @@ public class ComputerEngine implements Computer {
* trusted and will be used as-is; unlike userId which will be validated by this method.
*/
public final ActivityInfo getActivityInfoInternal(ComponentName component,
@PackageManager.ResolveInfoFlags long flags, int filterCallingUid, int userId) {
@PackageManager.ResolveInfoFlagsBits long flags, int filterCallingUid, int userId) {
if (!mUserManager.exists(userId)) return null;
flags = updateFlagsForComponent(flags, userId);
@ -811,7 +811,7 @@ public class ComputerEngine implements Computer {
}
protected ActivityInfo getActivityInfoInternalBody(ComponentName component,
@PackageManager.ResolveInfoFlags long flags, int filterCallingUid, int userId) {
@PackageManager.ResolveInfoFlagsBits long flags, int filterCallingUid, int userId) {
ParsedActivity a = mComponentResolver.getActivity(component);
if (DEBUG_PACKAGE_INFO) Log.v(TAG, "getActivityInfo " + component + ": " + a);
@ -879,7 +879,7 @@ public class ComputerEngine implements Computer {
}
public final ApplicationInfo getApplicationInfo(String packageName,
@PackageManager.ApplicationInfoFlags long flags, int userId) {
@PackageManager.ApplicationInfoFlagsBits long flags, int userId) {
return getApplicationInfoInternal(packageName, flags, Binder.getCallingUid(), userId);
}
@ -890,7 +890,7 @@ public class ComputerEngine implements Computer {
* trusted and will be used as-is; unlike userId which will be validated by this method.
*/
public final ApplicationInfo getApplicationInfoInternal(String packageName,
@PackageManager.ApplicationInfoFlags long flags,
@PackageManager.ApplicationInfoFlagsBits long flags,
int filterCallingUid, int userId) {
if (!mUserManager.exists(userId)) return null;
flags = updateFlagsForApplication(flags, userId);
@ -905,7 +905,7 @@ public class ComputerEngine implements Computer {
}
protected ApplicationInfo getApplicationInfoInternalBody(String packageName,
@PackageManager.ApplicationInfoFlags long flags,
@PackageManager.ApplicationInfoFlagsBits long flags,
int filterCallingUid, int userId) {
// writer
// Normalize package name to handle renamed packages and static libs
@ -1161,7 +1161,7 @@ public class ComputerEngine implements Computer {
}
public final CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int sourceUserId,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int sourceUserId,
int parentUserId) {
if (!mUserManager.hasUserRestriction(UserManager.ALLOW_PARENT_PROFILE_APP_LINKING,
sourceUserId)) {
@ -1426,7 +1426,7 @@ public class ComputerEngine implements Computer {
}
private List<ResolveInfo> maybeAddInstantAppInstaller(List<ResolveInfo> result,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits 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;
@ -1532,7 +1532,7 @@ public class ComputerEngine implements Computer {
}
public final PackageInfo generatePackageInfo(PackageStateInternal ps,
@PackageManager.PackageInfoFlags long flags, int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
if (!mUserManager.exists(userId)) return null;
if (ps == null) {
return null;
@ -1607,7 +1607,7 @@ public class ComputerEngine implements Computer {
}
public final PackageInfo getPackageInfo(String packageName,
@PackageManager.PackageInfoFlags long flags, int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
return getPackageInfoInternal(packageName, PackageManager.VERSION_CODE_HIGHEST,
flags, Binder.getCallingUid(), userId);
}
@ -1808,7 +1808,7 @@ public class ComputerEngine implements Computer {
@Nullable
private CrossProfileDomainInfo createForwardingResolveInfo(
@NonNull CrossProfileIntentFilter filter, @NonNull Intent intent,
@Nullable String resolvedType, @PackageManager.ResolveInfoFlags long flags,
@Nullable String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
int sourceUserId) {
int targetUserId = filter.getTargetUserId();
if (!isUserEnabled(targetUserId)) {
@ -1970,7 +1970,7 @@ public class ComputerEngine implements Computer {
}
public final ServiceInfo getServiceInfo(ComponentName component,
@PackageManager.ResolveInfoFlags long flags, int userId) {
@PackageManager.ResolveInfoFlagsBits long flags, int userId) {
if (!mUserManager.exists(userId)) return null;
final int callingUid = Binder.getCallingUid();
flags = updateFlagsForComponent(flags, userId);
@ -1981,7 +1981,7 @@ public class ComputerEngine implements Computer {
}
protected ServiceInfo getServiceInfoBody(ComponentName component,
@PackageManager.ResolveInfoFlags long flags, int userId, int callingUid) {
@PackageManager.ResolveInfoFlagsBits long flags, int userId, int callingUid) {
ParsedService s = mComponentResolver.getService(component);
if (DEBUG_PACKAGE_INFO) {
Log.v(
@ -2233,7 +2233,7 @@ public class ComputerEngine implements Computer {
}
private boolean filterStaticSharedLibPackage(@Nullable PackageStateInternal ps, int uid,
int userId, @PackageManager.ComponentInfoFlags long flags) {
int userId, @PackageManager.ComponentInfoFlagsBits long flags) {
// Callers can access only the static shared libs they depend on, otherwise they need to
// explicitly ask for the static shared libraries given the caller is allowed to access
// all static libs.
@ -2289,7 +2289,7 @@ public class ComputerEngine implements Computer {
}
private boolean filterSdkLibPackage(@Nullable PackageStateInternal ps, int uid,
int userId, @PackageManager.ComponentInfoFlags long flags) {
int userId, @PackageManager.ComponentInfoFlagsBits long flags) {
// Callers can access only the SDK libs they depend on, otherwise they need to
// explicitly ask for the SDKs given the caller is allowed to access
// all shared libs.
@ -2346,7 +2346,7 @@ public class ComputerEngine implements Computer {
@Override
public final boolean filterSharedLibPackage(@Nullable PackageStateInternal ps, int uid,
int userId, @PackageManager.ComponentInfoFlags long flags) {
int userId, @PackageManager.ComponentInfoFlagsBits long flags) {
return filterStaticSharedLibPackage(ps, uid, userId, flags) || filterSdkLibPackage(ps, uid,
userId, flags);
}
@ -2445,7 +2445,7 @@ public class ComputerEngine implements Computer {
* activity was not set by the DPC.
*/
public final boolean isImplicitImageCaptureIntentAndNotSetByDpcLocked(Intent intent,
int userId, String resolvedType, @PackageManager.ResolveInfoFlags long flags) {
int userId, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags) {
return intent.isImplicitImageCaptureIntent() && !isPersistentPreferredActivitySetByDpm(
intent, userId, resolvedType, flags);
}
@ -2486,7 +2486,7 @@ public class ComputerEngine implements Computer {
private boolean isInstantAppResolutionAllowed(
Intent intent, List<ResolveInfo> resolvedActivities, int userId,
boolean skipPackageCheck, @PackageManager.ResolveInfoFlags long flags) {
boolean skipPackageCheck, @PackageManager.ResolveInfoFlagsBits long flags) {
if (mInstantAppResolverConnection == null) {
return false;
}
@ -2526,7 +2526,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, @PackageManager.ResolveInfoFlags long flags) {
boolean skipPackageCheck, @PackageManager.ResolveInfoFlagsBits long flags) {
final int count = (resolvedActivities == null ? 0 : resolvedActivities.size());
for (int n = 0; n < count; n++) {
final ResolveInfo info = resolvedActivities.get(n);
@ -2558,7 +2558,7 @@ public class ComputerEngine implements Computer {
}
private boolean isPersistentPreferredActivitySetByDpm(Intent intent, int userId,
String resolvedType, @PackageManager.ResolveInfoFlags long flags) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags) {
PersistentPreferredIntentResolver ppir =
mSettings.getPersistentPreferredActivities(userId);
//TODO(b/158003772): Remove double query
@ -2716,7 +2716,7 @@ public class ComputerEngine implements Computer {
}
public int getPackageUidInternal(String packageName,
@PackageManager.PackageInfoFlags long flags, int userId, int callingUid) {
@PackageManager.PackageInfoFlagsBits long flags, int userId, int callingUid) {
// reader
final AndroidPackage p = mPackages.get(packageName);
if (p != null && AndroidPackageUtils.isMatchForSystemOnly(p, flags)) {
@ -3239,7 +3239,7 @@ public class ComputerEngine implements Computer {
// The body of findPreferredActivity.
protected PackageManagerService.FindPreferredActivityBodyResult findPreferredActivityBody(
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
List<ResolveInfo> query, boolean always,
boolean removeMatches, boolean debug, int userId, boolean queryMayBeFiltered,
int callingUid, boolean isDeviceProvisioned) {
@ -3448,7 +3448,7 @@ public class ComputerEngine implements Computer {
}
public final PackageManagerService.FindPreferredActivityBodyResult findPreferredActivityInternal(
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
List<ResolveInfo> query, boolean always,
boolean removeMatches, boolean debug, int userId, boolean queryMayBeFiltered) {
@ -3465,7 +3465,7 @@ public class ComputerEngine implements Computer {
}
public final ResolveInfo findPersistentPreferredActivityLP(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
List<ResolveInfo> query, boolean debug, int userId) {
final int n = query.size();
PersistentPreferredIntentResolver ppir =
@ -3663,7 +3663,7 @@ public class ComputerEngine implements Computer {
@Override
public int[] getPackageGids(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
if (!mUserManager.exists(userId)) return null;
final int callingUid = Binder.getCallingUid();
flags = updateFlagsForPackage(flags, userId);
@ -3740,7 +3740,7 @@ public class ComputerEngine implements Computer {
@Nullable
@Override
public ActivityInfo getReceiverInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId) {
if (!mUserManager.exists(userId)) return null;
final int callingUid = Binder.getCallingUid();
flags = updateFlagsForComponent(flags, userId);
@ -3773,7 +3773,7 @@ public class ComputerEngine implements Computer {
@Nullable
@Override
public ParceledListSlice<SharedLibraryInfo> getSharedLibraries(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
if (!mUserManager.exists(userId)) return null;
Preconditions.checkArgumentNonnegative(userId, "userId must be >= 0");
final int callingUid = Binder.getCallingUid();
@ -3902,7 +3902,8 @@ public class ComputerEngine implements Computer {
@Override
public List<VersionedPackage> getPackagesUsingSharedLibrary(@NonNull SharedLibraryInfo libInfo,
@PackageManager.PackageInfoFlags long flags, int callingUid, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int callingUid,
@UserIdInt int userId) {
List<VersionedPackage> versionedPackages = null;
final ArrayMap<String, ? extends PackageStateInternal> packageStates = getPackageStates();
final int packageCount = packageStates.size();
@ -3964,7 +3965,7 @@ public class ComputerEngine implements Computer {
@Nullable
@Override
public ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries(
@NonNull String packageName, @PackageManager.PackageInfoFlags long flags,
@NonNull String packageName, @PackageManager.PackageInfoFlagsBits long flags,
@UserIdInt int userId) {
mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_SHARED_LIBRARIES,
"getDeclaredSharedLibraries");
@ -4041,7 +4042,7 @@ public class ComputerEngine implements Computer {
@Nullable
@Override
public ProviderInfo getProviderInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId) {
if (!mUserManager.exists(userId)) return null;
final int callingUid = Binder.getCallingUid();
flags = updateFlagsForComponent(flags, userId);
@ -4515,7 +4516,7 @@ public class ComputerEngine implements Computer {
@NonNull
@Override
public ParceledListSlice<PackageInfo> getPackagesHoldingPermissions(
@NonNull String[] permissions, @PackageManager.PackageInfoFlags long flags,
@NonNull String[] permissions, @PackageManager.PackageInfoFlagsBits long flags,
@UserIdInt int userId) {
if (!mUserManager.exists(userId)) return ParceledListSlice.emptyList();
flags = updateFlagsForPackage(flags, userId);
@ -4536,7 +4537,7 @@ public class ComputerEngine implements Computer {
}
private void addPackageHoldingPermissions(ArrayList<PackageInfo> list, PackageStateInternal ps,
String[] permissions, boolean[] tmp, @PackageManager.PackageInfoFlags long flags,
String[] permissions, boolean[] tmp, @PackageManager.PackageInfoFlagsBits long flags,
int userId) {
int numMatch = 0;
for (int i=0; i<permissions.length; i++) {
@ -4578,7 +4579,7 @@ public class ComputerEngine implements Computer {
@NonNull
@Override
public List<ApplicationInfo> getInstalledApplications(
@PackageManager.ApplicationInfoFlags long flags, @UserIdInt int userId,
@PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId,
int callingUid) {
if (getInstantAppPackageName(callingUid) != null) {
return Collections.emptyList();
@ -4655,7 +4656,8 @@ public class ComputerEngine implements Computer {
@Nullable
@Override
public ProviderInfo resolveContentProvider(@NonNull String name,
@PackageManager.ResolveInfoFlags long flags, @UserIdInt int userId, int callingUid) {
@PackageManager.ResolveInfoFlagsBits 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);
@ -4744,7 +4746,8 @@ public class ComputerEngine implements Computer {
@NonNull
@Override
public ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName,
int uid, @PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey) {
int uid, @PackageManager.ComponentInfoFlagsBits long flags,
@Nullable String metaDataKey) {
final int callingUid = Binder.getCallingUid();
final int userId = processName != null ? UserHandle.getUserId(uid)
: UserHandle.getCallingUserId();
@ -5290,7 +5293,7 @@ public class ComputerEngine implements Computer {
@Override
public int getPackageUid(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
if (!mUserManager.exists(userId)) return -1;
final int callingUid = Binder.getCallingUid();
flags = updateFlagsForPackage(flags, userId);

View File

@ -314,7 +314,7 @@ public final class ComputerLocked extends ComputerEngine {
@Override
public int[] getPackageGids(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
synchronized (mLock) {
return super.getPackageGids(packageName, flags, userId);
}
@ -339,7 +339,7 @@ public final class ComputerLocked extends ComputerEngine {
@Nullable
@Override
public ActivityInfo getReceiverInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId) {
synchronized (mLock) {
return super.getReceiverInfo(component, flags, userId);
}
@ -348,7 +348,7 @@ public final class ComputerLocked extends ComputerEngine {
@Nullable
@Override
public ParceledListSlice<SharedLibraryInfo> getSharedLibraries(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
synchronized (mLock) {
return super.getSharedLibraries(packageName, flags, userId);
}
@ -365,7 +365,8 @@ public final class ComputerLocked extends ComputerEngine {
@Override
public List<VersionedPackage> getPackagesUsingSharedLibrary(@NonNull SharedLibraryInfo libInfo,
@PackageManager.PackageInfoFlags long flags, int callingUid, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int callingUid,
@UserIdInt int userId) {
synchronized (mLock) {
return super.getPackagesUsingSharedLibrary(libInfo, flags, callingUid, userId);
}
@ -374,7 +375,7 @@ public final class ComputerLocked extends ComputerEngine {
@Nullable
@Override
public ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries(
@NonNull String packageName, @PackageManager.PackageInfoFlags long flags,
@NonNull String packageName, @PackageManager.PackageInfoFlagsBits long flags,
@UserIdInt int userId) {
synchronized (mLock) {
return super.getDeclaredSharedLibraries(packageName, flags, userId);
@ -384,7 +385,7 @@ public final class ComputerLocked extends ComputerEngine {
@Nullable
@Override
public ProviderInfo getProviderInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId) {
synchronized (mLock) {
return super.getProviderInfo(component, flags, userId);
}
@ -498,7 +499,7 @@ public final class ComputerLocked extends ComputerEngine {
@NonNull
@Override
public ParceledListSlice<PackageInfo> getPackagesHoldingPermissions(
@NonNull String[] permissions, @PackageManager.PackageInfoFlags long flags,
@NonNull String[] permissions, @PackageManager.PackageInfoFlagsBits long flags,
@UserIdInt int userId) {
synchronized (mLock) {
return super.getPackagesHoldingPermissions(permissions, flags, userId);
@ -508,7 +509,7 @@ public final class ComputerLocked extends ComputerEngine {
@NonNull
@Override
public List<ApplicationInfo> getInstalledApplications(
@PackageManager.ApplicationInfoFlags long flags, @UserIdInt int userId,
@PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId,
int callingUid) {
synchronized (mLock) {
return super.getInstalledApplications(flags, userId, callingUid);
@ -518,7 +519,8 @@ public final class ComputerLocked extends ComputerEngine {
@Nullable
@Override
public ProviderInfo resolveContentProvider(@NonNull String name,
@PackageManager.ResolveInfoFlags long flags, @UserIdInt int userId, int callingUid) {
@PackageManager.ResolveInfoFlagsBits long flags, @UserIdInt int userId,
int callingUid) {
synchronized (mLock) {
return super.resolveContentProvider(name, flags, userId, callingUid);
}
@ -544,7 +546,8 @@ public final class ComputerLocked extends ComputerEngine {
@NonNull
@Override
public ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName,
int uid, @PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey) {
int uid, @PackageManager.ComponentInfoFlagsBits long flags,
@Nullable String metaDataKey) {
synchronized (mLock) {
return super.queryContentProviders(processName, uid, flags, metaDataKey);
}
@ -717,7 +720,7 @@ public final class ComputerLocked extends ComputerEngine {
@Override
public int getPackageUid(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
synchronized (mLock) {
return super.getPackageUid(packageName, flags, userId);
}

View File

@ -97,7 +97,7 @@ public final class ComputerTracker implements Computer {
}
public @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
@PackageManagerInternal.PrivateResolveFlags long privateResolveFlags,
int filterCallingUid, int userId, boolean resolveForStart,
boolean allowDynamicSplits) {
@ -111,7 +111,7 @@ public final class ComputerTracker implements Computer {
}
}
public @NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId) {
ThreadComputer current = snapshot();
try {
return current.mComputer.queryIntentActivitiesInternal(intent, resolvedType, flags,
@ -121,7 +121,7 @@ public final class ComputerTracker implements Computer {
}
}
public @NonNull List<ResolveInfo> queryIntentServicesInternal(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId,
int callingUid, boolean includeInstantApps) {
ThreadComputer current = snapshot();
try {
@ -132,7 +132,7 @@ public final class ComputerTracker implements Computer {
}
}
public @NonNull QueryIntentActivitiesResult queryIntentActivitiesInternalBody(
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits,
String pkgName, String instantAppPkgName) {
ThreadComputer current = live();
@ -145,7 +145,7 @@ public final class ComputerTracker implements Computer {
}
}
public ActivityInfo getActivityInfo(ComponentName component,
@PackageManager.ComponentInfoFlags long flags, int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, int userId) {
ThreadComputer current = snapshot();
try {
return current.mComputer.getActivityInfo(component, flags, userId);
@ -154,7 +154,7 @@ public final class ComputerTracker implements Computer {
}
}
public ActivityInfo getActivityInfoInternal(ComponentName component,
@PackageManager.ComponentInfoFlags long flags,
@PackageManager.ComponentInfoFlagsBits long flags,
int filterCallingUid, int userId) {
ThreadComputer current = live();
try {
@ -191,7 +191,7 @@ public final class ComputerTracker implements Computer {
}
}
public ApplicationInfo getApplicationInfo(String packageName,
@PackageManager.ApplicationInfoFlags long flags, int userId) {
@PackageManager.ApplicationInfoFlagsBits long flags, int userId) {
ThreadComputer current = snapshot();
try {
return current.mComputer.getApplicationInfo(packageName, flags, userId);
@ -200,7 +200,7 @@ public final class ComputerTracker implements Computer {
}
}
public ApplicationInfo getApplicationInfoInternal(String packageName,
@PackageManager.ApplicationInfoFlags long flags, int filterCallingUid, int userId) {
@PackageManager.ApplicationInfoFlagsBits long flags, int filterCallingUid, int userId) {
ThreadComputer current = live();
try {
return current.mComputer.getApplicationInfoInternal(packageName, flags,
@ -227,7 +227,7 @@ public final class ComputerTracker implements Computer {
}
}
public CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int sourceUserId,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int sourceUserId,
int parentUserId) {
ThreadComputer current = live();
try {
@ -268,7 +268,7 @@ public final class ComputerTracker implements Computer {
}
}
public PackageInfo generatePackageInfo(PackageStateInternal ps,
@PackageManager.PackageInfoFlags long flags, int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
ThreadComputer current = live();
try {
return current.mComputer.generatePackageInfo(ps, flags, userId);
@ -277,7 +277,7 @@ public final class ComputerTracker implements Computer {
}
}
public PackageInfo getPackageInfo(String packageName,
@PackageManager.PackageInfoFlags long flags, int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
ThreadComputer current = snapshot();
try {
return current.mComputer.getPackageInfo(packageName, flags, userId);
@ -341,7 +341,7 @@ public final class ComputerTracker implements Computer {
}
}
public ServiceInfo getServiceInfo(ComponentName component,
@PackageManager.ComponentInfoFlags long flags, int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, int userId) {
ThreadComputer current = live();
try {
return current.mComputer.getServiceInfo(component, flags, userId);
@ -446,7 +446,7 @@ public final class ComputerTracker implements Computer {
}
}
public boolean filterSharedLibPackage(@Nullable PackageStateInternal ps, int uid,
int userId, @PackageManager.ComponentInfoFlags long flags) {
int userId, @PackageManager.ComponentInfoFlagsBits long flags) {
ThreadComputer current = live();
try {
return current.mComputer.filterSharedLibPackage(ps, uid, userId, flags);
@ -480,7 +480,7 @@ public final class ComputerTracker implements Computer {
}
}
public boolean isImplicitImageCaptureIntentAndNotSetByDpcLocked(Intent intent,
int userId, String resolvedType, @PackageManager.ResolveInfoFlags long flags) {
int userId, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags) {
ThreadComputer current = live();
try {
return current.mComputer.isImplicitImageCaptureIntentAndNotSetByDpcLocked(intent,
@ -553,7 +553,7 @@ public final class ComputerTracker implements Computer {
}
}
public int getPackageUidInternal(String packageName,
@PackageManager.PackageInfoFlags long flags, int userId, int callingUid) {
@PackageManager.PackageInfoFlagsBits long flags, int userId, int callingUid) {
ThreadComputer current = live();
try {
return current.mComputer.getPackageUidInternal(packageName, flags, userId,
@ -648,7 +648,7 @@ public final class ComputerTracker implements Computer {
}
}
public PackageManagerService.FindPreferredActivityBodyResult findPreferredActivityInternal(
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
List<ResolveInfo> query, boolean always, boolean removeMatches, boolean debug,
int userId, boolean queryMayBeFiltered) {
ThreadComputer current = live();
@ -660,7 +660,7 @@ public final class ComputerTracker implements Computer {
}
}
public ResolveInfo findPersistentPreferredActivityLP(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
List<ResolveInfo> query, boolean debug, int userId) {
ThreadComputer current = live();
try {
@ -749,7 +749,7 @@ public final class ComputerTracker implements Computer {
@Override
public int[] getPackageGids(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.getPackageGids(packageName, flags, userId);
}
@ -774,7 +774,7 @@ public final class ComputerTracker implements Computer {
@Nullable
@Override
public ActivityInfo getReceiverInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.getReceiverInfo(component, flags, userId);
}
@ -783,7 +783,7 @@ public final class ComputerTracker implements Computer {
@Nullable
@Override
public ParceledListSlice<SharedLibraryInfo> getSharedLibraries(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.getSharedLibraries(packageName, flags, userId);
}
@ -808,7 +808,8 @@ public final class ComputerTracker implements Computer {
@Override
public List<VersionedPackage> getPackagesUsingSharedLibrary(@NonNull SharedLibraryInfo libInfo,
@PackageManager.PackageInfoFlags long flags, int callingUid, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int callingUid,
@UserIdInt int userId) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.getPackagesUsingSharedLibrary(libInfo, flags, callingUid,
userId);
@ -818,7 +819,7 @@ public final class ComputerTracker implements Computer {
@Nullable
@Override
public ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries(
@NonNull String packageName, @PackageManager.PackageInfoFlags long flags,
@NonNull String packageName, @PackageManager.PackageInfoFlagsBits long flags,
@UserIdInt int userId) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.getDeclaredSharedLibraries(packageName, flags, userId);
@ -828,7 +829,7 @@ public final class ComputerTracker implements Computer {
@Nullable
@Override
public ProviderInfo getProviderInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.getProviderInfo(component, flags, userId);
}
@ -943,7 +944,7 @@ public final class ComputerTracker implements Computer {
@NonNull
@Override
public ParceledListSlice<PackageInfo> getPackagesHoldingPermissions(
@NonNull String[] permissions, @PackageManager.PackageInfoFlags long flags,
@NonNull String[] permissions, @PackageManager.PackageInfoFlagsBits long flags,
@UserIdInt int userId) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.getPackagesHoldingPermissions(permissions, flags, userId);
@ -953,7 +954,7 @@ public final class ComputerTracker implements Computer {
@NonNull
@Override
public List<ApplicationInfo> getInstalledApplications(
@PackageManager.ApplicationInfoFlags long flags, @UserIdInt int userId,
@PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId,
int callingUid) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.getInstalledApplications(flags, userId, callingUid);
@ -963,7 +964,8 @@ public final class ComputerTracker implements Computer {
@Nullable
@Override
public ProviderInfo resolveContentProvider(@NonNull String name,
@PackageManager.ResolveInfoFlags long flags, @UserIdInt int userId, int callingUid) {
@PackageManager.ResolveInfoFlagsBits long flags, @UserIdInt int userId,
int callingUid) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.resolveContentProvider(name, flags, userId, callingUid);
}
@ -990,7 +992,8 @@ public final class ComputerTracker implements Computer {
@NonNull
@Override
public ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName,
int uid, @PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey) {
int uid, @PackageManager.ComponentInfoFlagsBits long flags,
@Nullable String metaDataKey) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.queryContentProviders(processName, uid, flags, metaDataKey);
}
@ -1164,7 +1167,7 @@ public final class ComputerTracker implements Computer {
@Override
public int getPackageUid(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
try (ThreadComputer current = snapshot()) {
return current.mComputer.getPackageUid(packageName, flags, userId);
}

View File

@ -2577,7 +2577,7 @@ public class PackageManagerService extends IPackageManager.Stub
}
private PackageInfo generatePackageInfo(@NonNull PackageStateInternal ps,
@PackageManager.PackageInfoFlags long flags, int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
return mComputer.generatePackageInfo(ps, flags, userId);
}
@ -2617,13 +2617,13 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public PackageInfo getPackageInfo(String packageName,
@PackageManager.PackageInfoFlags long flags, int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
return mComputer.getPackageInfo(packageName, flags, userId);
}
@Override
public PackageInfo getPackageInfoVersioned(VersionedPackage versionedPackage,
@PackageManager.PackageInfoFlags long flags, int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
return mComputer.getPackageInfoInternal(versionedPackage.getPackageName(),
versionedPackage.getLongVersionCode(), flags, Binder.getCallingUid(), userId);
}
@ -2660,7 +2660,7 @@ public class PackageManagerService extends IPackageManager.Stub
}
private boolean filterSharedLibPackage(@Nullable PackageStateInternal ps, int uid,
int userId, @PackageManager.ComponentInfoFlags long flags) {
int userId, @PackageManager.ComponentInfoFlagsBits long flags) {
return mComputer.filterSharedLibPackage(ps, uid, userId, flags);
}
@ -2676,17 +2676,17 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public int getPackageUid(@NonNull String packageName,
@PackageManager.PackageInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.PackageInfoFlagsBits long flags, @UserIdInt int userId) {
return mComputer.getPackageUid(packageName, flags, userId);
}
private int getPackageUidInternal(String packageName,
@PackageManager.PackageInfoFlags long flags, int userId, int callingUid) {
@PackageManager.PackageInfoFlagsBits long flags, int userId, int callingUid) {
return mComputer.getPackageUidInternal(packageName, flags, userId, callingUid);
}
@Override
public int[] getPackageGids(String packageName, @PackageManager.PackageInfoFlags long flags,
public int[] getPackageGids(String packageName, @PackageManager.PackageInfoFlagsBits long flags,
int userId) {
return mComputer.getPackageGids(packageName, flags, userId);
}
@ -2701,14 +2701,14 @@ public class PackageManagerService extends IPackageManager.Stub
}
private ApplicationInfo generateApplicationInfoFromSettings(String packageName,
@PackageManager.ApplicationInfoFlags long flags, int filterCallingUid, int userId) {
@PackageManager.ApplicationInfoFlagsBits long flags, int filterCallingUid, int userId) {
return mComputer.generateApplicationInfoFromSettings(packageName, flags, filterCallingUid,
userId);
}
@Override
public ApplicationInfo getApplicationInfo(String packageName,
@PackageManager.ApplicationInfoFlags long flags, int userId) {
@PackageManager.ApplicationInfoFlagsBits long flags, int userId) {
return mComputer.getApplicationInfo(packageName, flags, userId);
}
@ -2719,7 +2719,7 @@ public class PackageManagerService extends IPackageManager.Stub
* trusted and will be used as-is; unlike userId which will be validated by this method.
*/
private ApplicationInfo getApplicationInfoInternal(String packageName,
@PackageManager.ApplicationInfoFlags long flags,
@PackageManager.ApplicationInfoFlagsBits long flags,
int filterCallingUid, int userId) {
return mComputer.getApplicationInfoInternal(packageName, flags,
filterCallingUid, userId);
@ -2997,7 +2997,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public ActivityInfo getActivityInfo(ComponentName component,
@PackageManager.ComponentInfoFlags long flags, int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, int userId) {
return mComputer.getActivityInfo(component, flags, userId);
}
@ -3008,7 +3008,7 @@ public class PackageManagerService extends IPackageManager.Stub
* trusted and will be used as-is; unlike userId which will be validated by this method.
*/
private ActivityInfo getActivityInfoInternal(ComponentName component,
@PackageManager.ComponentInfoFlags long flags, int filterCallingUid, int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, int filterCallingUid, int userId) {
return mComputer.getActivityInfoInternal(component, flags,
filterCallingUid, userId);
}
@ -3022,42 +3022,42 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public ActivityInfo getReceiverInfo(ComponentName component,
@PackageManager.ComponentInfoFlags long flags, int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, int userId) {
return mComputer.getReceiverInfo(component, flags, userId);
}
@Override
public ParceledListSlice<SharedLibraryInfo> getSharedLibraries(String packageName,
@PackageManager.PackageInfoFlags long flags, int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
return mComputer.getSharedLibraries(packageName, flags, userId);
}
@Nullable
@Override
public ParceledListSlice<SharedLibraryInfo> getDeclaredSharedLibraries(
@NonNull String packageName, @PackageManager.PackageInfoFlags long flags,
@NonNull String packageName, @PackageManager.PackageInfoFlagsBits long flags,
@NonNull int userId) {
return mComputer.getDeclaredSharedLibraries(packageName, flags, userId);
}
@Nullable
List<VersionedPackage> getPackagesUsingSharedLibrary(
SharedLibraryInfo libInfo, @PackageManager.PackageInfoFlags long flags, int callingUid,
int userId) {
SharedLibraryInfo libInfo, @PackageManager.PackageInfoFlagsBits long flags,
int callingUid, int userId) {
return mComputer.getPackagesUsingSharedLibrary(libInfo, flags, callingUid, userId);
}
@Nullable
@Override
public ServiceInfo getServiceInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId) {
return mComputer.getServiceInfo(component, flags, userId);
}
@Nullable
@Override
public ProviderInfo getProviderInfo(@NonNull ComponentName component,
@PackageManager.ComponentInfoFlags long flags, @UserIdInt int userId) {
@PackageManager.ComponentInfoFlagsBits long flags, @UserIdInt int userId) {
return mComputer.getProviderInfo(component, flags, userId);
}
@ -3346,7 +3346,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public ResolveInfo resolveIntent(Intent intent, String resolvedType,
@PackageManager.ResolveInfoFlags long flags, int userId) {
@PackageManager.ResolveInfoFlagsBits long flags, int userId) {
return mResolveIntentHelper.resolveIntentInternal(intent, resolvedType, flags,
0 /*privateResolveFlags*/, userId, false, Binder.getCallingUid());
}
@ -3391,7 +3391,7 @@ public class PackageManagerService extends IPackageManager.Stub
*/
@GuardedBy("mLock")
boolean isImplicitImageCaptureIntentAndNotSetByDpcLocked(Intent intent, int userId,
String resolvedType, @PackageManager.ResolveInfoFlags long flags) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags) {
return mComputer.isImplicitImageCaptureIntentAndNotSetByDpcLocked(intent, userId,
resolvedType, flags);
}
@ -3399,7 +3399,7 @@ public class PackageManagerService extends IPackageManager.Stub
@GuardedBy("mLock")
ResolveInfo findPersistentPreferredActivityLP(Intent intent,
String resolvedType,
@PackageManager.ResolveInfoFlags long flags, List<ResolveInfo> query, boolean debug,
@PackageManager.ResolveInfoFlagsBits long flags, List<ResolveInfo> query, boolean debug,
int userId) {
return mComputer.findPersistentPreferredActivityLP(intent,
resolvedType, flags, query, debug, userId);
@ -3413,7 +3413,7 @@ public class PackageManagerService extends IPackageManager.Stub
}
FindPreferredActivityBodyResult findPreferredActivityInternal(
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
List<ResolveInfo> query, boolean always,
boolean removeMatches, boolean debug, int userId, boolean queryMayBeFiltered) {
return mComputer.findPreferredActivityInternal(
@ -3443,7 +3443,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public @NonNull ParceledListSlice<ResolveInfo> queryIntentActivities(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId) {
try {
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "queryIntentActivities");
@ -3463,13 +3463,13 @@ public class PackageManagerService extends IPackageManager.Stub
}
@NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId) {
return mComputer.queryIntentActivitiesInternal(intent,
resolvedType, flags, userId);
}
@NonNull List<ResolveInfo> queryIntentActivitiesInternal(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
@PrivateResolveFlags long privateResolveFlags, int filterCallingUid, int userId,
boolean resolveForStart, boolean allowDynamicSplits) {
return mComputer.queryIntentActivitiesInternal(intent,
@ -3478,7 +3478,7 @@ public class PackageManagerService extends IPackageManager.Stub
}
private CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int sourceUserId,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int sourceUserId,
int parentUserId) {
return mComputer.getCrossProfileDomainPreferredLpr(intent,
resolvedType, flags, sourceUserId, parentUserId);
@ -3506,21 +3506,21 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public @NonNull ParceledListSlice<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
Intent[] specifics, String[] specificTypes, Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits 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, @PackageManager.ResolveInfoFlags long flags, int userId) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId) {
return new ParceledListSlice<>(mResolveIntentHelper.queryIntentReceiversInternal(intent,
resolvedType, flags, userId, Binder.getCallingUid()));
}
@Override
public ResolveInfo resolveService(Intent intent, String resolvedType,
@PackageManager.ResolveInfoFlags long flags, int userId) {
@PackageManager.ResolveInfoFlagsBits long flags, int userId) {
final int callingUid = Binder.getCallingUid();
return mResolveIntentHelper.resolveServiceInternal(intent, resolvedType, flags, userId,
callingUid);
@ -3528,14 +3528,14 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public @NonNull ParceledListSlice<ResolveInfo> queryIntentServices(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits 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, @PackageManager.ResolveInfoFlags long flags, int userId,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId,
int callingUid, boolean includeInstantApps) {
return mComputer.queryIntentServicesInternal(intent,
resolvedType, flags, userId, callingUid,
@ -3544,27 +3544,27 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public @NonNull ParceledListSlice<ResolveInfo> queryIntentContentProviders(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId) {
return new ParceledListSlice<>(mResolveIntentHelper.queryIntentContentProvidersInternal(
intent, resolvedType, flags, userId));
}
@Override
public ParceledListSlice<PackageInfo> getInstalledPackages(
@PackageManager.PackageInfoFlags long flags, int userId) {
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
return mComputer.getInstalledPackages(flags, userId);
}
@Override
public ParceledListSlice<PackageInfo> getPackagesHoldingPermissions(
@NonNull String[] permissions, @PackageManager.PackageInfoFlags long flags,
@NonNull String[] permissions, @PackageManager.PackageInfoFlagsBits long flags,
@UserIdInt int userId) {
return mComputer.getPackagesHoldingPermissions(permissions, flags, userId);
}
@Override
public ParceledListSlice<ApplicationInfo> getInstalledApplications(
@PackageManager.ApplicationInfoFlags long flags, int userId) {
@PackageManager.ApplicationInfoFlagsBits long flags, int userId) {
final int callingUid = Binder.getCallingUid();
return new ParceledListSlice<>(
mComputer.getInstalledApplications(flags, userId, callingUid));
@ -3669,7 +3669,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public ProviderInfo resolveContentProvider(String name,
@PackageManager.ResolveInfoFlags long flags, int userId) {
@PackageManager.ResolveInfoFlagsBits long flags, int userId) {
return mComputer.resolveContentProvider(name, flags, userId, Binder.getCallingUid());
}
@ -3681,7 +3681,8 @@ public class PackageManagerService extends IPackageManager.Stub
@NonNull
@Override
public ParceledListSlice<ProviderInfo> queryContentProviders(@Nullable String processName,
int uid, @PackageManager.ComponentInfoFlags long flags, @Nullable String metaDataKey) {
int uid, @PackageManager.ComponentInfoFlagsBits long flags,
@Nullable String metaDataKey) {
return mComputer.queryContentProviders(processName, uid, flags, metaDataKey);
}
@ -7561,7 +7562,7 @@ public class PackageManagerService extends IPackageManager.Stub
private class PackageManagerInternalImpl extends PackageManagerInternal {
@Override
public List<ApplicationInfo> getInstalledApplications(
@PackageManager.ApplicationInfoFlags long flags, int userId, int callingUid) {
@PackageManager.ApplicationInfoFlagsBits long flags, int userId, int callingUid) {
return PackageManagerService.this.mComputer.getInstalledApplications(flags, userId,
callingUid);
}
@ -7756,7 +7757,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public PackageInfo getPackageInfo(
String packageName, @PackageManager.PackageInfoFlags long flags,
String packageName, @PackageManager.PackageInfoFlagsBits long flags,
int filterCallingUid, int userId) {
return PackageManagerService.this.mComputer
.getPackageInfoInternal(packageName, PackageManager.VERSION_CODE_HIGHEST,
@ -7885,15 +7886,15 @@ public class PackageManagerService extends IPackageManager.Stub
}
@Override
public int getPackageUid(String packageName, @PackageManager.PackageInfoFlags long flags,
int userId) {
public int getPackageUid(String packageName,
@PackageManager.PackageInfoFlagsBits long flags, int userId) {
return PackageManagerService.this
.getPackageUidInternal(packageName, flags, userId, Process.SYSTEM_UID);
}
@Override
public ApplicationInfo getApplicationInfo(
String packageName, @PackageManager.ApplicationInfoFlags long flags,
String packageName, @PackageManager.ApplicationInfoFlagsBits long flags,
int filterCallingUid, int userId) {
return PackageManagerService.this
.getApplicationInfoInternal(packageName, flags, filterCallingUid, userId);
@ -7901,7 +7902,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public ActivityInfo getActivityInfo(
ComponentName component, @PackageManager.ComponentInfoFlags long flags,
ComponentName component, @PackageManager.ComponentInfoFlagsBits long flags,
int filterCallingUid, int userId) {
return PackageManagerService.this
.getActivityInfoInternal(component, flags, filterCallingUid, userId);
@ -7909,7 +7910,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public List<ResolveInfo> queryIntentActivities(
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
int filterCallingUid, int userId) {
return PackageManagerService.this
.queryIntentActivitiesInternal(intent, resolvedType, flags, 0, filterCallingUid,
@ -7918,7 +7919,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public List<ResolveInfo> queryIntentReceivers(Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
int filterCallingUid, int userId) {
return PackageManagerService.this.mResolveIntentHelper.queryIntentReceiversInternal(
intent, resolvedType, flags, userId, filterCallingUid);
@ -7926,7 +7927,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public List<ResolveInfo> queryIntentServices(
Intent intent, @PackageManager.ResolveInfoFlags long flags, int callingUid,
Intent intent, @PackageManager.ResolveInfoFlagsBits long flags, int callingUid,
int userId) {
final String resolvedType = intent.resolveTypeIfNeeded(mContext.getContentResolver());
return PackageManagerService.this
@ -8195,7 +8196,7 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public ResolveInfo resolveIntent(Intent intent, String resolvedType,
@PackageManager.ResolveInfoFlags long flags,
@PackageManager.ResolveInfoFlagsBits long flags,
@PackageManagerInternal.PrivateResolveFlags long privateResolveFlags, int userId,
boolean resolveForStart, int filterCallingUid) {
return mResolveIntentHelper.resolveIntentInternal(
@ -8205,14 +8206,14 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public ResolveInfo resolveService(Intent intent, String resolvedType,
@PackageManager.ResolveInfoFlags long flags, int userId, int callingUid) {
@PackageManager.ResolveInfoFlagsBits long flags, int userId, int callingUid) {
return mResolveIntentHelper.resolveServiceInternal(intent, resolvedType, flags, userId,
callingUid);
}
@Override
public ProviderInfo resolveContentProvider(String name,
@PackageManager.ResolveInfoFlags long flags, int userId, int callingUid) {
@PackageManager.ResolveInfoFlagsBits long flags, int userId, int callingUid) {
return PackageManagerService.this.mComputer
.resolveContentProvider(name, flags, userId,callingUid);
}

View File

@ -1079,7 +1079,7 @@ public class PackageManagerServiceUtils {
public static boolean hasAnyDomainApproval(
@NonNull DomainVerificationManagerInternal manager,
@NonNull PackageStateInternal pkgSetting, @NonNull Intent intent,
@PackageManager.ResolveInfoFlags long resolveInfoFlags, @UserIdInt int userId) {
@PackageManager.ResolveInfoFlagsBits long resolveInfoFlags, @UserIdInt int userId) {
return manager.approvalLevelForDomain(pkgSetting, intent, resolveInfoFlags, userId)
> DomainVerificationManagerInternal.APPROVAL_LEVEL_NONE;
}

View File

@ -75,8 +75,8 @@ final class PreferredActivityHelper {
}
private ResolveInfo findPreferredActivityNotLocked(Intent intent, String resolvedType,
@PackageManager.ResolveInfoFlags long flags, List<ResolveInfo> query, boolean always,
boolean removeMatches, boolean debug, int userId) {
@PackageManager.ResolveInfoFlagsBits 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,7 +85,7 @@ 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, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
List<ResolveInfo> query, boolean always, boolean removeMatches, boolean debug,
int userId, boolean queryMayBeFiltered) {
if (Thread.holdsLock(mPm.mLock)) {

View File

@ -75,7 +75,7 @@ final class ResolveIntentHelper {
* since we need to allow the system to start any installed application.
*/
public ResolveInfo resolveIntentInternal(Intent intent, String resolvedType,
@PackageManager.ResolveInfoFlags long flags,
@PackageManager.ResolveInfoFlagsBits long flags,
@PackageManagerInternal.PrivateResolveFlags long privateResolveFlags, int userId,
boolean resolveForStart, int filterCallingUid) {
try {
@ -115,7 +115,7 @@ final class ResolveIntentHelper {
}
private ResolveInfo chooseBestActivity(Intent intent, String resolvedType,
@PackageManager.ResolveInfoFlags long flags,
@PackageManager.ResolveInfoFlagsBits long flags,
@PackageManagerInternal.PrivateResolveFlags long privateResolveFlags,
List<ResolveInfo> query, int userId, boolean queryMayBeFiltered) {
if (query != null) {
@ -278,7 +278,7 @@ 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, @PackageManager.ResolveInfoFlags long flags, int userId,
String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags, int userId,
int filterCallingUid) {
if (!mPm.mUserManager.exists(userId)) return Collections.emptyList();
mPm.enforceCrossUserPermission(filterCallingUid, userId, false /*requireFullPermission*/,
@ -374,7 +374,7 @@ final class ResolveIntentHelper {
public ResolveInfo resolveServiceInternal(Intent intent, String resolvedType,
@PackageManager.ResolveInfoFlags long flags, int userId, int callingUid) {
@PackageManager.ResolveInfoFlagsBits long flags, int userId, int callingUid) {
if (!mPm.mUserManager.exists(userId)) return null;
flags = mPm.updateFlagsForResolve(flags, userId, callingUid, false /*includeInstantApps*/,
false /* isImplicitImageCaptureIntentAndNotSetByDpc */);
@ -391,7 +391,7 @@ final class ResolveIntentHelper {
}
public @NonNull List<ResolveInfo> queryIntentContentProvidersInternal(
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlags long flags,
Intent intent, String resolvedType, @PackageManager.ResolveInfoFlagsBits long flags,
int userId) {
if (!mPm.mUserManager.exists(userId)) return Collections.emptyList();
final int callingUid = Binder.getCallingUid();
@ -533,7 +533,7 @@ final class ResolveIntentHelper {
public @NonNull List<ResolveInfo> queryIntentActivityOptionsInternal(ComponentName caller,
Intent[] specifics, String[] specificTypes, Intent intent,
String resolvedType, @PackageManager.ResolveInfoFlags long flags, int userId) {
String resolvedType, @PackageManager.ResolveInfoFlagsBits 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*/,

View File

@ -84,7 +84,7 @@ public class PackageInfoUtils {
*/
@Nullable
public static PackageInfo generate(AndroidPackage pkg, int[] gids,
@PackageManager.PackageInfoFlags long flags, long firstInstallTime,
@PackageManager.PackageInfoFlagsBits long flags, long firstInstallTime,
long lastUpdateTime, Set<String> grantedPermissions, PackageUserState state, int userId,
@Nullable PackageStateInternal pkgSetting) {
return generateWithComponents(pkg, gids, flags, firstInstallTime, lastUpdateTime,
@ -105,7 +105,7 @@ public class PackageInfoUtils {
* @param pkgSetting See {@link PackageInfoUtils} for description of pkgSetting usage.
*/
private static PackageInfo generateWithComponents(AndroidPackage pkg, int[] gids,
@PackageManager.PackageInfoFlags long flags, long firstInstallTime,
@PackageManager.PackageInfoFlagsBits 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,
@ -209,7 +209,7 @@ public class PackageInfoUtils {
*/
@Nullable
public static ApplicationInfo generateApplicationInfo(AndroidPackage pkg,
@PackageManager.ApplicationInfoFlags long flags, @NonNull PackageUserState state,
@PackageManager.ApplicationInfoFlagsBits 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 long flags, PackageUserState state, int userId,
@PackageManager.ComponentInfoFlagsBits 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 long flags, PackageUserState state,
@PackageManager.ComponentInfoFlagsBits 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 long flags, PackageUserState state, int userId,
@PackageManager.ComponentInfoFlagsBits 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 long flags, PackageUserState state,
@PackageManager.ComponentInfoFlagsBits 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 long flags, PackageUserState state,
@PackageManager.ComponentInfoFlagsBits 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 long flags, int userId,
AndroidPackage pkg, @PackageManager.ComponentInfoFlagsBits 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 long flags) {
@PackageManager.ComponentInfoFlagsBits 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 long flags) {
@PackageManager.ComponentInfoFlagsBits 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 long flags) {
Map<String, ParsedProcess> procs, @PackageManager.ComponentInfoFlagsBits 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 long flags) {
@PackageManager.PackageInfoFlagsBits 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,8 +628,8 @@ public class PackageInfoUtils {
*/
@Nullable
public ApplicationInfo generate(AndroidPackage pkg,
@PackageManager.ApplicationInfoFlags long flags, PackageUserState state, int userId,
@Nullable PackageStateInternal pkgSetting) {
@PackageManager.ApplicationInfoFlagsBits long flags, PackageUserState state,
int userId, @Nullable PackageStateInternal pkgSetting) {
ApplicationInfo appInfo = mCache.get(pkg.getPackageName());
if (appInfo != null) {
return appInfo;

View File

@ -103,12 +103,12 @@ final class DefaultPermissionGrantPolicy {
private static final String TAG = "DefaultPermGrantPolicy"; // must be <= 23 chars
private static final boolean DEBUG = false;
@PackageManager.ResolveInfoFlags
@PackageManager.ResolveInfoFlagsBits
private static final int DEFAULT_INTENT_QUERY_FLAGS =
PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE
| PackageManager.MATCH_UNINSTALLED_PACKAGES;
@PackageManager.PackageInfoFlags
@PackageManager.PackageInfoFlagsBits
private static final int DEFAULT_PACKAGE_INFO_QUERY_FLAGS =
PackageManager.MATCH_UNINSTALLED_PACKAGES
| PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS

View File

@ -391,7 +391,7 @@ public interface DomainVerificationManagerInternal {
*/
@ApprovalLevel
int approvalLevelForDomain(@NonNull PackageStateInternal pkgSetting, @NonNull Intent intent,
@PackageManager.ResolveInfoFlags long resolveInfoFlags, @UserIdInt int userId);
@PackageManager.ResolveInfoFlagsBits long resolveInfoFlags, @UserIdInt int userId);
/**
* @return the domain verification set ID for the given package, or null if the ID is

View File

@ -1721,7 +1721,7 @@ public class DomainVerificationService extends SystemService
@Override
public int approvalLevelForDomain(@NonNull PackageStateInternal pkgSetting,
@NonNull Intent intent, @PackageManager.ResolveInfoFlags long resolveInfoFlags,
@NonNull Intent intent, @PackageManager.ResolveInfoFlagsBits long resolveInfoFlags,
@UserIdInt int userId) {
String packageName = pkgSetting.getPackageName();
if (!DomainVerificationUtils.isDomainVerificationIntent(intent, resolveInfoFlags)) {

View File

@ -49,7 +49,7 @@ public final class DomainVerificationUtils {
}
public static boolean isDomainVerificationIntent(Intent intent,
@PackageManager.ResolveInfoFlags long resolveInfoFlags) {
@PackageManager.ResolveInfoFlagsBits long resolveInfoFlags) {
if (!intent.isWebIntent()) {
return false;
}

View File

@ -235,6 +235,7 @@ package android.test.mock {
method @Deprecated public android.content.Intent getLaunchIntentForPackage(String);
method @Deprecated public android.content.Intent getLeanbackLaunchIntentForPackage(String);
method @Deprecated public String getNameForUid(int);
method @Deprecated public android.content.pm.PackageInfo getPackageArchiveInfo(String, int);
method @Deprecated public int[] getPackageGids(String) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated public int[] getPackageGids(String, int) throws android.content.pm.PackageManager.NameNotFoundException;
method @Deprecated public android.content.pm.PackageInfo getPackageInfo(String, int) throws android.content.pm.PackageManager.NameNotFoundException;