Android phones are always connected to USB for automation and charging all the time, which may cause battery swelling. How to disable charging and turn on charging at regular intervals?

In order to avoid the problem of battery swelling caused by overcharging when the Android phone is connected to USB for automated testing, the following steps can be used to realize the function of prohibiting automatic charging after charging for several hours.

step:

Connect the Android phone to the USB port of the computer.

Select Device Manager in the left pane of the Computer Management window [3].

Locate and expand Android Phone, right-click on Android Composite ADB Interface[3], and select Update Driver.

In the Hardware Update Wizard, select Install from a list or a specified location [3], and then click Next.

Select Search these locations for the best drivers, uncheck Search removable media, and check Include this location in the search [3].

Click Browse and locate the USB driver folder [3].

Install the USB driver [2].

Download and install the Android Debug Bridge (ADB) tool[1].

Enter adb shell dumpsys battery set usb 0[1] on the command line to disable USB charging.

Enter adb shell dumpsys battery set usb 1[1] at the command line to allow USB charging.

Use the adb shell dumpsys battery command to query the battery information of the mobile phone, including the current power and charging status [1].

You can write a script, use adb shell dumpsys battery set usb 0 to disable charging, and then wait for a few hours before using adb shell dumpsys battery set usb 1 to allow charging, and then disable charging when the power is reduced to 50% [1].

The above is the implementation method of prohibiting the automatic charging of the Android mobile phone after USB charging for several hours.
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/weixin_45329445/article/details/129485574