@Implements(value=android.content.pm.PackageManager.class) public class ShadowPackageManager extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
ShadowPackageManager.ComponentState |
static class |
ShadowPackageManager.IntentComparator |
Modifier and Type | Field and Description |
---|---|
java.util.Map<java.lang.String,android.content.res.Resources> |
resources |
Constructor and Description |
---|
ShadowPackageManager() |
Modifier and Type | Method and Description |
---|---|
void |
addActivityIcon(android.content.ComponentName component,
android.graphics.drawable.Drawable drawable) |
void |
addActivityIcon(android.content.Intent intent,
android.graphics.drawable.Drawable drawable) |
void |
addCurrentToCannonicalName(java.lang.String currentName,
java.lang.String canonicalName) |
void |
addDrawableResolution(java.lang.String packageName,
int resourceId,
android.graphics.drawable.Drawable drawable) |
void |
addPackage(android.content.pm.PackageInfo packageInfo) |
void |
addPackage(android.content.pm.PackageInfo packageInfo,
android.content.pm.PackageStats packageStats) |
void |
addPackage(java.lang.String packageName)
Deprecated.
|
void |
addPackageInternal(android.content.pm.PackageParser.Package appPackage)
Internal use only.
|
void |
addPermissionGroupInfo(android.content.pm.PermissionGroupInfo permissionGroupInfo)
Allows overriding or adding permission-group elements.
|
void |
addPermissionInfo(android.content.pm.PermissionInfo permissionInfo) |
void |
addPreferredActivity(android.content.IntentFilter filter,
int match,
android.content.ComponentName[] set,
android.content.ComponentName activity) |
void |
addResolveInfoForIntent(android.content.Intent intent,
java.util.List<android.content.pm.ResolveInfo> info) |
void |
addResolveInfoForIntent(android.content.Intent intent,
android.content.pm.ResolveInfo info) |
void |
addSystemAvailableFeature(android.content.pm.FeatureInfo featureInfo) |
void |
clearSystemAvailableFeatures() |
void |
doPendingUninstallCallbacks()
Runs the callbacks pending from calls to
PackageManager.deletePackage(String, IPackageDeleteObserver, int) |
protected void |
freeStorage(long freeStorageSize,
android.content.IntentSender pi) |
protected void |
freeStorageAndNotify(long freeStorageSize,
android.content.pm.IPackageDataObserver observer) |
int |
getComponentEnabledSettingFlags(android.content.ComponentName componentName)
Return the flags set in call to
ApplicationPackageManager.setComponentEnabledSetting(ComponentName, int, int) . |
java.util.Set<java.lang.String> |
getDeletedPackages()
Returns package names successfully deleted with
PackageManager.deletePackage(String, IPackageDeleteObserver, int) Note that like real PackageManager the calling context must have Manifest.permission.DELETE_PACKAGES permission set. |
java.util.List<android.content.IntentFilter> |
getIntentFiltersForActivity(android.content.ComponentName componentName)
Get list of intent filters defined for given activity.
|
java.util.List<android.content.IntentFilter> |
getIntentFiltersForReceiver(android.content.ComponentName componentName)
Get list of intent filters defined for given receiver.
|
java.util.List<android.content.IntentFilter> |
getIntentFiltersForService(android.content.ComponentName componentName)
Get list of intent filters defined for given service.
|
protected android.content.pm.PackageInfo |
getPackageArchiveInfo(java.lang.String archiveFilePath,
int flags) |
int |
getPreferredActivities(java.util.List<android.content.IntentFilter> outFilters,
java.util.List<android.content.ComponentName> outActivities,
java.lang.String packageName) |
long |
getVerificationExtendedTimeout(int id) |
int |
getVerificationResult(int id) |
protected java.util.List<android.content.pm.ResolveInfo> |
queryBroadcastReceivers(android.content.Intent intent,
int flags,
int userId) |
protected java.util.List<android.content.pm.ResolveInfo> |
queryBroadcastReceiversAsUser(android.content.Intent intent,
int flags,
android.os.UserHandle userHandle) |
protected java.util.List<android.content.pm.ResolveInfo> |
queryOverriddenIntents(android.content.Intent intent,
int flags) |
void |
removePackage(java.lang.String packageName) |
void |
removeResolveInfosForIntent(android.content.Intent intent,
java.lang.String packageName) |
void |
setApplicationIcon(java.lang.String packageName,
android.graphics.drawable.Drawable drawable) |
void |
setNameForUid(int uid,
java.lang.String name) |
void |
setPackageArchiveInfo(java.lang.String archiveFilePath,
android.content.pm.PackageInfo packageInfo) |
void |
setPackagesForCallingUid(java.lang.String... packagesForCallingUid) |
void |
setPackagesForUid(int uid,
java.lang.String... packagesForCallingUid) |
void |
setShouldShowRequestPermissionRationale(java.lang.String permission,
boolean show) |
void |
setSystemFeature(java.lang.String name,
boolean supported) |
public java.util.Map<java.lang.String,android.content.res.Resources> resources
public void addResolveInfoForIntent(android.content.Intent intent, java.util.List<android.content.pm.ResolveInfo> info)
public void addResolveInfoForIntent(android.content.Intent intent, android.content.pm.ResolveInfo info)
public void removeResolveInfosForIntent(android.content.Intent intent, java.lang.String packageName)
public void addActivityIcon(android.content.ComponentName component, android.graphics.drawable.Drawable drawable)
public void addActivityIcon(android.content.Intent intent, android.graphics.drawable.Drawable drawable)
public void setApplicationIcon(java.lang.String packageName, android.graphics.drawable.Drawable drawable)
public void addPreferredActivity(android.content.IntentFilter filter, int match, android.content.ComponentName[] set, android.content.ComponentName activity)
public int getPreferredActivities(java.util.List<android.content.IntentFilter> outFilters, java.util.List<android.content.ComponentName> outActivities, java.lang.String packageName)
public int getComponentEnabledSettingFlags(android.content.ComponentName componentName)
Return the flags set in call to ApplicationPackageManager.setComponentEnabledSetting(ComponentName, int, int)
.
componentName
- The component name.@Deprecated public void addPackage(java.lang.String packageName)
addPackage(PackageInfo)
insteadpublic void addPackage(android.content.pm.PackageInfo packageInfo)
public void addPackage(android.content.pm.PackageInfo packageInfo, android.content.pm.PackageStats packageStats)
public void addPermissionInfo(android.content.pm.PermissionInfo permissionInfo)
public void addPermissionGroupInfo(android.content.pm.PermissionGroupInfo permissionGroupInfo)
Allows overriding or adding permission-group elements. These would be otherwise specified by either (the system)[https://developer.android.com/guide/topics/permissions/requesting.html#perm-groups] or by (the app itself)[https://developer.android.com/guide/topics/manifest/permission-group-element.html], as part of its manifest
PackageParser.PermissionGroup
s added through this method have precedence over those specified with the same name by one of the aforementioned methods.
PackageManager.getAllPermissionGroups(int)
,
PackageManager.getPermissionGroupInfo(String, int)
public void removePackage(java.lang.String packageName)
public void setSystemFeature(java.lang.String name, boolean supported)
public void addDrawableResolution(java.lang.String packageName, int resourceId, android.graphics.drawable.Drawable drawable)
public void setNameForUid(int uid, java.lang.String name)
public void setPackagesForCallingUid(java.lang.String... packagesForCallingUid)
public void setPackagesForUid(int uid, java.lang.String... packagesForCallingUid)
public void setPackageArchiveInfo(java.lang.String archiveFilePath, android.content.pm.PackageInfo packageInfo)
public int getVerificationResult(int id)
public long getVerificationExtendedTimeout(int id)
public void setShouldShowRequestPermissionRationale(java.lang.String permission, boolean show)
public void addSystemAvailableFeature(android.content.pm.FeatureInfo featureInfo)
public void clearSystemAvailableFeatures()
public void addCurrentToCannonicalName(java.lang.String currentName, java.lang.String canonicalName)
@Implementation protected java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceiversAsUser(android.content.Intent intent, int flags, android.os.UserHandle userHandle)
@Implementation protected java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(android.content.Intent intent, int flags, int userId)
@Implementation protected android.content.pm.PackageInfo getPackageArchiveInfo(java.lang.String archiveFilePath, int flags)
@Implementation protected void freeStorageAndNotify(long freeStorageSize, android.content.pm.IPackageDataObserver observer)
@Implementation protected void freeStorage(long freeStorageSize, android.content.IntentSender pi)
public void doPendingUninstallCallbacks()
Runs the callbacks pending from calls to PackageManager.deletePackage(String, IPackageDeleteObserver, int)
public java.util.Set<java.lang.String> getDeletedPackages()
Returns package names successfully deleted with PackageManager.deletePackage(String, IPackageDeleteObserver, int)
Note that like real PackageManager
the calling context must have Manifest.permission.DELETE_PACKAGES
permission set.
protected java.util.List<android.content.pm.ResolveInfo> queryOverriddenIntents(android.content.Intent intent, int flags)
public void addPackageInternal(android.content.pm.PackageParser.Package appPackage)
Internal use only.
appPackage
- public java.util.List<android.content.IntentFilter> getIntentFiltersForActivity(android.content.ComponentName componentName) throws android.content.pm.PackageManager.NameNotFoundException
Get list of intent filters defined for given activity.
componentName
- Name of the activity whose intent filters are to be retrievedandroid.content.pm.PackageManager.NameNotFoundException
public java.util.List<android.content.IntentFilter> getIntentFiltersForService(android.content.ComponentName componentName) throws android.content.pm.PackageManager.NameNotFoundException
Get list of intent filters defined for given service.
componentName
- Name of the service whose intent filters are to be retrievedandroid.content.pm.PackageManager.NameNotFoundException
public java.util.List<android.content.IntentFilter> getIntentFiltersForReceiver(android.content.ComponentName componentName) throws android.content.pm.PackageManager.NameNotFoundException
Get list of intent filters defined for given receiver.
componentName
- Name of the receiver whose intent filters are to be retrievedandroid.content.pm.PackageManager.NameNotFoundException