@Implements(value=android.app.ApplicationPackageManager.class, isInAndroidSdk=false, looseSignatures=true) public class ShadowApplicationPackageManager extends ShadowPackageManager
ShadowPackageManager.ComponentState, ShadowPackageManager.IntentComparator, ShadowPackageManager.PackageSetting
resources
Constructor and Description |
---|
ShadowApplicationPackageManager() |
addActivityIcon, addActivityIcon, addActivityIfNotPresent, 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, addSystemAvailableFeature, addSystemSharedLibraryName, clearIntentFilterForActivity, clearIntentFilterForProvider, clearIntentFilterForReceiver, clearIntentFilterForService, clearPackagePreferredActivitiesInternal, clearSystemAvailableFeatures, clearSystemSharedLibraryNames, deletePackage, doPendingUninstallCallbacks, freeStorage, getComponentEnabledSettingFlags, getDeletedPackages, getIntentFiltersForActivity, getIntentFiltersForProvider, getIntentFiltersForReceiver, getIntentFiltersForService, getInternalMutablePackageInfo, getPackageArchiveInfo, getPackageInfoForTesting, getPackageSetting, getPersistentPreferredActivities, getPreferredActivitiesInternal, getVerificationExtendedTimeout, getVerificationResult, installPackage, mapForPackage, queryBroadcastReceivers, queryBroadcastReceiversAsUser, queryOverriddenIntents, removeActivity, removePackage, removeProvider, removeReceiver, removeResolveInfosForIntent, removeService, reset, setApplicationIcon, setCanRequestPackageInstalls, setNameForUid, setPackageArchiveInfo, setPackagesForCallingUid, setPackagesForUid, setResolveInfosForIntent, setSafeMode, setShouldShowActivityChooser, setShouldShowRequestPermissionRationale, setSystemFeature, setUnbadgedApplicationIcon
@Implementation protected void __constructor__(Object contextImpl, Object pm)
@Implementation public List<PackageInfo> getInstalledPackages(int flags)
@Implementation protected ActivityInfo getActivityInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException
@Implementation protected boolean hasSystemFeature(String name)
@Implementation protected int getComponentEnabledSetting(ComponentName componentName)
@Implementation protected String getNameForUid(int uid)
@Implementation protected String[] getPackagesForUid(int uid)
getPackagesForUid
in class ShadowPackageManager
@Implementation protected int getApplicationEnabledSetting(String packageName)
@Implementation protected ProviderInfo getProviderInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException
@Implementation protected void setComponentEnabledSetting(ComponentName componentName, int newState, int flags)
@Implementation protected void setApplicationEnabledSetting(String packageName, int newState, int flags)
@Implementation protected ResolveInfo resolveActivity(Intent intent, int flags)
@Implementation protected ProviderInfo resolveContentProvider(String name, int flags)
@Implementation(minSdk=21) protected ProviderInfo resolveContentProviderAsUser(String name, int flags, int userId)
@Implementation protected PackageInfo getPackageInfo(String packageName, int flags) throws PackageManager.NameNotFoundException
@Implementation protected List<ResolveInfo> queryIntentServices(Intent intent, int flags)
@Implementation(minSdk=17) protected List<ResolveInfo> queryIntentServicesAsUser(Intent intent, int flags, int userId)
Behaves as queryIntentServices(Intent, int)
and currently ignores userId.
@Implementation protected List<ResolveInfo> queryIntentActivities(Intent intent, int flags)
@Implementation(minSdk=17) protected List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent, int flags, int userId)
Behaves as queryIntentActivities(Intent, int)
and currently ignores userId.
@Implementation protected int checkPermission(String permName, String pkgName)
@Implementation protected ActivityInfo getReceiverInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException
@Implementation protected List<ResolveInfo> queryBroadcastReceivers(Intent intent, int flags)
@Implementation protected ResolveInfo resolveService(Intent intent, int flags)
@Implementation protected ServiceInfo getServiceInfo(ComponentName component, int flags) throws PackageManager.NameNotFoundException
@Implementation protected Resources getResourcesForApplication(ApplicationInfo applicationInfo) throws PackageManager.NameNotFoundException
@Implementation protected List<ApplicationInfo> getInstalledApplications(int flags)
@Implementation protected String getInstallerPackageName(String packageName)
@Implementation protected PermissionInfo getPermissionInfo(String name, int flags) throws PackageManager.NameNotFoundException
@Implementation(minSdk=23) protected boolean shouldShowRequestPermissionRationale(String permission)
@Implementation protected FeatureInfo[] getSystemAvailableFeatures()
@Implementation protected void verifyPendingInstall(int id, int verificationCode)
@Implementation(minSdk=17) protected void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay)
@Implementation(maxSdk=22) protected void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer)
freeStorageAndNotify
in class ShadowPackageManager
@Implementation(minSdk=23) protected void freeStorageAndNotify(String volumeUuid, long freeStorageSize, IPackageDataObserver observer)
@Implementation protected void setInstallerPackageName(String targetPackage, String installerPackageName)
@Implementation(minSdk=19) protected List<ResolveInfo> queryIntentContentProviders(Intent intent, int flags)
@Implementation(minSdk=19) protected List<ResolveInfo> queryIntentContentProvidersAsUser(Intent intent, int flags, int userId)
@Implementation(minSdk=23) protected String getPermissionControllerPackageName()
@Implementation(maxSdk=16) protected void getPackageSizeInfo(Object pkgName, Object observer)
@Implementation(minSdk=17, maxSdk=23) protected void getPackageSizeInfo(Object pkgName, Object uid, Object observer)
@Implementation(minSdk=24) protected void getPackageSizeInfoAsUser(Object pkgName, Object uid, Object observer)
@Implementation protected void deletePackage(String packageName, IPackageDeleteObserver observer, int flags)
deletePackage
in class ShadowPackageManager
@Implementation protected String[] currentToCanonicalPackageNames(String[] names)
@Implementation protected boolean isSafeMode()
@Implementation protected Drawable getApplicationIcon(String packageName) throws PackageManager.NameNotFoundException
@Implementation protected Drawable getApplicationIcon(ApplicationInfo info)
@Implementation(minSdk=21) protected Drawable getUserBadgeForDensity(UserHandle userHandle, int i)
@Implementation protected int checkSignatures(String pkg1, String pkg2)
@Implementation protected int checkSignatures(int uid1, int uid2)
@Implementation protected List<PermissionInfo> queryPermissionsByGroup(String group, int flags) throws PackageManager.NameNotFoundException
@Implementation protected Intent getLaunchIntentForPackage(String packageName)
@Implementation(minSdk=24) protected PackageInfo getPackageInfoAsUser(String packageName, int flags, int userId) throws PackageManager.NameNotFoundException
@Implementation protected String[] canonicalToCurrentPackageNames(String[] names)
@Implementation protected int[] getPackageGids(String packageName) throws PackageManager.NameNotFoundException
@Implementation(minSdk=24) protected int[] getPackageGids(String packageName, int flags) throws PackageManager.NameNotFoundException
@Implementation(minSdk=18) protected int getPackageUid(String packageName, int flags) throws PackageManager.NameNotFoundException
@Implementation(minSdk=24) protected int getPackageUidAsUser(String packageName, int userId) throws PackageManager.NameNotFoundException
@Implementation(minSdk=24) protected int getPackageUidAsUser(String packageName, int flags, int userId) throws PackageManager.NameNotFoundException
@Implementation protected PermissionGroupInfo getPermissionGroupInfo(String name, int flags) throws PackageManager.NameNotFoundException
@Implementation protected List<PermissionGroupInfo> getAllPermissionGroups(int flags)
@Implementation protected ApplicationInfo getApplicationInfo(String packageName, int flags) throws PackageManager.NameNotFoundException
@Implementation protected String[] getSystemSharedLibraryNames()
Returns all the values added via ShadowPackageManager.addSystemSharedLibraryName(String)
.
@Implementation(minSdk=24) protected String getServicesSystemSharedLibraryPackageName()
@Implementation(minSdk=24) protected String getSharedSystemSharedLibraryPackageName()
@Implementation(minSdk=24) protected boolean hasSystemFeature(String name, int version)
@Implementation(minSdk=23) protected boolean isPermissionRevokedByPolicy(String permName, String pkgName)
@Implementation protected boolean addPermission(PermissionInfo info)
@Implementation protected boolean addPermissionAsync(PermissionInfo info)
@Implementation protected void removePermission(String name)
@Implementation(minSdk=23) protected void grantRuntimePermission(String packageName, String permissionName, UserHandle user)
@Implementation(minSdk=23) protected void revokeRuntimePermission(String packageName, String permissionName, UserHandle user)
@Implementation(minSdk=23) protected int getPermissionFlags(String permissionName, String packageName, UserHandle user)
@Implementation(minSdk=23) protected void updatePermissionFlags(String permissionName, String packageName, int flagMask, int flagValues, UserHandle user)
@Implementation protected int getUidForSharedUser(String sharedUserName) throws PackageManager.NameNotFoundException
@Implementation(minSdk=24) protected List<PackageInfo> getInstalledPackagesAsUser(int flags, int userId)
@Implementation(minSdk=18) protected List<PackageInfo> getPackagesHoldingPermissions(String[] permissions, int flags)
@Implementation(minSdk=17) protected ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId)
Behaves as resolveActivity(Intent, int)
and currently ignores userId.
@Implementation protected List<ResolveInfo> queryIntentActivityOptions(ComponentName caller, Intent[] specifics, Intent intent, int flags)
@Implementation(minSdk=24) protected List<ResolveInfo> queryBroadcastReceiversAsUser(Intent intent, int flags, int userId)
@Implementation protected List<ProviderInfo> queryContentProviders(String processName, int uid, int flags)
@Implementation protected InstrumentationInfo getInstrumentationInfo(ComponentName className, int flags) throws PackageManager.NameNotFoundException
@Implementation protected List<InstrumentationInfo> queryInstrumentation(String targetPackage, int flags)
@Implementation protected Drawable getDrawable(String packageName, @DrawableRes int resId, ApplicationInfo appInfo)
@Implementation protected Drawable getActivityIcon(ComponentName activityName) throws PackageManager.NameNotFoundException
@Implementation protected Drawable getDefaultActivityIcon()
@Implementation protected Resources getResourcesForActivity(ComponentName activityName) throws PackageManager.NameNotFoundException
@Implementation protected Resources getResourcesForApplication(String appPackageName) throws PackageManager.NameNotFoundException
@Implementation(minSdk=17) protected Resources getResourcesForApplicationAsUser(String appPackageName, int userId) throws PackageManager.NameNotFoundException
@Implementation(minSdk=23) protected void addOnPermissionsChangeListener(Object listener)
@Implementation(minSdk=23) protected void removeOnPermissionsChangeListener(Object listener)
@Implementation(maxSdk=27) protected void installPackage(Object packageURI, Object observer, Object flags, Object installerPackageName)
@Implementation(minSdk=17) protected int installExistingPackage(String packageName) throws PackageManager.NameNotFoundException
@Implementation(minSdk=24) protected int installExistingPackageAsUser(String packageName, int userId) throws PackageManager.NameNotFoundException
@Implementation(minSdk=23) protected void verifyIntentFilter(int id, int verificationCode, List<String> failedDomains)
@Implementation(minSdk=24) protected int getIntentVerificationStatusAsUser(String packageName, int userId)
@Implementation(minSdk=24) protected boolean updateIntentVerificationStatusAsUser(String packageName, int status, int userId)
@Implementation(minSdk=23) protected List<IntentFilterVerificationInfo> getIntentFilterVerifications(String packageName)
@Implementation(minSdk=23) protected List<IntentFilter> getAllIntentFilters(String packageName)
@Implementation(minSdk=24) protected String getDefaultBrowserPackageNameAsUser(int userId)
@Implementation(minSdk=24) protected boolean setDefaultBrowserPackageNameAsUser(String packageName, int userId)
@Implementation(minSdk=23) protected int getMoveStatus(int moveId)
@Implementation(minSdk=23) protected void registerMoveCallback(Object callback, Object handler)
@Implementation(minSdk=23) protected void unregisterMoveCallback(Object callback)
@Implementation(minSdk=23) protected Object movePackage(Object packageName, Object vol)
@Implementation(minSdk=23) protected Object getPackageCurrentVolume(Object app)
@Implementation(minSdk=23) protected List<VolumeInfo> getPackageCandidateVolumes(ApplicationInfo app)
@Implementation(minSdk=23) protected Object movePrimaryStorage(Object vol)
@Implementation(minSdk=23) protected Object getPrimaryStorageCurrentVolume()
@Implementation(minSdk=23) protected List<VolumeInfo> getPrimaryStorageCandidateVolumes()
@Implementation(minSdk=24) protected void deletePackageAsUser(String packageName, IPackageDeleteObserver observer, int flags, int userId)
@Implementation protected void clearApplicationUserData(String packageName, IPackageDataObserver observer)
@Implementation protected void deleteApplicationCacheFiles(String packageName, IPackageDataObserver observer)
@Implementation(minSdk=24) protected void deleteApplicationCacheFilesAsUser(String packageName, int userId, IPackageDataObserver observer)
@Implementation(minSdk=23) protected void freeStorage(String volumeUuid, long freeStorageSize, IntentSender pi)
@Implementation(minSdk=24, maxSdk=27) protected String[] setPackagesSuspendedAsUser(String[] packageNames, boolean suspended, int userId)
@Implementation(minSdk=24) protected boolean isPackageSuspendedForUser(String packageName, int userId)
@Implementation protected void addPackageToPreferred(String packageName)
@Implementation protected void removePackageFromPreferred(String packageName)
@Implementation protected List<PackageInfo> getPreferredPackages(int flags)
@Implementation public void addPreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity)
@Implementation protected void replacePreferredActivity(IntentFilter filter, int match, ComponentName[] set, ComponentName activity)
@Implementation public int getPreferredActivities(List<IntentFilter> outFilters, List<ComponentName> outActivities, String packageName)
@Implementation protected void clearPackagePreferredActivities(String packageName)
@Implementation(minSdk=19) protected ComponentName getHomeActivities(List<ResolveInfo> outActivities)
@Implementation(minSdk=24) protected void flushPackageRestrictionsAsUser(int userId)
@Implementation(minSdk=21) protected boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, UserHandle user)
@Implementation(minSdk=21) protected boolean getApplicationHiddenSettingAsUser(String packageName, UserHandle user)
@Implementation(minSdk=21) protected Object getKeySetByAlias(String packageName, String alias)
@Implementation(minSdk=21) protected Object getSigningKeySet(String packageName)
@Implementation(minSdk=21) protected boolean isSignedBy(String packageName, Object ks)
@Implementation(minSdk=21) protected boolean isSignedByExactly(String packageName, Object ks)
@Implementation protected VerifierDeviceIdentity getVerifierDeviceIdentity()
@Implementation(minSdk=22) protected boolean isUpgrade()
@Implementation(minSdk=21) protected boolean isPackageAvailable(String packageName)
@Implementation(minSdk=21) protected void addCrossProfileIntentFilter(IntentFilter filter, int sourceUserId, int targetUserId, int flags)
@Implementation(minSdk=21) protected void clearCrossProfileIntentFilters(int sourceUserId)
@Implementation(minSdk=22) protected Drawable loadUnbadgedItemIcon(PackageItemInfo itemInfo, ApplicationInfo appInfo)
Gets the unbadged icon based on the values set by ShadowPackageManager.setUnbadgedApplicationIcon(java.lang.String, android.graphics.drawable.Drawable)
or returns null if nothing has been set.
@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.
@Implementation(minSdk=26) protected boolean canRequestPackageInstalls()
@Implementation(minSdk=26) protected Object getChangedPackages(int sequenceNumber)
@Implementation(minSdk=28) public String getSystemTextClassifierPackageName()
@Implementation(minSdk=28) @HiddenApi protected String[] setPackagesSuspended(String[] packageNames, boolean suspended, PersistableBundle appExtras, PersistableBundle launcherExtras, String dialogMessage)
@HiddenApi @Implementation(minSdk=28) protected boolean isPackageSuspended(String packageName) throws PackageManager.NameNotFoundException
@Implementation(minSdk=26) protected boolean isInstantApp(String packageName)