简体   繁体   English

何时使用 adb shell getprop sys.boot_completed

[英]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.

相关问题 “ adb shell getproppersist.sys.country”返回空字符串 - “adb shell getprop persist.sys.country” returning empty string adb shell getprop和setprop如何工作? - How does adb shell getprop and setprop work? 更改android adb shell中“ getprop”的输出 - Change the output of “getprop” in android adb shell 设置 shell 脚本 Android SELinux 策略以在系统引导时启动它已完成 - Set shell script Android SELinux policies for starting it at sys boot completed linux shell-无法将字符串与:adb shell getprop ro.product.brand - linux shell - can't compare strings with: adb shell getprop ro.product.brand 无法从adb shell发送android.intent.action.BOOT_COMPLETED - Unable to send android.intent.action.BOOT_COMPLETED from adb shell ADB shell:如何获得将接收BOOT_COMPLETED Intent的BroadcastReceiver列表? - ADB shell: How do I get a list of BroadcastReceivers that will receive BOOT_COMPLETED Intent? 执行大多数命令(例如getprop ro.build.version.release)时,ADB总是崩溃 - ADB keeps crashing when executing most commands like getprop ro.build.version.release 当我使用“ adb shell am广播”时得到回应 - Get a response when I use “adb shell am broadcast” 当我使用 adb 显示 /sys/kernel/debug/tracing/available_filter_functions 时没有这样的设备 - No such device when I use adb to show /sys/kernel/debug/tracing/available_filter_functions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM