From 1deefa48eef2a15c9929093a24b5717a5d4b7074 Mon Sep 17 00:00:00 2001 From: Martin Gonzalez Date: Thu, 15 May 2014 11:55:42 -0500 Subject: [PATCH 01/16] CB-5652 make visible cordova version Log the cordova version using version string from CordovaWebView.java This closes #101 --- framework/src/org/apache/cordova/CordovaActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index 9f8b020c..a2610c5a 100755 --- a/framework/src/org/apache/cordova/CordovaActivity.java +++ b/framework/src/org/apache/cordova/CordovaActivity.java @@ -214,6 +214,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { @Override public void onCreate(Bundle savedInstanceState) { Config.init(this); + LOG.i(TAG, "Apache Cordova native platform version " + appView.CORDOVA_VERSION + " is starting"); LOG.d(TAG, "CordovaActivity.onCreate()"); super.onCreate(savedInstanceState); From 0b5bf0c0985ca2238b6739004de1d5b901dde516 Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Tue, 20 May 2014 07:00:21 -0400 Subject: [PATCH 02/16] CB-6707 Update minSdkVersion to 10 consistently Update minSdkVersion in the AndroidManifest for the cordova.jar and the test project. --- framework/AndroidManifest.xml | 2 +- test/AndroidManifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/AndroidManifest.xml b/framework/AndroidManifest.xml index 15a97022..6fbe1b4e 100755 --- a/framework/AndroidManifest.xml +++ b/framework/AndroidManifest.xml @@ -19,5 +19,5 @@ --> - + diff --git a/test/AndroidManifest.xml b/test/AndroidManifest.xml index 2f99b9ae..02247028 100755 --- a/test/AndroidManifest.xml +++ b/test/AndroidManifest.xml @@ -45,7 +45,7 @@ - + Date: Tue, 20 May 2014 07:09:02 -0400 Subject: [PATCH 03/16] CB-6723 Update package name for Robotium --- test/README.md | 6 ++++-- test/src/org/apache/cordova/test/junit/MessageTest.java | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/README.md b/test/README.md index 1a144e20..38d76a5b 100755 --- a/test/README.md +++ b/test/README.md @@ -26,8 +26,10 @@ These tests are designed to verify Android native features and other Android spe There really isn't any manual setup to do. The ant script takes care of that. You don't even need to compile cordova-x.y.z.jar or copy it, because -project.properties has a library reference to ../framework. However, Robotium has to be -installed for the onScrollChanged tests to work correctly. It can be found at https://code.google.com/p/robotium/ +project.properties has a library reference to ../framework. However, Robotium +has to be installed for the onScrollChanged tests to work correctly. It can be +found at https://code.google.com/p/robotium/ and the jar should be put in the +'libs' directory'. To run manually from command line: diff --git a/test/src/org/apache/cordova/test/junit/MessageTest.java b/test/src/org/apache/cordova/test/junit/MessageTest.java index 4d0ce16b..1d236963 100644 --- a/test/src/org/apache/cordova/test/junit/MessageTest.java +++ b/test/src/org/apache/cordova/test/junit/MessageTest.java @@ -25,8 +25,8 @@ import org.apache.cordova.pluginApi.pluginStub; import org.apache.cordova.test.CordovaWebViewTestActivity; import org.apache.cordova.test.R; -import com.jayway.android.robotium.solo.By; -import com.jayway.android.robotium.solo.Solo; +import com.robotium.solo.By; +import com.robotium.solo.Solo; import android.test.ActivityInstrumentationTestCase2; import android.view.View; From 629e05b7b1c93108bcdb992f9e7f22656b43cff9 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Thu, 22 May 2014 12:00:11 -0700 Subject: [PATCH 04/16] CB-6315: Wrapping this so it runs on the UI thread --- framework/src/org/apache/cordova/App.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/App.java b/framework/src/org/apache/cordova/App.java index ead99bc7..4b15906d 100755 --- a/framework/src/org/apache/cordova/App.java +++ b/framework/src/org/apache/cordova/App.java @@ -190,7 +190,11 @@ public class App extends CordovaPlugin { * Clear page history for the app. */ public void clearHistory() { - this.webView.clearHistory(); + cordova.getActivity().runOnUiThread(new Runnable() { + public void run() { + webView.clearHistory(); + } + }); } /** From 15056733932154c86e51739c2352a890b7d9dad1 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Tue, 27 May 2014 14:11:37 -0700 Subject: [PATCH 05/16] updated RELEASENOTES --- RELEASENOTES.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 09b3d5d6..d8e467b2 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -20,6 +20,40 @@ --> ## Release Notes for Cordova (Android) ## +### 3.5.0 (May 2014) ### + +* OkHttp has broken headers. Updating for ASF compliance. +* Revert accidentally removed lines from NOTICE +* CB-6552: added top level package.json +* CB-6491 add CONTRIBUTING.md +* CB-6543 Fix cordova/run failure when no custom_rules.xml available +* defaults.xml: Add AndroidLaunchMode preference +* Add JavaDoc for CordovaResourceApi +* CB-6388: Handle binary data correctly in LOAD_URL bridge +* Fix CB-6048: Set launchMode=singleTop so tapping app icon does not always restart app +* Remove incorrect usage of AlertDialog.Builder.create +* Catch uncaught exceptions in from plugins and turn them into error responses. +* Add NOTICE file +* CB-6047 Fix online sometimes getting in a bad state on page transitions. +* Add another convenience overload for CordovaResourceApi.copyResource +* Update framework's .classpath to what Eclipse wants it to be. +* README.md: `android update` to `android-19`. +* Fix NPE when POLLING bridge mode is used. +* Updating NOTICE to include Square for OkHttp +* CB-5398 Apply KitKat content URI fix to all content URIs +* CB-5398 Work-around for KitKat content: URLs not rendering in tags +* CB-5908: add splascreen images to template +* CB-5395: Make scheme and host (but not path) case-insensitive in whitelist +* Ignore multiple onPageFinished() callbacks & onReceivedError due to stopLoading() +* Removing addJavascriptInterface support from all Android versions lower than 4.2 due to security vu +* CB-4984 Don't create on CordovaActivity name +* CB-5917 Add a loadUrlIntoView overload that doesn't recreate plugins. +* Use thread pool for load timeout. +* CB-5715 For CLI, hide assets/www and res/xml/config.xml by default +* CB-5793 ant builds: Rename AndroidManifest during -post-build to avoid Eclipse detecting ant-build/ +* CB-5889 Make update script find project name instead of using "null" for CordovaLib +* CB-5889 Add a message in the update script about needing to import CordovaLib when using an IDE. + ### 3.4.0 (Feb 2014) ### 43 commits from 10 authors. Highlights include: From 1641f09dc9ff328e89f930381071b38795e99550 Mon Sep 17 00:00:00 2001 From: Michal Mocny Date: Thu, 29 May 2014 14:35:29 -0400 Subject: [PATCH 06/16] Revert "defaults.xml: Add AndroidLaunchMode preference" This reverts commit 11fc6be32871c3e6ce5159d34c99665cd7d05de5. --- bin/templates/cordova/defaults.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/templates/cordova/defaults.xml b/bin/templates/cordova/defaults.xml index 25a878ba..1654c136 100644 --- a/bin/templates/cordova/defaults.xml +++ b/bin/templates/cordova/defaults.xml @@ -23,7 +23,6 @@ - From 7687becfeeba8aa29cb24775140d32c7ebfe28ad Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Fri, 30 May 2014 11:45:13 -0400 Subject: [PATCH 07/16] CB-6784 Add license to CONTRIBUTING.md --- CONTRIBUTING.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1594d125..f7dbcaba 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,24 @@ + + # Contributing to Apache Cordova Anyone can contribute to Cordova. And we need your contributions. From 2661e010d90fc5a729c6679e6a81392702f9da59 Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Fri, 30 May 2014 15:10:54 -0400 Subject: [PATCH 08/16] CB-6784 Add missing licenses for ./test/assets/www/cordova_plugins.js and ./test/res/xml/config.xml --- test/assets/www/cordova_plugins.js | 23 +++++++++++++++++++++-- test/res/xml/config.xml | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/test/assets/www/cordova_plugins.js b/test/assets/www/cordova_plugins.js index fbe1f445..ecad9f6d 100644 --- a/test/assets/www/cordova_plugins.js +++ b/test/assets/www/cordova_plugins.js @@ -1,3 +1,22 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + cordova.define('cordova/plugin_list', function(require, exports, module) { -module.exports = [] -}); \ No newline at end of file + module.exports = []; +}); diff --git a/test/res/xml/config.xml b/test/res/xml/config.xml index d4fd635c..76172cbf 100644 --- a/test/res/xml/config.xml +++ b/test/res/xml/config.xml @@ -1,4 +1,22 @@ + Hello Cordova From 36e9fb292b17ac104c2967ee1925b17215e66c3f Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Tue, 3 Jun 2014 15:28:35 -0400 Subject: [PATCH 09/16] Remove +x from README.md --- README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 README.md diff --git a/README.md b/README.md old mode 100755 new mode 100644 From 94de0a7ce2a233cbadcff3489398b0e1bce0538c Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Tue, 3 Jun 2014 15:28:45 -0400 Subject: [PATCH 10/16] Add a comment to custom_rules.xml saying why we move AndroidManifest.xml --- bin/templates/project/custom_rules.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/templates/project/custom_rules.xml b/bin/templates/project/custom_rules.xml index 4b20e221..66483d3d 100644 --- a/bin/templates/project/custom_rules.xml +++ b/bin/templates/project/custom_rules.xml @@ -13,6 +13,7 @@ + From 743541218ff960ca542c53a4883b1866cec5ebd4 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Tue, 3 Jun 2014 16:08:35 -0400 Subject: [PATCH 11/16] CB-6860 Add activity_name and launcher_name to AndroidManifest.xml & strings.xml --- bin/templates/project/AndroidManifest.xml | 8 +++++--- bin/templates/project/res/values/strings.xml | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/templates/project/AndroidManifest.xml b/bin/templates/project/AndroidManifest.xml index b031b609..315a4dd0 100644 --- a/bin/templates/project/AndroidManifest.xml +++ b/bin/templates/project/AndroidManifest.xml @@ -32,10 +32,12 @@ - - + @@ -43,4 +45,4 @@ - + diff --git a/bin/templates/project/res/values/strings.xml b/bin/templates/project/res/values/strings.xml index e8ed749d..bb049db3 100644 --- a/bin/templates/project/res/values/strings.xml +++ b/bin/templates/project/res/values/strings.xml @@ -1,4 +1,9 @@ + __NAME__ + + @string/app_name + + @string/launcher_name From 07290277bad83605aba2e72ab86f92d3f2b2d74d Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 3 Jun 2014 15:21:46 -0700 Subject: [PATCH 12/16] CB-6818: I want to remove this code, because Square didn't do their headers properly --- .../squareup/okhttp/internal/spdy/ErrorCode.java | 16 ++++++++++++++++ .../com/squareup/okhttp/internal/spdy/Hpack.java | 16 ++++++++++++++++ .../internal/spdy/NameValueBlockReader.java | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/framework/src/com/squareup/okhttp/internal/spdy/ErrorCode.java b/framework/src/com/squareup/okhttp/internal/spdy/ErrorCode.java index d3a32e11..9394b69d 100755 --- a/framework/src/com/squareup/okhttp/internal/spdy/ErrorCode.java +++ b/framework/src/com/squareup/okhttp/internal/spdy/ErrorCode.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2012 Square, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.squareup.okhttp.internal.spdy; public enum ErrorCode { diff --git a/framework/src/com/squareup/okhttp/internal/spdy/Hpack.java b/framework/src/com/squareup/okhttp/internal/spdy/Hpack.java index c3ca8f11..9eaeebd7 100755 --- a/framework/src/com/squareup/okhttp/internal/spdy/Hpack.java +++ b/framework/src/com/squareup/okhttp/internal/spdy/Hpack.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2012 Square, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.squareup.okhttp.internal.spdy; import java.io.DataInputStream; diff --git a/framework/src/com/squareup/okhttp/internal/spdy/NameValueBlockReader.java b/framework/src/com/squareup/okhttp/internal/spdy/NameValueBlockReader.java index b95d0138..b731a6d3 100755 --- a/framework/src/com/squareup/okhttp/internal/spdy/NameValueBlockReader.java +++ b/framework/src/com/squareup/okhttp/internal/spdy/NameValueBlockReader.java @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2012 Square, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.squareup.okhttp.internal.spdy; import com.squareup.okhttp.internal.Util; From eb623a84d517327e62ed21e8a938af6ed279ac85 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Wed, 4 Jun 2014 11:13:37 -0700 Subject: [PATCH 13/16] Trivial spelling fix in comments when reading CordovaResourceApi --- framework/src/org/apache/cordova/CordovaResourceApi.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java b/framework/src/org/apache/cordova/CordovaResourceApi.java index f1770fda..d27eeb16 100644 --- a/framework/src/org/apache/cordova/CordovaResourceApi.java +++ b/framework/src/org/apache/cordova/CordovaResourceApi.java @@ -106,6 +106,7 @@ public class CordovaResourceApi { return threadCheckingEnabled; } + public static int getUriType(Uri uri) { assertNonRelative(uri); String scheme = uri.getScheme(); @@ -199,6 +200,8 @@ public class CordovaResourceApi { return null; } + + //This already exists private String getMimeTypeFromPath(String path) { String extension = path; int lastDot = extension.lastIndexOf('.'); @@ -217,7 +220,7 @@ public class CordovaResourceApi { } /** - * Opens a stream to the givne URI, also providing the MIME type & length. + * Opens a stream to the given URI, also providing the MIME type & length. * @return Never returns null. * @throws Throws an InvalidArgumentException for relative URIs. Relative URIs should be * resolved before being passed into this function. @@ -229,7 +232,7 @@ public class CordovaResourceApi { } /** - * Opens a stream to the givne URI, also providing the MIME type & length. + * Opens a stream to the given URI, also providing the MIME type & length. * @return Never returns null. * @throws Throws an InvalidArgumentException for relative URIs. Relative URIs should be * resolved before being passed into this function. From d427c52aacb974142e10677db1a43a184cfab80b Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Wed, 4 Jun 2014 19:12:55 -0400 Subject: [PATCH 14/16] CB-6876 Fix the "print usage" --- bin/templates/cordova/lib/run.js | 2 +- bin/templates/cordova/run | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/templates/cordova/lib/run.js b/bin/templates/cordova/lib/run.js index dd679016..be7f5a29 100644 --- a/bin/templates/cordova/lib/run.js +++ b/bin/templates/cordova/lib/run.js @@ -125,7 +125,7 @@ var path = require('path'), }); } -module.exports.help = function() { +module.exports.help = function(args) { console.log('Usage: ' + path.relative(process.cwd(), args[0]) + ' [options]'); console.log('Build options :'); console.log(' --debug : Builds project in debug mode'); diff --git a/bin/templates/cordova/run b/bin/templates/cordova/run index d4e2c6cb..8c6fe38c 100755 --- a/bin/templates/cordova/run +++ b/bin/templates/cordova/run @@ -26,7 +26,7 @@ var run = require('./lib/run'), // Support basic help commands if (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { - run.help(); + run.help(args); } else { reqs.run().done(function() { return run.run(args); From 32e07c22d07ae659d1ba9092effae73395824ab4 Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Wed, 4 Jun 2014 19:23:43 -0400 Subject: [PATCH 15/16] CB-6876 Show the correct executable name --- bin/templates/cordova/lib/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/templates/cordova/lib/run.js b/bin/templates/cordova/lib/run.js index be7f5a29..da8fc607 100644 --- a/bin/templates/cordova/lib/run.js +++ b/bin/templates/cordova/lib/run.js @@ -126,7 +126,7 @@ var path = require('path'), } module.exports.help = function(args) { - console.log('Usage: ' + path.relative(process.cwd(), args[0]) + ' [options]'); + console.log('Usage: ' + path.relative(process.cwd(), args[1]) + ' [options]'); console.log('Build options :'); console.log(' --debug : Builds project in debug mode'); console.log(' --release : Builds project in release mode'); From b40764104958e5b8a4c7ef19ae98d3a83be17810 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Sun, 8 Jun 2014 22:47:41 -0400 Subject: [PATCH 16/16] CB-6851 Deprecate WebView.sendJavascript() --- .../org/apache/cordova/CordovaWebView.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index 9e98ac6f..bb51a7a9 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -557,10 +557,25 @@ public class CordovaWebView extends WebView { /** * Send JavaScript statement back to JavaScript. - * (This is a convenience method) - * - * @param statement + * Deprecated (https://issues.apache.org/jira/browse/CB-6851) + * Instead of executing snippets of JS, you should use the exec bridge + * to create a Java->JS communication channel. + * To do this: + * 1. Within plugin.xml (to have your JS run before deviceready): + * + * 2. Within your .js (call exec on start-up): + * require('cordova/channel').onCordovaReady.subscribe(function() { + * require('cordova/exec')(win, null, 'Plugin', 'method', []); + * function win(message) { + * ... process message from java here ... + * } + * }); + * 3. Within your .java: + * PluginResult dataResult = new PluginResult(PluginResult.Status.OK, CODE); + * dataResult.setKeepCallback(true); + * savedCallbackContext.sendPluginResult(dataResult); */ + @Deprecated public void sendJavascript(String statement) { this.jsMessageQueue.addJavaScript(statement); }