Is there an API to control charging in Android OS?

] (720287a47233d58edb79d9a9802aee13.jpeg)

If i make the connection shown above, the Walkman will be in power supply mode and cannot be charged.
The DAC to which the miniB is connected has a power supply and does not require power supply from the Walkman.

After the connection with the DAC connecting the miniB is established, I want to be able to charge the Walkman from the charger connected to Type A under the control of the software.

  • Answer # 1

    It seems that it can not be done unless Android is rooted.
    It turned out that rooting is not covered by the manufacturer's warranty and cannot be commercialized.

  • Answer # 2

    How about this?