簡體   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