Android AIDL interface for HALs

已有的一个AIDL interface ==  /hardware/interfaces/health/aidl/android/hardware/health/IHealth.aidl

随便添加一个 function 到AIDL file

1. 直接mm编译 ==> 提示 AIDL API 被改变了

With diff:
@@ +8,5 @@
   int getCurrentAverageMicroamps();
   int getCapacity();
+  int Test();
   long getEnergyCounterNwh();
   android.hardware.health.BatteryStatus getChargeStatus();

###############################################################################
# ERROR: AIDL API change detected on a released platform                      #
###############################################################################
Above AIDL file(s) has changed and this is NEVER allowed on a release platform
(i.e., PLATFORM_VERSION_CODENAME is REL). If a device is shipped with this
change by ignoring this message, it has a high risk of breaking later when a
module using the interface is updated, e.g., Maineline modules.
15:33:34 ninja failed with: exit status 1

这个错误需要 -- 执行 m <name>-update-api

 

 

2. m <name>-update-api后做mm编译也是有编译错误

[  0% 5/607] AIDL CHECK API: hardware/interfaces/health/aidl/aidl_api/android.hardware.health/current against hardware/interfaces/health/aidl/aidl
FAILED: out/soong/.intermediates/hardware/interfaces/health/aidl/android.hardware.health-api/checkapi_current.timestamp
(out/host/linux-x86/bin/aidl --stability vintf --checkapi=compatible  hardware/interfaces/health/aidl/aidl_api/android.hardware.health/1 hardware/interfaces/health/aidl/aidl_api/android.hardware.health/current && touch out/soong/.intermediates/hardware/interfaces/health/aidl/android.hardware.health-api/checkapi_current.timestamp) || (cat system/tools/aidl/build/message_check_compatibility.txt && exit 1)
ERROR: hardware/interfaces/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl:45.7-27: Transaction ID changed: android.hardware.health.IHealth.getEnergyCounterNwh() is changed from 7 to 8.
ERROR: hardware/interfaces/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl:46.40-56: Transaction ID changed: android.hardware.health.IHealth.getChargeStatus() is changed from 8 to 9.
ERROR: hardware/interfaces/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl:47.40-55: Transaction ID changed: android.hardware.health.IHealth.getStorageInfo() is changed from 9 to 10.
ERROR: hardware/interfaces/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl:48.38-51: Transaction ID changed: android.hardware.health.IHealth.getDiskStats() is changed from 10 to 11.
ERROR: hardware/interfaces/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl:49.37-51: Transaction ID changed: android.hardware.health.IHealth.getHealthInfo() is changed from 11 to 12.
###############################################################################
# ERROR: Backward incompatible change detected on AIDL API                    #
###############################################################################
Above AIDL file(s) has changed in a backward-incompatible way, e.g. removing
a method from an interface or a field from a parcelable. If a device is shipped
with this change by ignoring this message, it has a high risk of breaking later
when a module using the interface is updated, e.g., Maineline modules.
15:36:33 ninja failed with: exit status 1


这个错误需要 -- 在AIDL interface 定义的最后添加新API,不要加到中间,打乱原API顺序

===
===
1. 在原有的aidl中的最后添加新的api(在最后加API,不要加到中间,打乱原API顺序)
2. 执行 m <name>-update-api ==> 会更新到current目录下的文件
3. 执行 mm, 编译生成对应version的modules,测试验证
   --- 等所有修改都完毕 --
4. 执行 m <name>-freeze-api固定版本,自动更新到Andrioid.bp中的versions_with_info,以及生成新版本对应的aidl_api\<name>\x目录及内容
5. 最后提交

===

 

posted on 2023-02-23 13:21  二的次方  阅读(1882)  评论(2编辑  收藏  举报