android 11 Stable AIDL 接口添加

BG

Android 10 添加了对稳定的 Android 接口定义语言 (AIDL) 的支持,这是一种跟踪由 AIDL 接口提供的应用编程接口 (API)/应用二进制接口 (ABI) 的新方法。稳定的 AIDL 与 AIDL 的主要区别如下:

在构建系统中使用 aidl_interfaces 定义接口。
接口只能包含结构化数据。对于代表所需类型的 Parcelable,系统会根据其 AIDL 定义自动创建,并自动对其进行编组和解组。
可以将接口声明为“稳定”接口(向后兼容)。声明之后,会在 AIDL 接口旁的一个文件中对这些接口的 API 进行跟踪和版本编号。

问题点

我们在netd aidl 中添加了新的接口
编译时候无法通过

Solution

you need to manage ToT version's API definition.
Whenever an API is updated, run foo-update-api to update aidl_api/name/current which contains ToT version's API definition.

补充:

To maintain the stability of an interface, owners can add new:

    Methods to the end of an interface (or methods with explicitly defined new serials)
    Elements to the end of a parcelable (requires a default to be added for each element)
    Constant values
    In Android 11, enumerators
    In Android 12, fields to the end of a union

No other actions are permitted, and no one else can modify an interface (otherwise they risk collision with changes that an owner makes).

对应此模块
你需要的事运行如下命令进行编译

make netd_aidl_interface-update-api
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐