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 (FCM)

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 FCM will be satisfied by the device manifest (requirements enforced at launch and OTA time).

Example FCM file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Comments, Legal notices, etc. here -->
<compatibility-matrix version="1.0" type="framework" level="3">
    <hal>
        <name>android.hardware.camera</name>
        <version>1.0</version>
        <version>3.1-4</version>
        <interface>
            <name>ICameraProvider</name>
            <instance>default</instance>
            <regex-instance>[a-z_]+/[0-9]+</regex-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">
        <!-- common configs -->
    </kernel>
    <kernel version="3.18.51">
        <!-- arm specific configs -->
        <condition>
            <config>
                <key>CONFIG_ARM</key>
                <value type="tristate">y</value>
            </config>
        <condition>
        <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">
        <!-- common configs -->
        <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>
</compatibility-matrix>

For more details, see FCM Lifecycle.

Device compatibility matrix (DCM)

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

Example DCM 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>
    <vendor-ndk>
        <version>27</version>
    </vendor-ndk>
    <system-sdk>
        <version>27</version>
    </system-sdk>
</compatibility-matrix>

Compatibility matrix schema

This section describes the meaning of these XML tags. Some "required" tags can be missing from the source file in Android source tree and written by assemble_vintf at build time. "Required" tags must be present in the corresponding files on the device.

?xml
Optional. It only provides information to the XML parser.
compatibility-matrix.version
Required. Meta-version of this compatibility matrix. Describes the elements expected in the compatibility matrix. Unrelated to XML version.
compatibility-matrix.type
Required. Type of this compatibility matrix:
  • "device": Device compatibility matrix.
  • "framework": Framework compatibility matrix.
manifest.level
Required for framework compatibility matrix. Specifies the Framework Compatibility Matrix Version (FCM Version) of this file. Should not be declared in device-specific framework compatibility matrix (i.e. DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE).
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 <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.instance
Optional, can repeat. A list of required instances of this interface.
compatibility-matrix.hal.interface.regex-instance
Optional, can repeat. A list of required instance name patterns on this interface. Use Extended Regular Expression format.
compatibility-matrix.kernel
Optional, can repeat. Specify a list of kernel configs that the framework requires on each kernel version.
Multiple <kernel> with the same <version> can exist to imply "and" relationship. Each <kernel> is a "fragment" of the requirements that are enabled only when <conditions> are met.
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.condition
Optional. Must not exist for the first <kernel> of each version. Specifies a list of conditions. Only when the conditions are met are the requirements stated in this <kernel> fragment is enabled.
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.
compatibility-matrix.vendor-ndk
Optional; used only by the device compatibility matrix. Declares the requirement of the VNDK vendor snapshot. If missing, no VNDK requirement is made on the system image.
compatibility-matrix.vendor-ndk.version
Required. A positive integer that declares a VNDK version required by the vendor image.
compatibility-matrix.vendor-ndk.library
Optional, can repeat. Declares a set of VNDK libraries required by the vendor image. Same semantics as manifest.vendor-ndk.library.
compatibility-matrix.system-sdk.version
Optional, can repeat; used only by the device compatibility matrix. Declares the requirement by vendor apps on System SDK versions. If missing, no System SDK requirement is made on the system image.