Great idea!

Could you explain how would you treat XWalkRuntimeLib.apk after downloaded the 
expansion file and extracted the APK file? I’m also interested with the 
approach of findExpansionCore().

In latest implementation, there’s no initSharedMode(), and initEmbeddedMode() 
is just for the compatibility with old code before shared mode. So maybe it’s 
not necessary to add a method called initExpansionMode() specially. The key is 
attachXWalkCore(). Now the checking sequence is findEmbeddedCore() -> 
findSharedCore(), you can change the sequence to findEmbeddedCore() -> 
findExpansionCore() ->findSharedCore(). I think that would be enough.

BTW, In order not to inconvenience the developers, XWalkApplication is 
deprecated in latest canary build, and will be integrated to Crosswalk-14 beta 
soon. Please keep track latest implementation of shared mode.

Thanks,
Lin

From: Crosswalk-dev [mailto:[email protected]] 
On Behalf Of Staudinger, Robert
Sent: Monday, August 03, 2015 19:33
To: [email protected]
Subject: [Crosswalk-dev] Intent to implement -- Expansion mode for Android

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