Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Rebase Crosswalk to support Cordova 3.7.1 #168

Open
wants to merge 82 commits into
base: next
Choose a base branch
from

Conversation

fujunwei
Copy link
Contributor

@fujunwei fujunwei commented Jun 4, 2015

huningxin and others added 30 commits April 15, 2015 13:08
The plain Cordova app is able to run.

TODO:
1. Plugin
2. Unit testing
This fixes the issue that Geolocation plugin does not work.
In XWalk, the thread which ExposedJsApi.exec() runs in does not contain
a message loop. As android.location.LocationManager need a loop to
process message, we have to prepare a Looper manually.
The root cause is the File Transfer API implementation leverages the android.webkit.CookieManager.
But trying to getinstance() of CookieManager before the webview isn't instantiated would cause crash.
In the cordova with xwalk backend solution, there doesn't exist webview.

According to android official document:
http://developer.android.com/reference/android/webkit/CookieManager.html#getInstance%28%29
We need to call "CookieSyncManager.createInstance(Context)" first.

Known issue:
This only fix crash issue, the cookie support is faking.
Still need to bridge xwalk cookie manager with default android.webkit.CookieManager.

BUG=https://github.com/otcshare/cordova-xwalk-android/issues/13
It needs to hook activity life-cycle events (resume, pause, destory and
on activityresult) to XWalkView handlers. Otherwise, it causes black screen
when pause-resume cycles for apps.

BUG=https://github.com/otcshare/cordova-xwalk-android/issues/55
Enable them since XWalkView has the APIs.
Changes in this patch:
 1. Implement XWalkRuntimeViewProvider interface for CordovaWebView.
 2. Add a public class CordovaXWalkCoreExtensionBridge to provide the
    functionalities of friendly class XWalkCoreExtensionBridge.
Otherwise, buildbot will not pack it into tarball.
Otherwise, build is blocked for abstract function not implemented.
It is introduced in XWalkRuntimeViewProvider to destroy the native
resources occupied by extension.
This is a refactor to remove unnecessary interfaces exposed by
XWalkRuntimeViewProvider. Reusing XWalkExtensionManager is enough to
integrate the extension system into cordova container.
XWalk adds the onGeolocationPermissionsShowPrompt support. Change the
CordovaWebView's implemenation to that.
XWalk adds the copyBackForwardList/saveState/restoreState API support,
and also adds WebBackForwardList and WebHistoryItem class.
Change the CordovaWebView's implemenation to that.
It includes:
1. update the project wiki URL.
2. add the python 2.6 into the requires.
Now the "create" script will not compile a cordova.jar,
insteadly, it will setup dependency for newly created
project.

Currently, the script will assume xwalk_core_library is
placed aside of cordova-xwalk-android.

TODO:
1. if core library not found, the "create" script should
download it.
2. Enable create.bat script on Windows.

Usage:
Assumpt the working folder is at /home/me/cordova
1. mkdir /home/me/cordova
2. cd /home/me/cordova
3. git clone ssh://[email protected]/otcshare/cordova-xwalk-android.git
4. download xwalk_core_library.tar.gz from xwalk release and extract it at
   /home/me/cordova/xwalk_core_library.
   (If the build you pick doesn't include
    crosswalk-project/crosswalk#847, you need to
    manually update the build.xml in xwalk_core_library to work)
5. cd cordova-xwalk-android
6. ./bin/create ../hello your.package.name YourAppName
7. cd ../hello
8. ant release/debug
   (you probably need to create you keystore first for release)

BUG=https://github.com/otcshare/cordova-xwalk-android/issues/19
Android library project doesn't handle assets according to
http://developer.android.com/tools/projects/index.html.

BUG=Input tag crashes cordova app
It aims to optimize the CLI workflow. It requires the buildbot copies the
xwalk_core_library into framework when producing cordova.tar.gz.

With these changes, CLI users will not download xwalk_core_library separately.
It avoids to use unsupported target on developers' system.
…rary

BUG=https://crosswalk-project.org/jira/browse/XWALK-760

Conflicts:
	framework/src/org/apache/cordova/CordovaWebViewClient.java
Will bring it back when it's ready.
2. Copy the xwalk_core_library to target application
   that it's built with non shared mode.
Otherwise, build will fail due to no sdk_dir defined in local.properties.
Shiliu Wang and others added 29 commits April 15, 2015 14:16
The xwalk's internal classes cordova uses are moved
to org.xwalk.core.internal.
Update the package here accordingly.
Besides, for internal APIs, need to use ClassInternal
for parameter type.
Including following changes:
1. Use crosswalk's default implementatin for
   getVideoLoadingProgressView,
   onReceivedHttpAuthRequest,
   onReceivedSslError.
2. Move onPageStarted/Finshed to CordovaChromeClient
3. Remove the customView related code in CordovaWebView as it's
   dead code.
4. Override dispatchKeyEvent instead of onKeyUp of CordovaWebView
   due to the key event handling change in crosswalk.
XWalkSettings is not a public class in XWalk Embedding API.
Use XWalkPreferences instead.
TODO: Recover these tests once the missed functions were implemented.

BUG=https://crosswalk-project.org/jira/browse/XWALK-1688
Add override prop to allow changes to framework/assets/www/cordova.js
can override to test/assets/www/cordova.js
XWalk already convert the error code from
chromium's error code to android ones.
No need to convert again in cordova.

BUG=https://crosswalk-project.org/jira/browse/XWALK-2139
After Kikkat, the immersive fullscreen mode is supported, we need support it.

BUG=XWALK-2142
As Crosswalk enable multiple windows to implement opening url with system
default browser, the navigation by clicking <a target="_blank"> in Cordova
was blocked, so disable multiple windows with XWalkPreferences.

To open urls in system default browser, the InAppBrowser plugin should be
used.

BUG=https://crosswalk-project.org/jira/browse/XWALK-2157
onShow() and onHide() will be called by XWalkView internally, depends on activity lifecycle change.
Avoid calling these two methods directly, otherwise there will be a white screen displayed.

BUG=XWALK-1956
The tag is <input type="file" accept="image/*;capture=camera">.
Chromium has already implemented a better file chooser for android,
so bypass that implemented by Cordova.

BUG=https://crosswalk-project.org/jira/browse/XWALK-2148
In the activity onResume() method, the view enters fullscreen mode
without checking the Fullscreen property. An if condition was added
to fix the issue.

BUG=https://crosswalk-project.org/jira/browse/XWALK-2187
Beacuse the JavaScripte timer was paused, the pause event can't send by
setTimeOut function.
Apply a patch from https://github.com/clelland/cordova-crosswalk-engine/
commit/e25e506cf815845480ae6e7a42be6cd0cd94f6bb

BUG=XWALK-2417
Adjust the onDestory() invoking in CordovaActivity.java to avoid
the null object reference.

BUG=https://crosswalk-project.org/jira/browse/XWALK-2493
Crosswalk-cordova will not support the option of --shared.
There are no super.setWebChromeClient and super.setWebViewClient function in Xwalk,
so keep align with upstream logic.
Replace WebView with XWalkView.
Fix test app crash when exit with back key, refer to gaochun's commit "
af2ab8b".
The tests Activity can't finish, explicit activity.finish() in back button handling.
If the bridge is reset incorrectly, its loadedUrl remains null, which
causes a NullPointerException when a non-file:// page tries to connect
to the bridge via prompt().

Relevant upstream code:
https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaWebViewClient.java#L144

BUG=XWALK-2907

(cherry picked from commit 88a9e71)
Cordova-Android ignores all SSL errors for debug builds, and fails on
SSL errors in release builds.

Crosswalk-Cordova-Android shows an alert dialog that lets the user
ignore the SSL error or cancel the request. This behavior is surprising
to Web platform developers, as typical browser behavior matches that of
Cordova-Android for release builds.

This change implements the Cordova-Android behavior, using the recently
introduced XWalkResourceClient::onReceivedSslError() hook.
The XWalkView has no focus after loading web page, it can't receive the
onKeyListener and onKeyDown event, so the volume-button plugin and the
Cordova volume event can't work.

BUG=XWALK-2424 XWALK-2835
The preference creation actually needs to be before
super.onCreate(savedInstance) in order to avoid the exception
"requestFeature() must be called before adding content". Also ran into an
issue in the native tests "Whitelist" and "User WebView/Client/Chrome" where
it would throw an exception that the CordovaWebView appView already had
a parent and needed to be removed from that parent before the invocation
to root.addView(appView). So I conditionally remove the wrong parent.
Also made a change to the native tests so the menus test would work.
I also put super.init() back into the template, though invoking it is optional
as loadUrl will call it automatically if needed.

(cherry picked from commit 90766ae0faa6594a6f4d6b9d61d66af8e3600b8e)

BUG=XWALK-3171

Conflicts:

	framework/src/org/apache/cordova/CordovaActivity.java
Immersive Fullscreen mode doesn´t recover after changing the volume on the device.
Refer libgdx/libgdx#1468 to fix this issue.

BUG=XWALK-2424
Update Android target sdk version from 19 to 21 to fit upgraded
xwalk_core_library.

BUG=XWALK-3234
Use the option of --xwalk-shared-library to create a shared mode Crosswalk
Cordova project. It isn't used together with --shared.
Sunlin comments:
wqIn new implementation, there are 2 parallel directories named
xwalk_share_library and xwalk_core_library, we plan to release both of them in
crosswalk build. The new option is to help developers of Embedding API or Cordova
to choose which library to link when  creating their project. Regardless which library
used in built time, the final crosswalk app could check whether it is in shared mode
and check compatibility on run time.
Shared mode allows multiple xwalk apps to share one xwalk runtime
library. Each xwalk app is bundled with a reflection layer instead
of the whole runtime library, whereas there is a library apk to be
installed on device for xwalk apps to use.
Don't separatly deal with LOLLIPOP about onShowFileChooser, the same behave above android 4.0
Don't support onReceivedClientCertRequest callback in crosswalk
Pass test cases
The fullscreen of Cordova upstream is hide system UI, so the StatusBar
plugin can work finely. But Crosswalk-cordova project is support immersive
fullscreen by default, so add a preference to align with Cordova upstream.

BUG=XWALK-3919

(cherry picked from commit 18b6305)

Conflicts:
	framework/src/org/apache/cordova/CordovaActivity.java
Newer versions of the splash screen Cordova plugin invoke CordovaWebView's canGoBack(),
which does not exist in our version of it (we invoke XWalkView.getNavigationHistory().canGoBack() instead).
Original report: https://lists.crosswalk-project.org/pipermail/crosswalk-help/2015-February/000845.html.

BUG=XWALK-3612

(cherry picked from commit f38d1c3)
The "--xwalk-apk-url" configure the download URL of the Crosswalk runtime
library in the Android manifest.
./bin/create HelloWorld org.example.HelloWorld HelloWorld
    --xwalk-shared-library --xwalk-apk-url=http://host/XWalkRuntimeLib.apk

(cherry picked from commit c684407)

Conflicts:
	bin/templates/project/AndroidManifest.xml
…-xwalk-apk-url"

BUG=XWALK-4107

(cherry picked from commit 4f2f614)
@fujunwei
Copy link
Contributor Author

fujunwei commented Jun 5, 2015

@huningxin @gaochun PTAL, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants