Class ApkManifestHelper
java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.XmlResourceHelper
com.pnfsoftware.jeb.core.units.code.android.ApkXmlResourceHelper
com.pnfsoftware.jeb.core.units.code.android.ApkManifestHelper
This helper class facilitates access to the data contained in an Android APK Manifest. In
particular, the
readAttributeXxx methods allow easy retrieval of attribute values by tag
names, throughout the entire document.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classShort description of an APK activity end-point.static enumTypes of Android systems.static classDescription of the APK's application.static classShort description of APK end-point.static enumTypes of APK end-points.static classShort description of an intent filter.static classA collection of intent filters.static classShort description of an APK provider end-point.static classShort description of an APK received end-point.static classShort description of an APK service end-point. -
Field Summary
Fields inherited from class com.pnfsoftware.jeb.core.units.code.android.ApkXmlResourceHelper
attrPrefixFields inherited from class com.pnfsoftware.jeb.core.units.code.android.XmlResourceHelper
doc, rootElt -
Constructor Summary
ConstructorsConstructorDescriptionThis convenience constructor can be used to create a helper from an APK unit.Create a manifest helper around the provided manifest unit.Create a manifest helper around the provided low-level XML document object. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanDetermine whether an APK unit has a manifest XML unit.Get activity class names.Get activity descriptions.getApplicationAttribute(String attributeName) Get an attribute value from the application element.Get the application component factory class name.Build an application description.Get the application class name.Get descriptions for all endpoint types.Infer the intended Android system type.Get the main activity class name.Get the manifest package name.Get permissions requested by the application.Get provider descriptions.Get provider class names.Get receiver descriptions.Get receiver class names.int[]Retrieve the minimal and target Android version numbers to run the app.Get service descriptions.Get service class names.This low-level method offers access to theorg.w3c.dom.Elementholding the Manifest root.booleanDetermine whether the manifest declares an application element.booleanDetermine whether the application is marked debuggable.protected voidThis implementation checks that the input XML resource is an actual Android Manifest.Methods inherited from class com.pnfsoftware.jeb.core.units.code.android.ApkXmlResourceHelper
buildAttributeNameMethods inherited from class com.pnfsoftware.jeb.core.units.code.android.XmlResourceHelper
convertEltlist, convertNodelist, getAttr, getRootElement, getSimpleName, hasAttributeValue, isFullyQualifiedName, isSimpleName, readAttribute, readAttributes, readMultiAttributes
-
Constructor Details
-
ApkManifestHelper
This convenience constructor can be used to create a helper from an APK unit. A ManifestXML unitmust exist under the APK unit.- Parameters:
apk- APK unit
-
ApkManifestHelper
Create a manifest helper around the provided manifest unit.- Parameters:
xml- manifest XML unit
-
ApkManifestHelper
Create a manifest helper around the provided low-level XML document object.- Parameters:
doc- manifest XML document
-
-
Method Details
-
canParse
Determine whether an APK unit has a manifest XML unit.- Parameters:
apk- APK unit- Returns:
- true if a manifest can be parsed
-
prepare
This implementation checks that the input XML resource is an actual Android Manifest.- Overrides:
preparein classApkXmlResourceHelper- Parameters:
doc- XML document
-
getXmlManifestElement
This low-level method offers access to theorg.w3c.dom.Elementholding the Manifest root. Use this method to retrieve any tag or attribute stored in the manifest.- Returns:
- the manifest root element
-
getPackageName
Get the manifest package name.- Returns:
- the package name, or null if none is declared
-
getPermissions
Get permissions requested by the application.- Returns:
- requested permission names
-
hasApplication
public boolean hasApplication()Determine whether the manifest declares an application element.- Returns:
- true if an application element exists
-
getApplicationName
Get the application class name.- Returns:
- the application class name, or null if none is declared
-
getApplicationComponentFactory
Get the application component factory class name.- Returns:
- the component factory class name, or null if none is declared
-
isDebuggable
public boolean isDebuggable()Determine whether the application is marked debuggable.- Returns:
- true if the manifest declares a debuggable application
-
getApplicationAttribute
Get an attribute value from the application element.- Parameters:
attributeName- simple attribute name- Returns:
- the attribute value, or null if none exists
-
getApplicationDescription
Build an application description.- Returns:
- null if the manifest does not have an Application element
-
getIntendedSystemType
Infer the intended Android system type.- Returns:
- the intended Android system type
-
getActivities
Get activity class names.- Returns:
- activity class names
-
getServices
Get service class names.- Returns:
- service class names
-
getReceivers
Get receiver class names.- Returns:
- receiver class names
-
getProviders
Get provider class names.- Returns:
- provider class names
-
getMainActivity
Get the main activity class name.- Returns:
- the main activity class name, or null if none was found
-
getEndPointDescriptions
Get descriptions for all endpoint types.- Returns:
- endpoint descriptions
-
getActivityDescriptions
Get activity descriptions.- Returns:
- activity descriptions
-
getServiceDescriptions
Get service descriptions.- Returns:
- service descriptions
-
getReceiverDescriptions
Get receiver descriptions.- Returns:
- receiver descriptions
-
getProviderDescriptions
Get provider descriptions.- Returns:
- provider descriptions
-
getSdkVersion
public int[] getSdkVersion()Retrieve the minimal and target Android version numbers to run the app.- Returns:
- a tuple (minSdkVersion, targetSdkVersion)
-