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 Constructor Description ShadowApplicationPackageManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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
addPermissionAsync(PermissionInfo info)
void
addPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity)
protected String[]
canonicalToCurrentPackageNames(String[] names)
protected boolean
canRequestPackageInstalls()
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
getApplicationIcon(ApplicationInfo info)
protected Drawable
getApplicationIcon(String packageName)
protected ApplicationInfo
getApplicationInfo(String packageName, int flags)
protected Object
getChangedPackages(int sequenceNumber)
List<String>
getClearedApplicationUserDataPackages()
Returns the list of package names that were requested to be cleared.protected int
getComponentEnabledSetting(ComponentName componentName)
protected Drawable
getDefaultActivityIcon()
protected String
getDefaultBrowserPackageNameAsUser(int userId)
protected Drawable
getDrawable(String packageName, int resId, ApplicationInfo appInfo)
protected ComponentName
getHomeActivities(List<ResolveInfo> outActivities)
protected List<ApplicationInfo>
getInstalledApplications(int flags)
protected List<ModuleInfo>
getInstalledModules(int flags)
List<PackageInfo>
getInstalledPackages(int 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 Object
getKeySetByAlias(String packageName, String alias)
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>
getPackageCandidateVolumes(ApplicationInfo app)
protected Object
getPackageCurrentVolume(Object app)
protected int[]
getPackageGids(String packageName)
protected int[]
getPackageGids(String packageName, int flags)
protected PackageInfo
getPackageInfo(String packageName, int flags)
protected PackageInfo
getPackageInfoAsUser(String packageName, int flags, int 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 int
getPackageUid(String packageName, int flags)
protected int
getPackageUidAsUser(String packageName, int userId)
protected int
getPackageUidAsUser(String packageName, int flags, int userId)
protected String
getPermissionControllerPackageName()
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>
getPrimaryStorageCandidateVolumes()
protected Object
getPrimaryStorageCurrentVolume()
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
getServicesSystemSharedLibraryPackageName()
protected String
getSharedSystemSharedLibraryPackageName()
protected Object
getSigningKeySet(String packageName)
protected FeatureInfo[]
getSystemAvailableFeatures()
protected String[]
getSystemSharedLibraryNames()
Returns all the values added viaShadowPackageManager.addSystemSharedLibraryName(String)
.String
getSystemTextClassifierPackageName()
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
getVerifierDeviceIdentity()
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
isAutoRevokeWhitelisted()
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
isSafeMode()
protected boolean
isSignedBy(String packageName, Object ks)
protected boolean
isSignedByExactly(String packageName, Object ks)
protected boolean
isUpgrade()
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>
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>
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 ProviderInfo
resolveContentProvider(String name, int flags)
protected ProviderInfo
resolveContentProviderAsUser(String name, int flags, int userId)
protected ResolveInfo
resolveService(Intent intent, int flags)
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 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 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, getPackageInfoForTesting, getPackageSetting, getPersistentPreferredActivities, getPreferredActivitiesInternal, getShadowPackageArchiveInfo, 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
-
-
-
-
Method Detail
-
getInstalledPackages
@Implementation public List<PackageInfo> getInstalledPackages(int flags)
-
getInstalledModules
@Implementation(minSdk=29) protected List<ModuleInfo> getInstalledModules(int flags)
-
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
@Implementation protected boolean hasSystemFeature(String name)
-
getComponentEnabledSetting
@Implementation protected int getComponentEnabledSetting(ComponentName componentName)
-
getNameForUid
@Implementation protected String getNameForUid(int uid)
-
getPackagesForUid
@Implementation protected String[] getPackagesForUid(int uid)
- Overrides:
getPackagesForUid
in classShadowPackageManager
-
getApplicationEnabledSetting
@Implementation protected int getApplicationEnabledSetting(String packageName)
-
getProviderInfo
@Implementation protected ProviderInfo getProviderInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException
-
setComponentEnabledSetting
@Implementation protected void setComponentEnabledSetting(ComponentName componentName, int newState, int flags)
-
setApplicationEnabledSetting
@Implementation protected void setApplicationEnabledSetting(String packageName, int newState, int flags)
-
resolveActivity
@Implementation protected ResolveInfo resolveActivity(Intent intent, int flags)
-
resolveContentProvider
@Implementation protected ProviderInfo resolveContentProvider(String name, int flags)
-
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
-
getPackageArchiveInfo
@Implementation(minSdk=31) 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
@Implementation protected List<ResolveInfo> queryIntentServices(Intent intent, int flags)
-
queryIntentServicesAsUser
@Implementation(minSdk=17) protected List<ResolveInfo> queryIntentServicesAsUser(Intent intent, int flags, int userId)
Behaves asqueryIntentServices(Intent, int)
and currently ignores userId.
-
queryIntentActivities
@Implementation protected List<ResolveInfo> queryIntentActivities(Intent intent, int flags)
-
queryIntentActivitiesAsUser
@Implementation(minSdk=17) protected List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId)
Behaves asqueryIntentActivities(Intent, int)
and currently ignores userId.
-
checkPermission
@Implementation protected int checkPermission(String permName, String pkgName)
-
getReceiverInfo
@Implementation protected ActivityInfo getReceiverInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException
-
queryBroadcastReceivers
@Implementation protected List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags)
-
resolveService
@Implementation protected ResolveInfo resolveService(Intent intent, int flags)
-
getServiceInfo
@Implementation protected ServiceInfo getServiceInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException
-
getResourcesForApplication
@Implementation protected Resources getResourcesForApplication(ApplicationInfo applicationInfo) throws PackageManager.NameNotFoundException
-
getInstalledApplications
@Implementation protected List<ApplicationInfo> getInstalledApplications(int flags)
-
getInstallerPackageName
@Implementation protected String getInstallerPackageName(String packageName)
-
getInstallSourceInfo
@Implementation(minSdk=30) protected Object getInstallSourceInfo(String packageName)
-
getPermissionInfo
@Implementation protected PermissionInfo getPermissionInfo(String name, int flags) throws PackageManager.NameNotFoundException
-
shouldShowRequestPermissionRationale
@Implementation(minSdk=23) protected boolean shouldShowRequestPermissionRationale(String permission)
-
getSystemAvailableFeatures
@Implementation protected FeatureInfo[] getSystemAvailableFeatures()
-
verifyPendingInstall
@Implementation protected void verifyPendingInstall(int id, int verificationCode)
-
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
@Implementation(minSdk=23) protected String getPermissionControllerPackageName()
-
getPackageSizeInfo
@Implementation(maxSdk=16) protected void getPackageSizeInfo(Object pkgName, Object observer)
-
getPackageSizeInfo
@Implementation(minSdk=17, 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:
deletePackage
in classShadowPackageManager
-
currentToCanonicalPackageNames
@Implementation protected String[] currentToCanonicalPackageNames(String[] names)
-
canonicalToCurrentPackageNames
@Implementation protected String[] canonicalToCurrentPackageNames(String[] names)
-
isSafeMode
@Implementation protected boolean isSafeMode()
-
getApplicationIcon
@Implementation protected Drawable getApplicationIcon(String packageName) throws PackageManager.NameNotFoundException
-
getApplicationIcon
@Implementation protected Drawable getApplicationIcon(ApplicationInfo info) throws PackageManager.NameNotFoundException
-
getUserBadgeForDensity
@Implementation(minSdk=21) protected Drawable getUserBadgeForDensity(UserHandle userHandle, int i)
-
checkSignatures
@Implementation protected int checkSignatures(String pkg1, String pkg2)
-
checkSignatures
@Implementation protected int checkSignatures(int uid1, int uid2)
-
queryPermissionsByGroup
@Implementation protected List<PermissionInfo> queryPermissionsByGroup(String group, int flags) throws PackageManager.NameNotFoundException
-
getLaunchIntentForPackage
@Implementation protected Intent getLaunchIntentForPackage(String packageName)
-
getLeanbackLaunchIntentForPackage
@Implementation(minSdk=21) protected Intent getLeanbackLaunchIntentForPackage(String packageName)
-
getPackageInfoAsUser
@Implementation(minSdk=24) protected PackageInfo getPackageInfoAsUser(String packageName, int flags, int 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
-
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
@Implementation protected List<PermissionGroupInfo> getAllPermissionGroups(int flags)
-
getApplicationInfo
@Implementation protected ApplicationInfo getApplicationInfo(String packageName, int flags) throws PackageManager.NameNotFoundException
-
getSystemSharedLibraryNames
@Implementation protected String[] getSystemSharedLibraryNames()
Returns all the values added viaShadowPackageManager.addSystemSharedLibraryName(String)
.
-
getServicesSystemSharedLibraryPackageName
@Implementation(minSdk=24) protected String getServicesSystemSharedLibraryPackageName()
-
getSharedSystemSharedLibraryPackageName
@Implementation(minSdk=24) protected String getSharedSystemSharedLibraryPackageName()
-
hasSystemFeature
@Implementation(minSdk=24) protected boolean hasSystemFeature(String name, int version)
-
isPermissionRevokedByPolicy
@Implementation(minSdk=23) protected boolean isPermissionRevokedByPolicy(String permName, String pkgName)
-
addPermission
@Implementation protected boolean addPermission(PermissionInfo info)
-
addPermissionAsync
@Implementation protected boolean addPermissionAsync(PermissionInfo info)
-
removePermission
@Implementation protected void removePermission(String name)
-
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.
-
getUidForSharedUser
@Implementation protected int getUidForSharedUser(String sharedUserName) throws PackageManager.NameNotFoundException
-
getInstalledPackagesAsUser
@Implementation(minSdk=24) protected List<PackageInfo> getInstalledPackagesAsUser(int flags, int userId)
-
getPackagesHoldingPermissions
@Implementation(minSdk=18) protected List<PackageInfo> getPackagesHoldingPermissions(String[] permissions, int flags)
-
resolveActivityAsUser
@Implementation(minSdk=17) protected ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId)
Behaves asresolveActivity(Intent, int)
and currently ignores 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
@Implementation protected Drawable 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
@Implementation(minSdk=23) protected void addOnPermissionsChangeListener(Object listener)
-
removeOnPermissionsChangeListener
@Implementation(minSdk=23) protected void removeOnPermissionsChangeListener(Object listener)
-
installPackage
@Implementation(maxSdk=27) protected void installPackage(Object packageURI, Object observer, Object flags, Object installerPackageName)
-
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
@Implementation(minSdk=23) protected List<IntentFilter> getAllIntentFilters(String packageName)
-
getDefaultBrowserPackageNameAsUser
@Implementation(minSdk=24) protected String getDefaultBrowserPackageNameAsUser(int userId)
-
setDefaultBrowserPackageNameAsUser
@Implementation(minSdk=24) protected boolean setDefaultBrowserPackageNameAsUser(String packageName, int userId)
-
getMoveStatus
@Implementation(minSdk=23) protected int getMoveStatus(int moveId)
-
registerMoveCallback
@Implementation(minSdk=23) protected void registerMoveCallback(Object callback, Object handler)
-
unregisterMoveCallback
@Implementation(minSdk=23) protected void unregisterMoveCallback(Object callback)
-
movePackage
@Implementation(minSdk=23) protected Object movePackage(Object packageName, Object vol)
-
getPackageCurrentVolume
@Implementation(minSdk=23) protected Object getPackageCurrentVolume(Object app)
-
getPackageCandidateVolumes
@Implementation(minSdk=23) protected List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app)
-
movePrimaryStorage
@Implementation(minSdk=23) protected Object movePrimaryStorage(Object vol)
-
getPrimaryStorageCurrentVolume
@Implementation(minSdk=23) protected Object getPrimaryStorageCurrentVolume()
-
getPrimaryStorageCandidateVolumes
@Implementation(minSdk=23) protected List<VolumeInfo> 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
@Implementation protected void addPackageToPreferred(String packageName)
-
removePackageFromPreferred
@Implementation protected void removePackageFromPreferred(String packageName)
-
getPreferredPackages
@Implementation protected List<PackageInfo> getPreferredPackages(int flags)
-
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
@Implementation protected void clearPackagePreferredActivities(String packageName)
-
getHomeActivities
@Implementation(minSdk=19) protected ComponentName getHomeActivities(List<ResolveInfo> outActivities)
-
flushPackageRestrictionsAsUser
@Implementation(minSdk=24) protected void flushPackageRestrictionsAsUser(int userId)
-
setApplicationHiddenSettingAsUser
@Implementation(minSdk=21) protected boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, UserHandle user)
-
getApplicationHiddenSettingAsUser
@Implementation(minSdk=21) protected boolean getApplicationHiddenSettingAsUser(String packageName, UserHandle user)
-
getKeySetByAlias
@Implementation(minSdk=21) protected Object getKeySetByAlias(String packageName, String alias)
-
getSigningKeySet
@Implementation(minSdk=21) protected Object getSigningKeySet(String packageName)
-
isSignedBy
@Implementation(minSdk=21) protected boolean isSignedBy(String packageName, Object ks)
-
isSignedByExactly
@Implementation(minSdk=21) protected boolean isSignedByExactly(String packageName, Object ks)
-
getVerifierDeviceIdentity
@Implementation protected VerifierDeviceIdentity getVerifierDeviceIdentity()
-
isUpgrade
@Implementation(minSdk=22) protected boolean isUpgrade()
-
isPackageAvailable
@Implementation(minSdk=21) protected boolean isPackageAvailable(String packageName)
-
addCrossProfileIntentFilter
@Implementation(minSdk=21) protected void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, int targetUserId, int flags)
-
clearCrossProfileIntentFilters
@Implementation(minSdk=21) protected void clearCrossProfileIntentFilters(int sourceUserId)
-
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
@Implementation(minSdk=21) protected Drawable getUserBadgedIcon(Drawable icon, UserHandle user)
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
@Implementation(minSdk=26) protected boolean canRequestPackageInstalls()
-
getChangedPackages
@Implementation(minSdk=26) protected Object getChangedPackages(int sequenceNumber)
-
getSystemTextClassifierPackageName
@Implementation(minSdk=28) public String 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
@Implementation(minSdk=30) protected boolean 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
@Implementation(minSdk=26) protected boolean isInstantApp(String packageName)
-
setDistractingPackageRestrictions
@HiddenApi @Implementation(minSdk=29) protected String[] setDistractingPackageRestrictions(String[] packages, int restrictionFlags)
-
-