09 November 2016

Externally Instrumented Wakelocks

# root required
adb shell "echo temporary > /sys/power/wake_lock"
adb shell "echo temporary > /sys/power/wake_unlock"

# System wakelocks:
# KeyEvents PowerManagerService.Broadcasts PowerManagerService.Display PowerManagerService.WakeLocks SensorService
# sensor_ind kickstart qmuxd_port_wl_29 qmuxd_port_wl_30 qmuxd_port_wl_31 qmuxd_port_wl_32 qmuxd_port_wl_33 qmuxd_port_wl_34 qmuxd_port_wl_35 qmuxd_port_wl_36

Power and Battery Stats

adb shell dumpsys [power | battery | batterproperties | batterystats]

# USB charger disconected
adb shell dumpsys battery set usb 0

# All charger disconnected since Android 6.0
adb shell dumpsys battery unplug

# Battery level
adb shell dumpsys battery set level 50

#  Status    Health
#  1 Unknown      1 Unknown
#  2 Charging     2 Good
#  3 Discharging  3 Overheat
#  4 Not charging 4 Dead
#  5 Full         5 Over voltage
#                 6 Unspecified failure
#                 7 Cold
adb shell dumpsys battery set status 3

# Reset battery
adb shell dumpsys battery reset