1、获取手机电池信息
adb shell dumpsys battery
字段说明
Current Battery Service state:AC powered: true #交流供电USB powered: false #usb供电Wireless powered: false #无线供电Max charging current: 75000 #最大充电电流Max charging voltage: 5000000 #最大充电电压Charge counter: 2238900 #已充电次数status: 2 #电池状态【2---正在充电,3---没插充电器,4---不充电,5---电量充满】health: 2 #电池健康状态【2---良好,3---过热,4---损坏,5---超压,7---温度过低】present: true #电池是否在机身内level: 77 #电池当前电量百分比scale: 100 #电池电量规模voltage: 4012 #电池当前电压temperature: 320 #电池当前温度,单位为0.1摄氏度technology: Li-poly #电池类型,这里为锂电
2、其它命令
adb shell dumpsys battery set status 2 #模拟手机正在充电状态
adb shell dumpsys battery set status 1 #模拟手机非充电状态
adb shell dumpsys battery unplug #模拟手机断开充电
adb shell dumpsys battery set level 88 #模拟手机电量百分比
adb shell dumpsys battery reset #复位,恢复电池实际状态