-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Android Embedding PR26: Offer an async version of FlutterMain's ensure initialization complete. #8465
Conversation
…e initialization complete.
public static void ensureInitializationCompleteAsync( | ||
Context applicationContext, | ||
String[] args, | ||
Handler callbackHandler, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would the caller want to run callback
on anything other than the main thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One example of threading restrictions is that a SQL DB must be accessed on the same thread it was opened with. That specific example may not be highly relevant here, other than that sometimes things in Android come with strict threading requirements and so it is generally preferable to allow for that control. It's easy to hand over whatever Handler you want, it is tedious to get from another thread to the one you want.
…'s ensure initialization complete. (flutter/engine#8465)
…'s ensure initialization complete. (flutter/engine#8465)
…'s ensure initialization complete. (flutter/engine#8465)
…'s ensure initialization complete. (flutter/engine#8465)
…'s ensure initialization complete. (flutter/engine#8465)
…'s ensure initialization complete. (flutter/engine#8465)
…'s ensure initialization complete. (flutter/engine#8465)
…'s ensure initialization complete. (flutter/engine#8465)
…'s ensure initialization complete. (flutter/engine#8465)
flutter/engine@ff1bcdc...8a46559 git log ff1bcdc..8a46559 --no-merges --oneline 8a46559 Route FlutterEventTracer events to Fuchsia tracing for Fuchsia (flutter/engine#8499) 7ce64be [scenic] Remove unused mozart.internal (flutter/engine#8496) edb050f Roll src/third_party/skia 2f08a4043b26..0ea414a08208 (2 commits) (flutter/engine#8506) 623dca0 Roll src/third_party/dart b23817105c..cc63d6e647 (8 commits) c7b138d [scenic][SCN-1054] remove dangling uses of SetTranslationRH (flutter/engine#8503) 5362035 Roll src/third_party/dart aacc0b0709..b23817105c (8 commits) 046b3cd Get rid of the macro for accessing the current test name. (flutter/engine#8500) 533ca01 Roll src/third_party/skia 6b797fec83f0..2f08a4043b26 (8 commits) (flutter/engine#8501) 612abee Wire up support for Dart fixtures in shell_unittests. (flutter/engine#8497) dbcfc50 Android Embedding PR26: Offer an async version of FlutterMain's ensure initialization complete. (flutter/engine#8465) a930ca8 Roll src/third_party/dart 8e4dcf48c4..aacc0b0709 (4 commits) acfc831 Roll src/third_party/skia 602df41025ea..6b797fec83f0 (19 commits) (flutter/engine#8494) 3558fa6 [Docs] Correcting link to contributing guide. (flutter/engine#8472) 0bf708e Refactor ios play input sound logic. (flutter/engine#7783) 78bd318 Add Locale.toLanguageTag() (flutter/engine#8421) efb3b00 Roll src/third_party/dart 8e0a669e74..8e4dcf48c4 (8 commits) 075b489 Support ContextWrapper when FlutterView is instantiated within a Fragment. (flutter/engine#7776) 85ca8c4 Roll src/third_party/skia 053b2939938c..602df41025ea (21 commits) (flutter/engine#8492) a6b8e70 Remove unused variable (flutter/engine#8490) 377dc64 Roll src/third_party/dart 86b5304ccd..8e0a669e74 (6 commits) 7ee3a31 Roll src/third_party/dart 907c514c89..86b5304ccd (27 commits) The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff (jsimmons@google.com), and stop the roller if necessary.
Android Embedding PR26: Offer an async version of FlutterMain's ensure initialization complete.
This PR addresses a request from @mjohnsullivan that we be able to run
FlutterMain.ensureInitializationComplete()
in an async manner with a callback.Achieving this is not 100% possible because the behavior within
FlutterMain.ensureInitializationComplete()
requires that it be run on the Main thread. However, it appears that the waiting call withinensureInitializationComplete()
does not need to be on the Main thread. Therefore, this PR essentially does the waiting on a background thread and then runs the important part ofensureInitializationCompleter()
on the Main thread.