我正在尝试创建一个稳定的 AIDL HAL 服务。我正在按照下面链接中的示例进行操作。
我遵循了教程中提到的所有步骤,但由于某种原因,我的构建失败并出现错误“以下实例位于设备清单中,但未在框架兼容性矩阵中指定”
我已经在源代码中添加了兼容性矩阵。我无法弄清楚下面的 xml 有什么问题。有人可以分享可能是什么问题吗?有解决这个问题的建议吗?
<?xml version="1.0" encoding="UTF-8"?>
<!-- Comments, Legal notices, etc. here -->
<compatibility-matrix version="1.0" type="framework">
<hal format="aidl" optional="true">
<name>android.hardware.invcase</name>
<version>1</version>
<interface>
<name>IInvcase</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>
这是完整的错误。
ERROR: files are incompatible: The following instances are in the device manifest but not specified in framework compatibility matrix:
android.hardware.invcase.IInvcase/default (@1)
Suggested fix:
1. Update deprecated HALs to the latest version.
2. Check for any typos in device manifest or framework compatibility matrices with FCM version >= 8.
3. For new platform HALs, add them to any framework compatibility matrix with FCM version >= 8 where applicable.
4. For device-specific HALs, add to DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE or DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE.: Success
INCOMPATIBLE
19:44:38 ninja failed with: exit status 1
#### failed to build some targets (19 seconds) ####
您的设备框架兼容性矩阵 XML 文件位于何处?您的设备 mk 文件是否指向它?
如果您的 XML 文件名为:
custom_framework_compatibility_matrix.xml
,那么您的设备 mk 文件中可能会缺少以下行(通常设备 mk 文件位于类似 device/<your_company>/<your_device>/<your_device>.mk
的某个位置):
这是您的设备 mk 文件中所需的行:
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE += \
device/<your_company>/<your_device>/custom_framework_compatibility_matrix.xml
替换
your_company
和 your_device
以匹配您的 AOSP 构建路径。
现在 Android 框架应该知道您创建的新 HAL。
目前,在我看来,source.android.com 上关于 HAL 开发的这方面的记录非常少。 codeinsideout 博客链接是一个非常好的资源,但缺少这个特定文件的描述。