-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Internal: b/160378043
As detailed in dart-lang/sdk#41974, customer:money is interested in splitting their AOT code by country and by feature. Once Dart VM team provides this capability, we need changes to engine (and tooling) to be able to generate these splits and load them.
Phase 1: Install-time AOT Code Splits
This would be transparent to the app. We would load all the splits into memory when a Dart isolate gets created. This requires an engine change but no application specific API.
Phase 2: Dynamic AOT Code splits.
This would require an engine change as well which would expose a system channel to request a particular AOT split to be loaded into the isolate. It is possible that we want these asset loading that is exposed via flutter engine (FlutterLoader) to do this. FlutterLoader would access Core APIs to download the so's and then load into isolate. There's an argument to be made to extend this to any PlatformAsset; I would leave that decision to the engine team.
PS: The tooling change is lower priority from customer's point of view since we have to implement this in g3.
The following is added/tracked by @GaryQian at the top for visibility:
Tasks left TODO:
Engine:
- Support uninstalling (Rename DynamicFeature->DeferredComponent and impl uninstall DeferredComponents engine#23224)
- Manual/System channels API for asset-only splits and uninstall (DynamicFeatureChannel MethodChannel and Install state tracking engine#22833)
- Getter for installation state (DynamicFeatureChannel MethodChannel and Install state tracking engine#22833)
- Improved engine DynamicFeatureManager injection (Split AOT Android Embedder and shell engine#22179)
- Replace APKAssetResolver instead of replacing entire asset manager (AssetResolver updating in AssetManager for Dynamic features engine#23130)
- Dart_DeferredLoadHandler implementation (Split AOT Android Embedder and shell engine#22179)
- Core shell and embedder implementation (Split AOT Android Embedder and shell engine#22179)
- Runtime+VM implementation (Split AOT Engine Runtime engine#22624)
- Error handling (Add split AOT loading unit failure/error code path engine#22857)
Framework:
- System channel for manual invocation (Add DynamicFeature system channel #71879)
- Wrapper class to expose system channel methods (DeferredComponent utility class for manual handling of Deferred Components #72895)
Tooling:
- General cleanup
- Separate into final commands (Deferred Components tooling #63773)
- Add user verification for overwrite or provide instructions for manual overwrite ([flutter_tools] Deferred components setup validator #75739)
- Improve asset packaging to no longer depend on copying into android dir (Deferred Components tooling #63773)
- Improve native lib packaging to no longer depend on copying into android dir (Deferred Components tooling #63773)
Misc:
- Finish instructions/guide (go/flutter-split-aot-instructions)
- Finalize naming, eg, what to call this feature ("Deferred Components")