| <html devsite><head> |
| <title>兼容性矩阵</title> |
| <meta name="project_path" value="/_project.yaml"/> |
| <meta name="book_path" value="/_book.yaml"/> |
| </head> |
| <body> |
| <!-- |
| Copyright 2017 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <p>本部分介绍框架和设备兼容性矩阵以及<a href="#compatiblity-matrix-schema">兼容性矩阵结构</a>。有关匹配规则,请参见<a href="/devices/architecture/vintf/match-rules.html">匹配规则</a>一文。</p> |
| |
| <h2 id="framework-compatibility-matrix">框架兼容性矩阵</h2> |
| <p>框架兼容性矩阵说明了框架对运行它的设备的需求。矩阵文件与 Android 框架映像(位于 <code>system.img</code> 中)相关联。框架的兼容性矩阵的需求应通过设备清单来满足(在启动和 OTA 时需求是被强制执行的)。</p> |
| |
| <p>框架兼容性矩阵文件示例:</p> |
| |
| <pre class="prettyprint"> |
| <?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> |
| </pre> |
| |
| <h2 id="device-compatibility-matrix">设备兼容性矩阵</h2> |
| <p>设备兼容性矩阵说明了设备期望框架满足的一组需求(在启动和 OTA 时需求是被强制执行的)。 |
| </p> |
| <p>设备兼容性矩阵文件示例:</p> |
| |
| <pre class="prettyprint"> |
| <?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> |
| </pre> |
| |
| <h2 id="compatiblity-matrix-schema">兼容性矩阵结构</h2> |
| <dl> |
| <dt><code>?xml</code></dt> |
| <dd>可选。它只向 XML 解析器提供信息。</dd> |
| <dt><code>compatibility-matrix.version</code></dt> |
| <dd>必需。该兼容性矩阵的版本。描述清单中预期的元素。与 XML 版本无关。</dd> |
| <dt><code>compatibility-matrix.type</code></dt> |
| <dd>必需。该兼容性矩阵的类型: |
| <ul> |
| <li><code>"device"</code>:设备兼容性矩阵。</li> |
| <li><code>"framework"</code>:框架兼容性矩阵。</li> |
| </ul> |
| </dd> |
| <dt><code>compatibility-matrix.hal</code></dt> |
| <dd>可选且可重复。列出兼容性矩阵(框架或设备)的所有者要求存在的单个 HAL(HIDL 或本机)。HAL 条目通过 <code><name></code> 元素来区分,可以有多个同名的 HAL 条目(暗示“和”条件)。 |
| </dd> |
| <dt><code>compatibility-matrix.hal.format</code></dt> |
| <dd>可选。值可以是以下几项之一: |
| <ul> |
| <li><code>"hidl"</code>:HIDL HAL。这是默认值。</li> |
| <li><code>"native"</code>:本机 HAL。</li> |
| </ul> |
| </dd> |
| <dt><code>compatibility-matrix.hal.optional</code></dt> |
| <dd>属性是可选的,默认值为 false。指明该 HAL 对兼容性矩阵(框架或设备)的所有者来说是否为可选。如果将 <code>&ltp;hal></code> 条目标记为可选,则表示在存在的情况下所有者可以使用该 HAL,但并非是必须存在。</dd> |
| <dt><code>compatibility-matrix.hal.name</code></dt> |
| <dd>必需。该 HAL 的完整软件包名称。示例: |
| <ul> |
| <li><code>android.hardware.camera</code> (HIDL HAL)</li> |
| <li><code>GLES</code>(本机 HAL,只需提供名称)</li> |
| </ul> |
| </dd> |
| <dt><code>compatibility-matrix.hal.version</code></dt> |
| <dd>必需,可以在不重名的情况下进行重复使用。版本范围的列表(请参见 <a href="/devices/architecture/vintf/match-rules.html#hals">HAL 匹配</a>一节),用于定义兼容性矩阵(框架或设备)的所有者期望的版本。</dd> |
| <dt><code>compatibility-matrix.hal.interface</code></dt> |
| <dd>可选且可重复。该 HAL 的必需接口的列表。</dd> |
| <dt><code>compatibility-matrix.hal.interface.name</code></dt> |
| <dd>必需。接口的名称。</dd> |
| <dt><code>compatibility-matrix.hal.interface.instance</code></dt> |
| <dd>可选且可重复。该接口的必需实例的列表。</dd> |
| <dt><code>compatibility-matrix.kernel.version</code></dt> |
| <dd>必需。内核版本。格式为 <code>{version}.{major-revision}.{minor-revision}</code>。版本和主要修订版本必须完全匹配,次要修订版本定义框架期望的内核的最低 LTS 版本。</dd> |
| <dt><code>compatibility-matrix.kernel.config</code></dt> |
| <dd>可选且可重复。列出该内核版本必须匹配的 <code>CONFIG</code> 项。每个 <code>CONFIG</code> 项是一个键值对,配置项通过键来区分。</dd> |
| <dt><code>compatibility-matrix.kernel.config.key</code></dt> |
| <dd>必需。<code>CONFIG</code> 项的键名称。以 <code>CONFIG_</code> 开头。</dd> |
| <dt><code>compatibility-matrix.kernel.config.value</code></dt> |
| <dd>必需。<code>CONFIG</code> 项的值。格式视类型而定: |
| <ul> |
| <li><code>string</code>:省略了引号。</li> |
| <li><code>int</code>:接受十进制和十六进制值(必须以 <code>0x</code> 或 <code>0X)</code> 开头)。解释为 64 位整数,溢出部分会被截断。(解析器接受从 -2<sup>64</sup> + 1 到 2<sup>64</sup> - 1 的值,会在第 65 位截断;有关详情,请参阅 <a href="http://man7.org/linux/man-pages/man3/strtoul.3.html" class="external">strtoull 手册页</a>。)</li> |
| <li><code>range</code>:格式为 <code>[int]-[int]</code>,例如 <code>10-20</code>。接受十六进制值且值必须以 <code>0x</code> 或 <code>0X</code> 开头。两个边界必须是无符号的 64 位整数。</li> |
| <li><code>tristate</code>:有效值为 <code>y</code>、<code>m</code> 和 <code>n</code>。</li> |
| </ul> |
| </dd> |
| <dt><code>compatibility-matrix.kernel.config.value.type</code></dt> |
| <dd>必需。<code>CONFIG</code> 项的值的类型,应该是以下几项之一: |
| <ul> |
| <li><code>string</code></li> |
| <li><code>int</code></li> |
| <li><code>range</code></li> |
| <li><code>tristate</code></li> |
| </ul> |
| </dd> |
| <dt><code>compatibility-matrix.sepolicy</code></dt> |
| <dd>必需。包含所有与 sepolicy 相关的条目。仅供框架兼容性矩阵使用。</dd> |
| <dt><code>compatibility-matrix.sepolicy.sepolicy-version</code></dt> |
| <dd>必需且可重复。描述对 sepolicy 版本的需求。与 <code>manifest.sepolicy.version</code> 相对应。元素的每个实例定义一系列 sepolicy 版本。</dd> |
| <dt><code>compatibility-matrix.sepolicy.kernel-sepolicy-version</code></dt> |
| <dd>必需。声明框架支持的 <code>policydb</code> 版本。</dd> |
| <dt><code>compatibility-matrix.avb.vbmeta-version</code></dt> |
| <dd>可选,仅供框架兼容性矩阵使用。声明用于对 <code>system.img</code> 签名的 <a href="/devices/architecture/vintf/match-rules.html#avb-version">AVB 版本</a>。</dd> |
| </dl> |
| |
| </body></html> |