*Intent to implement:Expansion mode for Android*
*Description*

The size of crosswalk-enable packages has been a concern for a long time.
With the 50MB size limit on the Google Play store, rich applications like
games are having problems to meet the restriction. To mitigate this, I am
proposing the introduction of "expansion mode", in addition to the already
existing embedded and shared modes. In expansion mode, the crosswalk
runtime will be loaded from an android expansion file[1], re-using the
shared mode class loading infrastructure as much as possible. To keep the
packaging and publishing and updating of apps steps as simple as possible,
our XWalkRuntimeLib.apk should be used as extension file as-is.

Features and advantages:
* Full 50MB APK size becomes available to the application (minus a small
shim to load crosswalk).
* Smaller, modular upgrades. Fixes to apps can be pushed without requiring
the user to re-download the whole crosswalk runtime.*
* Integrates with Cordova and also the Unity engine, the latter offering
limited flexibility in how applications are packaged.


*Affected Components*
* Crosswalk
* Crosswalk-app-tools

*JIRA Issue*: https://crosswalk-project.org/jira/browse/XWALK-4726

*Target Release:* TBD



*Future Directions*
This proposal is only about loading crosswalk from an expansion file using
the XWalkInitializer approach. Future enhancements include:
* Integration with XWalkApplication
* Automatic re-download of the expansion file.
* A tool to help publishing APK and expansion file in one fell swoop.



*Implementation Details*
Expansion mode should be configured in AndroidManifest.xml, using a
metadata entry:
    <meta-data android:name="xwalk_expansion_file" android:value="main" />
Permitted values are "main" or "patch", corresponding to which of the two
expansion files[1] will carry the crosswalk runtime.

The bulk of the enhancements will be made to XWalkCoreWrapper.java:

* mBridgeContext: in expansion mode will be as subclass of
android.content.ContextWrapper that points back to the original context. It
implements getClassLoader(), which creates a DexClassLoader on the
expansion file.

* Method attachXWalkCore() if expansion mode is configured in the manifest,
will invoke a new method findExpansionCore().

* A new method initExpansionMode() along the lines of initSharedMode() and
initEmbeddedMode().

[1] https://developer.android.com/google/play/expansion-files.html

Thanks,
Rob
_______________________________________________
Crosswalk-dev mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

Reply via email to