一、获取电池信息 命令:adb shell dumpsys battery Current Battery Service state: AC powered: false //false表示没使用AC电源 USB po
命令:adb shell dumpsys battery
Current Battery Service state:
AC powered: false //false表示没使用AC电源
USB powered: true //true表示使用USB电源
Wireless powered: false //false表示没使用无线电源
status: 2 //2表示电池正在充电,1表示没充电
health: 2 //2表示电池状态优秀
present: true / /true表示已安装电池
level: 63 //电池百分比
scale: 100 //满电量时电池百分比为100%(不确定是否正确)
voltage: 3781 //电池电压3.781V
temperature: 250 //电池温度为25摄氏度
technology: Li-ion //电池类型为锂电池
先查看帮助信息:
home@ubuntu:~$ adb shell dumpsys battery -hBattery service (battery) commands: help Print this help text. set [-f] [ac|usb|wireless|status|level|temp|present|invalid] Force a battery property value, freezing battery state. -f: force a battery change broadcast be sent, prints new sequence. unplug [-f] Force battery unplugged, freezing battery state. -f: force a battery change broadcast be sent, prints new sequence. // 该参数用途:当你用adb修改电池参数值后,想还原到硬件实际值,用此参数重置电池各参数 reset [-f] Unfreeze battery state, returning to current hardware values. -f: force a battery change broadcast be sent, prints new sequence.
adb shell dumpsys battery unplug // 模拟断开充电
adb shell dumpsys battery reset // 模拟恢复充电
adb shell dumpsys battery set ac 1 //用交流充电器充电
adb shell dumpsys battery set usb 1 // 用USB充电
adb shell dumpsys battery set wireless 1 //无线充电
当设置完上面命令后,再dump下电池信息:
AC powered: true
USB powered: true
Wireless powered: true
adb shell dumpsys battery set status 1
1 表示:电池状态
adb shell dumpsys battery set status 2
2表示:充电状态 ,其他数字为非充电状态
adb shell dumpsys battery set level 80
你想还原到实际值,你可以重启,这种肯定很浪费时间,我们直接用:
adb shell dumpsys battery reset 命令重置 电池电量就恢复到实际值了
来源地址:https://blog.csdn.net/u012514113/article/details/127655735
--结束END--
本文标题: adb shell 查看和修改电池信息
本文链接: https://www.lsjlt.com/news/401880.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0