Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wait_for_boot waiting forever #978

Merged
merged 1 commit into from
May 22, 2020

Conversation

breautek
Copy link
Contributor

@breautek breautek commented May 22, 2020

Platforms affected

Android

Motivation and Context

Fixes: #698

Description

Changes wait_for_boot from using ps shell command to check for android.process.acore to getprop sys.boot_completed

android.process.acore is a process that (despite it's name) is used for the ContactsProvider. 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 cause cordova 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

  • Ran npm test
  • Tested android emulators between API 22 through R (API 30) to ensure that getprop sys.boot_completed indeed returns a value when expected to.
  • Ran cordova run android while the emulator was off to ensure emulator starts and installs the app properly.
  • Tested on Android Emulator 30.0.12 (Latest version as the time of this PR)

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@codecov-commenter
Copy link

codecov-commenter commented May 22, 2020

Codecov Report

Merging #978 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #978   +/-   ##
=======================================
  Coverage   68.11%   68.11%           
=======================================
  Files          21       21           
  Lines        1866     1866           
=======================================
  Hits         1271     1271           
  Misses        595      595           
Impacted Files Coverage Δ
bin/templates/cordova/lib/emulator.js 89.83% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e86b211...297cd02. Read the comment docs.

Copy link
Member

@timbru31 timbru31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'cordova run android --emulator' command line tool stuck at 'Waiting for emulator to start...'
3 participants