从新代码控制 AOSP 功率报告功能

Controlling the AOSP power-reporting functionality from new code

在 Android 开源项目中,我 add/override 告诉 Android 电池电量和交流电源的代码在哪里?

我需要轮询 i2c 总线上的组件以获取此信息,在我的板上,并将其传递给 Android。

这取决于您的 Android 版本:

奥利奥和更新的

您必须替换现有的 Health HAL service with a custom one that provides the information you want. You don't have to write the service from scratch but change the provided dummy implementation

牛轧糖和更老

这些版本还没有 Health HAL。您必须直接在 system/core/healthd 中更新 healthd