You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

healthd与android.hardware.health@2.0-service.imx是否需要同时运行?

Android多healthd进程问题解答

问题背景

测试发现Android系统中存在两个独立的healthd进程,执行进程查询命令输出如下:

$ adb shell "ps -ef | grep health"
root          3535     1 3 14:33:18 ?     00:00:00 healthd
system        3548     1 5 14:33:18 ?     00:00:00 android.hardware.health@2.0-service.imx

二者均复用system/core/healthd和hardware/interfaces/health/2.0/default路径下的公共代码,仅android.hardware.health@2.0-service.imx会调用vendor/nxp-opensource/imx/health路径下的NXP平台定制代码。

核心疑问

  • 两个进程是否有同时运行的必要性?
  • NXP(或下游设备厂商)是否应当禁止默认Android healthd的编译与启动?

补充测试信息

两个服务对应的init rc配置存在差异:

smarc_mx8mq:/etc/init # cat healthd.rc                                                                                                                                     
service healthd /system/bin/healthd
    class hal
    critical
    group root system wakelock
smarc_mx8mq:/etc/init # cat /vendor/etc/init/android.hardware.health@2.0-service.imx.rc                                                                                    
service vendor.health-hal-2-0 /vendor/bin/hw/android.hardware.health@2.0-service.imx
    class hal
    user system
    group system
    capabilities WAKE_ALARM
    file /dev/kmsg w

实测从编译完成的系统中移除/etc/init/healthd.rc后,原生healthd不会启动,目前暂未观察到任何不良影响。


解答

双进程共存的必要性

没有任何必要。Android 8.0推出Treble架构后,health服务就已经从原生system分区的通用healthd,迁移为vendor分区的硬件抽象层实现。你设备上运行的android.hardware.health@2.0-service.imx就是适配i.MX平台的Vendor Health HAL实现,已经完全覆盖了原生healthd的所有功能,还额外包含了厂商定制的电池、硬件健康状态采集逻辑,原生healthd属于完全冗余的旧服务,同时运行只会额外占用系统资源,甚至可能出现状态采集冲突。

厂商是否应当禁用原生healthd

按照AOSP的Treble适配规范,厂商实现了自定义Health 2.0 HAL服务后,必须在编译配置中关闭原生healthd的编译,或者移除其rc启动脚本,避免冗余运行。你实测移除healthd.rc后无异常,也验证了原生healthd确实属于多余的遗留组件,NXP在适配该平台时漏做了该适配步骤。

内容的提问来源于stack exchange,提问作者fadedbee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.30 13:06:05