I am building Android AOSP 8.1 (Oreo) for a phone-like device, which is permanently mounted (e.g. industrial deployment) and has no battery. However, when I power it up, it shows a charging indicator and a power reading of 6%. What do I have to change to tell Android there is no battery? I think that is possible, since Android also runs on devices like set-top-boxes and so on. Can I remove this verification? I've tried to modify BatteryService.java in ./frameworks/base/services/core/java/com/android/server/BatteryService.java, and also tried to modify frameworks/base/core/res/res/values/config.xml but didn't have success. Any help will be very welcome.
Thanks in advance.
As Simpl mentioned, AOSP describes how to configure batteryless devices, I implemented health HAL for my industrial device on Android 9, by default with no battery it shows Battery UNKNOWN (as mentioned in AOSP documentation). My requirement was to show Battery 100% when no battery inserted and actual battery status when battery is present.
Below is the code snippet from my health hal, HealthService.cpp
int healthd_board_battery_update(struct android::BatteryProperties *props) {
// return 0 to log periodic polled battery status to kernel log
if (! props->batteryPresent){
props->chargerAcOnline=true;
props->batteryPresent = true;
props->batteryStatus = android::BATTERY_STATUS_CHARGING;
props->batteryHealth = android::BATTERY_HEALTH_GOOD;
props->batteryFullCharge = 100;
props->batteryLevel = 100;
}
return 0;
}
For more details on how to write your own health HAL, follow: https://android.googlesource.com/platform/hardware/interfaces/+/master/health/2.0/README.md