首页 > 其他分享 >Android AIDL interface for HALs

Android AIDL interface for HALs

时间:2023-02-23 13:33:34浏览次数:46  
标签:HALs aidl interfaces hardware api health interface Android android

已有的一个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. 最后提交

===

 

标签:HALs,aidl,interfaces,hardware,api,health,interface,Android,android
From: https://www.cnblogs.com/roger-yu/p/17127128.html

相关文章

  • Android Studio虚拟机配置出现Intel® HAXM installation failed
    跟着动脑学院下载编写安卓软件的程序,在设置虚拟机的时候报错,出现了下面一行错误Intel®HAXMinstallationfailed.ToinstallIntel®HAXMfollowtheinstructionsfo......
  • Android使用第三方字体
    Android使用第三方字体为了UI美观使用apk第三方字体,方法如下:FontsinXML是Android8中推出的功能,也就是可以像图片资源那样指定,使用@font/xxx或R.font.xxx等。具体步......
  • Android Studio新建项目
    1.选择模块  这个相当于是一个空页面。  ......
  • Android Dangerous权限的处理【设为默认】
    AndroidDangerous权限的处理【设为默认】在日常的使用中,如果我们调用到某一个接口,该接口依赖于危险权限的声明,平时我们会去对权限进行检查,检查这个权限是否被赋予,如果没......
  • Android笔记-跳转到相册选择图片
    跳转到相册选择图片即设置一个点击事件,点击之后即可跳转到相册进行图片的选择具体的实现步骤:界面很简单的啦,这里就直接将源代码放出来啦:<?xmlversion="1.0"encoding=......
  • typescript中的type和interface的区别
    //1,写法不一样typeMyType={name:stringage:number}interfaceMyType{name:string;age:number}//2,拓展方式不一样typeMyType={name:......
  • Android学习——控件TextView
    1.基本2.带阴影的3.跑马灯效果......
  • 关于首次接触Android Studio
    今天正式接触了AndroidStudio,刚开始学,创建一个安卓工程这个东西  下载太慢。      此时千万不能断网,不然一切都会重新开始。 ......
  • Android 启动优化(二) - 有向无环图的原理以及解题思路
    Android启动优化(一)-有向无环图Android启动优化(二)-拓扑排序的原理以及解题思路Android启动优化(三)-AnchorTask使用说明Android启动优化(四)-手把手教你实现An......
  • 【Android】“你好,世界”的地基
    哪一个活动?创建一个普通的BaseActivity类,并将其定为所有活动类的父类。publicclassBaseActivityextendsAppCompatActivity{@OverrideprotectedvoidonC......