@Implements(value=android.content.pm.PackageManager.class)
public class ShadowPackageManager
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
ShadowPackageManager.ComponentState
Deprecated.
Use
ApplicationPackageManager.getComponentEnabledSetting(ComponentName) instead. This class will be made private in Robolectric 3.5. |
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 |
addManifest(org.robolectric.manifest.AndroidManifest androidManifest) |
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) |
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) |
int |
checkPermission(java.lang.String permName,
java.lang.String pkgName)
Deprecated.
Prefer
PackageManager.checkPermission(String, String) instead. |
void |
clearSystemAvailableFeatures() |
void |
doPendingUninstallCallbacks()
Runs the callbacks pending from calls to
PackageManager.deletePackage(String, IPackageDeleteObserver, int) |
void |
freeStorage(long freeStorageSize,
android.content.IntentSender pi) |
void |
freeStorageAndNotify(long freeStorageSize,
android.content.pm.IPackageDataObserver observer) |
android.graphics.drawable.Drawable |
getActivityIcon(android.content.ComponentName componentName) |
android.graphics.drawable.Drawable |
getActivityIcon(android.content.Intent intent) |
android.content.pm.ActivityInfo |
getActivityInfo(android.content.ComponentName className,
int flags)
Deprecated.
Prefer
PackageManager.getActivityInfo(ComponentName, int) instead. |
android.graphics.drawable.Drawable |
getApplicationIcon(java.lang.String packageName)
Deprecated.
Prefer
PackageManager.getApplicationIcon(String) instead. |
android.content.pm.ApplicationInfo |
getApplicationInfo(java.lang.String packageName,
int flags)
Deprecated.
Prefer
PackageManager.getApplicationInfo(String, int) instead. |
java.lang.CharSequence |
getApplicationLabel(android.content.pm.ApplicationInfo info)
Deprecated.
Prefer
PackageManager.getApplicationLabel(ApplicationInfo) instead. |
int |
getComponentEnabledSettingFlags(android.content.ComponentName componentName)
Return the flags set in call to
ApplicationPackageManager.setComponentEnabledSetting(ComponentName, int, int). |
ShadowPackageManager.ComponentState |
getComponentState(android.content.ComponentName componentName)
Deprecated.
Use
ApplicationPackageManager.getComponentEnabledSetting(ComponentName) or getComponentEnabledSettingFlags(ComponentName) instead. This method will be removed in Robolectric 3.5. |
protected static int |
getConfigChanges(org.robolectric.manifest.ActivityData activityData) |
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. |
android.graphics.drawable.Drawable |
getDrawable(java.lang.String packageName,
int resourceId,
android.content.pm.ApplicationInfo applicationInfo) |
java.util.List<android.content.pm.PackageInfo> |
getInstalledPackages(int flags)
Deprecated.
Prefer
PackageManager.getInstalledPackages(int) instead. |
android.content.Intent |
getLaunchIntentForPackage(java.lang.String packageName)
Deprecated.
Prefer
PackageManager.getLaunchIntentForPackage(String) instead. |
android.content.pm.PackageInfo |
getPackageArchiveInfo(java.lang.String archiveFilePath,
int flags) |
android.content.pm.PackageInfo |
getPackageInfo(java.lang.String packageName,
int flags)
Deprecated.
Prefer
PackageManager.getPackageInfo(String, int) instead. |
int |
getPreferredActivities(java.util.List<android.content.IntentFilter> outFilters,
java.util.List<android.content.ComponentName> outActivities,
java.lang.String packageName) |
android.content.pm.ActivityInfo |
getReceiverInfo(android.content.ComponentName className,
int flags)
Deprecated.
Prefer
PackageManager.getReceiverInfo(ComponentName, int) instead. |
android.content.pm.ServiceInfo |
getServiceInfo(android.content.ComponentName className,
int flags)
Deprecated.
Prefer
PackageManager.getServiceInfo(ComponentName, int) instead. |
long |
getVerificationExtendedTimeout(int id) |
int |
getVerificationResult(int id) |
boolean |
hasSystemFeature(java.lang.String name)
Deprecated.
Prefer
PackageManager.hasSystemFeature(String) instead. |
boolean |
isQueryIntentImplicitly() |
java.util.List<android.content.pm.ResolveInfo> |
queryBroadcastReceivers(android.content.Intent intent,
int flags)
Deprecated.
Prefer
PackageManager.queryBroadcastReceivers(Intent, int) instead. |
java.util.List<android.content.pm.ResolveInfo> |
queryBroadcastReceivers(android.content.Intent intent,
int flags,
int userId) |
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> |
queryIntent(android.content.Intent intent,
int flags) |
java.util.List<android.content.pm.ResolveInfo> |
queryIntentActivities(android.content.Intent intent,
int flags)
Deprecated.
Prefer
PackageManager.queryIntentActivities(Intent, int) instead. |
java.util.List<android.content.pm.ResolveInfo> |
queryIntentServices(android.content.Intent intent,
int flags)
Deprecated.
Prefer
PackageManager.queryIntentServices(Intent, int) instead. |
void |
removePackage(java.lang.String packageName) |
void |
removeResolveInfosForIntent(android.content.Intent intent,
java.lang.String packageName) |
android.content.pm.ResolveInfo |
resolveActivity(android.content.Intent intent,
int flags)
Deprecated.
Prefer
PackageManager.resolveActivity(Intent, int) instead. |
android.content.pm.ResolveInfo |
resolveService(android.content.Intent intent,
int flags)
Deprecated.
Prefer
PackageManager.resolveService(Intent, int) instead. |
void |
setApplicationEnabledSetting(java.lang.String packageName,
int newState,
int flags) |
void |
setApplicationIcon(java.lang.String packageName,
android.graphics.drawable.Drawable drawable) |
void |
setComponentEnabledSetting(android.content.ComponentName componentName,
int newState,
int flags)
Deprecated.
Prefer
PackageManager.setComponentEnabledSetting(ComponentName, int, int) instead. |
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 |
setQueryIntentImplicitly(boolean queryIntentImplicitly) |
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
@Deprecated
public android.content.pm.PackageInfo getPackageInfo(java.lang.String packageName,
int flags)
throws android.content.pm.PackageManager.NameNotFoundException
PackageManager.getPackageInfo(String, int) instead.android.content.pm.PackageManager.NameNotFoundException@Deprecated
public android.content.pm.ApplicationInfo getApplicationInfo(java.lang.String packageName,
int flags)
throws android.content.pm.PackageManager.NameNotFoundException
PackageManager.getApplicationInfo(String, int) instead.android.content.pm.PackageManager.NameNotFoundException@Deprecated
public android.content.pm.ActivityInfo getActivityInfo(android.content.ComponentName className,
int flags)
throws android.content.pm.PackageManager.NameNotFoundException
PackageManager.getActivityInfo(ComponentName, int) instead.android.content.pm.PackageManager.NameNotFoundException@Deprecated
public android.content.pm.ActivityInfo getReceiverInfo(android.content.ComponentName className,
int flags)
throws android.content.pm.PackageManager.NameNotFoundException
PackageManager.getReceiverInfo(ComponentName, int) instead.android.content.pm.PackageManager.NameNotFoundException@Deprecated
public android.content.pm.ServiceInfo getServiceInfo(android.content.ComponentName className,
int flags)
throws android.content.pm.PackageManager.NameNotFoundException
PackageManager.getServiceInfo(ComponentName, int) instead.android.content.pm.PackageManager.NameNotFoundException@Deprecated public java.util.List<android.content.pm.PackageInfo> getInstalledPackages(int flags)
PackageManager.getInstalledPackages(int) instead.@Deprecated
public java.util.List<android.content.pm.ResolveInfo> queryIntentActivities(android.content.Intent intent,
int flags)
PackageManager.queryIntentActivities(Intent, int) instead.@Deprecated
public java.util.List<android.content.pm.ResolveInfo> queryIntentServices(android.content.Intent intent,
int flags)
PackageManager.queryIntentServices(Intent, int) instead.@Deprecated
public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(android.content.Intent intent,
int flags)
PackageManager.queryBroadcastReceivers(Intent, int) instead.@Deprecated
public android.content.pm.ResolveInfo resolveActivity(android.content.Intent intent,
int flags)
PackageManager.resolveActivity(Intent, int) instead.@Deprecated
public android.content.pm.ResolveInfo resolveService(android.content.Intent intent,
int flags)
PackageManager.resolveService(Intent, int) instead.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 android.graphics.drawable.Drawable getActivityIcon(android.content.Intent intent)
throws android.content.pm.PackageManager.NameNotFoundException
android.content.pm.PackageManager.NameNotFoundExceptionpublic android.graphics.drawable.Drawable getActivityIcon(android.content.ComponentName componentName)
throws android.content.pm.PackageManager.NameNotFoundException
android.content.pm.PackageManager.NameNotFoundExceptionpublic void addActivityIcon(android.content.ComponentName component,
android.graphics.drawable.Drawable drawable)
public void addActivityIcon(android.content.Intent intent,
android.graphics.drawable.Drawable drawable)
@Deprecated
public android.graphics.drawable.Drawable getApplicationIcon(java.lang.String packageName)
throws android.content.pm.PackageManager.NameNotFoundException
PackageManager.getApplicationIcon(String) instead.android.content.pm.PackageManager.NameNotFoundExceptionpublic void setApplicationIcon(java.lang.String packageName,
android.graphics.drawable.Drawable drawable)
@Deprecated public android.content.Intent getLaunchIntentForPackage(java.lang.String packageName)
PackageManager.getLaunchIntentForPackage(String) instead.@Deprecated public java.lang.CharSequence getApplicationLabel(android.content.pm.ApplicationInfo info)
PackageManager.getApplicationLabel(ApplicationInfo) instead.@Deprecated
public void setComponentEnabledSetting(android.content.ComponentName componentName,
int newState,
int flags)
PackageManager.setComponentEnabledSetting(ComponentName, int, int) instead.public void setApplicationEnabledSetting(java.lang.String packageName,
int newState,
int flags)
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)
@Deprecated public ShadowPackageManager.ComponentState getComponentState(android.content.ComponentName componentName)
ApplicationPackageManager.getComponentEnabledSetting(ComponentName) or getComponentEnabledSettingFlags(ComponentName) instead. This method will be removed in Robolectric 3.5.public int getComponentEnabledSettingFlags(android.content.ComponentName componentName)
Return the flags set in call to ApplicationPackageManager.setComponentEnabledSetting(ComponentName, int, int).
componentName - The component name.public 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 addPackage(java.lang.String packageName)
public void addManifest(org.robolectric.manifest.AndroidManifest androidManifest)
public void removePackage(java.lang.String packageName)
@Deprecated public boolean hasSystemFeature(java.lang.String name)
PackageManager.hasSystemFeature(String) instead.public void setSystemFeature(java.lang.String name,
boolean supported)
public void addDrawableResolution(java.lang.String packageName,
int resourceId,
android.graphics.drawable.Drawable drawable)
public android.graphics.drawable.Drawable getDrawable(java.lang.String packageName,
int resourceId,
android.content.pm.ApplicationInfo applicationInfo)
@Deprecated
public int checkPermission(java.lang.String permName,
java.lang.String pkgName)
PackageManager.checkPermission(String, String) instead.public boolean isQueryIntentImplicitly()
public void setQueryIntentImplicitly(boolean queryIntentImplicitly)
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
public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceiversAsUser(android.content.Intent intent,
int flags,
android.os.UserHandle userHandle)
@Implementation
public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(android.content.Intent intent,
int flags,
int userId)
@Implementation
public android.content.pm.PackageInfo getPackageArchiveInfo(java.lang.String archiveFilePath,
int flags)
@Implementation
public void freeStorageAndNotify(long freeStorageSize,
android.content.pm.IPackageDataObserver observer)
@Implementation
public 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> queryIntent(android.content.Intent intent,
int flags)
protected static int getConfigChanges(org.robolectric.manifest.ActivityData activityData)