Controlling the AOSP power-reporting functionality from new code

234 Views Asked by At

In the Android Open Source Project, where would I add/override the code which tells Android about the battery level and AC power?

I need to poll a component on an i2c bus to get this information, on my board, and pass it to Android.

1

There are 1 best solutions below

1
Simpl On BEST ANSWER

It depends on your Android version:

Oreo and Newer

You have to replace the existing 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.

Nougat and Older

These version do not yet have a Health HAL. You have to update the healthd directly in system/core/healthd.