fix: wait_for_boot waiting forever #978
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Platforms affected
Android
Motivation and Context
Fixes: #698
Description
Changes
wait_for_boot
from usingps
shell command to check forandroid.process.acore
togetprop sys.boot_completed
android.process.acore
is a process that (despite it's name) is used for theContactsProvider
. The process is launched on boot, but will get killed after some amount of inactivity. When this happens, emulators that are opened for approximately 15 minutes or more will causecordova run android
to hang indefinitely.Using
getprop sys.boot_completed
is a more reliable way to determine if the simulator has been booted.A longer research comment I have posted on the issue ticket at #698 (comment)
Additionally one unit test has been updated to reflect this change.
I believe this is a safe change to make as all android emulators available via the android sdk of the API levels cordova-android@9 will support all appear to support the
sys.boot_completed
prop. It is possible other third-party simulators may not support this flag, but I don't believe this is a Cordova's concern.Testing
npm test
getprop sys.boot_completed
indeed returns a value when expected to.cordova run android
while the emulator was off to ensure emulator starts and installs the app properly.Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)