[英]When to use the adb shell getprop sys.boot_completed
I am calling a sequence of adb commands as below我正在调用一系列 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
But as you can see the android device starts throwing error of 'device not found' at last.但正如您所见,android 设备最后开始抛出“未找到设备”错误。 I have come to know that "adb reboot" might be the culprit here as reboot might not have finished booting completely before next commands starts executing.我知道“adb reboot”可能是这里的罪魁祸首,因为在下一个命令开始执行之前,reboot 可能还没有完全完成引导。 To check this I have used "adb wait-for-device".为了检查这一点,我使用了“adb wait-for-device”。 But it seems that it is not able to detect device state correctly.但似乎无法正确检测到设备 state。
I also have found the use of "adb shell getprop sys.boot_completed" to rectify this error.我还发现使用“adb shell getprop sys.boot_completed”来纠正这个错误。 Detect when Android emulator is fully booted 检测 Android 仿真器何时完全启动
I am not sure though when to use "adb shell getprop sys.boot_completed".我不确定何时使用“adb shell getprop sys.boot_completed”。 Is it to be used on every reboot of the device or can I use it after every "adb wait-for-device" command?它是在每次重新启动设备时使用还是可以在每个“adb wait-for-device”命令后使用?
You should call getprop sys.boot_completed
after boot or reboot and together with adb wait-for-device
like this:您应该在启动或重新启动后调用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'
When you call just single adb wait-for-device
it doesn't guarantee that boot is completed since it only check that daemon has started properly.当您仅调用单个adb wait-for-device
时,它并不能保证引导已完成,因为它仅检查守护程序是否已正确启动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.