/** * Update the Crosswalk runtime. There are 2 ways to download the Crosswalk runtime: from the play * store or the specified URL. It will download from the play store if the download URL is not * specified. To specify the download URL, insert a meta-data element with the name * "xwalk_apk_url" inside the application tag in the Android manifest. * * <p>Please try to initialize by {@link XWalkInitializer} first and only invoke this method when * the initialization failed. This method must be invoked on the UI thread. * * @return True if the updater is launched, false if is in updating, or the Crosswalk runtime * doesn't need to be updated, or the Crosswalk runtime has not been initialized yet. */ public boolean updateXWalkRuntime() { if (mIsDownloading || (mDialogManager != null && mDialogManager.isShowingDialog())) { return false; } int status = XWalkLibraryLoader.getLibraryStatus(); if (status == XWalkLibraryInterface.STATUS_PENDING || status == XWalkLibraryInterface.STATUS_MATCH) return false; if (mUpdateListener != null) { mDownloadCommand = new Runnable() { @Override public void run() { downloadXWalkApk(); } }; mCancelCommand = new Runnable() { @Override public void run() { Log.d(TAG, "XWalkUpdater cancelled"); mUpdateListener.onXWalkUpdateCancelled(); } }; mDialogManager.showInitializationError(status, mCancelCommand, mDownloadCommand); } else if (mBackgroundUpdateListener != null) { downloadXWalkApkSilently(); } else { Assert.fail(); } return true; }