Package com.android.xml
Class AndroidManifest
- java.lang.Object
-
- com.android.xml.AndroidManifest
-
public final class AndroidManifest extends java.lang.Object
Helper and Constants for the AndroidManifest.xml file.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ATTRIBUTE_ANYDENSITY
static java.lang.String
ATTRIBUTE_BACKUP_AGENT
static java.lang.String
ATTRIBUTE_DEBUGGABLE
static java.lang.String
ATTRIBUTE_EXPORTED
static java.lang.String
ATTRIBUTE_GLESVERSION
static java.lang.String
ATTRIBUTE_ICON
static java.lang.String
ATTRIBUTE_LABEL
static java.lang.String
ATTRIBUTE_LARGESCREENS
static java.lang.String
ATTRIBUTE_MANAGE_SPACE_ACTIVITY
static java.lang.String
ATTRIBUTE_MIME_TYPE
static java.lang.String
ATTRIBUTE_MIN_SDK_VERSION
static java.lang.String
ATTRIBUTE_NAME
static java.lang.String
ATTRIBUTE_NORMALSCREENS
static java.lang.String
ATTRIBUTE_PACKAGE
static java.lang.String
ATTRIBUTE_PARENT_ACTIVITY_NAME
static java.lang.String
ATTRIBUTE_PORT
static java.lang.String
ATTRIBUTE_PROCESS
static java.lang.String
ATTRIBUTE_REQ_5WAYNAV
static java.lang.String
ATTRIBUTE_REQ_HARDKEYBOARD
static java.lang.String
ATTRIBUTE_REQ_KEYBOARDTYPE
static java.lang.String
ATTRIBUTE_REQ_NAVIGATION
static java.lang.String
ATTRIBUTE_REQ_TOUCHSCREEN
static java.lang.String
ATTRIBUTE_REQUIRED
static java.lang.String
ATTRIBUTE_RESIZEABLE
static java.lang.String
ATTRIBUTE_SMALLSCREENS
static java.lang.String
ATTRIBUTE_SUPPORTS_RTL
static java.lang.String
ATTRIBUTE_TARGET_ACTIVITY
static java.lang.String
ATTRIBUTE_TARGET_PACKAGE
static java.lang.String
ATTRIBUTE_TARGET_SDK_VERSION
static java.lang.String
ATTRIBUTE_THEME
static java.lang.String
ATTRIBUTE_UI_OPTIONS
static java.lang.String
ATTRIBUTE_VALUE
static java.lang.String
ATTRIBUTE_VERSIONCODE
static java.lang.String
NODE_ACTION
static java.lang.String
NODE_ACTIVITY
static java.lang.String
NODE_ACTIVITY_ALIAS
static java.lang.String
NODE_APPLICATION
static java.lang.String
NODE_CATEGORY
static java.lang.String
NODE_COMPATIBLE_SCREENS
static java.lang.String
NODE_DATA
static java.lang.String
NODE_GRANT_URI_PERMISSION
static java.lang.String
NODE_INSTRUMENTATION
static java.lang.String
NODE_INTENT
static java.lang.String
NODE_MANIFEST
static java.lang.String
NODE_METADATA
static java.lang.String
NODE_PATH_PERMISSION
static java.lang.String
NODE_PERMISSION
static java.lang.String
NODE_PERMISSION_GROUP
static java.lang.String
NODE_PERMISSION_TREE
static java.lang.String
NODE_PROVIDER
static java.lang.String
NODE_RECEIVER
static java.lang.String
NODE_SERVICE
static java.lang.String
NODE_SUPPORTS_GL_TEXTURE
static java.lang.String
NODE_SUPPORTS_SCREENS
static java.lang.String
NODE_USES_CONFIGURATION
static java.lang.String
NODE_USES_FEATURE
static java.lang.String
NODE_USES_LIBRARY
static java.lang.String
NODE_USES_PERMISSION
static java.lang.String
NODE_USES_SDK
static java.lang.String
VALUE_PARENT_ACTIVITY
-
Constructor Summary
Constructors Constructor Description AndroidManifest()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
combinePackageAndClassName(java.lang.String javaPackage, java.lang.String className)
Combines a java package, with a class value from the manifest to make a fully qualified class namestatic java.lang.String
extractActivityName(java.lang.String fullActivityName, java.lang.String packageName)
Given a fully qualified activity name (e.g. com.foo.test.MyClass) and given a project package base name (e.g. com.foo), returns the relative activity name that would be used the "name" attribute of an "activity" element.static java.lang.String
getApplicationIcon(IAbstractFile manifestFile)
Returns the application icon for a given manifest.static java.lang.String
getApplicationLabel(IAbstractFile manifestFile)
Returns the application label for a given manifest.static boolean
getDebuggable(IAbstractFile manifestFile)
Returns whether the manifest is set to make the application debuggable.static IAbstractFile
getManifest(IAbstractFolder projectFolder)
Returns anIAbstractFile
object representing the manifest for the given project.static java.lang.Object
getMinSdkVersion(IAbstractFile manifestFile)
Returns the value of the minSdkVersion attribute.static java.lang.String
getPackage(IAbstractFile manifestFile)
Returns the package for a given manifest.static java.lang.String
getPackage(IAbstractFolder projectFolder)
Returns the package for a given project.static boolean
getSupportsRtl(IAbstractFile manifestFile)
Returns whether the manifest is set to make the application RTL aware.static java.lang.Object
getTargetSdkVersion(IAbstractFile manifestFile)
Returns the value of the targetSdkVersion attribute.static int
getVersionCode(IAbstractFile manifestFile)
Returns the value of the versionCode attribute or -1 if the value is not set.static boolean
hasVersionCode(IAbstractFile manifestFile)
Returns whether the version Code attribute is set in a given manifest.
-
-
-
Field Detail
-
NODE_MANIFEST
public static final java.lang.String NODE_MANIFEST
- See Also:
- Constant Field Values
-
NODE_APPLICATION
public static final java.lang.String NODE_APPLICATION
- See Also:
- Constant Field Values
-
NODE_ACTIVITY
public static final java.lang.String NODE_ACTIVITY
- See Also:
- Constant Field Values
-
NODE_ACTIVITY_ALIAS
public static final java.lang.String NODE_ACTIVITY_ALIAS
- See Also:
- Constant Field Values
-
NODE_SERVICE
public static final java.lang.String NODE_SERVICE
- See Also:
- Constant Field Values
-
NODE_RECEIVER
public static final java.lang.String NODE_RECEIVER
- See Also:
- Constant Field Values
-
NODE_PROVIDER
public static final java.lang.String NODE_PROVIDER
- See Also:
- Constant Field Values
-
NODE_INTENT
public static final java.lang.String NODE_INTENT
- See Also:
- Constant Field Values
-
NODE_ACTION
public static final java.lang.String NODE_ACTION
- See Also:
- Constant Field Values
-
NODE_CATEGORY
public static final java.lang.String NODE_CATEGORY
- See Also:
- Constant Field Values
-
NODE_USES_SDK
public static final java.lang.String NODE_USES_SDK
- See Also:
- Constant Field Values
-
NODE_PERMISSION
public static final java.lang.String NODE_PERMISSION
- See Also:
- Constant Field Values
-
NODE_PERMISSION_TREE
public static final java.lang.String NODE_PERMISSION_TREE
- See Also:
- Constant Field Values
-
NODE_PERMISSION_GROUP
public static final java.lang.String NODE_PERMISSION_GROUP
- See Also:
- Constant Field Values
-
NODE_USES_PERMISSION
public static final java.lang.String NODE_USES_PERMISSION
- See Also:
- Constant Field Values
-
NODE_INSTRUMENTATION
public static final java.lang.String NODE_INSTRUMENTATION
- See Also:
- Constant Field Values
-
NODE_USES_LIBRARY
public static final java.lang.String NODE_USES_LIBRARY
- See Also:
- Constant Field Values
-
NODE_SUPPORTS_SCREENS
public static final java.lang.String NODE_SUPPORTS_SCREENS
- See Also:
- Constant Field Values
-
NODE_COMPATIBLE_SCREENS
public static final java.lang.String NODE_COMPATIBLE_SCREENS
- See Also:
- Constant Field Values
-
NODE_USES_CONFIGURATION
public static final java.lang.String NODE_USES_CONFIGURATION
- See Also:
- Constant Field Values
-
NODE_USES_FEATURE
public static final java.lang.String NODE_USES_FEATURE
- See Also:
- Constant Field Values
-
NODE_METADATA
public static final java.lang.String NODE_METADATA
- See Also:
- Constant Field Values
-
NODE_DATA
public static final java.lang.String NODE_DATA
- See Also:
- Constant Field Values
-
NODE_GRANT_URI_PERMISSION
public static final java.lang.String NODE_GRANT_URI_PERMISSION
- See Also:
- Constant Field Values
-
NODE_PATH_PERMISSION
public static final java.lang.String NODE_PATH_PERMISSION
- See Also:
- Constant Field Values
-
NODE_SUPPORTS_GL_TEXTURE
public static final java.lang.String NODE_SUPPORTS_GL_TEXTURE
- See Also:
- Constant Field Values
-
ATTRIBUTE_PACKAGE
public static final java.lang.String ATTRIBUTE_PACKAGE
- See Also:
- Constant Field Values
-
ATTRIBUTE_VERSIONCODE
public static final java.lang.String ATTRIBUTE_VERSIONCODE
- See Also:
- Constant Field Values
-
ATTRIBUTE_NAME
public static final java.lang.String ATTRIBUTE_NAME
- See Also:
- Constant Field Values
-
ATTRIBUTE_MIME_TYPE
public static final java.lang.String ATTRIBUTE_MIME_TYPE
- See Also:
- Constant Field Values
-
ATTRIBUTE_PORT
public static final java.lang.String ATTRIBUTE_PORT
- See Also:
- Constant Field Values
-
ATTRIBUTE_REQUIRED
public static final java.lang.String ATTRIBUTE_REQUIRED
- See Also:
- Constant Field Values
-
ATTRIBUTE_GLESVERSION
public static final java.lang.String ATTRIBUTE_GLESVERSION
- See Also:
- Constant Field Values
-
ATTRIBUTE_PROCESS
public static final java.lang.String ATTRIBUTE_PROCESS
- See Also:
- Constant Field Values
-
ATTRIBUTE_DEBUGGABLE
public static final java.lang.String ATTRIBUTE_DEBUGGABLE
- See Also:
- Constant Field Values
-
ATTRIBUTE_LABEL
public static final java.lang.String ATTRIBUTE_LABEL
- See Also:
- Constant Field Values
-
ATTRIBUTE_ICON
public static final java.lang.String ATTRIBUTE_ICON
- See Also:
- Constant Field Values
-
ATTRIBUTE_MIN_SDK_VERSION
public static final java.lang.String ATTRIBUTE_MIN_SDK_VERSION
- See Also:
- Constant Field Values
-
ATTRIBUTE_TARGET_SDK_VERSION
public static final java.lang.String ATTRIBUTE_TARGET_SDK_VERSION
- See Also:
- Constant Field Values
-
ATTRIBUTE_TARGET_PACKAGE
public static final java.lang.String ATTRIBUTE_TARGET_PACKAGE
- See Also:
- Constant Field Values
-
ATTRIBUTE_TARGET_ACTIVITY
public static final java.lang.String ATTRIBUTE_TARGET_ACTIVITY
- See Also:
- Constant Field Values
-
ATTRIBUTE_MANAGE_SPACE_ACTIVITY
public static final java.lang.String ATTRIBUTE_MANAGE_SPACE_ACTIVITY
- See Also:
- Constant Field Values
-
ATTRIBUTE_EXPORTED
public static final java.lang.String ATTRIBUTE_EXPORTED
- See Also:
- Constant Field Values
-
ATTRIBUTE_RESIZEABLE
public static final java.lang.String ATTRIBUTE_RESIZEABLE
- See Also:
- Constant Field Values
-
ATTRIBUTE_ANYDENSITY
public static final java.lang.String ATTRIBUTE_ANYDENSITY
- See Also:
- Constant Field Values
-
ATTRIBUTE_SMALLSCREENS
public static final java.lang.String ATTRIBUTE_SMALLSCREENS
- See Also:
- Constant Field Values
-
ATTRIBUTE_NORMALSCREENS
public static final java.lang.String ATTRIBUTE_NORMALSCREENS
- See Also:
- Constant Field Values
-
ATTRIBUTE_LARGESCREENS
public static final java.lang.String ATTRIBUTE_LARGESCREENS
- See Also:
- Constant Field Values
-
ATTRIBUTE_REQ_5WAYNAV
public static final java.lang.String ATTRIBUTE_REQ_5WAYNAV
- See Also:
- Constant Field Values
-
ATTRIBUTE_REQ_NAVIGATION
public static final java.lang.String ATTRIBUTE_REQ_NAVIGATION
- See Also:
- Constant Field Values
-
ATTRIBUTE_REQ_HARDKEYBOARD
public static final java.lang.String ATTRIBUTE_REQ_HARDKEYBOARD
- See Also:
- Constant Field Values
-
ATTRIBUTE_REQ_KEYBOARDTYPE
public static final java.lang.String ATTRIBUTE_REQ_KEYBOARDTYPE
- See Also:
- Constant Field Values
-
ATTRIBUTE_REQ_TOUCHSCREEN
public static final java.lang.String ATTRIBUTE_REQ_TOUCHSCREEN
- See Also:
- Constant Field Values
-
ATTRIBUTE_THEME
public static final java.lang.String ATTRIBUTE_THEME
- See Also:
- Constant Field Values
-
ATTRIBUTE_BACKUP_AGENT
public static final java.lang.String ATTRIBUTE_BACKUP_AGENT
- See Also:
- Constant Field Values
-
ATTRIBUTE_PARENT_ACTIVITY_NAME
public static final java.lang.String ATTRIBUTE_PARENT_ACTIVITY_NAME
- See Also:
- Constant Field Values
-
ATTRIBUTE_SUPPORTS_RTL
public static final java.lang.String ATTRIBUTE_SUPPORTS_RTL
- See Also:
- Constant Field Values
-
ATTRIBUTE_UI_OPTIONS
public static final java.lang.String ATTRIBUTE_UI_OPTIONS
- See Also:
- Constant Field Values
-
ATTRIBUTE_VALUE
public static final java.lang.String ATTRIBUTE_VALUE
- See Also:
- Constant Field Values
-
VALUE_PARENT_ACTIVITY
public static final java.lang.String VALUE_PARENT_ACTIVITY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getManifest
public static IAbstractFile getManifest(IAbstractFolder projectFolder)
Returns anIAbstractFile
object representing the manifest for the given project.- Parameters:
projectFolder
- The project containing the manifest file.- Returns:
- An IAbstractFile object pointing to the manifest or null if the manifest is missing.
-
getPackage
public static java.lang.String getPackage(IAbstractFolder projectFolder) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns the package for a given project.- Parameters:
projectFolder
- the folder of the project.- Returns:
- the package info or null (or empty) if not found.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
getPackage
public static java.lang.String getPackage(IAbstractFile manifestFile) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns the package for a given manifest.- Parameters:
manifestFile
- the manifest to parse.- Returns:
- the package info or null (or empty) if not found.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
getDebuggable
public static boolean getDebuggable(IAbstractFile manifestFile) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns whether the manifest is set to make the application debuggable. If the give manifest does not contain the debuggable attribute then the application is considered to not be debuggable.- Parameters:
manifestFile
- the manifest to parse.- Returns:
- true if the application is debuggable.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
getVersionCode
public static int getVersionCode(IAbstractFile manifestFile) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns the value of the versionCode attribute or -1 if the value is not set.- Parameters:
manifestFile
- the manifest file to read the attribute from.- Returns:
- the integer value or -1 if not set.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
hasVersionCode
public static boolean hasVersionCode(IAbstractFile manifestFile) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns whether the version Code attribute is set in a given manifest.- Parameters:
manifestFile
- the manifest to check- Returns:
- true if the versionCode attribute is present and its value is not empty.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
getMinSdkVersion
@Nullable public static java.lang.Object getMinSdkVersion(IAbstractFile manifestFile) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns the value of the minSdkVersion attribute.If the attribute is set with an int value, the method returns an Integer object.
If the attribute is set with a codename, it returns the codename as a String object.
If the attribute is not set, it returns null.
- Parameters:
manifestFile
- the manifest file to read the attribute from.- Returns:
- the attribute value.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
getTargetSdkVersion
@Nullable public static java.lang.Object getTargetSdkVersion(IAbstractFile manifestFile) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns the value of the targetSdkVersion attribute.If the attribute is set with an int value, the method returns an Integer object.
If the attribute is set with a codename, it returns the codename as a String object.
If the attribute is not set, it returns null.
- Parameters:
manifestFile
- the manifest file to read the attribute from.- Returns:
- the integer value or -1 if not set.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
getApplicationIcon
public static java.lang.String getApplicationIcon(IAbstractFile manifestFile) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns the application icon for a given manifest.- Parameters:
manifestFile
- the manifest to parse.- Returns:
- the icon or null (or empty) if not found.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
getApplicationLabel
public static java.lang.String getApplicationLabel(IAbstractFile manifestFile) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns the application label for a given manifest.- Parameters:
manifestFile
- the manifest to parse.- Returns:
- the label or null (or empty) if not found.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
getSupportsRtl
public static boolean getSupportsRtl(IAbstractFile manifestFile) throws javax.xml.xpath.XPathExpressionException, StreamException
Returns whether the manifest is set to make the application RTL aware. If the give manifest does not contain the supportsRtl attribute then the application is considered to not be not supporting RTL (there will be no layout mirroring).- Parameters:
manifestFile
- the manifest to parse.- Returns:
- true if the application is supporting RTL.
- Throws:
javax.xml.xpath.XPathExpressionException
StreamException
- If any error happens when reading the manifest.
-
combinePackageAndClassName
public static java.lang.String combinePackageAndClassName(java.lang.String javaPackage, java.lang.String className)
Combines a java package, with a class value from the manifest to make a fully qualified class name- Parameters:
javaPackage
- the java package from the manifest.className
- the class name from the manifest.- Returns:
- the fully qualified class name.
-
extractActivityName
public static java.lang.String extractActivityName(java.lang.String fullActivityName, java.lang.String packageName)
Given a fully qualified activity name (e.g. com.foo.test.MyClass) and given a project package base name (e.g. com.foo), returns the relative activity name that would be used the "name" attribute of an "activity" element.- Parameters:
fullActivityName
- a fully qualified activity class name, e.g. "com.foo.test.MyClass"packageName
- The project base package name, e.g. "com.foo"- Returns:
- The relative activity name if it can be computed or the original fullActivityName.
-
-