0

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.

  • Perhaps the difference is the current the device is charging at? (If so, what is the minimum current for 'AC'? Is the device free to define the cutoff?)

  • Or is the difference that the device can also communicate data over its cable? That seems like a strange way to distinguish the two.

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

Thanks in advance!

faradaic
  • 3
  • 1

1 Answers1

0

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.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • Aha, thanks. So the device and OS can't really tell if what's on the other side of the connection is a literal wall charger vs. a laptop, e.g. if a phone connected to a laptop's charge-only ports (with no data lines), Android would report as "AC", and a phone connected to a battery power bank with no data connection would also show as "AC" – faradaic Dec 15 '18 at 23:49
  • @faradaic think that even charging via `USB` can be bidirectional... because it drains the juice from my smartphone when I keep it connected - and the PC has an UPS connected (which charges from the smartphone battery then, despite it shouldn't). also have microUSB cables, which have different charging directions, depending on the pin layout. `USB uses a master/slave star architecture. Master supplies power.` – Martin Zeitler Dec 15 '18 at 23:54