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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCrossProfileIntentFilter
(IntentFilter filter, int sourceUserId, int targetUserId, int flags) protected void
addOnPermissionsChangeListener
(Object listener) protected void
addPackageToPreferred
(String packageName) protected boolean
addPermission
(PermissionInfo info) protected boolean
void
addPreferredActivity
(IntentFilter filter, int match, ComponentName[] set, ComponentName activity) protected String[]
canonicalToCurrentPackageNames
(String[] names) protected boolean
protected int
checkPermission
(String permName, String pkgName) protected int
checkSignatures
(int uid1, int uid2) protected int
checkSignatures
(String pkg1, String pkg2) protected void
clearApplicationUserData
(String packageName, IPackageDataObserver observer) protected void
clearCrossProfileIntentFilters
(int sourceUserId) protected void
clearPackagePreferredActivities
(String packageName) protected String[]
currentToCanonicalPackageNames
(String[] names) protected void
deleteApplicationCacheFiles
(String packageName, IPackageDataObserver observer) protected void
deleteApplicationCacheFilesAsUser
(String packageName, int userId, IPackageDataObserver observer) protected void
deletePackage
(String packageName, IPackageDeleteObserver observer, int flags) protected void
deletePackageAsUser
(String packageName, IPackageDeleteObserver observer, int flags, int userId) protected void
extendVerificationTimeout
(int id, int verificationCodeAtTimeout, long millisecondsToDelay) protected void
flushPackageRestrictionsAsUser
(int userId) protected void
freeStorage
(String volumeUuid, long freeStorageSize, IntentSender pi) protected void
freeStorageAndNotify
(long freeStorageSize, IPackageDataObserver observer) protected void
freeStorageAndNotify
(String volumeUuid, long freeStorageSize, IPackageDataObserver observer) protected Drawable
getActivityIcon
(ComponentName activityName) protected ActivityInfo
getActivityInfo
(ComponentName component, int flags) protected List<IntentFilter>
getAllIntentFilters
(String packageName) protected List<PermissionGroupInfo>
getAllPermissionGroups
(int flags) protected int
getApplicationEnabledSetting
(String packageName) protected boolean
getApplicationHiddenSettingAsUser
(String packageName, UserHandle user) protected Drawable
protected Drawable
getApplicationIcon
(String packageName) protected ApplicationInfo
getApplicationInfo
(Object packageName, Object flagsObject) protected ApplicationInfo
getApplicationInfo
(String packageName, int flags) protected Object
getChangedPackages
(int sequenceNumber) Returns the list of package names that were requested to be cleared.protected int
getComponentEnabledSetting
(ComponentName componentName) protected Drawable
protected String
getDefaultBrowserPackageNameAsUser
(int userId) protected Drawable
getDrawable
(String packageName, int resId, ApplicationInfo appInfo) void
getGroupOfPlatformPermission
(String permissionName, Executor executor, Consumer<String> callback) protected ComponentName
getHomeActivities
(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 String
getInstallerPackageName
(String packageName) protected Object
getInstallSourceInfo
(String packageName) protected InstrumentationInfo
getInstrumentationInfo
(ComponentName className, int flags) protected List<IntentFilterVerificationInfo>
getIntentFilterVerifications
(String packageName) protected int
getIntentVerificationStatusAsUser
(String packageName, int userId) protected Intent
getLaunchIntentForPackage
(String packageName) protected Intent
getLeanbackLaunchIntentForPackage
(String packageName) protected Object
getModuleInfo
(String packageName, int flags) protected int
getMoveStatus
(int moveId) protected String
getNameForUid
(int uid) protected PackageInfo
getPackageArchiveInfo
(String archiveFilePath, int flags) Starting in Android S, this method was moved fromPackageManager
toApplicationPackageManager
.protected List<VolumeInfo>
protected Object
protected int[]
getPackageGids
(String packageName) protected int[]
getPackageGids
(String packageName, int flags) protected PackageInfo
getPackageInfo
(Object packageName, Object flags) protected PackageInfo
getPackageInfo
(String packageName, int flags) protected Object
getPackageInfoAsUser
(Object packageName, Object flagsObject, Object userId) protected String[]
getPackagesForUid
(int uid) protected List<PackageInfo>
getPackagesHoldingPermissions
(String[] permissions, int flags) protected void
getPackageSizeInfo
(Object pkgName, Object observer) protected void
getPackageSizeInfo
(Object pkgName, Object uid, Object observer) protected void
getPackageSizeInfoAsUser
(Object pkgName, Object uid, Object observer) protected Object
getPackageUid
(Object packageName, Object flags) protected int
getPackageUid
(String packageName, int flags) protected int
getPackageUidAsUser
(String packageName, int userId) protected int
getPackageUidAsUser
(String packageName, int flags, int userId) protected String
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.protected PermissionGroupInfo
getPermissionGroupInfo
(String name, int flags) protected PermissionInfo
getPermissionInfo
(String name, int flags) int
getPreferredActivities
(List<IntentFilter> outFilters, List<ComponentName> outActivities, String packageName) protected List<PackageInfo>
getPreferredPackages
(int flags) protected List<VolumeInfo>
protected Object
protected Object
getProperty
(String propertyName, ComponentName name) Stub that will always throw.protected Object
getProperty
(String propertyName, String packageName) Stub that will always throw.protected ProviderInfo
getProviderInfo
(ComponentName component, int flags) protected ActivityInfo
getReceiverInfo
(ComponentName component, int flags) protected Resources
getResourcesForActivity
(ComponentName activityName) protected Resources
getResourcesForApplication
(ApplicationInfo applicationInfo) protected Resources
getResourcesForApplication
(String appPackageName) protected Resources
getResourcesForApplicationAsUser
(String appPackageName, int userId) protected ServiceInfo
getServiceInfo
(ComponentName component, int flags) protected String
protected String
protected boolean
getSyntheticAppDetailsActivityEnabled
(String packageName) protected FeatureInfo[]
protected String[]
Returns all the values added viaShadowPackageManager.addSystemSharedLibraryName(String)
.protected CharSequence
getText
(String packageName, int resId, ApplicationInfo appInfo) Returns a user stored String resource withresId
corresponding topackageName
.protected int
getUidForSharedUser
(String sharedUserName) protected String[]
getUnsuspendablePackages
(String[] packageNames) protected Drawable
getUserBadgedIcon
(Drawable icon, UserHandle user) Adds a profile badge to the icon.protected Drawable
getUserBadgeForDensity
(UserHandle userHandle, int i) protected VerifierDeviceIdentity
protected void
grantRuntimePermission
(String packageName, String permissionName, UserHandle user) protected boolean
hasSystemFeature
(String name) protected boolean
hasSystemFeature
(String name, int version) protected int
installExistingPackage
(String packageName) protected int
installExistingPackageAsUser
(String packageName, int userId) protected void
installPackage
(Object packageURI, Object observer, Object flags, Object installerPackageName) protected boolean
protected boolean
isInstantApp
(String packageName) protected boolean
isPackageAvailable
(String packageName) protected boolean
isPackageSuspended
(String packageName) protected boolean
isPackageSuspendedForUser
(String packageName, int userId) protected boolean
isPermissionRevokedByPolicy
(String permName, String pkgName) protected boolean
protected boolean
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.protected Object
movePackage
(Object packageName, Object vol) protected Object
movePrimaryStorage
(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 void
registerMoveCallback
(Object callback, Object handler) protected void
removeOnPermissionsChangeListener
(Object listener) protected void
removePackageFromPreferred
(String packageName) protected void
removePermission
(String name) protected void
replacePreferredActivity
(IntentFilter filter, int match, ComponentName[] set, ComponentName activity) protected ResolveInfo
resolveActivity
(Intent intent, int flags) protected ResolveInfo
resolveActivityAsUser
(Intent intent, int flags, int userId) Behaves asresolveActivity(Intent, int)
and currently ignores userId.protected ResolveInfo
resolveActivityAsUser
(Object intent, Object flags, Object userId) protected ProviderInfo
resolveContentProvider
(String name, int flags) protected ProviderInfo
resolveContentProviderAsUser
(String name, int flags, int userId) protected ResolveInfo
resolveService
(Intent intent, int flags) protected ResolveInfo
resolveServiceAsUser
(Object intent, Object flags, Object userId) protected void
revokeRuntimePermission
(String packageName, String permissionName, UserHandle user) protected void
setApplicationEnabledSetting
(String packageName, int newState, int flags) protected boolean
setApplicationHiddenSettingAsUser
(String packageName, boolean hidden, UserHandle user) protected void
setComponentEnabledSetting
(ComponentName componentName, int newState, int flags) protected void
protected boolean
setDefaultBrowserPackageNameAsUser
(String packageName, int userId) protected String[]
setDistractingPackageRestrictions
(String[] packages, int restrictionFlags) protected void
setInstallerPackageName
(String targetPackage, String installerPackageName) protected Object
setPackagesSuspended
(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 void
setSyntheticAppDetailsActivityEnabled
(String packageName, boolean enabled) protected boolean
shouldShowRequestPermissionRationale
(String permission) protected void
unregisterMoveCallback
(Object callback) protected boolean
updateIntentVerificationStatusAsUser
(String packageName, int status, int userId) 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.protected void
verifyIntentFilter
(int id, int verificationCode, List<String> failedDomains) protected void
verifyPendingInstall
(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:
getPackagesForUid
in 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(minSdk=21) 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 fromPackageManager
toApplicationPackageManager
. However, it was moved back toPackageManager
in T.- Overrides:
getPackageArchiveInfo
in classShadowPackageManager
-
queryIntentServices
-
queryIntentServicesAsUser
@Implementation(minSdk=17) protected List<ResolveInfo> queryIntentServicesAsUser(Intent intent, int flags, int userId) Behaves asqueryIntentServices(Intent, int)
and currently ignores userId. -
queryIntentActivities
-
queryIntentActivitiesAsUser
@Implementation(minSdk=17) 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 -
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 -
getResourcesForApplication
@Implementation protected Resources getResourcesForApplication(ApplicationInfo applicationInfo) throws PackageManager.NameNotFoundException -
getInstalledApplications
-
getInstalledApplications
-
getInstallerPackageName
-
getInstallSourceInfo
-
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(minSdk=17) protected void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay) -
freeStorageAndNotify
@Implementation(maxSdk=22) protected void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer) - Overrides:
freeStorageAndNotify
in classShadowPackageManager
-
freeStorageAndNotify
@Implementation(minSdk=23) protected void freeStorageAndNotify(String volumeUuid, long freeStorageSize, IPackageDataObserver observer) -
setInstallerPackageName
@Implementation protected void setInstallerPackageName(String targetPackage, String installerPackageName) -
queryIntentContentProviders
@Implementation(minSdk=19) protected List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags) -
queryIntentContentProvidersAsUser
@Implementation(minSdk=19) protected List<ResolveInfo> queryIntentContentProvidersAsUser(Intent intent, int flags, int userId) -
getPermissionControllerPackageName
-
getPackageSizeInfo
-
getPackageSizeInfo
-
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:
deletePackage
in 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(minSdk=18) 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(minSdk=18) protected List<PackageInfo> getPackagesHoldingPermissions(String[] permissions, int flags) -
getGroupOfPlatformPermission
-
resolveActivityAsUser
@Implementation(minSdk=17) protected ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId) 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 withresId
corresponding 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
resId
andpackageName
. -
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(minSdk=17) protected Resources getResourcesForApplicationAsUser(String appPackageName, int userId) throws PackageManager.NameNotFoundException -
addOnPermissionsChangeListener
-
removeOnPermissionsChangeListener
-
installPackage
-
installExistingPackage
@Implementation(minSdk=17) 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
@Implementation(minSdk=19) protected ComponentName getHomeActivities(List<ResolveInfo> outActivities) -
flushPackageRestrictionsAsUser
-
setApplicationHiddenSettingAsUser
@Implementation(minSdk=21) protected boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, UserHandle user) -
getApplicationHiddenSettingAsUser
@Implementation(minSdk=21) protected boolean getApplicationHiddenSettingAsUser(String packageName, UserHandle user) -
getVerifierDeviceIdentity
-
isUpgrade
-
isPackageAvailable
-
addCrossProfileIntentFilter
@Implementation(minSdk=21) 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.
-