public class AndroidManifest extends java.lang.Object implements UsesSdk
A wrapper for an Android App Manifest, which represents information about one’s App to an Android system.
| Constructor and Description |
|---|
AndroidManifest(FsFile androidManifestFile,
FsFile resDirectory,
FsFile assetsDirectory)
Creates a Robolectric configuration using specified locations.
|
AndroidManifest(FsFile androidManifestFile,
FsFile resDirectory,
FsFile assetsDirectory,
java.util.List<AndroidManifest> libraryManifests,
java.lang.String overridePackageName)
Creates a Robolectric configuration using specified values.
|
AndroidManifest(FsFile androidManifestFile,
FsFile resDirectory,
FsFile assetsDirectory,
java.util.List<AndroidManifest> libraryManifests,
java.lang.String overridePackageName,
FsFile apkFile) |
AndroidManifest(FsFile androidManifestFile,
FsFile resDirectory,
FsFile assetsDirectory,
java.lang.String overridePackageName)
Creates a Robolectric configuration using specified values.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
ActivityData |
getActivityData(java.lang.String activityClassName) |
java.util.Map<java.lang.String,ActivityData> |
getActivityDatas() |
java.lang.String |
getActivityLabel(java.lang.String activityClassName) |
java.util.List<AndroidManifest> |
getAllManifests()
Returns all transitively reachable manifests, including this one, in order and without duplicates.
|
FsFile |
getAndroidManifestFile() |
FsFile |
getApkFile() |
java.util.Map<java.lang.String,java.lang.String> |
getApplicationAttributes() |
java.util.Map<java.lang.String,java.lang.Object> |
getApplicationMetaData() |
java.lang.String |
getApplicationName() |
FsFile |
getAssetsDirectory() |
BroadcastReceiverData |
getBroadcastReceiver(java.lang.String className)
Returns data for the broadcast receiver with the provided name from this manifest.
|
java.util.List<BroadcastReceiverData> |
getBroadcastReceivers() |
java.util.List<ContentProviderData> |
getContentProviders() |
java.util.List<ResourcePath> |
getIncludedResourcePaths() |
java.lang.String |
getLabelRef() |
java.util.List<AndroidManifest> |
getLibraryManifests() |
java.lang.Integer |
getMaxSdkVersion()
Returns the maximum Android SDK version that this package expects to be runnable on, as specified in the manifest.
|
int |
getMinSdkVersion()
Returns the minimum Android SDK version that this package expects to be runnable on, as specified in the manifest.
|
java.lang.String |
getPackageName() |
java.util.Map<java.lang.String,PermissionGroupItemData> |
getPermissionGroups() |
java.util.Map<java.lang.String,PermissionItemData> |
getPermissions() |
java.lang.String |
getProcessName() |
java.lang.Class |
getRClass() |
java.lang.String |
getRClassName() |
FsFile |
getResDirectory() |
ResourcePath |
getResourcePath() |
ServiceData |
getServiceData(java.lang.String serviceClassName) |
java.util.List<ServiceData> |
getServices() |
int |
getTargetSdkVersion()
Returns the Android SDK version that this package prefers to be run on, as specified in the manifest.
|
java.lang.String |
getThemeRef() |
java.lang.String |
getThemeRef(java.lang.String activityClassName) |
java.util.List<java.lang.String> |
getUsedPermissions() |
int |
getVersionCode() |
java.lang.String |
getVersionName() |
int |
hashCode() |
void |
initMetaData(ResourceTable resourceTable)
Allows ShadowPackageManager to provide a resource index for initialising the resource attributes in all the metadata elements
|
boolean |
supportsBinaryResourcesMode()
Deprecated.
Do not use.
|
boolean |
supportsLegacyResourcesMode()
Deprecated.
Do not use.
|
public AndroidManifest(FsFile androidManifestFile, FsFile resDirectory, FsFile assetsDirectory)
Creates a Robolectric configuration using specified locations.
androidManifestFile - Location of the AndroidManifest.xml file.resDirectory - Location of the res directory.assetsDirectory - Location of the assets directory.public AndroidManifest(FsFile androidManifestFile, FsFile resDirectory, FsFile assetsDirectory, java.lang.String overridePackageName)
Creates a Robolectric configuration using specified values.
androidManifestFile - Location of the AndroidManifest.xml file.resDirectory - Location of the res directory.assetsDirectory - Location of the assets directory.overridePackageName - Application package name.public AndroidManifest(FsFile androidManifestFile, FsFile resDirectory, FsFile assetsDirectory, @Nonnull java.util.List<AndroidManifest> libraryManifests, java.lang.String overridePackageName)
Creates a Robolectric configuration using specified values.
androidManifestFile - Location of the AndroidManifest.xml file.resDirectory - Location of the res directory.assetsDirectory - Location of the assets directory.libraryManifests - List of dependency library manifests.overridePackageName - Application package name.public AndroidManifest(FsFile androidManifestFile, FsFile resDirectory, FsFile assetsDirectory, @Nonnull java.util.List<AndroidManifest> libraryManifests, java.lang.String overridePackageName, FsFile apkFile)
public java.lang.String getThemeRef(java.lang.String activityClassName)
public java.lang.String getRClassName()
throws java.lang.Exception
java.lang.Exceptionpublic java.lang.Class getRClass()
public void initMetaData(ResourceTable resourceTable) throws RoboNotFoundException
Allows ShadowPackageManager to provide a resource index for initialising the resource attributes in all the metadata elements
resourceTable - used for getting resource IDs from string identifiersRoboNotFoundExceptionpublic java.lang.String getApplicationName()
public java.lang.String getActivityLabel(java.lang.String activityClassName)
public java.lang.String getPackageName()
public int getVersionCode()
public java.lang.String getVersionName()
public java.lang.String getLabelRef()
public int getMinSdkVersion()
Returns the minimum Android SDK version that this package expects to be runnable on, as specified in the manifest.
Note that if targetSdkVersion isn’t set, this value changes the behavior of some Android code (notably SharedPreferences) to emulate old bugs.
getMinSdkVersion in interface UsesSdkpublic int getTargetSdkVersion()
Returns the Android SDK version that this package prefers to be run on, as specified in the manifest.
Note that this value changes the behavior of some Android code (notably SharedPreferences) to emulate old bugs.
getTargetSdkVersion in interface UsesSdkpublic java.lang.Integer getMaxSdkVersion()
UsesSdkReturns the maximum Android SDK version that this package expects to be runnable on, as specified in the manifest.
If no maximum version is specified, null may be returned.
getMaxSdkVersion in interface UsesSdknullpublic java.util.Map<java.lang.String,java.lang.String> getApplicationAttributes()
public java.lang.String getProcessName()
public java.util.Map<java.lang.String,java.lang.Object> getApplicationMetaData()
public ResourcePath getResourcePath()
public java.util.List<ResourcePath> getIncludedResourcePaths()
public java.util.List<ContentProviderData> getContentProviders()
public java.util.List<AndroidManifest> getLibraryManifests()
public java.util.List<AndroidManifest> getAllManifests()
Returns all transitively reachable manifests, including this one, in order and without duplicates.
public FsFile getResDirectory()
public FsFile getAssetsDirectory()
public FsFile getAndroidManifestFile()
public java.util.List<BroadcastReceiverData> getBroadcastReceivers()
public java.util.List<ServiceData> getServices()
public ServiceData getServiceData(java.lang.String serviceClassName)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic ActivityData getActivityData(java.lang.String activityClassName)
public java.lang.String getThemeRef()
public java.util.Map<java.lang.String,ActivityData> getActivityDatas()
public java.util.List<java.lang.String> getUsedPermissions()
public java.util.Map<java.lang.String,PermissionItemData> getPermissions()
public java.util.Map<java.lang.String,PermissionGroupItemData> getPermissionGroups()
@Nullable public BroadcastReceiverData getBroadcastReceiver(java.lang.String className)
Returns data for the broadcast receiver with the provided name from this manifest. If no receiver with the class name can be found, returns null.
className - the fully resolved class name of the receiverpublic FsFile getApkFile()
@Deprecated public boolean supportsLegacyResourcesMode()
@Deprecated public boolean supportsBinaryResourcesMode()