Package org.robolectric.shadows
Class ShadowApplicationPackageManager
java.lang.Object
org.robolectric.shadows.ShadowPackageManager
org.robolectric.shadows.ShadowApplicationPackageManager
@Implements(value=android.app.ApplicationPackageManager.class,
isInAndroidSdk=false,
looseSignatures=true)
public class ShadowApplicationPackageManager
extends ShadowPackageManager
-
Nested Class Summary
Nested classes/interfaces inherited from class org.robolectric.shadows.ShadowPackageManager
ShadowPackageManager.ComponentState, ShadowPackageManager.IntentComparator, ShadowPackageManager.PackageSetting -
Field Summary
Fields inherited from class org.robolectric.shadows.ShadowPackageManager
resources -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, int targetUserId, int flags) protected voidaddOnPermissionsChangeListener(Object listener) protected voidaddPackageToPreferred(String packageName) protected booleanaddPermission(PermissionInfo info) protected booleanvoidaddPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity) protected String[]canonicalToCurrentPackageNames(String[] names) protected booleanprotected intcheckPermission(String permName, String pkgName) protected intcheckSignatures(int uid1, int uid2) protected intcheckSignatures(String pkg1, String pkg2) protected voidclearApplicationUserData(String packageName, IPackageDataObserver observer) protected voidclearCrossProfileIntentFilters(int sourceUserId) protected voidclearPackagePreferredActivities(String packageName) protected String[]currentToCanonicalPackageNames(String[] names) protected voiddeleteApplicationCacheFiles(String packageName, IPackageDataObserver observer) protected voiddeleteApplicationCacheFilesAsUser(String packageName, int userId, IPackageDataObserver observer) protected voiddeletePackage(String packageName, IPackageDeleteObserver observer, int flags) protected voiddeletePackageAsUser(String packageName, IPackageDeleteObserver observer, int flags, int userId) protected voidextendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay) protected voidflushPackageRestrictionsAsUser(int userId) protected voidfreeStorage(String volumeUuid, long freeStorageSize, IntentSender pi) protected voidfreeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) protected voidfreeStorageAndNotify(String volumeUuid, long freeStorageSize, IPackageDataObserver observer) protected DrawablegetActivityIcon(ComponentName activityName) protected ActivityInfogetActivityInfo(ComponentName component, int flags) protected List<IntentFilter>getAllIntentFilters(String packageName) protected List<PermissionGroupInfo>getAllPermissionGroups(int flags) protected intgetApplicationEnabledSetting(String packageName) protected booleangetApplicationHiddenSettingAsUser(String packageName, UserHandle user) protected Drawableprotected DrawablegetApplicationIcon(String packageName) protected ApplicationInfogetApplicationInfo(Object packageName, Object flagsObject) protected ApplicationInfogetApplicationInfo(String packageName, int flags) protected ObjectgetChangedPackages(int sequenceNumber) Returns the list of package names that were requested to be cleared.protected intgetComponentEnabledSetting(ComponentName componentName) protected Drawableprotected StringgetDefaultBrowserPackageNameAsUser(int userId) protected DrawablegetDrawable(String packageName, int resId, ApplicationInfo appInfo) protected voidgetGroupOfPlatformPermission(String permissionName, Executor executor, Consumer<String> callback) This implementation relies on the limited list of platform permissions defined inShadowPackageManager.AOSP_PLATFORM_PERMISSIONSand on permissions added using the {ShadowPackageManager#addPermission} API (if they have a platform permission prefix).protected ComponentNamegetHomeActivities(List<ResolveInfo> outActivities) protected List<ApplicationInfo>getInstalledApplications(int flags) protected List<ApplicationInfo>getInstalledApplications(Object flags) protected List<ModuleInfo>getInstalledModules(int flags) getInstalledPackages(int flags) protected List<PackageInfo>getInstalledPackages(Object flags) protected List<PackageInfo>getInstalledPackagesAsUser(int flags, int userId) protected StringgetInstallerPackageName(String packageName) protected ObjectgetInstallSourceInfo(String packageName) protected InstrumentationInfogetInstrumentationInfo(ComponentName className, int flags) protected List<IntentFilterVerificationInfo>getIntentFilterVerifications(String packageName) protected intgetIntentVerificationStatusAsUser(String packageName, int userId) protected IntentgetLaunchIntentForPackage(String packageName) protected IntentgetLeanbackLaunchIntentForPackage(String packageName) protected ObjectgetModuleInfo(String packageName, int flags) protected intgetMoveStatus(int moveId) protected StringgetNameForUid(int uid) protected PackageInfogetPackageArchiveInfo(String archiveFilePath, int flags) Starting in Android S, this method was moved fromPackageManagertoApplicationPackageManager.protected List<VolumeInfo>protected Objectprotected int[]getPackageGids(String packageName) protected int[]getPackageGids(String packageName, int flags) protected PackageInfogetPackageInfo(Object packageName, Object flags) protected PackageInfogetPackageInfo(String packageName, int flags) protected ObjectgetPackageInfoAsUser(Object packageName, Object flagsObject, Object userId) protected String[]getPackagesForUid(int uid) protected List<PackageInfo>getPackagesHoldingPermissions(String[] permissions, int flags) protected voidgetPackageSizeInfo(Object pkgName, Object uid, Object observer) protected voidgetPackageSizeInfoAsUser(Object pkgName, Object uid, Object observer) protected ObjectgetPackageUid(Object packageName, Object flags) protected intgetPackageUid(String packageName, int flags) protected intgetPackageUidAsUser(String packageName, int userId) protected intgetPackageUidAsUser(String packageName, int flags, int userId) protected Stringprotected intgetPermissionFlags(String permissionName, String packageName, UserHandle user) This method differs from the real implementation in that we only return the permission flags that were added via updatePermissionFlags, and do not perform any verification of permissions, packages or users.protected PermissionGroupInfogetPermissionGroupInfo(String name, int flags) protected PermissionInfogetPermissionInfo(String name, int flags) protected voidgetPlatformPermissionsForGroup(String permissionGroupName, Executor executor, Consumer<List<String>> callback) This implementation relies on the limited list of platform permissions defined inShadowPackageManager.AOSP_PLATFORM_PERMISSIONSand on permissions added using the {ShadowPackageManager#addPermission} API (if they have a platform permission prefix).intgetPreferredActivities(List<IntentFilter> outFilters, List<ComponentName> outActivities, String packageName) protected List<PackageInfo>getPreferredPackages(int flags) protected List<VolumeInfo>protected Objectprotected ObjectgetProperty(String propertyName, ComponentName name) Stub that will always throw.protected ObjectgetProperty(String propertyName, String packageName) Stub that will always throw.protected ProviderInfogetProviderInfo(ComponentName component, int flags) protected ActivityInfogetReceiverInfo(ComponentName component, int flags) protected ActivityInfogetReceiverInfo(Object component, Object flags) protected ResourcesgetResourcesForActivity(ComponentName activityName) protected ResourcesgetResourcesForApplication(ApplicationInfo applicationInfo) protected ResourcesgetResourcesForApplication(String appPackageName) protected ResourcesgetResourcesForApplicationAsUser(String appPackageName, int userId) protected ServiceInfogetServiceInfo(ComponentName component, int flags) protected ServiceInfogetServiceInfo(Object component, Object flags) protected Stringprotected Stringprotected booleangetSyntheticAppDetailsActivityEnabled(String packageName) protected FeatureInfo[]protected String[]Returns all the values added viaShadowPackageManager.addSystemSharedLibraryName(String).protected CharSequencegetText(String packageName, int resId, ApplicationInfo appInfo) Returns a user stored String resource withresIdcorresponding topackageName.protected intgetUidForSharedUser(String sharedUserName) protected String[]getUnsuspendablePackages(String[] packageNames) protected DrawablegetUserBadgedIcon(Drawable icon, UserHandle user) Adds a profile badge to the icon.protected DrawablegetUserBadgeForDensity(UserHandle userHandle, int i) protected VerifierDeviceIdentityprotected voidgrantRuntimePermission(String packageName, String permissionName, UserHandle user) protected booleanhasSystemFeature(String name) protected booleanhasSystemFeature(String name, int version) protected intinstallExistingPackage(String packageName) protected intinstallExistingPackageAsUser(String packageName, int userId) protected voidinstallPackage(Object packageURI, Object observer, Object flags, Object installerPackageName) protected booleanprotected booleanisInstantApp(String packageName) protected booleanisPackageAvailable(String packageName) protected booleanisPackageSuspended(String packageName) protected booleanisPackageSuspendedForUser(String packageName, int userId) protected booleanisPermissionRevokedByPolicy(String permName, String pkgName) protected booleanprotected booleanprotected DrawableloadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo) Gets the unbadged icon based on the values set byShadowPackageManager.setUnbadgedApplicationIcon(java.lang.String, android.graphics.drawable.Drawable)or returns null if nothing has been set.protected ObjectmovePackage(Object packageName, Object vol) protected ObjectmovePrimaryStorage(Object vol) protected List<ResolveInfo>queryBroadcastReceivers(Intent intent, int flags) protected List<ResolveInfo>queryBroadcastReceivers(Object intent, Object flags) protected List<ResolveInfo>queryBroadcastReceiversAsUser(Intent intent, int flags, int userId) protected List<ProviderInfo>queryContentProviders(String processName, int uid, int flags) protected List<InstrumentationInfo>queryInstrumentation(String targetPackage, int flags) protected List<ResolveInfo>queryIntentActivities(Intent intent, int flags) protected List<ResolveInfo>queryIntentActivitiesAsUser(Intent intent, int flags, int userId) Behaves asqueryIntentActivities(Intent, int)and currently ignores userId.protected List<ResolveInfo>queryIntentActivitiesAsUser(Object intent, Object flags, Object userId) Behaves asqueryIntentActivities(Intent, int)and currently ignores userId.protected List<ResolveInfo>queryIntentActivityOptions(ComponentName caller, Intent[] specifics, Intent intent, int flags) protected List<ResolveInfo>queryIntentContentProviders(Intent intent, int flags) protected List<ResolveInfo>queryIntentContentProvidersAsUser(Intent intent, int flags, int userId) protected List<ResolveInfo>queryIntentServices(Intent intent, int flags) protected List<ResolveInfo>queryIntentServicesAsUser(Intent intent, int flags, int userId) Behaves asqueryIntentServices(Intent, int)and currently ignores userId.protected List<PermissionInfo>queryPermissionsByGroup(String group, int flags) protected voidregisterMoveCallback(Object callback, Object handler) protected voidremoveOnPermissionsChangeListener(Object listener) protected voidremovePackageFromPreferred(String packageName) protected voidremovePermission(String name) protected voidreplacePreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity) protected ResolveInforesolveActivity(Intent intent, int flags) protected ResolveInforesolveActivityAsUser(Intent intent, int flags, int userId) Behaves asresolveActivity(Intent, int)and currently ignores userId.protected ResolveInforesolveActivityAsUser(Object intent, Object flags, Object userId) protected ProviderInforesolveContentProvider(String name, int flags) protected ProviderInforesolveContentProviderAsUser(String name, int flags, int userId) protected ResolveInforesolveService(Intent intent, int flags) protected ResolveInforesolveServiceAsUser(Object intent, Object flags, Object userId) protected voidrevokeRuntimePermission(String packageName, String permissionName, UserHandle user) protected voidsetApplicationEnabledSetting(String packageName, int newState, int flags) protected booleansetApplicationHiddenSettingAsUser(String packageName, boolean hidden, UserHandle user) protected voidsetComponentEnabledSetting(ComponentName componentName, int newState, int flags) protected voidprotected booleansetDefaultBrowserPackageNameAsUser(String packageName, int userId) protected String[]setDistractingPackageRestrictions(String[] packages, int restrictionFlags) protected voidsetInstallerPackageName(String targetPackage, String installerPackageName) protected ObjectsetPackagesSuspended(Object packageNames, Object suspended, Object appExtras, Object launcherExtras, Object dialogInfo) protected String[]setPackagesSuspended(String[] packageNames, boolean suspended, PersistableBundle appExtras, PersistableBundle launcherExtras, String dialogMessage) protected String[]setPackagesSuspendedAsUser(String[] packageNames, boolean suspended, int userId) protected voidsetSyntheticAppDetailsActivityEnabled(String packageName, boolean enabled) protected booleanshouldShowRequestPermissionRationale(String permission) protected voidunregisterMoveCallback(Object callback) protected booleanupdateIntentVerificationStatusAsUser(String packageName, int status, int userId) protected voidupdatePermissionFlags(String permissionName, String packageName, int flagMask, int flagValues, UserHandle user) This method differs from the real implementation in that no permission checking or package existent checks are performed here.protected voidverifyIntentFilter(int id, int verificationCode, List<String> failedDomains) protected voidverifyPendingInstall(int id, int verificationCode) Methods inherited from class org.robolectric.shadows.ShadowPackageManager
addActivityIcon, addActivityIcon, addActivityIfNotPresent, addCanonicalName, addChangedPackage, addCurrentToCannonicalName, addDrawableResolution, addIntentFilterForActivity, addIntentFilterForProvider, addIntentFilterForReceiver, addIntentFilterForService, addOrUpdateActivity, addOrUpdateProvider, addOrUpdateReceiver, addOrUpdateService, addPackage, addPackage, addPackage, addPackageInternal, addPackageNoDefaults, addPermissionGroupInfo, addPermissionInfo, addPreferredActivityInternal, addProviderIfNotPresent, addReceiverIfNotPresent, addResolveInfoForIntent, addResolveInfoForIntent, addResolveInfoForIntentNoDefaults, addServiceIfNotPresent, addStringResource, addSystemAvailableFeature, addSystemSharedLibraryName, clearIntentFilterForActivity, clearIntentFilterForProvider, clearIntentFilterForReceiver, clearIntentFilterForService, clearPackagePreferredActivitiesInternal, clearSystemAvailableFeatures, clearSystemSharedLibraryNames, deleteModule, deletePackage, doPendingUninstallCallbacks, freeStorage, generatePackageInfo, getComponentEnabledSettingFlags, getDeletedPackages, getDistractingPackageRestrictions, getIntentFiltersForActivity, getIntentFiltersForProvider, getIntentFiltersForReceiver, getIntentFiltersForService, getInternalMutablePackageInfo, getPackageSetting, getPersistentPreferredActivities, getPreferredActivitiesInternal, getShadowPackageArchiveInfo, getVerificationCodeAtTimeoutExtension, getVerificationExtendedTimeout, getVerificationResult, installModule, installPackage, mapForPackage, queryBroadcastReceivers, queryBroadcastReceiversAsUser, queryOverriddenIntents, removeActivity, removePackage, removeProvider, removeReceiver, removeResolveInfosForIntent, removeService, reset, setApplicationIcon, setAutoRevokeWhitelisted, setCanRequestPackageInstalls, setInstallSourceInfo, setNameForUid, setPackageArchiveInfo, setPackagesForCallingUid, setPackagesForUid, setResolveInfosForIntent, setSafeMode, setShouldShowActivityChooser, setShouldShowRequestPermissionRationale, setSystemFeature, setUnbadgedApplicationIcon, triggerInstallVerificationTimeout
-
Constructor Details
-
ShadowApplicationPackageManager
public ShadowApplicationPackageManager()
-
-
Method Details
-
getInstalledPackages
-
getInstalledPackages
-
getInstalledModules
-
getModuleInfo
@Implementation(minSdk=29) protected Object getModuleInfo(String packageName, int flags) throws PackageManager.NameNotFoundException -
getActivityInfo
@Implementation protected ActivityInfo getActivityInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException -
hasSystemFeature
-
getComponentEnabledSetting
-
getNameForUid
-
getPackagesForUid
- Overrides:
getPackagesForUidin classShadowPackageManager
-
getApplicationEnabledSetting
-
getProviderInfo
@Implementation protected ProviderInfo getProviderInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException -
setComponentEnabledSetting
@Implementation protected void setComponentEnabledSetting(ComponentName componentName, int newState, int flags) -
setComponentEnabledSettings
@Implementation(minSdk=33) protected void setComponentEnabledSettings(List<PackageManager.ComponentEnabledSetting> settings) -
setSyntheticAppDetailsActivityEnabled
@Implementation(minSdk=29) protected void setSyntheticAppDetailsActivityEnabled(String packageName, boolean enabled) -
getSyntheticAppDetailsActivityEnabled
@Implementation(minSdk=29) protected boolean getSyntheticAppDetailsActivityEnabled(String packageName) -
setApplicationEnabledSetting
@Implementation protected void setApplicationEnabledSetting(String packageName, int newState, int flags) -
resolveActivity
-
resolveContentProvider
-
resolveContentProviderAsUser
@Implementation protected ProviderInfo resolveContentProviderAsUser(String name, int flags, int userId) -
getPackageInfo
@Implementation protected PackageInfo getPackageInfo(String packageName, int flags) throws PackageManager.NameNotFoundException -
getPackageInfo
@Implementation(minSdk=33) protected PackageInfo getPackageInfo(Object packageName, Object flags) throws PackageManager.NameNotFoundException -
getPackageArchiveInfo
@Implementation(minSdk=31, maxSdk=32) protected PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) Starting in Android S, this method was moved fromPackageManagertoApplicationPackageManager. However, it was moved back toPackageManagerin T.- Overrides:
getPackageArchiveInfoin classShadowPackageManager
-
queryIntentServices
-
queryIntentServicesAsUser
@Implementation protected List<ResolveInfo> queryIntentServicesAsUser(Intent intent, int flags, int userId) Behaves asqueryIntentServices(Intent, int)and currently ignores userId. -
queryIntentActivities
-
queryIntentActivitiesAsUser
@Implementation protected List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId) Behaves asqueryIntentActivities(Intent, int)and currently ignores userId. -
queryIntentActivitiesAsUser
@Implementation(minSdk=33) protected List<ResolveInfo> queryIntentActivitiesAsUser(Object intent, Object flags, Object userId) Behaves asqueryIntentActivities(Intent, int)and currently ignores userId. -
checkPermission
-
getReceiverInfo
@Implementation protected ActivityInfo getReceiverInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException -
getReceiverInfo
@Implementation(minSdk=33) protected ActivityInfo getReceiverInfo(Object component, Object flags) throws PackageManager.NameNotFoundException -
queryBroadcastReceivers
-
queryBroadcastReceivers
@Implementation(minSdk=33) protected List<ResolveInfo> queryBroadcastReceivers(Object intent, Object flags) -
resolveService
-
getServiceInfo
@Implementation protected ServiceInfo getServiceInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException -
getServiceInfo
@Implementation(minSdk=33) protected ServiceInfo getServiceInfo(Object component, Object flags) throws PackageManager.NameNotFoundException -
getResourcesForApplication
@Implementation protected Resources getResourcesForApplication(ApplicationInfo applicationInfo) throws PackageManager.NameNotFoundException -
getInstalledApplications
-
getInstalledApplications
-
getInstallerPackageName
-
getInstallSourceInfo
@Implementation(minSdk=30) protected Object getInstallSourceInfo(String packageName) throws PackageManager.NameNotFoundException -
getPermissionInfo
@Implementation protected PermissionInfo getPermissionInfo(String name, int flags) throws PackageManager.NameNotFoundException -
shouldShowRequestPermissionRationale
@Implementation(minSdk=23) protected boolean shouldShowRequestPermissionRationale(String permission) -
getSystemAvailableFeatures
-
verifyPendingInstall
-
extendVerificationTimeout
@Implementation protected void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay) -
freeStorageAndNotify
@Implementation(maxSdk=22) protected void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) - Overrides:
freeStorageAndNotifyin classShadowPackageManager
-
freeStorageAndNotify
@Implementation(minSdk=23) protected void freeStorageAndNotify(String volumeUuid, long freeStorageSize, IPackageDataObserver observer) -
setInstallerPackageName
@Implementation protected void setInstallerPackageName(String targetPackage, String installerPackageName) -
queryIntentContentProviders
-
queryIntentContentProvidersAsUser
@Implementation protected List<ResolveInfo> queryIntentContentProvidersAsUser(Intent intent, int flags, int userId) -
getPermissionControllerPackageName
-
getPackageSizeInfo
@Implementation(maxSdk=23) protected void getPackageSizeInfo(Object pkgName, Object uid, Object observer) -
getPackageSizeInfoAsUser
@Implementation(minSdk=24) protected void getPackageSizeInfoAsUser(Object pkgName, Object uid, Object observer) -
deletePackage
@Implementation protected void deletePackage(String packageName, IPackageDeleteObserver observer, int flags) - Overrides:
deletePackagein classShadowPackageManager
-
currentToCanonicalPackageNames
-
canonicalToCurrentPackageNames
-
isSafeMode
-
getApplicationIcon
@Implementation protected Drawable getApplicationIcon(String packageName) throws PackageManager.NameNotFoundException -
getApplicationIcon
@Implementation protected Drawable getApplicationIcon(ApplicationInfo info) throws PackageManager.NameNotFoundException -
getUserBadgeForDensity
-
checkSignatures
-
checkSignatures
-
queryPermissionsByGroup
@Implementation protected List<PermissionInfo> queryPermissionsByGroup(String group, int flags) throws PackageManager.NameNotFoundException -
getLaunchIntentForPackage
-
getLeanbackLaunchIntentForPackage
-
getPackageInfoAsUser
@Implementation(minSdk=24) protected Object getPackageInfoAsUser(Object packageName, Object flagsObject, Object userId) throws PackageManager.NameNotFoundException -
getPackageGids
@Implementation protected int[] getPackageGids(String packageName) throws PackageManager.NameNotFoundException -
getPackageGids
@Implementation(minSdk=24) protected int[] getPackageGids(String packageName, int flags) throws PackageManager.NameNotFoundException -
getPackageUid
@Implementation protected int getPackageUid(String packageName, int flags) throws PackageManager.NameNotFoundException -
getPackageUid
@Implementation(minSdk=33) protected Object getPackageUid(Object packageName, Object flags) throws PackageManager.NameNotFoundException -
getPackageUidAsUser
@Implementation(minSdk=24) protected int getPackageUidAsUser(String packageName, int userId) throws PackageManager.NameNotFoundException -
getPackageUidAsUser
@Implementation(minSdk=24) protected int getPackageUidAsUser(String packageName, int flags, int userId) throws PackageManager.NameNotFoundException -
getPermissionGroupInfo
@Implementation protected PermissionGroupInfo getPermissionGroupInfo(String name, int flags) throws PackageManager.NameNotFoundException -
getAllPermissionGroups
-
getApplicationInfo
@Implementation protected ApplicationInfo getApplicationInfo(String packageName, int flags) throws PackageManager.NameNotFoundException -
getApplicationInfo
@Implementation(minSdk=33) protected ApplicationInfo getApplicationInfo(Object packageName, Object flagsObject) throws PackageManager.NameNotFoundException -
hasSystemFeature
-
isPermissionRevokedByPolicy
@Implementation(minSdk=23) protected boolean isPermissionRevokedByPolicy(String permName, String pkgName) -
addPermission
-
addPermissionAsync
-
removePermission
-
grantRuntimePermission
@Implementation(minSdk=23) protected void grantRuntimePermission(String packageName, String permissionName, UserHandle user) -
revokeRuntimePermission
@Implementation(minSdk=23) protected void revokeRuntimePermission(String packageName, String permissionName, UserHandle user) -
getPermissionFlags
@Implementation(minSdk=23) protected int getPermissionFlags(String permissionName, String packageName, UserHandle user) This method differs from the real implementation in that we only return the permission flags that were added via updatePermissionFlags, and do not perform any verification of permissions, packages or users. -
updatePermissionFlags
@Implementation(minSdk=23) protected void updatePermissionFlags(String permissionName, String packageName, int flagMask, int flagValues, UserHandle user) This method differs from the real implementation in that no permission checking or package existent checks are performed here. -
getInstalledPackagesAsUser
@Implementation(minSdk=24) protected List<PackageInfo> getInstalledPackagesAsUser(int flags, int userId) -
getPackagesHoldingPermissions
@Implementation protected List<PackageInfo> getPackagesHoldingPermissions(String[] permissions, int flags) -
getGroupOfPlatformPermission
@Implementation(minSdk=31) protected void getGroupOfPlatformPermission(String permissionName, Executor executor, Consumer<String> callback) This implementation relies on the limited list of platform permissions defined inShadowPackageManager.AOSP_PLATFORM_PERMISSIONSand on permissions added using the {ShadowPackageManager#addPermission} API (if they have a platform permission prefix). It will not return an accurate grouping for all platform permissions that can be found on different AOSP versions. -
getPlatformPermissionsForGroup
@Implementation(minSdk=31) protected void getPlatformPermissionsForGroup(String permissionGroupName, Executor executor, Consumer<List<String>> callback) This implementation relies on the limited list of platform permissions defined inShadowPackageManager.AOSP_PLATFORM_PERMISSIONSand on permissions added using the {ShadowPackageManager#addPermission} API (if they have a platform permission prefix). It will not return an accurate grouping for all platform permissions that can be found on different AOSP versions. -
resolveActivityAsUser
Behaves asresolveActivity(Intent, int)and currently ignores userId. -
resolveActivityAsUser
@Implementation(minSdk=33) protected ResolveInfo resolveActivityAsUser(Object intent, Object flags, Object userId) -
resolveServiceAsUser
@Implementation(minSdk=33) protected ResolveInfo resolveServiceAsUser(Object intent, Object flags, Object userId) -
queryIntentActivityOptions
@Implementation protected List<ResolveInfo> queryIntentActivityOptions(ComponentName caller, Intent[] specifics, Intent intent, int flags) -
queryBroadcastReceiversAsUser
@Implementation(minSdk=24) protected List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, int flags, int userId) -
queryContentProviders
@Implementation protected List<ProviderInfo> queryContentProviders(String processName, int uid, int flags) -
getInstrumentationInfo
@Implementation protected InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags) throws PackageManager.NameNotFoundException -
queryInstrumentation
@Implementation protected List<InstrumentationInfo> queryInstrumentation(String targetPackage, int flags) -
getDrawable
@Implementation protected Drawable getDrawable(String packageName, @DrawableRes int resId, ApplicationInfo appInfo) -
getText
@Implementation protected CharSequence getText(String packageName, int resId, ApplicationInfo appInfo) Returns a user stored String resource withresIdcorresponding topackageName. User can store this String viaShadowPackageManager.addStringResource(String, int, String).Real method is called if the user has not stored a String corresponding to
resIdandpackageName. -
getActivityIcon
@Implementation protected Drawable getActivityIcon(ComponentName activityName) throws PackageManager.NameNotFoundException -
getDefaultActivityIcon
-
getResourcesForActivity
@Implementation protected Resources getResourcesForActivity(ComponentName activityName) throws PackageManager.NameNotFoundException -
getResourcesForApplication
@Implementation protected Resources getResourcesForApplication(String appPackageName) throws PackageManager.NameNotFoundException -
getResourcesForApplicationAsUser
@Implementation protected Resources getResourcesForApplicationAsUser(String appPackageName, int userId) throws PackageManager.NameNotFoundException -
addOnPermissionsChangeListener
-
removeOnPermissionsChangeListener
-
installPackage
-
installExistingPackage
@Implementation protected int installExistingPackage(String packageName) throws PackageManager.NameNotFoundException -
installExistingPackageAsUser
@Implementation(minSdk=24) protected int installExistingPackageAsUser(String packageName, int userId) throws PackageManager.NameNotFoundException -
verifyIntentFilter
@Implementation(minSdk=23) protected void verifyIntentFilter(int id, int verificationCode, List<String> failedDomains) -
getIntentVerificationStatusAsUser
@Implementation(minSdk=24) protected int getIntentVerificationStatusAsUser(String packageName, int userId) -
updateIntentVerificationStatusAsUser
@Implementation(minSdk=24) protected boolean updateIntentVerificationStatusAsUser(String packageName, int status, int userId) -
getIntentFilterVerifications
@Implementation(minSdk=23) protected List<IntentFilterVerificationInfo> getIntentFilterVerifications(String packageName) -
getAllIntentFilters
-
getDefaultBrowserPackageNameAsUser
-
setDefaultBrowserPackageNameAsUser
@Implementation(minSdk=24) protected boolean setDefaultBrowserPackageNameAsUser(String packageName, int userId) -
getMoveStatus
-
registerMoveCallback
-
unregisterMoveCallback
-
movePackage
-
getPackageCurrentVolume
-
getPackageCandidateVolumes
@Implementation(minSdk=23) protected List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app) -
movePrimaryStorage
-
getPrimaryStorageCurrentVolume
-
getPrimaryStorageCandidateVolumes
-
deletePackageAsUser
@Implementation(minSdk=24) protected void deletePackageAsUser(String packageName, IPackageDeleteObserver observer, int flags, int userId) -
clearApplicationUserData
@Implementation protected void clearApplicationUserData(String packageName, IPackageDataObserver observer) -
deleteApplicationCacheFiles
@Implementation protected void deleteApplicationCacheFiles(String packageName, IPackageDataObserver observer) -
deleteApplicationCacheFilesAsUser
@Implementation(minSdk=24) protected void deleteApplicationCacheFilesAsUser(String packageName, int userId, IPackageDataObserver observer) -
freeStorage
@Implementation(minSdk=23) protected void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi) -
setPackagesSuspendedAsUser
@Implementation(minSdk=24, maxSdk=27) protected String[] setPackagesSuspendedAsUser(String[] packageNames, boolean suspended, int userId) -
isPackageSuspendedForUser
@Implementation(minSdk=24) protected boolean isPackageSuspendedForUser(String packageName, int userId) -
addPackageToPreferred
-
removePackageFromPreferred
-
getPreferredPackages
-
addPreferredActivity
@Implementation public void addPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity) -
replacePreferredActivity
@Implementation protected void replacePreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity) -
getPreferredActivities
@Implementation public int getPreferredActivities(List<IntentFilter> outFilters, List<ComponentName> outActivities, String packageName) -
clearPackagePreferredActivities
-
getHomeActivities
-
flushPackageRestrictionsAsUser
-
setApplicationHiddenSettingAsUser
@Implementation protected boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, UserHandle user) -
getApplicationHiddenSettingAsUser
@Implementation protected boolean getApplicationHiddenSettingAsUser(String packageName, UserHandle user) -
getVerifierDeviceIdentity
-
isUpgrade
-
isPackageAvailable
-
addCrossProfileIntentFilter
@Implementation protected void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, int targetUserId, int flags) -
clearCrossProfileIntentFilters
-
loadUnbadgedItemIcon
@Implementation(minSdk=22) protected Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo) Gets the unbadged icon based on the values set byShadowPackageManager.setUnbadgedApplicationIcon(java.lang.String, android.graphics.drawable.Drawable)or returns null if nothing has been set. -
getUserBadgedIcon
Adds a profile badge to the icon.This implementation just returns the unbadged icon, as some default implementations add an internal resource to the icon that is unavailable to Robolectric.
-
canRequestPackageInstalls
-
getChangedPackages
-
getSystemTextClassifierPackageName
-
setPackagesSuspended
@Implementation(minSdk=28) @HiddenApi protected String[] setPackagesSuspended(String[] packageNames, boolean suspended, PersistableBundle appExtras, PersistableBundle launcherExtras, String dialogMessage) -
setPackagesSuspended
@Implementation(minSdk=29) @HiddenApi protected Object setPackagesSuspended(Object packageNames, Object suspended, Object appExtras, Object launcherExtras, Object dialogInfo) -
isAutoRevokeWhitelisted
-
getUnsuspendablePackages
@HiddenApi @Implementation(minSdk=29) protected String[] getUnsuspendablePackages(String[] packageNames) -
isPackageSuspended
@HiddenApi @Implementation(minSdk=28) protected boolean isPackageSuspended(String packageName) throws PackageManager.NameNotFoundException -
isInstantApp
-
setDistractingPackageRestrictions
@HiddenApi @Implementation(minSdk=29) protected String[] setDistractingPackageRestrictions(String[] packages, int restrictionFlags) -
getProperty
@Implementation(minSdk=31) protected Object getProperty(String propertyName, String packageName) throws PackageManager.NameNotFoundException Stub that will always throw. -
getProperty
@Implementation(minSdk=31) protected Object getProperty(String propertyName, ComponentName name) throws PackageManager.NameNotFoundException Stub that will always throw. -
getClearedApplicationUserDataPackages
Returns the list of package names that were requested to be cleared.
-