ModuleMetadata

The ModuleMetadata module contains metadata about the list of modules on a given device. The metadata is parsed and cached as soon as the system server starts.

Changes in Android 10

The ModuleMetadata APK contains ModuleInfoProvider, which implements the getModuleInfo and getInstalledModules methods from the PackageManager API. These methods are backed by XML metadata parsed from a module metadata provider package. The package name for the module metadata package is stored in the config_defaultModuleMetadataProvider config value.

The module metadata provider must contain a <metadata> entry for its <application> tag. The metadata entry must contain a single key (android.content.pm.MODULE_METADATA) whose value is a reference to an XML resource that contains metadata about the list of modules on a given device.

Format and dependencies

The ModuleMetadata module is delivered as an APK file. In the XML document, metadata includes a single top-level <module-metadata> element with one or more children. Each child is a <module> element that contains the following attributes:

  • name is a resource reference to a user-visible package name. Maps to ModuleInfo#getName.
  • packageName is the package name of the module. Maps to ModuleInfo#getPackageName.
  • isHidden indicates whether the module is hidden. Maps to ModuleInfo#isHidden.

Example:

<module-metadata>
    <module name="@string/resource" packageName="package_name" isHidden="false|true" />
    <module .... />
</module-metadata>