Description:

Currently, for APK bundled with xwalk_shared_library (aka, shared mode APK), at 
the first launch, users will be prompted to download and install the 
XWalkRuntimeLib.apk explicitly when the runtime APK had not been installed on 
the device.  Some customers think that it’s not user-friendly and then they 
want to have the runtime APK downloaded/installed in the background silently 
without any user interaction.

To meet this customer request, we are proposing the introduction of “silent 
download mode”. In silent download mode, customer’s application is still 
bundled with xwalk_shared_library in order to keep the app size as small as 
possible, while the XWalkRuntimeLib.apk is downloaded from the host indicated 
by customer in the background silently at the first launch of customer’s APK 
and the runtime libraries/resources will be extracted from the downloaded 
runtime APK and loaded as a plugin, that is, the runtime APK will not be 
installed as a normal application as usual.

*Security Concern*

After the XWalkRuntimeLib.apk was downloaded, we will check the integrity of 
the APK and check the signature of the APK to ensure that the APK was signed 
with either Chromium debug key or Intel’s private key.
The XWalkRuntimeLib.apk built by Crosswalk buildbot (could be downloaded from 
https://download.01.org/crosswalk/releases/crosswalk/android/canary/latest/) 
was signed with Chromium debug key by default and the one released to Google 
Play was re-signed with Intel’s private key, that’s why we check these two keys 
here.

*Deployment*
Given that the security check mentioned above, XWalkRuntimeLib.apk signed with 
developer’s private key is NOT supported. Developers have to grab a build from 
Crosswalk official build or the one released to Google Play. However, a local 
built XWalkRuntimeLib.apk is also supported as the local build will be signed 
with Chromium debug key by default.

Developer need to host XWalkRuntimeLib.apk for different CPU architectures, the 
URL will be appended with a query string “?arch=CPU_ABI” when the request is 
sent to server, where CPU_ABI is exactly the same as the value returned from 
“adb shell getprop ro.product.cpu.abi”, e.g, x86 for x86 32bit, armeabi-v7a for 
ARM 32bit.

*Advantages*
* App size is as small as shared mode’s
* Developer can use a dedicated XWalkRuntimeLib.apk for his/her application 
while can avoid huge app size in embedded mode.

Affected component:
Crosswalk

Related feature:
https://crosswalk-project.org/jira/browse/XWALK-5121

Target release:
Crosswalk-16

Implementation details:
Code review is ready @ 
https://github.com/XiaosongWei/crosswalk/tree/silent-download

1) The URL where XWalkRuntimeLib.apk will be downloaded from is specified in 
AndroidManifest.xml, using a meta-data entry
<meta-data android:name=”xwalk_apk_url” 
android:value=”http://host/XWalkRuntimeLib.apk” />.

2) A new interface XWalkBackgroundUpdateListener is added in XWalkUpdater and 
developer should create XWalkUpdater with XWalkBackgroundUpdateListener in 
order to get App work under silent download mode.

3) After the downloaded XWalkRuntimeLib.apk has been verified good, Crosswalk 
runtime libraries/resources ( libxwalkcore.so, classes.dex, xwalk.pak and 
icudtl.dat ) will be extracted from the downloaded XWalkRuntimeLib.apk and 
saved to app’s private folder.

4) In XWalkCoreWrapper.java attachXWalkCore() will invoke a new method 
findDownloadedCore() to check if the downloaded core library is ready. And 
within findDownloadedCore(), a DexClassLoader is created to load xwalk core 
library from the extracted classes.dex

5) make_apk.py will be modified to support silent download mode packaging


Thanks,
Xiaosong



_______________________________________________
Crosswalk-dev mailing list
Crosswalk-dev@lists.crosswalk-project.org
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

Reply via email to