Compatibility matrixes

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

Framework compatibility matrix (FCM)

The framework compatibility matrix (FCM) describes the requirements of the framework on the device it runs on. The framework compatibility matrix consists of the system compatibility matrix, the product compatibility matrix, and the system_ext compatibility matrix. The requirements of the FCM must be satisfied by the device manifest (requirements enforced at build time, runtime, and in VTS).

The system_ext FCM and the product FCM are complements of device-specific FCM (installed in the system partition).

  • The device FCM should reflect the requirements of modules in the system partition.
  • The system_ext FCM should reflect the requirements by modules in the system_ext partition.
  • The product FCM should reflect the requirements by modules in the product partition.

All of the FCMs should align with an OEM's modifications to the framework in the system, product, and system_ext partitions. For example, if an app installed in the product partition uses a vendor extension of a HAL interface, the HAL interface requirement should be declared in the product FCM.

Example system compatibility matrix 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>
        <interface>
            <name>IComposer</name>
            <instance>default</instance>
        </interface>
    </hal>
    <hal format="aidl" optional="true">
        <name>android.hardware.light</name>
        <version>1-2</version>
        <interface>
            <name>ILights</name>
            <instance>default</instance>
        </interface>
    </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.

Product compatibility matrix

The product FCM is a framework compatibility matrix file in the product partition. The VINTF object joins the product FCM with FCMs in the system and system_ext partitions at runtime.

Example product FCM file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Comments, Legal notices, etc. here -->
<compatibility-matrix version="1.0" type="framework">
    <hal>
        <name>vendor.foo.camera</name>
        <version>1.0</version>
        <interface>
            <name>IBetterCamera</name>
            <instance>default</instance>
        </interface>
    </hal>
</compatibility-matrix>

System_ext compatibility matrix

The system_ext FCM is a framework compatibility matrix file in the system_ext partition. The VINTF object joins the system_ext FCM with FCMs in the system and product partitions at runtime. See product compatibility matrix for an example system_ext FCM file.

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. In Android 12 and higher, allowed in framework compatibility matrix files in the product and system_ext partitions. Specifies the Framework Compatibility Matrix Version (FCM Version) of this file. Don't declare this 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.
  • "aidl": AIDL HALs. Only valid on compatibility matrix meta-version 2.0.
  • "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 or AIDL HAL)
  • GLES (native HAL, requires name only)
compatibility-matrix.hal.version
A list of version ranges (see HAL matches) that defines what versions the owner of the compatibility matrix (framework or device) expects.

For HIDL and native HALs, required, can repeat without duplicates. Format is one of the following:
  • MAJOR.MINOR_MIN-MINOR_MAX
  • MAJOR.MINOR (equivalent to MAJOR.MINOR-MINOR)

For AIDL HALs, must not be present on devices running Android 11 and below. Optional on devices running later versions. If specified, format is one of the following:
  • VERSION_MIN-VERSION_MAX
  • VERSION (equivalent to VERSION-VERSION)
If unspecified, the value defaults to 1.
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. When the conditions are met, the requirements stated in this <kernel> fragment are 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. Deprecated in Android 10.
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.