当前位置:网站首页>binder hwbinder vndbinder
binder hwbinder vndbinder
2022-06-27 16:54:00 【菜鸟xiaowang】
一直以来,供应商进程都使用 Binder 进程间通信 (IPC) 技术进行通信。在 Android 8 中,/dev/binder 设备节点成为框架进程的专有节点,这意味着供应商进程无法再访问此节点。供应商进程可以访问 /dev/hwbinder,但必须将其 AIDL 接口转为 HIDL接口。对于想要继续在供应商进程之间使用 AIDL 接口的供应商,Android 会按以下方式支持 Binder IPC。
Android 8 支持供 供应商服务使用的新 Binder 域,访问此域需要使用 /dev/vndbinder(而非 /dev/binder)。添加 /dev/vndbinder 后,Android 现在拥有以下 3 个 IPC 域:

dev/binder
这个是我们最熟悉的Binder,App开发中,ActivityManagerService用的都是这个,Java继承Binder,C++中继承Bbbinder,然后通过servicemanager进程注册实名Binder,然后通过已经创建好的Binder接口传递匿名Binder对象,拿到BinderProxy或者BpBinder以后,就可以Binder通信了。
dev/vndbinder
其实dev/vndbinde和dev/binder使用方式基本一样而且是共用一套Binder SDK,也是Java继承Binder,C++中继承Bbbinder,通过vndservicemanager进程注册实名Binder,然后通过已经创建好的Binder接口传递匿名Binder对象,拿到BinderProxy或者BpBinder以后,就可以Binder通信了。如何在使用同一套Binder SDK的代码,最后访问的设备节点变成dev/vndbinder,servicemanager变成vndservicemanager。
其实只要在你这个进程初始化的时候执行下面这个代码即可
ProcessState::initWithDriver("/dev/vndbinder");dev/binder和dev/vndbinder无法在一个进程中同时使用
dev/hwbinder
硬件接口binder
为什么会引入 HwBinder?
HwBinder 引入的本质还是 Treble 机制的使用,这使得 system 和 vendor 分区相互隔离。在 Android 8.0 之前,Android HAL 与系统框架是紧耦合的,它们打包在一个镜像里。HAL只是一个个的so库,framework 通过打开动态库来调用 HAL。 为了适配 HwBinder,Android 8.0 同时引入了 HIDL,用于建立 framework 和 HAL 间的通信。
经过这个改变后,HAL 可以同时服务于 system 和 vendor。而 HAL 的实现位于 vendor 分区,通过 HwBinder 可以确保 system 和 vendor 独立升级,而不会影响 HAL 的调用。
HIDL是什么
假如Android官方定义了一个ILight.hal的HAL层接口
Interface ILight {
void turnOn();
void turnOff();
}通过编译会自动生成如下两个类LightServer和LightClient的java对象和c++对象。
供应商只需要简单的继承LightServer,并实现turnOn和turnOff的抽象方法,就可以完成Light接口的实现,以及Light服务注册到hwservicemanager。
需要使用ILight接口的进程,只需要调用LightClient的turnOn和turnOff接口,就可以完成从hwservicemanager获得Light服务的Proxy对象,以及ILight的接口调用。
边栏推荐
- The incluxdb cluster function is no longer open source, and the tdengine cluster function is even better
- Market status and development prospect of resorcinol derivatives for skin products in the world in 2022
- [elt.zip] openharmony paper Club - memory compression for data intensive applications
- 电脑安全证书错误怎么处理比较好
- Market status and development prospect forecast of global epoxy resin active toughener industry in 2022
- 中国工业软件市场研究报告出炉,力控SCADA、MES丰富国产工业软件生态
- The computer voice is blurry, the video is also out of the card, and the sound cannot be played. It is normal to insert the headset
- Rxjs mergeMap 的使用场合
- 新中大冲刺科创板:年营收2.84亿 拟募资5.57亿
- 银河麒麟V10系统激活
猜你喜欢

laravel框架中 定时任务的实现

Technology sharing | introduction to kubernetes pod

国产数据库认证考试指南汇总(2022年6月16日更新)

2022年信创行业空间测算

使用 WebDAV 替代445端口文件共享

How to view the index information of MySQL tables?

Space calculation of information and innovation industry in 2022

产学合作协同育人,麒麟软件携手南开大学合力完成《软件测试与维护》实践课程

脉脉热帖:为啥大厂都热衷于造轮子?

International School of Digital Economics, South China Institute of technology 𞓜 unified Bert for few shot natural language understanding
随机推荐
How to view the index information of MySQL tables?
Current market situation and development prospect forecast of global 3,3 ', 4,4' - biphenyltetracarboxylic dianhydride industry in 2022
ABAP随笔-EXCEL-3-批量导入(突破标准函数的9999行)
开源之夏 2022 | openGauss 项目中选公布
Core dynamic Lianke rushes to the scientific innovation board: with an annual revenue of 170million yuan, Beifang Electronics Institute and Zhongcheng venture capital are shareholders
什么是 ICMP ?ping和ICMP之间有啥关系?
Don't worry. This is the truth about wages in all industries in China
Market status and development prospect forecast of global 3-Chloro-1,2-Propanediol industry in 2022
[notice of the Association] notice on holding summer special teacher training in the field of artificial intelligence and Internet of things
xctf攻防世界 MISC薪手进阶区
Market status and development prospect forecast of global epoxy resin active toughener industry in 2022
Jinyuan's high-end IPO was terminated: it was planned to raise 750million Rushan assets and Liyang industrial investment were shareholders
DFS and BFS simple principle
电脑安全证书错误怎么处理比较好
PCB线路板蛇形布线要注意哪些问题?
云原生数据库:数据库的风口,你也可以起飞
实施MES管理系统前,要对哪些问题进行评估
国产数据库认证考试指南汇总(2022年6月16日更新)
Market status and development prospect forecast of global aircraft hose industry in 2022
在arcgis中以txt格式导出点的坐标