androidbatterymanager

How does a device report the difference between BATTERY_PLUGGED_USB and BATTERY_PLUGGED_AC to BatteryManager?


I understand there are two different flags and they represent whether the device is plugged into AC or USB charging. How does the device know that, and what does it report to the operating system?

I would have thought the OS could not distinguish between the phone plugged into the USB port of a laptop and charging at 500 mA, vs. the phone plugged into a wall charger and charging at 500 mA.

https://developer.android.com/reference/android/os/BatteryManager

Thanks in advance!


Solution

  • a common AC charger-adapter has no USB host-controller available (unidirectional), contrary to a USB port on a computer (bidrectional). my wall outlet with two charge-only USB ports still behaves different than my QC4 charger-adapter, with is being detected as "turbo power" ...which is the third mode, which it is able to detect - and where at least a charging controller should be present, in order to negotiate the volts and ampere used for charging. meanwhile there even is QC4+ available. there also is BATTERY_PLUGGED_WIRELESS ...eg. PowerMat, also only for compatible devices.