Skip to content

Ultimate Guide to Battery Management with ADB Commands


Print level full capacity of battery
cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/batt_full_capacity
Dump battery temperature
#!/bin/bash

temp=$(cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/batt_temp)
celsius=$(echo "scale=1; $temp / 10" | bc)
echo "Battery Temperature in Celsius: $celsius"
#!/bin/bash

temp=$(cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/batt_temp)

celsius=$(echo "scale=1; $temp / 10" | bc)
fahrenheit=$(echo "scale=1; ($celsius * 9/5) + 32" | bc)
echo "Battery Temperature in Fahrenheit: $fahrenheit"
Is USB Connected and Charging
cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/usb/online   
Print online status for Battery Charging
cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/ac/online
Dump Battery JIG GPIO Status
cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/batt_jig_gpio
Dump Factory Mode Status
cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/factory_mode 
Dump Factory Bypass Mode Status
/sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/factory_mode_bypass
Print Battery Status
cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/status
Dump Battery Technology
cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/technology
Print Battery Health Status
cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/health
Dump Led Cover Status
cat /sys/devices/platform/samsung_mobile_device/samsung_mobile_device:battery/power_supply/battery/led_cover
Simulate we got 1% Battery
adb shell dumpsys battery set level 1
Connect AC charger
adb shell dumpsys battery set ac 1
Disconnect AC charger
adb shell dumpsys battery set ac 0
Connect USB cable
adb shell dumpsys battery set usb 1
Disconnect USB cable
adb shell dumpsys battery set usb 0
After running each of those commands you can reset the battery options using
adb shell dumpsys battery reset
And for example, you can dump data for all of the running services, dump all data for battery
adb shell dumpsys battery
Dump stats for your battery
adb shell dumpsys batterystats 
Erase old stats for battery
adb shell dumpsys batterystats --reset 
Unplug AC
adb shell dumpsys battery unplug
Freezing Battery State
adb shell cmd battery unplug -f
Unfreeze Battery State
adb shell cmd battery reset -f
Dump Battery Level
adb shell cmd battery get level | sed 's/.*/Battery:&%/'
Dump all settings for cmd battery (posix)
#!/bin/bash

batstats="ac usb wireless status level temp present counter invalid"

for batstat in $batstats; do
  value=$(adb shell cmd battery get "$batstat")
  printf "%-8s: %s\n" "$batstat" "$value"
done