Class ApkManifestHelper


public class ApkManifestHelper extends ApkXmlResourceHelper
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.
  • Constructor Details

    • ApkManifestHelper

      public ApkManifestHelper(IApkUnit apk)
      This convenience constructor can be used to create a helper from an APK unit. A Manifest XML unit must exist under the APK unit.
      Parameters:
      apk -
    • ApkManifestHelper

      public ApkManifestHelper(IXmlUnit xml)
      Create a manifest helper around the provided manifest unit.
      Parameters:
      xml -
    • ApkManifestHelper

      public ApkManifestHelper(Document doc)
      Create a manifest helper around the provided low-level XML document object.
      Parameters:
      doc -
  • Method Details

    • canParse

      public static boolean canParse(IApkUnit apk)
    • prepare

      protected void prepare(Document doc)
      This implementation checks that the input XML resource is an actual Android Manifest.
      Overrides:
      prepare in class ApkXmlResourceHelper
    • getXmlManifestElement

      public Element getXmlManifestElement()
      This low-level method offers access to the org.w3c.dom.Element holding the Manifest root. Use this method to retrieve any tag or attribute stored in the manifest.
      Returns:
    • getPackageName

      public String getPackageName()
    • getPermissions

      public List<String> getPermissions()
    • hasApplication

      public boolean hasApplication()
    • getApplicationName

      public String getApplicationName()
    • getApplicationComponentFactory

      public String getApplicationComponentFactory()
    • isDebuggable

      public boolean isDebuggable()
    • getApplicationAttribute

      public String getApplicationAttribute(String attributeName)
    • getApplicationDescription

      public ApkManifestHelper.ApplicationDescription getApplicationDescription()
      Returns:
      null if the manifest does not have an Application element
    • getIntendedSystemType

      public ApkManifestHelper.AndroidSystemType getIntendedSystemType()
    • getActivities

      public List<String> getActivities()
    • getServices

      public List<String> getServices()
    • getReceivers

      public List<String> getReceivers()
    • getProviders

      public List<String> getProviders()
    • getMainActivity

      public String getMainActivity()
    • getEndPointDescriptions

      public List<ApkManifestHelper.EndPointDescription> getEndPointDescriptions()
    • getActivityDescriptions

      public List<ApkManifestHelper.ActivityDescription> getActivityDescriptions()
    • getServiceDescriptions

      public List<ApkManifestHelper.ServiceDescription> getServiceDescriptions()
    • getReceiverDescriptions

      public List<ApkManifestHelper.ReceiverDescription> getReceiverDescriptions()
    • getProviderDescriptions

      public List<ApkManifestHelper.ProviderDescription> getProviderDescriptions()
    • getSdkVersion

      public int[] getSdkVersion()
      Retrieve the minimal and target Android version numbers to run the app.
      Returns:
      a tuple (minSdkVersion, targetSdkVersion)