Compatibility Matrices

This section describes the framework and device compatibility matrices and the compatibility matrix schema. For match rules, see Matching Rules.

Framework compatibility matrix

The framework compatibility matrix describes the requirements of the framework on the device it runs on. The matrix file is associated with the Android framework image (on system.img). It is expected the requirements of the framework's compatibility matrix will be satisfied by the device manifest (requirements enforced at launch and OTA time).

Example framework compatibility matrix file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Comments, Legal notices, etc. here -->
<compatibility-matrix version="1.0" type="framework">
    <hal>
        <name>android.hardware.camera</name>
        <version>1.0</version>
        <version>3.1-4</version>
        <interface>
            <name>ICameraProvider</name>
            <instance>default</instance>
        </interface>
    </hal>
    <hal>
        <name>android.hardware.nfc</name>
        <version>1.0</version>
        <interface>
            <name>INfc</name>
            <instance>default</instance>
        </interface>
    </hal>
    <hal optional="true">
        <name>android.hardware.graphics.composer</name>
        <version>2.1</version>
    </hal>
    <hal format="native">
        <name>GL</name>
        <version>1.1</version>
        <version>3.0</version>
    </hal>
    <hal format="native">
        <name>EGL</name>
        <version>1.1</version>
    </hal>
    <kernel version="3.18.51">
        <config>
            <key>CONFIG_A</key>
            <value type="string"></value>
        </config>
        <config>
            <key>CONFIG_B</key>
            <value type="tristate">y</value>
        </config>
    </kernel>
    <kernel version="4.1.22">
        <config>
            <key>CONFIG_A</key>
            <value type="string">foo</value>
        </config>
        <config>
            <key>CONFIG_B2</key>
            <value type="int">1024</value>
        </config>
    </kernel>
    <sepolicy>
        <kernel-sepolicy-version>30</kernel-sepolicy-version>
        <sepolicy-version>25.0</sepolicy-version>
        <sepolicy-version>26.0-3</sepolicy-version>
    </sepolicy>
    <avb>
        <vbmeta-version>2.1</vbmeta-version>
    </avb>
    <xmlfile format="dtd">
        <name>media_profile</name>
        <version>1.0</version>
        <path>/system/etc/media_profile_V1_0.dtd</path>
    </xmlfile>
</compatiblity-matrix>

Device compatibility matrix

The device compatibility matrix describes a set of requirements the device expects from the framework (requirements enforced at launch and OTA time).

Example device compatibility matrix file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Comments, Legal notices, etc. here -->
<compatibility-matrix version="1.0" type="device">
    <hal>
        <name>android.hidl.manager</name>
        <version>1.0</version>
        <interface>
            <name>IServiceManager</name>
            <instance>default</instance>
        </interface>
    </hal>
    <hal>
        <name>android.hidl.memory</name>
        <version>1.0</version>
        <interface>
            <name>IMemory</name>
            <instance>ashmem</instance>
        </interface>
    </hal>
    <hal>
        <name>android.hidl.allocator</name>
        <version>1.0</version>
        <interface>
            <name>IAllocator</name>
            <instance>ashmem</instance>
        </interface>
    </hal>
    <hal>
        <name>android.framework.sensor</name>
        <version>1.0</version>
        <interface>
            <name>ISensorManager</name>
            <instance>default</instance>
        </interface>
    </hal>
    <xmlfile format="dtd" optional="false">
        <name>sample_xml</name>
        <version>1.0</version>
    </xmlfile>
</compatibility-matrix>

Compatiblity matrix schema

?xml
Optional. It only provides information to the XML parser.
compatibility-matrix.version
Required. Version of this compatiblity matrix. Describes the elements expected in the manifest. Unrelated to XML version.
compatibility-matrix.type
Required. Type of this compatibility matrix:
  • "device": Device compatibility matrix.
  • "framework": Framework compatibility matrix.
compatibility-matrix.hal
Optional and can repeat. Lists a single HAL (HIDL or native) that is required by owner of the compatibility matrix (framework or device) to be present. HAL entries are distinguished by a <name> element; there can be several HAL entries with the same name (implies "and" condition).
compatibility-matrix.hal.format
Optional. Value can be one of:
  • "hidl": HIDL HALs. This is the default.
  • "native": native HALs.
compatibility-matrix.hal.optional
Attribute is optional and defaults to false. States whether this HAL is optional to the owner of the compatibility matrix (framework or device). If a <p;hal> entry is marked as optional, it means the owner can work with this HAL, if present, but does not require it to be present.
compatibility-matrix.hal.name
Required. Full package name of this HAL. Examples:
  • android.hardware.camera (HIDL HAL)
  • GLES (native HAL, requires name only)
compatibility-matrix.hal.version
Required, can repeat without duplicates. A list of version ranges (see HAL matches) that defines what versions the owner of the compatibility matrix (framework or device) expects.
compatibility-matrix.hal.interface
Optional, can repeat. A list of required interfaces of this HAL.
compatibility-matrix.hal.interface.name
Required. Name of the interface.
compatibility-matrix.hal.interface
Optional, can repeat. A list of required instances of this interface.
compatibility-matrix.kernel.version
Required. Kernel version. Format is {version}.{major-revision}.{minor-revision}. Version and major revision must match exactly, minor-revision defines the minimum LTS version of the kernel the framework expects.
compatibility-matrix.kernel.config
Optional, can repeat. Lists CONFIG items that must be matched for this kernel version. Each CONFIG item is a key-value pair; config items are distinguished by key.
compatibility-matrix.kernel.config.key
Required. Key name of the CONFIG item. Starts with CONFIG_.
compatibility-matrix.kernel.config.value
Required. Value of the CONFIG item. Format depends on type:
  • string. Quotes are omitted.
  • int. Decimal and hexadecimal (must start with 0x or 0X)values are accepted. Interpreted as an 64-bit integer; overflows result in truncation. (Parser accepts values from -264 + 1 to 264 - 1, 65th bit is truncated; for details refer to the strtoull man page.)
  • range. Format is [int]-[int], e.g. 10-20. Hexadecimal values are accepted and must start with 0x or 0X. Two boundaries must be an unsigned 64-bit integer.
  • tristate. Valid values are y, m and n.
compatibility-matrix.kernel.config.value.type
Required. Type of the value of the CONFIG item, one of:
  • string
  • int
  • range
  • tristate
compatibility-matrix.sepolicy
Required. Contains all sepolicy-related entries. Used only by the framework compatibility matrix.
compatibility-matrix.sepolicy.sepolicy-version
Required, can repeat. Describes the requirement on sepolicy version. Corresponds to manifest.sepolicy.version. Each instance of an element defines a range of sepolicy versions.
compatibility-matrix.sepolicy.kernel-sepolicy-version
Required. Declares the policydb version the framework works with.
compatibility-matrix.avb.vbmeta-version
Optional; used only by the framework compatibility matrix. Declares the AVB version used to sign system.img.