繁体   English   中英

何时使用 adb shell getprop sys.boot_completed

[英]When to use the adb shell getprop sys.boot_completed

我正在调用一系列 adb 命令,如下所示

"adb root"
adbd is already running as root
"adb wait-for-device"
"adb shell getprop sys.boot_completed"
1
boot_completed successful
"adb remount"
remount succeeded
"adb uninstall ..."
Success
"adb shell rm -rf ..."
"adb push ..."
9366 KB/s (46299481 bytes in 4.827s)
"adb push ..."
14 files pushed. 0 files skipped.
9701 KB/s (26658580 bytes in 2.683s)
"adb push ..."
14 files pushed. 0 files skipped.
9544 KB/s (33592272 bytes in 3.437s)
"adb reboot"
"adb wait-for-device"
"adb root"
error: protocol fault (no status)
error: protocol fault (no status)
Sleeping 2 sec. before retrying
increasing timeout by 180.0 seconds
"adb root"
error: device not found
error: device not found
Sleeping 2 sec. before retrying
increasing timeout by 270.0 seconds
"adb root"
error: device not found
error: device not found
Sleeping 2 sec. before retrying
increasing timeout by 405.0 seconds
"adb root"
error: device not found
error: device not found

但正如您所见,android 设备最后开始抛出“未找到设备”错误。 我知道“adb reboot”可能是这里的罪魁祸首,因为在下一个命令开始执行之前,reboot 可能还没有完全完成引导。 为了检查这一点,我使用了“adb wait-for-device”。 但似乎无法正确检测到设备 state。
我还发现使用“adb shell getprop sys.boot_completed”来纠正这个错误。 检测 Android 仿真器何时完全启动

我不确定何时使用“adb shell getprop sys.boot_completed”。 它是在每次重新启动设备时使用还是可以在每个“adb wait-for-device”命令后使用?

您应该在启动或重新启动调用getprop sys.boot_completed并与adb wait-for-device一起调用,如下所示:

adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82' 

当您仅调用单个adb wait-for-device时,它并不能保证引导已完成,因为它仅检查守护程序是否已正确启动。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM