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!: Make CoreAndroid plugin instantiate on load #1605

Merged

Conversation

breautek
Copy link
Contributor

@breautek breautek commented Apr 21, 2023

I don't anticipate breaking changes from this change, however it is a difference in behaviour since CoreAndroid won't be lazily loaded, therefore I've marked this commit has a breaking change.

Platforms affected

Android / CoreAndroid plugin

Motivation and Context

CoreAndroid was lazily loaded via getPlugin call. This can create a race condition in some situations, particularly
with a new feature in the works: #1574 where onRenderProcessGone may be invoked before anything gets a chance to call getPlugin for CoreAndroid.

In general, because this is Core plugin, I feel like it should always be loaded in, not lazily loaded in.

Description

Inside PluginManager, I added a new public API: addService(String serviceName, String className, bool onload).
The addService(String serviceName, String className) implementation has been moved to the new public API.

CordovaWebviewImpl will now add the CoreAndroid service with onload set to true.

Testing

Ran npm test on linux.
Also manual test while testing the onRenderProcessGone 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

I don't anticipate breaking changes from this change, however it is a difference
in behaviour since CoreAndroid won't be lazily loaded, therefore I've marked this
commit has a breaking change.
@breautek breautek added this to the 12.0.0 milestone Apr 21, 2023
@breautek breautek requested a review from erisu April 21, 2023 16:14
@codecov-commenter
Copy link

codecov-commenter commented Apr 21, 2023

Codecov Report

Merging #1605 (57369f3) into master (2252c09) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1605   +/-   ##
=======================================
  Coverage   71.82%   71.82%           
=======================================
  Files          23       23           
  Lines        1796     1796           
=======================================
  Hits         1290     1290           
  Misses        506      506           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@dpogue dpogue left a comment

Choose a reason for hiding this comment

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

LGTM

@breautek breautek merged commit a62f699 into apache:master Apr 21, 2023
@breautek breautek deleted the fix/make-coreandroid-init-immediately branch April 21, 2023 19:00
breautek added a commit to breautek/cordova-android that referenced this pull request Oct 21, 2023
I don't anticipate breaking changes from this change, however it is a difference
in behaviour since CoreAndroid won't be lazily loaded, therefore I've marked this
commit has a breaking change.
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.

3 participants