You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2015/09/23 21:58:12 UTC
[01/45] android commit: Commiting code to handle permissions,
and the special case of the Geolocation Plugin
Repository: cordova-android
Updated Branches:
refs/heads/5.0.x [created] 659cd6311
Commiting code to handle permissions, and the special case of the Geolocation Plugin
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/bb7761a2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/bb7761a2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/bb7761a2
Branch: refs/heads/5.0.x
Commit: bb7761a283f9243530b8177a2a39b4f7633800d0
Parents: 6d334c0
Author: Joe Bowser <bo...@apache.org>
Authored: Tue Jul 14 14:31:07 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Tue Jul 14 14:31:07 2015 -0700
----------------------------------------------------------------------
.../src/org/apache/cordova/CordovaActivity.java | 81 +++++++++++---------
.../org/apache/cordova/CordovaInterface.java | 2 +
.../apache/cordova/CordovaInterfaceImpl.java | 6 ++
.../src/org/apache/cordova/CordovaPlugin.java | 48 ++++++++++++
.../src/org/apache/cordova/PluginManager.java | 25 ++++++
.../cordova/engine/SystemWebChromeClient.java | 9 +++
6 files changed, 134 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bb7761a2/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 7a855af..8bed308 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -108,26 +108,20 @@ public class CordovaActivity extends Activity {
// need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
loadConfig();
- if(!preferences.getBoolean("ShowTitle", false))
- {
+ if (!preferences.getBoolean("ShowTitle", false)) {
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
}
- if(preferences.getBoolean("SetFullscreen", false))
- {
+ if (preferences.getBoolean("SetFullscreen", false)) {
Log.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
preferences.set("Fullscreen", true);
}
- if(preferences.getBoolean("Fullscreen", false))
- {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
- {
+ if (preferences.getBoolean("Fullscreen", false)) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
immersiveMode = true;
- }
- else
- {
+ } else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
} else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
@@ -137,12 +131,11 @@ public class CordovaActivity extends Activity {
super.onCreate(savedInstanceState);
cordovaInterface = makeCordovaInterface();
- if(savedInstanceState != null)
- {
+ if (savedInstanceState != null) {
cordovaInterface.restoreInstanceState(savedInstanceState);
}
}
-
+
protected void init() {
appView = makeWebView();
createViews();
@@ -191,7 +184,7 @@ public class CordovaActivity extends Activity {
/**
* Construct the default web view object.
- *
+ * <p/>
* Override this to customize the webview that is used.
*/
protected CordovaWebView makeWebView() {
@@ -241,13 +234,13 @@ public class CordovaActivity extends Activity {
/**
* Called when the activity receives a new intent
- **/
+ */
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
//Forward to plugins
if (this.appView != null)
- this.appView.onNewIntent(intent);
+ this.appView.onNewIntent(intent);
}
/**
@@ -257,7 +250,7 @@ public class CordovaActivity extends Activity {
protected void onResume() {
super.onResume();
LOG.d(TAG, "Resumed the activity.");
-
+
if (this.appView == null) {
return;
}
@@ -317,11 +310,11 @@ public class CordovaActivity extends Activity {
super.onWindowFocusChanged(hasFocus);
if (hasFocus && immersiveMode) {
final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
}
@@ -338,10 +331,10 @@ public class CordovaActivity extends Activity {
* Called when an activity you launched exits, giving you the requestCode you started it with,
* the resultCode it returned, and any additional data from it.
*
- * @param requestCode The request code originally supplied to startActivityForResult(),
- * allowing you to identify who this result came from.
- * @param resultCode The integer result code returned by the child activity through its setResult().
- * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
+ * @param requestCode The request code originally supplied to startActivityForResult(),
+ * allowing you to identify who this result came from.
+ * @param resultCode The integer result code returned by the child activity through its setResult().
+ * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
@@ -354,9 +347,9 @@ public class CordovaActivity extends Activity {
* Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
* The errorCode parameter corresponds to one of the ERROR_* constants.
*
- * @param errorCode The error code corresponding to an ERROR_* value.
- * @param description A String describing the error.
- * @param failingUrl The url that failed to load.
+ * @param errorCode The error code corresponding to an ERROR_* value.
+ * @param description A String describing the error.
+ * @param failingUrl The url that failed to load.
*/
public void onReceivedError(final int errorCode, final String description, final String failingUrl) {
final CordovaActivity me = this;
@@ -445,9 +438,9 @@ public class CordovaActivity extends Activity {
/**
* Called when a message is sent to plugin.
*
- * @param id The message id
- * @param data The message data
- * @return Object or null
+ * @param id The message id
+ * @param data The message data
+ * @return Object or null
*/
public Object onMessage(String id, Object data) {
if ("onReceivedError".equals(id)) {
@@ -463,8 +456,7 @@ public class CordovaActivity extends Activity {
return null;
}
- protected void onSaveInstanceState(Bundle outState)
- {
+ protected void onSaveInstanceState(Bundle outState) {
cordovaInterface.onSaveInstanceState(outState);
super.onSaveInstanceState(outState);
}
@@ -472,7 +464,7 @@ public class CordovaActivity extends Activity {
/**
* Called by the system when the device configuration changes while your activity is running.
*
- * @param newConfig The new device configuration
+ * @param newConfig The new device configuration
*/
@Override
public void onConfigurationChanged(Configuration newConfig) {
@@ -485,4 +477,19 @@ public class CordovaActivity extends Activity {
pm.onConfigurationChanged(newConfig);
}
}
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String permissions[],
+ int[] grantResults) {
+ PluginManager pm = this.appView.getPluginManager();
+ pm.onRequestPermissionResult(requestCode, permissions, grantResults);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bb7761a2/framework/src/org/apache/cordova/CordovaInterface.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterface.java b/framework/src/org/apache/cordova/CordovaInterface.java
index 59ed486..3fa6e63 100755
--- a/framework/src/org/apache/cordova/CordovaInterface.java
+++ b/framework/src/org/apache/cordova/CordovaInterface.java
@@ -69,4 +69,6 @@ public interface CordovaInterface {
* Returns a shared thread pool that can be used for background tasks.
*/
public ExecutorService getThreadPool();
+
+ public void requestPermission(CordovaPlugin plugin);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bb7761a2/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
index e35a181..146bacb 100644
--- a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
+++ b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -161,4 +161,10 @@ public class CordovaInterfaceImpl implements CordovaInterface {
this.intent = intent;
}
}
+
+ public void requestPermission(CordovaPlugin plugin)
+ {
+ pluginManager.requestPermission(plugin);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bb7761a2/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java
index 7cf8528..8ca1dd1 100644
--- a/framework/src/org/apache/cordova/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -26,6 +26,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.net.Uri;
@@ -40,6 +41,7 @@ public class CordovaPlugin {
public CordovaInterface cordova;
protected CordovaPreferences preferences;
private String serviceName;
+ private String [] permissions;
/**
* Call this after constructing to initialize the plugin.
@@ -359,4 +361,50 @@ public class CordovaPlugin {
*/
public void onConfigurationChanged(Configuration newConfig) {
}
+
+ /**
+ * Called by the Plugin Manager when we need to actually request permissions
+ *
+ * @return Returns the permission that was stored in the plugin
+ */
+
+ public String[] getPermissionRequest() {
+ return permissions;
+ }
+
+ /**
+ * requestPermission
+ */
+ public void requestPermission() {
+ cordova.requestPermission(this);
+ }
+
+ public boolean hasPermisssion() {
+ for(String p : permissions)
+ {
+ if(PackageManager.PERMISSION_DENIED == cordova.getActivity().checkSelfPermission(p))
+ {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ public boolean onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) {
+
+ for(int r:grantResults)
+ {
+ if(r == PackageManager.PERMISSION_DENIED)
+ return false;
+ }
+
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bb7761a2/framework/src/org/apache/cordova/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java
index a541e77..e543b04 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -47,6 +47,8 @@ public class PluginManager {
private final CordovaWebView app;
private boolean isInitialized;
+ private CordovaPlugin permissionRequester;
+
public PluginManager(CordovaWebView cordovaWebView, CordovaInterface cordova, Collection<PluginEntry> pluginEntries) {
this.ctx = cordova;
this.app = cordovaWebView;
@@ -508,4 +510,27 @@ public class PluginManager {
}
}
}
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ public void onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) {
+ if(permissionRequester != null)
+ {
+ permissionRequester.onRequestPermissionResult(requestCode, permissions, grantResults);
+ permissionRequester = null;
+ }
+ }
+
+ public void requestPermission(CordovaPlugin plugin) {
+ permissionRequester = plugin;
+ String[] permissions = plugin.getPermissionRequest();
+ int requestCode = 1;
+ ctx.getActivity().requestPermissions(permissions, requestCode);
+ }
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bb7761a2/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
index 3b5866c..8c02bfa 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -174,12 +174,21 @@ public class SystemWebChromeClient extends WebChromeClient {
/**
* Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin.
*
+ * This also checks for the Geolocation Plugin and requests permission from the application to use Geolocation.
+ *
* @param origin
* @param callback
*/
public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
super.onGeolocationPermissionsShowPrompt(origin, callback);
callback.invoke(origin, true, false);
+ //Get the plugin, it should be loaded
+ CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("org.apache.cordova.geolocation.PermissionHandler");
+ if(geolocation != null && !geolocation.hasPermisssion())
+ {
+ parentEngine.pluginManager.requestPermission(geolocation);
+ }
+
}
// API level 7 is required for this, see if we could lower this using something else
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[17/45] android commit: Update JS snapshot to version 4.2.0-dev (via
coho)
Posted by bo...@apache.org.
Update JS snapshot to version 4.2.0-dev (via coho)
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/67ba0213
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/67ba0213
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/67ba0213
Branch: refs/heads/5.0.x
Commit: 67ba0213d2130d2635e960e580aae518a5487ba6
Parents: 9e31d3a
Author: Nikhil Khandelwal <ni...@microsoft.com>
Authored: Mon Jul 20 09:52:18 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:03 2015 -0700
----------------------------------------------------------------------
bin/templates/project/assets/www/cordova.js | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/67ba0213/bin/templates/project/assets/www/cordova.js
----------------------------------------------------------------------
diff --git a/bin/templates/project/assets/www/cordova.js b/bin/templates/project/assets/www/cordova.js
index dbc221f..9503a3d 100644
--- a/bin/templates/project/assets/www/cordova.js
+++ b/bin/templates/project/assets/www/cordova.js
@@ -1,5 +1,5 @@
// Platform: android
-// 23738581906992092a43ad2e643b1e0c43bba38a
+// a83e94b489774dc8e514671e81c6154eda650af1
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -19,7 +19,7 @@
under the License.
*/
;(function() {
-var PLATFORM_VERSION_BUILD_LABEL = '4.1.0-dev';
+var PLATFORM_VERSION_BUILD_LABEL = '4.2.0-dev';
// file: src/scripts/require.js
/*jshint -W079 */
@@ -328,7 +328,7 @@ module.exports = cordova;
});
-// file: node_modules/cordova-android/cordova-js-src/android/nativeapiprovider.js
+// file: D:/cordova/cordova-android/cordova-js-src/android/nativeapiprovider.js
define("cordova/android/nativeapiprovider", function(require, exports, module) {
/**
@@ -351,7 +351,7 @@ module.exports = {
});
-// file: node_modules/cordova-android/cordova-js-src/android/promptbasednativeapi.js
+// file: D:/cordova/cordova-android/cordova-js-src/android/promptbasednativeapi.js
define("cordova/android/promptbasednativeapi", function(require, exports, module) {
/**
@@ -861,7 +861,7 @@ module.exports = channel;
});
-// file: node_modules/cordova-android/cordova-js-src/exec.js
+// file: D:/cordova/cordova-android/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) {
/**
@@ -896,11 +896,7 @@ var cordova = require('cordova'),
// For the ONLINE_EVENT to be viable, it would need to intercept all event
// listeners (both through addEventListener and window.ononline) as well
// as set the navigator property itself.
- ONLINE_EVENT: 2,
- // Uses reflection to access private APIs of the WebView that can send JS
- // to be executed.
- // Requires Android 3.2.4 or above.
- PRIVATE_API: 3
+ ONLINE_EVENT: 2
},
jsToNativeBridgeMode, // Set lazily.
nativeToJsBridgeMode = nativeToJsModes.ONLINE_EVENT,
@@ -1504,7 +1500,7 @@ exports.reset();
});
-// file: node_modules/cordova-android/cordova-js-src/platform.js
+// file: D:/cordova/cordova-android/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) {
module.exports = {
@@ -1580,7 +1576,7 @@ function onMessageFromNative(msg) {
});
-// file: node_modules/cordova-android/cordova-js-src/plugin/android/app.js
+// file: D:/cordova/cordova-android/cordova-js-src/plugin/android/app.js
define("cordova/plugin/android/app", function(require, exports, module) {
var exec = require('cordova/exec');
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[31/45] android commit: CB-9496 removed permissions added for
crosswalk
Posted by bo...@apache.org.
CB-9496 removed permissions added for crosswalk
These would better live in the actual crosswalk plugin
https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview
I have also submit a PR to that repo adding them to its `plugin.xml`
github: close #206
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/e8821c90
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/e8821c90
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/e8821c90
Branch: refs/heads/5.0.x
Commit: e8821c908e061060acee8c8d99e5192f2b2b5d82
Parents: 1e1a9ab
Author: Tommy-Carlos Williams <to...@devgeeks.org>
Authored: Mon Aug 17 10:17:29 2015 +1000
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:08:18 2015 -0700
----------------------------------------------------------------------
bin/templates/project/AndroidManifest.xml | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e8821c90/bin/templates/project/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/bin/templates/project/AndroidManifest.xml b/bin/templates/project/AndroidManifest.xml
index a4b3dfc..1111bcb 100644
--- a/bin/templates/project/AndroidManifest.xml
+++ b/bin/templates/project/AndroidManifest.xml
@@ -29,8 +29,6 @@
/>
<uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:hardwareAccelerated="true" android:supportsRtl="true">
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[30/45] android commit: Working on getting the Geolocation Plugin to
work by default with the default WebView. Crosswalk will need to make similar
modifications.
Posted by bo...@apache.org.
Working on getting the Geolocation Plugin to work by default with the default WebView. Crosswalk will need to make similar modifications.
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/1e1a9ab2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/1e1a9ab2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/1e1a9ab2
Branch: refs/heads/5.0.x
Commit: 1e1a9ab273c4503859a000539e185e38d59da5a4
Parents: 4f3571a
Author: Joe Bowser <bo...@apache.org>
Authored: Fri Sep 18 13:52:12 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Fri Sep 18 13:52:12 2015 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/engine/SystemWebChromeClient.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1e1a9ab2/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
index d411421..9faae29 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -189,7 +189,7 @@ public class SystemWebChromeClient extends WebChromeClient {
CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("Geolocation");
if(geolocation != null && !geolocation.hasPermisssion())
{
- //cordova.requestPermissions(geolocation);
+ geolocation.cordova.requestPermissions(geolocation, 0);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[14/45] android commit: CB-9392 Fixed printing flavored versions.
This closes #184
Posted by bo...@apache.org.
CB-9392 Fixed printing flavored versions. This closes #184
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/29ff5402
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/29ff5402
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/29ff5402
Branch: refs/heads/5.0.x
Commit: 29ff54024374675c3f80c23e66520599bb3dd335
Parents: e124669
Author: Jose Pereira <on...@gmail.com>
Authored: Fri Jun 19 11:33:45 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:02 2015 -0700
----------------------------------------------------------------------
bin/templates/project/build.gradle | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/29ff5402/bin/templates/project/build.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle
index 289b7af..4195308 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -152,11 +152,8 @@ task cdvPrintProps << {
println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile)
println('cdvBuildArch=' + cdvBuildArch)
println('computedVersionCode=' + android.defaultConfig.versionCode)
- if (android.productFlavors.has('armv7')) {
- println('computedArmv7VersionCode=' + android.productFlavors.armv7.versionCode)
- }
- if (android.productFlavors.has('x86')) {
- println('computedx86VersionCode=' + android.productFlavors.x86.versionCode)
+ android.productFlavors.each { flavor ->
+ println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode)
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[02/45] android commit: Finally got it kinda working,
Geolocation is not going to work in browser anymore
Posted by bo...@apache.org.
Finally got it kinda working, Geolocation is not going to work in browser anymore
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/23327402
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/23327402
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/23327402
Branch: refs/heads/5.0.x
Commit: 233274028f8657f798f1e3ad24610ffafb7ae2f5
Parents: bb7761a
Author: Joe Bowser <bo...@apache.org>
Authored: Tue Jul 14 14:58:55 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Tue Jul 14 14:58:55 2015 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/CordovaPlugin.java | 4 +++-
.../src/org/apache/cordova/engine/SystemWebChromeClient.java | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/23327402/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java
index 8ca1dd1..6cb2a3c 100644
--- a/framework/src/org/apache/cordova/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -41,7 +41,7 @@ public class CordovaPlugin {
public CordovaInterface cordova;
protected CordovaPreferences preferences;
private String serviceName;
- private String [] permissions;
+ protected String [] permissions;
/**
* Call this after constructing to initialize the plugin.
@@ -387,6 +387,8 @@ public class CordovaPlugin {
return false;
}
}
+
+ return true;
}
/**
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/23327402/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
index 8c02bfa..bca847b 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -183,7 +183,7 @@ public class SystemWebChromeClient extends WebChromeClient {
super.onGeolocationPermissionsShowPrompt(origin, callback);
callback.invoke(origin, true, false);
//Get the plugin, it should be loaded
- CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("org.apache.cordova.geolocation.PermissionHandler");
+ CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("Geolocation");
if(geolocation != null && !geolocation.hasPermisssion())
{
parentEngine.pluginManager.requestPermission(geolocation);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[33/45] android commit: Adding a working build.gradle that skips our
code that can't handle non-numeric SDK targets
Posted by bo...@apache.org.
Adding a working build.gradle that skips our code that can't handle non-numeric SDK targets
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/69d14236
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/69d14236
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/69d14236
Branch: refs/heads/5.0.x
Commit: 69d1423698be89b1084279ec8656aeca02b87ff8
Parents: a265a61
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Jul 15 16:32:20 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:08:18 2015 -0700
----------------------------------------------------------------------
framework/build.gradle | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/69d14236/framework/build.gradle
----------------------------------------------------------------------
diff --git a/framework/build.gradle b/framework/build.gradle
index a598faa..09b0908 100644
--- a/framework/build.gradle
+++ b/framework/build.gradle
@@ -34,8 +34,10 @@ ext {
}
android {
- compileSdkVersion cdvCompileSdkVersion
- buildToolsVersion cdvBuildToolsVersion
+ // compileSdkVersion cdvCompileSdkVersion
+ // buildToolsVersion cdvBuildToolsVersion
+ compileSdkVersion 'android-MNC'
+ buildToolsVersion '23.0.0 rc3'
publishNonDefault true
compileOptions {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[18/45] android commit: CB-9185 Fixed an issue when unsigned apks
couldn't be found. This closes #202
Posted by bo...@apache.org.
CB-9185 Fixed an issue when unsigned apks couldn't be found. This closes #202
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/78a2951a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/78a2951a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/78a2951a
Branch: refs/heads/5.0.x
Commit: 78a2951a4fbf909099739d4bc4ae2cdcf6a1e6b1
Parents: e02cbc7
Author: alsorokin <al...@akvelon.com>
Authored: Wed Jul 22 18:39:35 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:03 2015 -0700
----------------------------------------------------------------------
bin/templates/cordova/lib/build.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/78a2951a/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index cd07a59..aa9f3d0 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -74,7 +74,7 @@ function findOutputApksHelper(dir, build_type, arch) {
return /-debug/.exec(candidate) && !/-unaligned|-unsigned/.exec(candidate);
}
if (build_type === 'release') {
- return /-release/.exec(candidate) && !/-unaligned|-unsigned/.exec(candidate);
+ return /-release/.exec(candidate) && !/-unaligned/.exec(candidate);
}
return true;
});
@@ -82,7 +82,7 @@ function findOutputApksHelper(dir, build_type, arch) {
if (ret.length === 0) {
return ret;
}
- // Assume arch-specific build if newest api has -x86 or -arm.
+ // Assume arch-specific build if newest apk has -x86 or -arm.
var archSpecific = !!/-x86|-arm/.exec(ret[0]);
// And show only arch-specific ones (or non-arch-specific)
ret = ret.filter(function(p) {
@@ -90,11 +90,12 @@ function findOutputApksHelper(dir, build_type, arch) {
return !!/-x86|-arm/.exec(p) == archSpecific;
/*jshint +W018 */
});
- if (arch && ret.length > 1) {
+ if (archSpecific && ret.length > 1) {
ret = ret.filter(function(p) {
return p.indexOf('-' + arch) != -1;
});
}
+
return ret;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[19/45] android commit: updated release notes
Posted by bo...@apache.org.
updated release notes
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/ea5ddccc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/ea5ddccc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/ea5ddccc
Branch: refs/heads/5.0.x
Commit: ea5ddccc4733a8a30b31e4100b97ed2ae48b5864
Parents: 4126d3e
Author: Steve Gill <st...@gmail.com>
Authored: Fri Jul 31 16:40:14 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:40 2015 -0700
----------------------------------------------------------------------
RELEASENOTES.md | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/ea5ddccc/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 41ec1c1..bf2e83a 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -21,6 +21,11 @@
## Release Notes for Cordova (Android) ##
Update these notes using: git log --pretty=format:'* %s' --topo-order --no-merges *remote*/4.1.x...HEAD
+### Release 4.1.1 (Aug 2015) ###
+
+* CB-9428 update script now bumps up minSdkVersion to 14 if it is less than that
+* CB-9430 Fixes check_reqs failure when javac returns an extra line
+
### Release 4.1.0 (Jul 2015) ###
* CB-9392 Fixed printing flavored versions. This closes #184.
* CB-9382 [Android] Fix KeepRunning setting when Plugin activity is showed. This closes #200
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[43/45] android commit: Doing a nasty merge commit because somehow
gradle fixes causes divergence
Posted by bo...@apache.org.
Doing a nasty merge commit because somehow gradle fixes causes divergence
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/18545711
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/18545711
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/18545711
Branch: refs/heads/5.0.x
Commit: 18545711e895fc9b32fb18456867bc22da2398d8
Parents: dfb87f0 5324486
Author: Joe Bowser <bo...@apache.org>
Authored: Mon Sep 21 18:11:05 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:11:05 2015 -0700
----------------------------------------------------------------------
framework/build.gradle | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[09/45] android commit: CB-9394 Updated RELEASENOTES - Fixing typo
Posted by bo...@apache.org.
CB-9394 Updated RELEASENOTES - Fixing typo
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/65bfa133
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/65bfa133
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/65bfa133
Branch: refs/heads/5.0.x
Commit: 65bfa133c70157dbc52d9f29fac67d9858f23b0d
Parents: 3a1d5a1
Author: Nikhil Khandelwal <ni...@microsoft.com>
Authored: Mon Jul 20 09:44:06 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:02 2015 -0700
----------------------------------------------------------------------
RELEASENOTES.md | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/65bfa133/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 401564e..41ec1c1 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -21,7 +21,7 @@
## Release Notes for Cordova (Android) ##
Update these notes using: git log --pretty=format:'* %s' --topo-order --no-merges *remote*/4.1.x...HEAD
-### Release 4.1.0 (Jul 2014) ###
+### Release 4.1.0 (Jul 2015) ###
* CB-9392 Fixed printing flavored versions. This closes #184.
* CB-9382 [Android] Fix KeepRunning setting when Plugin activity is showed. This closes #200
* CB-9391 Fixes cdvBuildMultipleApks option casting
@@ -45,10 +45,8 @@ Update these notes using: git log --pretty=format:'* %s' --topo-order --no-merge
* CB-9080: -d option is not supported on Android 4.1.1 and lower, removing
* CB-8954 Adds `requirements` command support to check_reqs module
* Update JS snapshot to version 4.1.0-dev (via coho)
-* Updating Release Notes
* CB-8417 updated platform specific files from cordova.js repo
* Adding tests to confirm that preferences aren't changed by Intents
-* updating existing test code
* Forgot to remove the method that copied over the intent data
* Getting around to removing this old Intent code
* Update JS snapshot to version 4.1.0-dev (via coho)
@@ -67,10 +65,6 @@ Update these notes using: git log --pretty=format:'* %s' --topo-order --no-merge
* CB-8891 Add a gradle helper for retrieving config.xml preference values
* CB-8884 Delete Eclipse tweaks from create script
* CB-8834 Don't fail to install on VERSION_DOWNGRADE
-* Update JS snapshot to version 4.1.0-dev (via coho)
-* Set VERSION to 4.1.0-dev (via coho)
-* Set VERSION to 4.0.2 (via coho)
-* Update JS snapshot to version 4.0.2 (via coho)
* Automated tools fail, and you have to remember all four places where this is set.
* Update the package.json
* CB-9042 coho failed to update version, so here we are
@@ -79,11 +73,7 @@ Update these notes using: git log --pretty=format:'* %s' --topo-order --no-merge
* updating existing test code
* Forgot to remove the method that copied over the intent data
* Getting around to removing this old Intent code
-* Set VERSION to 4.0.1 (via coho)
-* Update JS snapshot to version 4.0.1 (via coho)
* CB-8834 Don't fail to install on VERSION_DOWNGRADE
-* Set VERSION to 4.0.0 (via coho)
-* Update JS snapshot to version 4.0.0 (via coho)
### Release 4.0.2 (May 2015) ###
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[25/45] android commit: Make Cordova pass the Lint step
Posted by bo...@apache.org.
Make Cordova pass the Lint step
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/771f5ecc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/771f5ecc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/771f5ecc
Branch: refs/heads/5.0.x
Commit: 771f5ecc22488d69a2deefbe2cbd47e7eb632626
Parents: ea5ddcc
Author: Joe Bowser <bo...@apache.org>
Authored: Mon Aug 10 16:43:41 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:41 2015 -0700
----------------------------------------------------------------------
framework/build.gradle | 19 +++----------------
.../src/org/apache/cordova/CordovaActivity.java | 2 ++
.../cordova/engine/SystemCookieManager.java | 3 +++
.../cordova/engine/SystemWebViewEngine.java | 2 +-
4 files changed, 9 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/771f5ecc/framework/build.gradle
----------------------------------------------------------------------
diff --git a/framework/build.gradle b/framework/build.gradle
index 4d6f36c..a598faa 100644
--- a/framework/build.gradle
+++ b/framework/build.gradle
@@ -20,23 +20,10 @@ buildscript {
mavenCentral()
}
- // Switch the Android Gradle plugin version requirement depending on the
- // installed version of Gradle. This dependency is documented at
- // http://tools.android.com/tech-docs/new-build-system/version-compatibility
- // and https://issues.apache.org/jira/browse/CB-8143
- if (gradle.gradleVersion >= "2.2") {
- dependencies {
- classpath 'com.android.tools.build:gradle:1.0.0+'
- }
- } else if (gradle.gradleVersion >= "2.1") {
- dependencies {
- classpath 'com.android.tools.build:gradle:0.14.0+'
- }
- } else {
- dependencies {
- classpath 'com.android.tools.build:gradle:0.12.0+'
- }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.0.0+'
}
+
}
apply plugin: 'android-library'
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/771f5ecc/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index e446927..171e2a8 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -26,6 +26,7 @@ import org.json.JSONObject;
import android.app.Activity;
import android.app.AlertDialog;
+import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
@@ -323,6 +324,7 @@ public class CordovaActivity extends Activity {
}
}
+ @SuppressLint("NewApi")
@Override
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
// Capture requestCode here so that it is captured in the setActivityResultCallback() case.
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/771f5ecc/framework/src/org/apache/cordova/engine/SystemCookieManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemCookieManager.java b/framework/src/org/apache/cordova/engine/SystemCookieManager.java
index ae55dfe..b88909e 100644
--- a/framework/src/org/apache/cordova/engine/SystemCookieManager.java
+++ b/framework/src/org/apache/cordova/engine/SystemCookieManager.java
@@ -19,6 +19,7 @@
package org.apache.cordova.engine;
+import android.annotation.TargetApi;
import android.os.Build;
import android.webkit.CookieManager;
import android.webkit.WebView;
@@ -30,6 +31,8 @@ class SystemCookieManager implements ICordovaCookieManager {
protected final WebView webView;
private final CookieManager cookieManager;
+ //Added because lint can't see the conditional RIGHT ABOVE this
+ @TargetApi(Build.VERSION_CODES.LOLLIPOP)
public SystemCookieManager(WebView webview) {
webView = webview;
cookieManager = CookieManager.getInstance();
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/771f5ecc/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
index 221a884..5e6e4b6 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java
@@ -135,7 +135,7 @@ public class SystemWebViewEngine implements CordovaWebViewEngine {
return webView;
}
- @SuppressLint("SetJavaScriptEnabled")
+ @SuppressLint({"NewApi", "SetJavaScriptEnabled"})
@SuppressWarnings("deprecation")
private void initWebViewSettings() {
webView.setInitialScale(0);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[07/45] android commit: CB-9149 Make gradle alias subprojects in
order to handle libs that depend on libs. This closes #182
Posted by bo...@apache.org.
CB-9149 Make gradle alias subprojects in order to handle libs that depend on libs. This closes #182
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/dd1b2c44
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/dd1b2c44
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/dd1b2c44
Branch: refs/heads/5.0.x
Commit: dd1b2c44e7c5dd7e6077ab4b6d8acd0a2ac4fd3a
Parents: b008214
Author: Tony Homer <to...@intel.com>
Authored: Wed Jun 10 00:57:01 2015 -0400
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:01 2015 -0700
----------------------------------------------------------------------
bin/templates/cordova/lib/build.js | 34 ++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/dd1b2c44/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index 1794f93..9835172 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -102,6 +102,19 @@ function hasCustomRules() {
return fs.existsSync(path.join(ROOT, 'custom_rules.xml'));
}
+function extractRealProjectNameFromManifest(projectPath) {
+ var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
+ var manifestData = fs.readFileSync(manifestPath, 'utf8');
+ var m = /<manifest[\s\S]*?package\s*=\s*"(.*?)"/i.exec(manifestData);
+ if (!m) {
+ throw new Error('Could not find package name in ' + manifestPath);
+ }
+
+ var packageName=m[1];
+ var lastDotIndex = packageName.lastIndexOf('.');
+ return packageName.substring(lastDotIndex + 1);
+}
+
function extractProjectNameFromManifest(projectPath) {
var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
var manifestData = fs.readFileSync(manifestPath, 'utf8');
@@ -245,18 +258,29 @@ var builders = {
}
}
+ var name=extractRealProjectNameFromManifest(ROOT);
var subProjectsAsGradlePaths = subProjects.map(function(p) { return ':' + p.replace(/[/\\]/g, ':'); });
+ //Remove the proj.id/name- prefix from projects: https://issues.apache.org/jira/browse/CB-9149
+ var settingsGradlePaths = subProjects.map(function(p){
+ var realDir=p.replace(/[/\\]/g, ':');
+ var libName=realDir.replace(name+'-','');
+ var str='include ":'+libName+'"\n';
+ if(realDir.indexOf(name+'-')!==-1)
+ str+='project(":'+libName+'").projectDir = new File("'+p+'")\n';
+ return str;
+ });
+
// Write the settings.gradle file.
fs.writeFileSync(path.join(projectPath, 'settings.gradle'),
'// GENERATED FILE - DO NOT EDIT\n' +
- 'include ":"\n' +
- 'include "' + subProjectsAsGradlePaths.join('"\ninclude "') + '"\n');
+ 'include ":"\n' + settingsGradlePaths.join(''));
// Update dependencies within build.gradle.
var buildGradle = fs.readFileSync(path.join(projectPath, 'build.gradle'), 'utf8');
var depsList = '';
- subProjectsAsGradlePaths.forEach(function(p) {
- depsList += ' debugCompile project(path: "' + p + '", configuration: "debug")\n';
- depsList += ' releaseCompile project(path: "' + p + '", configuration: "release")\n';
+ subProjects.forEach(function(p) {
+ var libName=p.replace(/[/\\]/g, ':').replace(name+'-','');
+ depsList += ' debugCompile project(path: "' + libName + '", configuration: "debug")\n';
+ depsList += ' releaseCompile project(path: "' + libName + '", configuration: "release")\n';
});
// For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390
var SYSTEM_LIBRARY_MAPPINGS = [
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[29/45] android commit: Got the PoC working with the Contacts plugin,
going to work through all the plugins
Posted by bo...@apache.org.
Got the PoC working with the Contacts plugin, going to work through all the plugins
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/4f3571a0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/4f3571a0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/4f3571a0
Branch: refs/heads/5.0.x
Commit: 4f3571a0a103b2833b1c5186a8d4e7aedb8d9670
Parents: 1f8a231
Author: Joe Bowser <bo...@apache.org>
Authored: Mon Aug 31 15:32:53 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Aug 31 15:32:53 2015 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/CordovaActivity.java | 11 ++++++++++-
framework/src/org/apache/cordova/CordovaInterface.java | 4 ++--
.../src/org/apache/cordova/CordovaInterfaceImpl.java | 10 +++++-----
framework/src/org/apache/cordova/CordovaPlugin.java | 11 ++---------
.../org/apache/cordova/engine/SystemWebChromeClient.java | 7 +++++--
5 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4f3571a0/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 43e013b..868b243 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -493,7 +493,16 @@ public class CordovaActivity extends Activity {
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
int[] grantResults) {
- cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
+ try
+ {
+ cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
+ }
+ catch (JSONException e)
+ {
+ LOG.d(TAG, "JSONException: Parameters fed into the method are not valid");
+ e.printStackTrace();
+ }
+
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4f3571a0/framework/src/org/apache/cordova/CordovaInterface.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterface.java b/framework/src/org/apache/cordova/CordovaInterface.java
index 2aa0452..4b43580 100755
--- a/framework/src/org/apache/cordova/CordovaInterface.java
+++ b/framework/src/org/apache/cordova/CordovaInterface.java
@@ -70,6 +70,6 @@ public interface CordovaInterface {
*/
public ExecutorService getThreadPool();
- public void requestPermission(CordovaPlugin plugin, String permission);
- public void requestPermissions(CordovaPlugin plugin);
+ public void requestPermission(CordovaPlugin plugin, int requestCode, String permission);
+ public void requestPermissions(CordovaPlugin plugin, int requestCode);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4f3571a0/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
index 7b436af..ac31189 100644
--- a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
+++ b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -24,6 +24,8 @@ import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
+import org.json.JSONException;
+
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -171,7 +173,7 @@ public class CordovaInterfaceImpl implements CordovaInterface {
* @param grantResults
*/
public void onRequestPermissionResult(int requestCode, String[] permissions,
- int[] grantResults) {
+ int[] grantResults) throws JSONException {
if(permissionResultCallback != null)
{
permissionResultCallback.onRequestPermissionResult(requestCode, permissions, grantResults);
@@ -179,19 +181,17 @@ public class CordovaInterfaceImpl implements CordovaInterface {
}
}
- public void requestPermission(CordovaPlugin plugin, String permission) {
+ public void requestPermission(CordovaPlugin plugin, int requestCode, String permission) {
permissionResultCallback = plugin;
String[] permissions = new String [1];
permissions[0] = permission;
- int requestCode = 1;
getActivity().requestPermissions(permissions, requestCode);
}
- public void requestPermissions(CordovaPlugin plugin)
+ public void requestPermissions(CordovaPlugin plugin, int requestCode)
{
permissionResultCallback = plugin;
String[] permissions = plugin.getPermissionRequest();
- int requestCode = 1;
getActivity().requestPermissions(permissions, requestCode);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4f3571a0/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java
index 6e82027..7dc18e3 100644
--- a/framework/src/org/apache/cordova/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -391,15 +391,8 @@ public class CordovaPlugin {
* @param permissions
* @param grantResults
*/
- public boolean onRequestPermissionResult(int requestCode, String[] permissions,
- int[] grantResults) {
+ public void onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) throws JSONException {
- for(int r:grantResults)
- {
- if(r == PackageManager.PERMISSION_DENIED)
- return false;
- }
-
- return true;
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4f3571a0/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
index bca847b..d411421 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -21,6 +21,7 @@ package org.apache.cordova.engine;
import java.util.Arrays;
import android.annotation.TargetApi;
import android.app.Activity;
+import android.content.Context;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
@@ -63,13 +64,15 @@ public class SystemWebChromeClient extends WebChromeClient {
private View mVideoProgressView;
private CordovaDialogsHelper dialogsHelper;
+ private Context appContext;
private WebChromeClient.CustomViewCallback mCustomViewCallback;
private View mCustomView;
public SystemWebChromeClient(SystemWebViewEngine parentEngine) {
this.parentEngine = parentEngine;
- dialogsHelper = new CordovaDialogsHelper(parentEngine.webView.getContext());
+ appContext = parentEngine.webView.getContext();
+ dialogsHelper = new CordovaDialogsHelper(appContext);
}
/**
@@ -186,7 +189,7 @@ public class SystemWebChromeClient extends WebChromeClient {
CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("Geolocation");
if(geolocation != null && !geolocation.hasPermisssion())
{
- parentEngine.pluginManager.requestPermission(geolocation);
+ //cordova.requestPermissions(geolocation);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[11/45] android commit: CB-9382 [Android] Fix KeepRunning setting
when Plugin activity is showed. This closes #200
Posted by bo...@apache.org.
CB-9382 [Android] Fix KeepRunning setting when Plugin activity is showed. This closes #200
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/e1246698
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/e1246698
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/e1246698
Branch: refs/heads/5.0.x
Commit: e124669818c107b73abf57f97618172378278e3b
Parents: b20b2e7
Author: sgrebnov <v-...@microsoft.com>
Authored: Mon Jul 20 14:14:50 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:02 2015 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/CordovaActivity.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e1246698/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 8bed308..e446927 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -228,7 +228,10 @@ public class CordovaActivity extends Activity {
LOG.d(TAG, "Paused the activity.");
if (this.appView != null) {
- this.appView.handlePause(this.keepRunning);
+ // CB-9382 If there is an activity that started for result and main activity is waiting for callback
+ // result, we shoudn't stop WebView Javascript timers, as activity for result might be using them
+ boolean keepRunning = this.keepRunning || this.cordovaInterface.activityResultCallback != null;
+ this.appView.handlePause(keepRunning);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[26/45] android commit: CB-9402 Allow to set gradle distubutionUrl
via env variable CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL
Posted by bo...@apache.org.
CB-9402 Allow to set gradle distubutionUrl via env variable CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL
This closes #205
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/a56f55b0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/a56f55b0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/a56f55b0
Branch: refs/heads/5.0.x
Commit: a56f55b0364b88d0fefea5a3139c68eda658c4bf
Parents: 771f5ec
Author: Alexander Lebedev <al...@gmail.com>
Authored: Fri Aug 14 10:17:02 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:41 2015 -0700
----------------------------------------------------------------------
bin/templates/cordova/lib/build.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/a56f55b0/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index bbcf171..268a7c5 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -344,10 +344,10 @@ var builders = {
// If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
// For some reason, using ^ and $ don't work. This does the job, though.
var distributionUrlRegex = /distributionUrl.*zip/;
- var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip';
+ var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip';
var gradleWrapperPropertiesPath = path.join(projectPath, 'gradle', 'wrapper', 'gradle-wrapper.properties');
shell.chmod('u+w', gradleWrapperPropertiesPath);
- shell.sed('-i', distributionUrlRegex, distributionUrl, gradleWrapperPropertiesPath);
+ shell.sed('-i', distributionUrlRegex, 'distributionUrl='+distributionUrl, gradleWrapperPropertiesPath);
var propertiesFile = opts.buildType + SIGNING_PROPERTIES;
var propertiesFilePath = path.join(ROOT, propertiesFile);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[05/45] android commit: CB-9149 Fixes JSHint issue introduced by
899daa9
Posted by bo...@apache.org.
CB-9149 Fixes JSHint issue introduced by 899daa9
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/b15d39d2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/b15d39d2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/b15d39d2
Branch: refs/heads/5.0.x
Commit: b15d39d25f7a7737bceb7c6e7766c324037efd38
Parents: fcde2b5
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Mon Jul 20 13:00:17 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:01 2015 -0700
----------------------------------------------------------------------
bin/templates/cordova/lib/build.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b15d39d2/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index 9835172..cd07a59 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -258,8 +258,7 @@ var builders = {
}
}
- var name=extractRealProjectNameFromManifest(ROOT);
- var subProjectsAsGradlePaths = subProjects.map(function(p) { return ':' + p.replace(/[/\\]/g, ':'); });
+ var name = extractRealProjectNameFromManifest(ROOT);
//Remove the proj.id/name- prefix from projects: https://issues.apache.org/jira/browse/CB-9149
var settingsGradlePaths = subProjects.map(function(p){
var realDir=p.replace(/[/\\]/g, ':');
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[44/45] android commit: Set VERSION to 5.0.0 (via coho)
Posted by bo...@apache.org.
Set VERSION to 5.0.0 (via coho)
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/659cd631
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/659cd631
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/659cd631
Branch: refs/heads/5.0.x
Commit: 659cd6311d9e0346df2d0a936edddc6ee49e3923
Parents: a600859
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Sep 23 12:50:02 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Wed Sep 23 12:51:07 2015 -0700
----------------------------------------------------------------------
VERSION | 2 +-
bin/templates/cordova/version | 2 +-
framework/src/org/apache/cordova/CordovaWebView.java | 2 +-
package.json | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/659cd631/VERSION
----------------------------------------------------------------------
diff --git a/VERSION b/VERSION
index 5fb11aa..0062ac9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.2.0-dev
+5.0.0
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/659cd631/bin/templates/cordova/version
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/version b/bin/templates/cordova/version
index 8acf18f..28ae86f 100755
--- a/bin/templates/cordova/version
+++ b/bin/templates/cordova/version
@@ -20,6 +20,6 @@
*/
// Coho updates this line:
-var VERSION = "4.2.0-dev";
+var VERSION = "5.0.0";
console.log(VERSION);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/659cd631/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index a202c0d..72c35f7 100644
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
* are not expected to implement it.
*/
public interface CordovaWebView {
- public static final String CORDOVA_VERSION = "4.2.0-dev";
+ public static final String CORDOVA_VERSION = "5.0.0";
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/659cd631/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 7e384d5..7f66ca7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "cordova-android",
- "version": "4.2.0-dev",
+ "version": "5.0.0",
"description": "cordova-android release",
"main": "bin/create",
"repository": {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[08/45] android commit: Set VERSION to 4.2.0-dev (via coho)
Posted by bo...@apache.org.
Set VERSION to 4.2.0-dev (via coho)
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/9e31d3a1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/9e31d3a1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/9e31d3a1
Branch: refs/heads/5.0.x
Commit: 9e31d3a180f218e89cbf48662fffb36de2b6b367
Parents: 65bfa13
Author: Nikhil Khandelwal <ni...@microsoft.com>
Authored: Mon Jul 20 09:52:14 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:02 2015 -0700
----------------------------------------------------------------------
VERSION | 2 +-
bin/templates/cordova/version | 2 +-
framework/src/org/apache/cordova/CordovaWebView.java | 2 +-
package.json | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/9e31d3a1/VERSION
----------------------------------------------------------------------
diff --git a/VERSION b/VERSION
index 4aa925d..5fb11aa 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.1.0-dev
+4.2.0-dev
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/9e31d3a1/bin/templates/cordova/version
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/version b/bin/templates/cordova/version
index 7039287..8acf18f 100755
--- a/bin/templates/cordova/version
+++ b/bin/templates/cordova/version
@@ -20,6 +20,6 @@
*/
// Coho updates this line:
-var VERSION = "4.1.0-dev";
+var VERSION = "4.2.0-dev";
console.log(VERSION);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/9e31d3a1/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index 518f5fb..a202c0d 100644
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
* are not expected to implement it.
*/
public interface CordovaWebView {
- public static final String CORDOVA_VERSION = "4.1.0-dev";
+ public static final String CORDOVA_VERSION = "4.2.0-dev";
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/9e31d3a1/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 1f43c9f..7e384d5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "cordova-android",
- "version": "4.1.0-dev",
+ "version": "4.2.0-dev",
"description": "cordova-android release",
"main": "bin/create",
"repository": {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[06/45] android commit: CB-9372: Remove unused files: 'main.js' &
'master.css'. This closes #198
Posted by bo...@apache.org.
CB-9372: Remove unused files: 'main.js' & 'master.css'. This closes #198
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/fcde2b58
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/fcde2b58
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/fcde2b58
Branch: refs/heads/5.0.x
Commit: fcde2b585762021b60537783ce9a73bb7826909b
Parents: dd1b2c4
Author: Omar Mefire <om...@gmail.com>
Authored: Fri Jul 17 00:27:56 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:01 2015 -0700
----------------------------------------------------------------------
bin/templates/project/assets/www/main.js | 165 -----------------------
bin/templates/project/assets/www/master.css | 116 ----------------
2 files changed, 281 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fcde2b58/bin/templates/project/assets/www/main.js
----------------------------------------------------------------------
diff --git a/bin/templates/project/assets/www/main.js b/bin/templates/project/assets/www/main.js
deleted file mode 100644
index 3a8b04a..0000000
--- a/bin/templates/project/assets/www/main.js
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- 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.
-*/
-
-var deviceInfo = function() {
- document.getElementById("platform").innerHTML = device.platform;
- document.getElementById("version").innerHTML = device.version;
- document.getElementById("uuid").innerHTML = device.uuid;
- document.getElementById("name").innerHTML = device.name;
- document.getElementById("width").innerHTML = screen.width;
- document.getElementById("height").innerHTML = screen.height;
- document.getElementById("colorDepth").innerHTML = screen.colorDepth;
-};
-
-var getLocation = function() {
- var suc = function(p) {
- alert(p.coords.latitude + " " + p.coords.longitude);
- };
- var locFail = function() {
- };
- navigator.geolocation.getCurrentPosition(suc, locFail);
-};
-
-var beep = function() {
- navigator.notification.beep(2);
-};
-
-var vibrate = function() {
- navigator.notification.vibrate(0);
-};
-
-function roundNumber(num) {
- var dec = 3;
- var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
- return result;
-}
-
-var accelerationWatch = null;
-
-function updateAcceleration(a) {
- document.getElementById('x').innerHTML = roundNumber(a.x);
- document.getElementById('y').innerHTML = roundNumber(a.y);
- document.getElementById('z').innerHTML = roundNumber(a.z);
-}
-
-var toggleAccel = function() {
- if (accelerationWatch !== null) {
- navigator.accelerometer.clearWatch(accelerationWatch);
- updateAcceleration({
- x : "",
- y : "",
- z : ""
- });
- accelerationWatch = null;
- } else {
- var options = {};
- options.frequency = 1000;
- accelerationWatch = navigator.accelerometer.watchAcceleration(
- updateAcceleration, function(ex) {
- alert("accel fail (" + ex.name + ": " + ex.message + ")");
- }, options);
- }
-};
-
-var preventBehavior = function(e) {
- e.preventDefault();
-};
-
-function dump_pic(data) {
- var viewport = document.getElementById('viewport');
- console.log(data);
- viewport.style.display = "";
- viewport.style.position = "absolute";
- viewport.style.top = "10px";
- viewport.style.left = "10px";
- document.getElementById("test_img").src = data;
-}
-
-function fail(msg) {
- alert(msg);
-}
-
-function show_pic() {
- navigator.camera.getPicture(dump_pic, fail, {
- quality : 50
- });
-}
-
-function close() {
- var viewport = document.getElementById('viewport');
- viewport.style.position = "relative";
- viewport.style.display = "none";
-}
-
-function contacts_success(contacts) {
- alert(contacts.length
- + ' contacts returned.'
- + (contacts[2] && contacts[2].name ? (' Third contact is ' + contacts[2].name.formatted)
- : ''));
-}
-
-function get_contacts() {
- var obj = new ContactFindOptions();
- obj.filter = "";
- obj.multiple = true;
- navigator.contacts.find(
- [ "displayName", "name" ], contacts_success,
- fail, obj);
-}
-
-function check_network() {
- var networkState = navigator.network.connection.type;
-
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.NONE] = 'No network connection';
-
- confirm('Connection type:\n ' + states[networkState]);
-}
-
-var watchID = null;
-
-function updateHeading(h) {
- document.getElementById('h').innerHTML = h.magneticHeading;
-}
-
-function toggleCompass() {
- if (watchID !== null) {
- navigator.compass.clearWatch(watchID);
- watchID = null;
- updateHeading({ magneticHeading : "Off"});
- } else {
- var options = { frequency: 1000 };
- watchID = navigator.compass.watchHeading(updateHeading, function(e) {
- alert('Compass Error: ' + e.code);
- }, options);
- }
-}
-
-function init() {
- // the next line makes it impossible to see Contacts on the HTC Evo since it
- // doesn't have a scroll button
- // document.addEventListener("touchmove", preventBehavior, false);
- document.addEventListener("deviceready", deviceInfo, true);
-}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fcde2b58/bin/templates/project/assets/www/master.css
----------------------------------------------------------------------
diff --git a/bin/templates/project/assets/www/master.css b/bin/templates/project/assets/www/master.css
deleted file mode 100644
index 3aad33d..0000000
--- a/bin/templates/project/assets/www/master.css
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- 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.
-*/
-
-
- body {
- background:#222 none repeat scroll 0 0;
- color:#666;
- font-family:Helvetica;
- font-size:72%;
- line-height:1.5em;
- margin:0;
- border-top:1px solid #393939;
- }
-
- #info{
- background:#ffa;
- border: 1px solid #ffd324;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- clear:both;
- margin:15px 6px 0;
- width:295px;
- padding:4px 0px 2px 10px;
- }
-
- #info > h4{
- font-size:.95em;
- margin:5px 0;
- }
-
- #stage.theme{
- padding-top:3px;
- }
-
- /* Definition List */
- #stage.theme > dl{
- padding-top:10px;
- clear:both;
- margin:0;
- list-style-type:none;
- padding-left:10px;
- overflow:auto;
- }
-
- #stage.theme > dl > dt{
- font-weight:bold;
- float:left;
- margin-left:5px;
- }
-
- #stage.theme > dl > dd{
- width:45px;
- float:left;
- color:#a87;
- font-weight:bold;
- }
-
- /* Content Styling */
- #stage.theme > h1, #stage.theme > h2, #stage.theme > p{
- margin:1em 0 .5em 13px;
- }
-
- #stage.theme > h1{
- color:#eee;
- font-size:1.6em;
- text-align:center;
- margin:0;
- margin-top:15px;
- padding:0;
- }
-
- #stage.theme > h2{
- clear:both;
- margin:0;
- padding:3px;
- font-size:1em;
- text-align:center;
- }
-
- /* Stage Buttons */
- #stage.theme a.btn{
- border: 1px solid #555;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- text-align:center;
- display:block;
- float:left;
- background:#444;
- width:150px;
- color:#9ab;
- font-size:1.1em;
- text-decoration:none;
- padding:1.2em 0;
- margin:3px 0px 3px 5px;
- }
- #stage.theme a.btn.large{
- width:308px;
- padding:1.2em 0;
- }
-
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[15/45] android commit: CB-9397 Fixes minor issues with `cordova
requirements android`
Posted by bo...@apache.org.
CB-9397 Fixes minor issues with `cordova requirements android`
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/e02cbc73
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/e02cbc73
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/e02cbc73
Branch: refs/heads/5.0.x
Commit: e02cbc7344699550a583051af11336680611be70
Parents: 082e299
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Wed Jul 22 16:45:49 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:03 2015 -0700
----------------------------------------------------------------------
bin/lib/check_reqs.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e02cbc73/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index 0b31a2a..ffa35b6 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -82,9 +82,13 @@ module.exports.check_ant = function() {
// Returns a promise. Called only by build and clean commands.
module.exports.check_gradle = function() {
var sdkDir = process.env['ANDROID_HOME'];
+ if (!sdkDir)
+ return Q.reject('Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.\n' +
+ 'Might need to install Android SDK or set up \'ANDROID_HOME\' env variable.');
+
var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
if (!fs.existsSync(wrapperDir)) {
- return Q.reject(new Error('Could not find gradle wrapper within android sdk. Might need to update your Android SDK.\n' +
+ return Q.reject(new Error('Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.\n' +
'Looked here: ' + wrapperDir));
}
return Q.when();
@@ -312,7 +316,7 @@ module.exports.check_all = function() {
requirement.installed = true;
requirement.metadata.version = version;
}, function (err) {
- requirement.metadata.reason = err;
+ requirement.metadata.reason = err instanceof Error ? err.message : err;
});
}, Q())
.then(function () {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[04/45] android commit: CB-9255 Make getUriType case insensitive.
Posted by bo...@apache.org.
CB-9255 Make getUriType case insensitive.
This closes #186
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/c5557f7d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/c5557f7d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/c5557f7d
Branch: refs/heads/5.0.x
Commit: c5557f7d6ae74e1f6d264e0ff8e61e35b99437e7
Parents: b15d39d
Author: Connor Pearson <cj...@gmail.com>
Authored: Fri Jun 26 09:37:13 2015 -0400
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:01 2015 -0700
----------------------------------------------------------------------
.../src/org/apache/cordova/CordovaResourceApi.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/c5557f7d/framework/src/org/apache/cordova/CordovaResourceApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java b/framework/src/org/apache/cordova/CordovaResourceApi.java
index b2b0380..0390bb0 100644
--- a/framework/src/org/apache/cordova/CordovaResourceApi.java
+++ b/framework/src/org/apache/cordova/CordovaResourceApi.java
@@ -104,28 +104,28 @@ public class CordovaResourceApi {
public static int getUriType(Uri uri) {
assertNonRelative(uri);
String scheme = uri.getScheme();
- if (ContentResolver.SCHEME_CONTENT.equals(scheme)) {
+ if (ContentResolver.SCHEME_CONTENT.equalsIgnoreCase(scheme)) {
return URI_TYPE_CONTENT;
}
- if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(scheme)) {
+ if (ContentResolver.SCHEME_ANDROID_RESOURCE.equalsIgnoreCase(scheme)) {
return URI_TYPE_RESOURCE;
}
- if (ContentResolver.SCHEME_FILE.equals(scheme)) {
+ if (ContentResolver.SCHEME_FILE.equalsIgnoreCase(scheme)) {
if (uri.getPath().startsWith("/android_asset/")) {
return URI_TYPE_ASSET;
}
return URI_TYPE_FILE;
}
- if ("data".equals(scheme)) {
+ if ("data".equalsIgnoreCase(scheme)) {
return URI_TYPE_DATA;
}
- if ("http".equals(scheme)) {
+ if ("http".equalsIgnoreCase(scheme)) {
return URI_TYPE_HTTP;
}
- if ("https".equals(scheme)) {
+ if ("https".equalsIgnoreCase(scheme)) {
return URI_TYPE_HTTPS;
}
- if (PLUGIN_URI_SCHEME.equals(scheme)) {
+ if (PLUGIN_URI_SCHEME.equalsIgnoreCase(scheme)) {
return URI_TYPE_PLUGIN;
}
return URI_TYPE_UNKNOWN;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[13/45] android commit: CB-9391 Fixes cdvBuildMultipleApks option
casting
Posted by bo...@apache.org.
CB-9391 Fixes cdvBuildMultipleApks option casting
This closes #199
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/b20b2e78
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/b20b2e78
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/b20b2e78
Branch: refs/heads/5.0.x
Commit: b20b2e78a1abcb71a3167c2bdb9f2ee4160b183b
Parents: 662429a
Author: Malte Legenhausen <ml...@gmail.com>
Authored: Fri Jul 17 15:51:10 2015 +0200
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:02 2015 -0700
----------------------------------------------------------------------
bin/templates/project/build.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b20b2e78/bin/templates/project/build.gradle
----------------------------------------------------------------------
diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle
index e40af30..289b7af 100644
--- a/bin/templates/project/build.gradle
+++ b/bin/templates/project/build.gradle
@@ -118,7 +118,7 @@ if (ext.cdvReleaseSigningPropertiesFile == null && file('release-signing.propert
}
// Cast to appropriate types.
-ext.cdvBuildMultipleApks = !!cdvBuildMultipleApks;
+ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : Integer.parseInt('' + cdvMinSdkVersion)
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[03/45] android commit: Adding a working build.gradle that skips our
code that can't handle non-numeric SDK targets
Posted by bo...@apache.org.
Adding a working build.gradle that skips our code that can't handle non-numeric SDK targets
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/b0082144
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/b0082144
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/b0082144
Branch: refs/heads/5.0.x
Commit: b00821449554ab406582837264dfaf8ad67ca1bc
Parents: 2332740
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Jul 15 16:32:20 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Wed Jul 15 16:32:20 2015 -0700
----------------------------------------------------------------------
framework/build.gradle | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b0082144/framework/build.gradle
----------------------------------------------------------------------
diff --git a/framework/build.gradle b/framework/build.gradle
index 2565633..70954d6 100644
--- a/framework/build.gradle
+++ b/framework/build.gradle
@@ -15,9 +15,6 @@
specific language governing permissions and limitations
under the License.
*/
-
-
-
buildscript {
repositories {
mavenCentral()
@@ -41,12 +38,12 @@ buildscript {
}
}
}
-
apply plugin: 'android-library'
-
android {
- compileSdkVersion cdvCompileSdkVersion
- buildToolsVersion cdvBuildToolsVersion
+ // compileSdkVersion cdvCompileSdkVersion
+ // buildToolsVersion cdvBuildToolsVersion
+ compileSdkVersion 'android-MNC'
+ buildToolsVersion '23.0.0 rc3'
publishNonDefault true
compileOptions {
@@ -66,3 +63,6 @@ android {
}
}
}
+
+dependencies {
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[41/45] android commit: CB-8320: Setting up gradle so we can use
CordovaLib as a standard Android Library
Posted by bo...@apache.org.
CB-8320: Setting up gradle so we can use CordovaLib as a standard Android Library
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/dfb87f00
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/dfb87f00
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/dfb87f00
Branch: refs/heads/5.0.x
Commit: dfb87f00c9b3010dd99f4c67e2cdda42cadfb08f
Parents: 507078a
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Jul 22 13:23:16 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:09:30 2015 -0700
----------------------------------------------------------------------
framework/build.gradle | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/dfb87f00/framework/build.gradle
----------------------------------------------------------------------
diff --git a/framework/build.gradle b/framework/build.gradle
index fed3a3d..e4c182e 100644
--- a/framework/build.gradle
+++ b/framework/build.gradle
@@ -38,10 +38,8 @@ ext {
}
android {
- // compileSdkVersion cdvCompileSdkVersion
- // buildToolsVersion cdvBuildToolsVersion
- compileSdkVersion 'android-MNC'
- buildToolsVersion '23.0.0 rc3'
+ compileSdkVersion cdvCompileSdkVersion
+ buildToolsVersion cdvBuildToolsVersion
publishNonDefault true
compileOptions {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[36/45] android commit: Commiting code to handle permissions,
and the special case of the Geolocation Plugin
Posted by bo...@apache.org.
Commiting code to handle permissions, and the special case of the Geolocation Plugin
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/d3044f35
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/d3044f35
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/d3044f35
Branch: refs/heads/5.0.x
Commit: d3044f3524866a0056f0c2632b5fdb68eafdf0f3
Parents: bf57aa1
Author: Joe Bowser <bo...@apache.org>
Authored: Tue Jul 14 14:31:07 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:09:24 2015 -0700
----------------------------------------------------------------------
.../src/org/apache/cordova/CordovaActivity.java | 81 +++++++++++---------
.../org/apache/cordova/CordovaInterface.java | 2 +
.../apache/cordova/CordovaInterfaceImpl.java | 6 ++
.../src/org/apache/cordova/CordovaPlugin.java | 48 ++++++++++++
.../src/org/apache/cordova/PluginManager.java | 25 ++++++
.../cordova/engine/SystemWebChromeClient.java | 9 +++
6 files changed, 134 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d3044f35/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index cf055c6..171e2a8 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -109,26 +109,20 @@ public class CordovaActivity extends Activity {
// need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
loadConfig();
- if(!preferences.getBoolean("ShowTitle", false))
- {
+ if (!preferences.getBoolean("ShowTitle", false)) {
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
}
- if(preferences.getBoolean("SetFullscreen", false))
- {
+ if (preferences.getBoolean("SetFullscreen", false)) {
Log.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
preferences.set("Fullscreen", true);
}
- if(preferences.getBoolean("Fullscreen", false))
- {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
- {
+ if (preferences.getBoolean("Fullscreen", false)) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
immersiveMode = true;
- }
- else
- {
+ } else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
} else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
@@ -138,12 +132,11 @@ public class CordovaActivity extends Activity {
super.onCreate(savedInstanceState);
cordovaInterface = makeCordovaInterface();
- if(savedInstanceState != null)
- {
+ if (savedInstanceState != null) {
cordovaInterface.restoreInstanceState(savedInstanceState);
}
}
-
+
protected void init() {
appView = makeWebView();
createViews();
@@ -192,7 +185,7 @@ public class CordovaActivity extends Activity {
/**
* Construct the default web view object.
- *
+ * <p/>
* Override this to customize the webview that is used.
*/
protected CordovaWebView makeWebView() {
@@ -245,13 +238,13 @@ public class CordovaActivity extends Activity {
/**
* Called when the activity receives a new intent
- **/
+ */
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
//Forward to plugins
if (this.appView != null)
- this.appView.onNewIntent(intent);
+ this.appView.onNewIntent(intent);
}
/**
@@ -261,7 +254,7 @@ public class CordovaActivity extends Activity {
protected void onResume() {
super.onResume();
LOG.d(TAG, "Resumed the activity.");
-
+
if (this.appView == null) {
return;
}
@@ -321,11 +314,11 @@ public class CordovaActivity extends Activity {
super.onWindowFocusChanged(hasFocus);
if (hasFocus && immersiveMode) {
final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
}
@@ -343,10 +336,10 @@ public class CordovaActivity extends Activity {
* Called when an activity you launched exits, giving you the requestCode you started it with,
* the resultCode it returned, and any additional data from it.
*
- * @param requestCode The request code originally supplied to startActivityForResult(),
- * allowing you to identify who this result came from.
- * @param resultCode The integer result code returned by the child activity through its setResult().
- * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
+ * @param requestCode The request code originally supplied to startActivityForResult(),
+ * allowing you to identify who this result came from.
+ * @param resultCode The integer result code returned by the child activity through its setResult().
+ * @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
@@ -359,9 +352,9 @@ public class CordovaActivity extends Activity {
* Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
* The errorCode parameter corresponds to one of the ERROR_* constants.
*
- * @param errorCode The error code corresponding to an ERROR_* value.
- * @param description A String describing the error.
- * @param failingUrl The url that failed to load.
+ * @param errorCode The error code corresponding to an ERROR_* value.
+ * @param description A String describing the error.
+ * @param failingUrl The url that failed to load.
*/
public void onReceivedError(final int errorCode, final String description, final String failingUrl) {
final CordovaActivity me = this;
@@ -450,9 +443,9 @@ public class CordovaActivity extends Activity {
/**
* Called when a message is sent to plugin.
*
- * @param id The message id
- * @param data The message data
- * @return Object or null
+ * @param id The message id
+ * @param data The message data
+ * @return Object or null
*/
public Object onMessage(String id, Object data) {
if ("onReceivedError".equals(id)) {
@@ -468,8 +461,7 @@ public class CordovaActivity extends Activity {
return null;
}
- protected void onSaveInstanceState(Bundle outState)
- {
+ protected void onSaveInstanceState(Bundle outState) {
cordovaInterface.onSaveInstanceState(outState);
super.onSaveInstanceState(outState);
}
@@ -477,7 +469,7 @@ public class CordovaActivity extends Activity {
/**
* Called by the system when the device configuration changes while your activity is running.
*
- * @param newConfig The new device configuration
+ * @param newConfig The new device configuration
*/
@Override
public void onConfigurationChanged(Configuration newConfig) {
@@ -490,4 +482,19 @@ public class CordovaActivity extends Activity {
pm.onConfigurationChanged(newConfig);
}
}
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String permissions[],
+ int[] grantResults) {
+ PluginManager pm = this.appView.getPluginManager();
+ pm.onRequestPermissionResult(requestCode, permissions, grantResults);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d3044f35/framework/src/org/apache/cordova/CordovaInterface.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterface.java b/framework/src/org/apache/cordova/CordovaInterface.java
index 59ed486..3fa6e63 100755
--- a/framework/src/org/apache/cordova/CordovaInterface.java
+++ b/framework/src/org/apache/cordova/CordovaInterface.java
@@ -69,4 +69,6 @@ public interface CordovaInterface {
* Returns a shared thread pool that can be used for background tasks.
*/
public ExecutorService getThreadPool();
+
+ public void requestPermission(CordovaPlugin plugin);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d3044f35/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
index e35a181..146bacb 100644
--- a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
+++ b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -161,4 +161,10 @@ public class CordovaInterfaceImpl implements CordovaInterface {
this.intent = intent;
}
}
+
+ public void requestPermission(CordovaPlugin plugin)
+ {
+ pluginManager.requestPermission(plugin);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d3044f35/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java
index 7cf8528..8ca1dd1 100644
--- a/framework/src/org/apache/cordova/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -26,6 +26,7 @@ import org.json.JSONArray;
import org.json.JSONException;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.net.Uri;
@@ -40,6 +41,7 @@ public class CordovaPlugin {
public CordovaInterface cordova;
protected CordovaPreferences preferences;
private String serviceName;
+ private String [] permissions;
/**
* Call this after constructing to initialize the plugin.
@@ -359,4 +361,50 @@ public class CordovaPlugin {
*/
public void onConfigurationChanged(Configuration newConfig) {
}
+
+ /**
+ * Called by the Plugin Manager when we need to actually request permissions
+ *
+ * @return Returns the permission that was stored in the plugin
+ */
+
+ public String[] getPermissionRequest() {
+ return permissions;
+ }
+
+ /**
+ * requestPermission
+ */
+ public void requestPermission() {
+ cordova.requestPermission(this);
+ }
+
+ public boolean hasPermisssion() {
+ for(String p : permissions)
+ {
+ if(PackageManager.PERMISSION_DENIED == cordova.getActivity().checkSelfPermission(p))
+ {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ public boolean onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) {
+
+ for(int r:grantResults)
+ {
+ if(r == PackageManager.PERMISSION_DENIED)
+ return false;
+ }
+
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d3044f35/framework/src/org/apache/cordova/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java
index a541e77..e543b04 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -47,6 +47,8 @@ public class PluginManager {
private final CordovaWebView app;
private boolean isInitialized;
+ private CordovaPlugin permissionRequester;
+
public PluginManager(CordovaWebView cordovaWebView, CordovaInterface cordova, Collection<PluginEntry> pluginEntries) {
this.ctx = cordova;
this.app = cordovaWebView;
@@ -508,4 +510,27 @@ public class PluginManager {
}
}
}
+
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ public void onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) {
+ if(permissionRequester != null)
+ {
+ permissionRequester.onRequestPermissionResult(requestCode, permissions, grantResults);
+ permissionRequester = null;
+ }
+ }
+
+ public void requestPermission(CordovaPlugin plugin) {
+ permissionRequester = plugin;
+ String[] permissions = plugin.getPermissionRequest();
+ int requestCode = 1;
+ ctx.getActivity().requestPermissions(permissions, requestCode);
+ }
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d3044f35/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
index 3b5866c..8c02bfa 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -174,12 +174,21 @@ public class SystemWebChromeClient extends WebChromeClient {
/**
* Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin.
*
+ * This also checks for the Geolocation Plugin and requests permission from the application to use Geolocation.
+ *
* @param origin
* @param callback
*/
public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
super.onGeolocationPermissionsShowPrompt(origin, callback);
callback.invoke(origin, true, false);
+ //Get the plugin, it should be loaded
+ CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("org.apache.cordova.geolocation.PermissionHandler");
+ if(geolocation != null && !geolocation.hasPermisssion())
+ {
+ parentEngine.pluginManager.requestPermission(geolocation);
+ }
+
}
// API level 7 is required for this, see if we could lower this using something else
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[32/45] android commit: CB-9557 Fixes apk install failure when
switching from debug to release build
Posted by bo...@apache.org.
CB-9557 Fixes apk install failure when switching from debug to release build
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/a265a614
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/a265a614
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/a265a614
Branch: refs/heads/5.0.x
Commit: a265a6146a54b94cef116050bd6a465c8ef3332f
Parents: e8821c9
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Wed Aug 26 16:09:27 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:08:18 2015 -0700
----------------------------------------------------------------------
bin/templates/cordova/lib/appinfo.js | 11 +++++--
bin/templates/cordova/lib/device.js | 13 ++++++--
bin/templates/cordova/lib/emulator.js | 52 +++++++++++++++++-------------
3 files changed, 48 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/a265a614/bin/templates/cordova/lib/appinfo.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/appinfo.js b/bin/templates/cordova/lib/appinfo.js
index 080c2ba..e37b89b 100644
--- a/bin/templates/cordova/lib/appinfo.js
+++ b/bin/templates/cordova/lib/appinfo.js
@@ -33,9 +33,16 @@ function readAppInfoFromManifest() {
var activityName = /\bandroid:name\s*=\s*"(.+?)"/.exec(activityTag);
if (!activityName) throw new Error('Could not find android:name within ' + manifestPath);
- return packageName[1] + '/.' + activityName[1];
+ return (cachedAppInfo = {
+ packageName: packageName[1],
+ activityName: packageName[1] + '/.' + activityName[1]
+ });
}
exports.getActivityName = function() {
- return (cachedAppInfo = cachedAppInfo || readAppInfoFromManifest());
+ return cachedAppInfo ? cachedAppInfo.activityName : readAppInfoFromManifest().activityName;
+};
+
+exports.getPackageName = function() {
+ return cachedAppInfo ? cachedAppInfo.packageName : readAppInfoFromManifest().packageName;
};
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/a265a614/bin/templates/cordova/lib/device.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/device.js b/bin/templates/cordova/lib/device.js
index c13fdc4..560f26d 100644
--- a/bin/templates/cordova/lib/device.js
+++ b/bin/templates/cordova/lib/device.js
@@ -96,10 +96,17 @@ module.exports.install = function(target, buildResults) {
}).then(function(resolvedTarget) {
var apk_path = build.findBestApkForArchitecture(buildResults, resolvedTarget.arch);
var launchName = appinfo.getActivityName();
+ var pkgName = appinfo.getPackageName();
console.log('Using apk: ' + apk_path);
- console.log('Installing app on device...');
- var cmd = 'adb -s ' + resolvedTarget.target + ' install -r "' + apk_path + '"';
- return exec(cmd, os.tmpdir())
+ console.log('Uninstalling ' + pkgName + ' from device...');
+ // This promise is always resolved, even if 'adb uninstall' fails to uninstall app
+ // or the app doesn't installed at all, so no error catching needed.
+ return exec('adb -s ' + resolvedTarget.target + ' uninstall ' + pkgName, os.tmpdir())
+ .then(function() {
+ console.log('Installing app on device...');
+ var cmd = 'adb -s ' + resolvedTarget.target + ' install -r -d "' + apk_path + '"';
+ return exec(cmd, os.tmpdir());
+ })
.then(function(output) {
if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/a265a614/bin/templates/cordova/lib/emulator.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/emulator.js b/bin/templates/cordova/lib/emulator.js
index 8fbdbc1..a27d0d3 100644
--- a/bin/templates/cordova/lib/emulator.js
+++ b/bin/templates/cordova/lib/emulator.js
@@ -326,31 +326,37 @@ module.exports.install = function(givenTarget, buildResults) {
// install the app
}).then(function () {
+ var pkgName = appinfo.getPackageName();
+ console.log('Uninstalling ' + pkgName + ' from emulator...');
+ // This promise is always resolved, even if 'adb uninstall' fails to uninstall app
+ // or the app doesn't installed at all, so no error catching needed.
+ return exec('adb -s ' + target.target + ' uninstall ' + pkgName, os.tmpdir())
+ .then(function() {
- var apk_path = build.findBestApkForArchitecture(buildResults, target.arch);
- var execOptions = {
- timeout: INSTALL_COMMAND_TIMEOUT, // in milliseconds
- killSignal: EXEC_KILL_SIGNAL
- };
-
- console.log('Installing app on emulator...');
- console.log('Using apk: ' + apk_path);
-
- var retriedInstall = retry.retryPromise(
- NUM_INSTALL_RETRIES,
- exec, 'adb -s ' + target.target + ' install -r -d "' + apk_path + '"', os.tmpdir(), execOptions
- );
-
- return retriedInstall.then(function (output) {
- if (output.match(/Failure/)) {
- return Q.reject('Failed to install apk to emulator: ' + output);
- } else {
- console.log('INSTALL SUCCESS');
- }
- }, function (err) {
- return Q.reject('Failed to install apk to emulator: ' + err);
- });
+ var apk_path = build.findBestApkForArchitecture(buildResults, target.arch);
+ var execOptions = {
+ timeout: INSTALL_COMMAND_TIMEOUT, // in milliseconds
+ killSignal: EXEC_KILL_SIGNAL
+ };
+
+ console.log('Installing app on emulator...');
+ console.log('Using apk: ' + apk_path);
+
+ var retriedInstall = retry.retryPromise(
+ NUM_INSTALL_RETRIES,
+ exec, 'adb -s ' + target.target + ' install -r -d "' + apk_path + '"', os.tmpdir(), execOptions
+ );
+ return retriedInstall.then(function (output) {
+ if (output.match(/Failure/)) {
+ return Q.reject('Failed to install apk to emulator: ' + output);
+ } else {
+ console.log('INSTALL SUCCESS');
+ }
+ }, function (err) {
+ return Q.reject('Failed to install apk to emulator: ' + err);
+ });
+ });
// unlock screen
}).then(function () {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[28/45] android commit: Refactoring based on feedback from Andrew
Posted by bo...@apache.org.
Refactoring based on feedback from Andrew
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/1f8a2319
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/1f8a2319
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/1f8a2319
Branch: refs/heads/5.0.x
Commit: 1f8a23193efc9db48ba53c7f6147cf36f590457d
Parents: 2cd5e3c
Author: Joe Bowser <bo...@apache.org>
Authored: Fri Aug 28 16:50:16 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Fri Aug 28 16:50:16 2015 -0700
----------------------------------------------------------------------
.../src/org/apache/cordova/CordovaActivity.java | 3 +-
.../org/apache/cordova/CordovaInterface.java | 3 +-
.../apache/cordova/CordovaInterfaceImpl.java | 32 ++++++++++++++++++--
.../src/org/apache/cordova/CordovaPlugin.java | 7 -----
.../src/org/apache/cordova/PluginManager.java | 22 --------------
5 files changed, 33 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1f8a2319/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 171e2a8..43e013b 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -493,8 +493,7 @@ public class CordovaActivity extends Activity {
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
int[] grantResults) {
- PluginManager pm = this.appView.getPluginManager();
- pm.onRequestPermissionResult(requestCode, permissions, grantResults);
+ cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1f8a2319/framework/src/org/apache/cordova/CordovaInterface.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterface.java b/framework/src/org/apache/cordova/CordovaInterface.java
index 3fa6e63..2aa0452 100755
--- a/framework/src/org/apache/cordova/CordovaInterface.java
+++ b/framework/src/org/apache/cordova/CordovaInterface.java
@@ -70,5 +70,6 @@ public interface CordovaInterface {
*/
public ExecutorService getThreadPool();
- public void requestPermission(CordovaPlugin plugin);
+ public void requestPermission(CordovaPlugin plugin, String permission);
+ public void requestPermissions(CordovaPlugin plugin);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1f8a2319/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
index 146bacb..7b436af 100644
--- a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
+++ b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -38,6 +38,7 @@ public class CordovaInterfaceImpl implements CordovaInterface {
protected ActivityResultHolder savedResult;
protected CordovaPlugin activityResultCallback;
+ protected CordovaPlugin permissionResultCallback;
protected String initCallbackService;
protected int activityResultRequestCode;
@@ -162,9 +163,36 @@ public class CordovaInterfaceImpl implements CordovaInterface {
}
}
- public void requestPermission(CordovaPlugin plugin)
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ public void onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) {
+ if(permissionResultCallback != null)
+ {
+ permissionResultCallback.onRequestPermissionResult(requestCode, permissions, grantResults);
+ permissionResultCallback = null;
+ }
+ }
+
+ public void requestPermission(CordovaPlugin plugin, String permission) {
+ permissionResultCallback = plugin;
+ String[] permissions = new String [1];
+ permissions[0] = permission;
+ int requestCode = 1;
+ getActivity().requestPermissions(permissions, requestCode);
+ }
+
+ public void requestPermissions(CordovaPlugin plugin)
{
- pluginManager.requestPermission(plugin);
+ permissionResultCallback = plugin;
+ String[] permissions = plugin.getPermissionRequest();
+ int requestCode = 1;
+ getActivity().requestPermissions(permissions, requestCode);
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1f8a2319/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java
index 6cb2a3c..6e82027 100644
--- a/framework/src/org/apache/cordova/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -372,13 +372,6 @@ public class CordovaPlugin {
return permissions;
}
- /**
- * requestPermission
- */
- public void requestPermission() {
- cordova.requestPermission(this);
- }
-
public boolean hasPermisssion() {
for(String p : permissions)
{
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1f8a2319/framework/src/org/apache/cordova/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java
index e543b04..3afbc18 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -511,26 +511,4 @@ public class PluginManager {
}
}
- /**
- * Called by the system when the user grants permissions
- *
- * @param requestCode
- * @param permissions
- * @param grantResults
- */
- public void onRequestPermissionResult(int requestCode, String[] permissions,
- int[] grantResults) {
- if(permissionRequester != null)
- {
- permissionRequester.onRequestPermissionResult(requestCode, permissions, grantResults);
- permissionRequester = null;
- }
- }
-
- public void requestPermission(CordovaPlugin plugin) {
- permissionRequester = plugin;
- String[] permissions = plugin.getPermissionRequest();
- int requestCode = 1;
- ctx.getActivity().requestPermissions(permissions, requestCode);
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[34/45] android commit: CB-8320: Setting up gradle so we can use
CordovaLib as a standard Android Library
Posted by bo...@apache.org.
CB-8320: Setting up gradle so we can use CordovaLib as a standard Android Library
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/53244863
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/53244863
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/53244863
Branch: refs/heads/5.0.x
Commit: 53244863be8d7751450cc507703b332043034222
Parents: 69d1423
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Jul 22 13:23:16 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:08:18 2015 -0700
----------------------------------------------------------------------
framework/build.gradle | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/53244863/framework/build.gradle
----------------------------------------------------------------------
diff --git a/framework/build.gradle b/framework/build.gradle
index 09b0908..a598faa 100644
--- a/framework/build.gradle
+++ b/framework/build.gradle
@@ -34,10 +34,8 @@ ext {
}
android {
- // compileSdkVersion cdvCompileSdkVersion
- // buildToolsVersion cdvBuildToolsVersion
- compileSdkVersion 'android-MNC'
- buildToolsVersion '23.0.0 rc3'
+ compileSdkVersion cdvCompileSdkVersion
+ buildToolsVersion cdvBuildToolsVersion
publishNonDefault true
compileOptions {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[20/45] android commit: CB-9430 Fixes check_reqs failure when javac
returns an extra line
Posted by bo...@apache.org.
CB-9430 Fixes check_reqs failure when javac returns an extra line
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/0b6909ad
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/0b6909ad
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/0b6909ad
Branch: refs/heads/5.0.x
Commit: 0b6909adebcac2aac835c9228408e2ffc10fb90d
Parents: 1aedc0c
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Fri Jul 31 16:37:21 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:40 2015 -0700
----------------------------------------------------------------------
bin/lib/check_reqs.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/0b6909ad/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index ffa35b6..9d25159 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -155,7 +155,8 @@ module.exports.check_java = function() {
// javac writes version info to stderr instead of stdout
return tryCommand('javac -version', msg, true);
}).then(function (output) {
- return /^javac ((?:\d+\.)+(?:\d+))/i.exec(output)[1];
+ var match = /javac ((?:\d+\.)+(?:\d+))/i.exec(output)[1];
+ return match && match[1];
});
});
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[39/45] android commit: Bump up to API level 23
Posted by bo...@apache.org.
Bump up to API level 23
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/e766eaed
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/e766eaed
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/e766eaed
Branch: refs/heads/5.0.x
Commit: e766eaed2826110cca3afd561c2efe9a7f91d804
Parents: e62696e
Author: Joe Bowser <bo...@apache.org>
Authored: Thu Aug 20 13:47:57 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:09:29 2015 -0700
----------------------------------------------------------------------
framework/project.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e766eaed/framework/project.properties
----------------------------------------------------------------------
diff --git a/framework/project.properties b/framework/project.properties
index 40ae82c..2342a16 100644
--- a/framework/project.properties
+++ b/framework/project.properties
@@ -10,7 +10,7 @@
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
-target=android-22
+target=android-23
apk-configurations=
renderscript.opt.level=O0
android.library=true
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[42/45] android commit: Adding a working build.gradle that skips our
code that can't handle non-numeric SDK targets
Posted by bo...@apache.org.
Adding a working build.gradle that skips our code that can't handle non-numeric SDK targets
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/507078a8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/507078a8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/507078a8
Branch: refs/heads/5.0.x
Commit: 507078a82c305a3397f04099dfb7bd70fd3de28d
Parents: 10c9132
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Jul 15 16:32:20 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:09:30 2015 -0700
----------------------------------------------------------------------
framework/build.gradle | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/507078a8/framework/build.gradle
----------------------------------------------------------------------
diff --git a/framework/build.gradle b/framework/build.gradle
index e4c182e..fed3a3d 100644
--- a/framework/build.gradle
+++ b/framework/build.gradle
@@ -38,8 +38,10 @@ ext {
}
android {
- compileSdkVersion cdvCompileSdkVersion
- buildToolsVersion cdvBuildToolsVersion
+ // compileSdkVersion cdvCompileSdkVersion
+ // buildToolsVersion cdvBuildToolsVersion
+ compileSdkVersion 'android-MNC'
+ buildToolsVersion '23.0.0 rc3'
publishNonDefault true
compileOptions {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[38/45] android commit: Got the PoC working with the Contacts plugin,
going to work through all the plugins
Posted by bo...@apache.org.
Got the PoC working with the Contacts plugin, going to work through all the plugins
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/e00cae12
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/e00cae12
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/e00cae12
Branch: refs/heads/5.0.x
Commit: e00cae122c246c7e8aa468460ff25ea7671d8ceb
Parents: d42c53b
Author: Joe Bowser <bo...@apache.org>
Authored: Mon Aug 31 15:32:53 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:09:29 2015 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/CordovaActivity.java | 11 ++++++++++-
framework/src/org/apache/cordova/CordovaInterface.java | 4 ++--
.../src/org/apache/cordova/CordovaInterfaceImpl.java | 10 +++++-----
framework/src/org/apache/cordova/CordovaPlugin.java | 11 ++---------
.../org/apache/cordova/engine/SystemWebChromeClient.java | 7 +++++--
5 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e00cae12/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 43e013b..868b243 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -493,7 +493,16 @@ public class CordovaActivity extends Activity {
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
int[] grantResults) {
- cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
+ try
+ {
+ cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
+ }
+ catch (JSONException e)
+ {
+ LOG.d(TAG, "JSONException: Parameters fed into the method are not valid");
+ e.printStackTrace();
+ }
+
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e00cae12/framework/src/org/apache/cordova/CordovaInterface.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterface.java b/framework/src/org/apache/cordova/CordovaInterface.java
index 2aa0452..4b43580 100755
--- a/framework/src/org/apache/cordova/CordovaInterface.java
+++ b/framework/src/org/apache/cordova/CordovaInterface.java
@@ -70,6 +70,6 @@ public interface CordovaInterface {
*/
public ExecutorService getThreadPool();
- public void requestPermission(CordovaPlugin plugin, String permission);
- public void requestPermissions(CordovaPlugin plugin);
+ public void requestPermission(CordovaPlugin plugin, int requestCode, String permission);
+ public void requestPermissions(CordovaPlugin plugin, int requestCode);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e00cae12/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
index 7b436af..ac31189 100644
--- a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
+++ b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -24,6 +24,8 @@ import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
+import org.json.JSONException;
+
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -171,7 +173,7 @@ public class CordovaInterfaceImpl implements CordovaInterface {
* @param grantResults
*/
public void onRequestPermissionResult(int requestCode, String[] permissions,
- int[] grantResults) {
+ int[] grantResults) throws JSONException {
if(permissionResultCallback != null)
{
permissionResultCallback.onRequestPermissionResult(requestCode, permissions, grantResults);
@@ -179,19 +181,17 @@ public class CordovaInterfaceImpl implements CordovaInterface {
}
}
- public void requestPermission(CordovaPlugin plugin, String permission) {
+ public void requestPermission(CordovaPlugin plugin, int requestCode, String permission) {
permissionResultCallback = plugin;
String[] permissions = new String [1];
permissions[0] = permission;
- int requestCode = 1;
getActivity().requestPermissions(permissions, requestCode);
}
- public void requestPermissions(CordovaPlugin plugin)
+ public void requestPermissions(CordovaPlugin plugin, int requestCode)
{
permissionResultCallback = plugin;
String[] permissions = plugin.getPermissionRequest();
- int requestCode = 1;
getActivity().requestPermissions(permissions, requestCode);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e00cae12/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java
index 6e82027..7dc18e3 100644
--- a/framework/src/org/apache/cordova/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -391,15 +391,8 @@ public class CordovaPlugin {
* @param permissions
* @param grantResults
*/
- public boolean onRequestPermissionResult(int requestCode, String[] permissions,
- int[] grantResults) {
+ public void onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) throws JSONException {
- for(int r:grantResults)
- {
- if(r == PackageManager.PERMISSION_DENIED)
- return false;
- }
-
- return true;
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e00cae12/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
index bca847b..d411421 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -21,6 +21,7 @@ package org.apache.cordova.engine;
import java.util.Arrays;
import android.annotation.TargetApi;
import android.app.Activity;
+import android.content.Context;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
@@ -63,13 +64,15 @@ public class SystemWebChromeClient extends WebChromeClient {
private View mVideoProgressView;
private CordovaDialogsHelper dialogsHelper;
+ private Context appContext;
private WebChromeClient.CustomViewCallback mCustomViewCallback;
private View mCustomView;
public SystemWebChromeClient(SystemWebViewEngine parentEngine) {
this.parentEngine = parentEngine;
- dialogsHelper = new CordovaDialogsHelper(parentEngine.webView.getContext());
+ appContext = parentEngine.webView.getContext();
+ dialogsHelper = new CordovaDialogsHelper(appContext);
}
/**
@@ -186,7 +189,7 @@ public class SystemWebChromeClient extends WebChromeClient {
CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("Geolocation");
if(geolocation != null && !geolocation.hasPermisssion())
{
- parentEngine.pluginManager.requestPermission(geolocation);
+ //cordova.requestPermissions(geolocation);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[27/45] android commit: Bump up to API level 23
Posted by bo...@apache.org.
Bump up to API level 23
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/2cd5e3cf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/2cd5e3cf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/2cd5e3cf
Branch: refs/heads/5.0.x
Commit: 2cd5e3cf0acc20a4a525a3c80d19d96f88778b55
Parents: a56f55b
Author: Joe Bowser <bo...@apache.org>
Authored: Thu Aug 20 13:47:57 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:41 2015 -0700
----------------------------------------------------------------------
framework/project.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/2cd5e3cf/framework/project.properties
----------------------------------------------------------------------
diff --git a/framework/project.properties b/framework/project.properties
index 40ae82c..2342a16 100644
--- a/framework/project.properties
+++ b/framework/project.properties
@@ -10,7 +10,7 @@
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
-target=android-22
+target=android-23
apk-configurations=
renderscript.opt.level=O0
android.library=true
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[16/45] android commit: CB-9389 Fixes build/check_reqs hang
Posted by bo...@apache.org.
CB-9389 Fixes build/check_reqs hang
This removes gradle version check since it requires downloading and
installing of gradle distributive if it is not installed yet.
Partial revert of 4bf705a
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/082e2990
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/082e2990
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/082e2990
Branch: refs/heads/5.0.x
Commit: 082e299003a3c03b0e750e6b6b636a534cab31b0
Parents: 67ba021
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Wed Jul 22 13:20:39 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:03 2015 -0700
----------------------------------------------------------------------
bin/lib/check_reqs.js | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/082e2990/bin/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/lib/check_reqs.js b/bin/lib/check_reqs.js
index d11a0d2..0b31a2a 100644
--- a/bin/lib/check_reqs.js
+++ b/bin/lib/check_reqs.js
@@ -82,15 +82,12 @@ module.exports.check_ant = function() {
// Returns a promise. Called only by build and clean commands.
module.exports.check_gradle = function() {
var sdkDir = process.env['ANDROID_HOME'];
- var message = 'Could not find gradle wrapper within Android SDK. ';
- if (!sdkDir) return Q.reject(message + 'Might need to install Android SDK or set up \'ADROID_HOME\' env variable.');
- var wrapper = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper', 'gradlew');
- return tryCommand('"' + wrapper + '" -v', message + 'Might need to update your Android SDK.\n' +
- 'Looked here: ' + path.dirname(wrapper))
- .then(function (output) {
- // Parse Gradle version from command output
- return/^gradle ((?:\d+\.)+(?:\d+))/gim.exec(output)[1];
- });
+ var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
+ if (!fs.existsSync(wrapperDir)) {
+ return Q.reject(new Error('Could not find gradle wrapper within android sdk. Might need to update your Android SDK.\n' +
+ 'Looked here: ' + wrapperDir));
+ }
+ return Q.when();
};
// Returns a promise.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[21/45] android commit: CB-9172 Improved emulator deploy stability.
This closes #188.
Posted by bo...@apache.org.
CB-9172 Improved emulator deploy stability. This closes #188.
- Use UUID to distinguish between launched emulators
- Wait for android.process.acore instead of init.svc.bootanim on emulator boot
- Increased retry timeout when installing app to the emulator
- If there is already a started/starting emulator, wait for it's boot instead of trying to deploy to it right away
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/1aedc0c0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/1aedc0c0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/1aedc0c0
Branch: refs/heads/5.0.x
Commit: 1aedc0c05913a68cf9756a0e47b3daefa73de7b4
Parents: fb4cc38
Author: alsorokin <al...@akvelon.com>
Authored: Fri Jul 3 11:26:11 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:40 2015 -0700
----------------------------------------------------------------------
bin/templates/cordova/lib/emulator.js | 70 +++++++++++++++---------------
bin/templates/cordova/lib/run.js | 4 +-
2 files changed, 39 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1aedc0c0/bin/templates/cordova/lib/emulator.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/emulator.js b/bin/templates/cordova/lib/emulator.js
index e81dd67..8fbdbc1 100644
--- a/bin/templates/cordova/lib/emulator.js
+++ b/bin/templates/cordova/lib/emulator.js
@@ -33,7 +33,8 @@ var child_process = require('child_process');
// constants
var ONE_SECOND = 1000; // in milliseconds
-var INSTALL_COMMAND_TIMEOUT = 120 * ONE_SECOND; // in milliseconds
+var ONE_MINUTE = 60 * ONE_SECOND; // in milliseconds
+var INSTALL_COMMAND_TIMEOUT = 5 * ONE_MINUTE; // in milliseconds
var NUM_INSTALL_RETRIES = 3;
var EXEC_KILL_SIGNAL = 'SIGKILL';
@@ -146,19 +147,18 @@ module.exports.list_targets = function() {
/*
* Starts an emulator with the given ID,
* and returns the started ID of that emulator.
- * If no ID is given it will used the first image available,
+ * If no ID is given it will use the first image available,
* if no image is available it will error out (maybe create one?).
*
* Returns a promise.
*/
module.exports.start = function(emulator_ID) {
var self = this;
- var emulator_id, num_started, started_emulators;
+ var now = new Date();
+ var uuid = 'cordova_emulator_' + now.getTime();
+ var emulator_id;
- return self.list_started()
- .then(function(list) {
- started_emulators = list;
- num_started = started_emulators.length;
+ return Q().then(function(list) {
if (!emulator_ID) {
return self.list_images()
.then(function(emulator_list) {
@@ -182,24 +182,17 @@ module.exports.start = function(emulator_ID) {
}
}).then(function() {
var cmd = 'emulator';
- var args = ['-avd', emulator_ID];
+ var uuidProp = 'emu.uuid=' + uuid;
+ var args = ['-avd', emulator_ID, '-prop', uuidProp];
var proc = child_process.spawn(cmd, args, { stdio: 'inherit', detached: true });
proc.unref(); // Don't wait for it to finish, since the emulator will probably keep running for a long time.
}).then(function() {
// wait for emulator to start
console.log('Waiting for emulator...');
- return self.wait_for_emulator(num_started);
- }).then(function(new_started) {
- if (new_started.length > 1) {
- for (var i in new_started) {
- if (started_emulators.indexOf(new_started[i]) < 0) {
- emulator_id = new_started[i];
- }
- }
- } else {
- emulator_id = new_started[0];
- }
- if (!emulator_id) return Q.reject('ERROR : Failed to start emulator, could not find new emulator');
+ return self.wait_for_emulator(uuid);
+ }).then(function(emId) {
+ emulator_id = emId;
+ if (!emulator_id) return Q.reject('ERROR : Failed to start emulator');
//wait for emulator to boot up
process.stdout.write('Booting up emulator (this may take a while)...');
@@ -216,31 +209,40 @@ module.exports.start = function(emulator_ID) {
};
/*
- * Waits for the new emulator to apear on the started-emulator list.
- * Returns a promise with a list of newly started emulators' IDs.
+ * Waits for an emulator with given uuid to apear on the started-emulator list.
+ * Returns a promise with this emulator's ID.
*/
-module.exports.wait_for_emulator = function(num_running) {
+module.exports.wait_for_emulator = function(uuid) {
var self = this;
return self.list_started()
.then(function(new_started) {
- if (new_started.length > num_running) {
- return new_started;
- } else {
- return Q.delay(1000).then(function() {
- return self.wait_for_emulator(num_running);
- });
- }
- });
+ var emulator_id = null;
+ var promises = [];
+
+ new_started.forEach(function (emulator) {
+ promises.push(exec('adb -s ' + emulator + ' shell getprop emu.uuid', os.tmpdir())
+ .then(function (output) {
+ if (output.indexOf(uuid) >= 0) {
+ emulator_id = emulator;
+ }
+ })
+ );
+ });
+
+ return Q.all(promises).then(function () {
+ return emulator_id || self.wait_for_emulator(uuid);
+ });
+ });
};
/*
- * Waits for the boot animation property of the emulator to switch to 'stopped'
+ * Waits for the core android process of the emulator to start
*/
module.exports.wait_for_boot = function(emulator_id) {
var self = this;
- return exec('adb -s ' + emulator_id + ' shell getprop init.svc.bootanim', os.tmpdir())
+ return exec('adb -s ' + emulator_id + ' shell ps', os.tmpdir())
.then(function(output) {
- if (output.match(/stopped/)) {
+ if (output.match(/android\.process\.acore/)) {
return;
} else {
process.stdout.write('.');
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/1aedc0c0/bin/templates/cordova/lib/run.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/run.js b/bin/templates/cordova/lib/run.js
index 7f15448..e6e00b0 100644
--- a/bin/templates/cordova/lib/run.js
+++ b/bin/templates/cordova/lib/run.js
@@ -139,7 +139,9 @@ var path = require('path'),
}).then(function(resolvedTarget) {
return build.run(buildFlags, resolvedTarget).then(function(buildResults) {
if (resolvedTarget.isEmulator) {
- return emulator.install(resolvedTarget, buildResults);
+ return emulator.wait_for_boot(resolvedTarget.target).then(function () {
+ return emulator.install(resolvedTarget, buildResults);
+ });
}
return device.install(resolvedTarget, buildResults);
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[45/45] android commit: Update JS snapshot to version 5.0.0 (via coho)
Posted by bo...@apache.org.
Update JS snapshot to version 5.0.0 (via coho)
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/a6008593
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/a6008593
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/a6008593
Branch: refs/heads/5.0.x
Commit: a60085935699d2905fa8d81ddaec07e345a9c599
Parents: 1854571
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Sep 23 12:50:02 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Wed Sep 23 12:51:07 2015 -0700
----------------------------------------------------------------------
bin/templates/project/assets/www/cordova.js | 227 +++++++++++++++++++----
1 file changed, 192 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/a6008593/bin/templates/project/assets/www/cordova.js
----------------------------------------------------------------------
diff --git a/bin/templates/project/assets/www/cordova.js b/bin/templates/project/assets/www/cordova.js
index 9503a3d..a999c49 100644
--- a/bin/templates/project/assets/www/cordova.js
+++ b/bin/templates/project/assets/www/cordova.js
@@ -1,5 +1,5 @@
// Platform: android
-// a83e94b489774dc8e514671e81c6154eda650af1
+// 064b25a40aab8fc2f210fdbb394d63c31e7d3e6d
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -19,7 +19,7 @@
under the License.
*/
;(function() {
-var PLATFORM_VERSION_BUILD_LABEL = '4.2.0-dev';
+var PLATFORM_VERSION_BUILD_LABEL = '5.0.0';
// file: src/scripts/require.js
/*jshint -W079 */
@@ -101,7 +101,9 @@ if (typeof module === "object" && typeof require === "function") {
// file: src/cordova.js
define("cordova", function(require, exports, module) {
-if(window.cordova){
+// Workaround for Windows 10 in hosted environment case
+// http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object
+if (window.cordova && !(window.cordova instanceof HTMLElement)) {
throw new Error("cordova already defined");
}
@@ -328,7 +330,7 @@ module.exports = cordova;
});
-// file: D:/cordova/cordova-android/cordova-js-src/android/nativeapiprovider.js
+// file: /Users/jbowser/cordova/cordova-android/cordova-js-src/android/nativeapiprovider.js
define("cordova/android/nativeapiprovider", function(require, exports, module) {
/**
@@ -351,7 +353,7 @@ module.exports = {
});
-// file: D:/cordova/cordova-android/cordova-js-src/android/promptbasednativeapi.js
+// file: /Users/jbowser/cordova/cordova-android/cordova-js-src/android/promptbasednativeapi.js
define("cordova/android/promptbasednativeapi", function(require, exports, module) {
/**
@@ -376,7 +378,6 @@ module.exports = {
// file: src/common/argscheck.js
define("cordova/argscheck", function(require, exports, module) {
-var exec = require('cordova/exec');
var utils = require('cordova/utils');
var moduleExports = module.exports;
@@ -861,7 +862,7 @@ module.exports = channel;
});
-// file: D:/cordova/cordova-android/cordova-js-src/exec.js
+// file: /Users/jbowser/cordova/cordova-android/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) {
/**
@@ -1230,6 +1231,7 @@ if (!window.console.warn) {
// Register pause, resume and deviceready channels as events on document.
channel.onPause = cordova.addDocumentEventHandler('pause');
channel.onResume = cordova.addDocumentEventHandler('resume');
+channel.onActivated = cordova.addDocumentEventHandler('activated');
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
// Listen for DOMContentLoaded and notify our channel subscribers.
@@ -1291,10 +1293,12 @@ define("cordova/init_b", function(require, exports, module) {
var channel = require('cordova/channel');
var cordova = require('cordova');
+var modulemapper = require('cordova/modulemapper');
var platform = require('cordova/platform');
+var pluginloader = require('cordova/pluginloader');
var utils = require('cordova/utils');
-var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady];
+var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady];
// setting exec
cordova.exec = require('cordova/exec');
@@ -1357,6 +1361,7 @@ if (!window.console.warn) {
// Register pause, resume and deviceready channels as events on document.
channel.onPause = cordova.addDocumentEventHandler('pause');
channel.onResume = cordova.addDocumentEventHandler('resume');
+channel.onActivated = cordova.addDocumentEventHandler('activated');
channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
// Listen for DOMContentLoaded and notify our channel subscribers.
@@ -1378,10 +1383,19 @@ if (window._nativeReady) {
// Call the platform-specific initialization.
platform.bootstrap && platform.bootstrap();
+// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js.
+// The delay allows the attached modules to be defined before the plugin loader looks for them.
+setTimeout(function() {
+ pluginloader.load(function() {
+ channel.onPluginsReady.fire();
+ });
+}, 0);
+
/**
* Create all cordova objects once native side is ready.
*/
channel.join(function() {
+ modulemapper.mapModules(window);
platform.initialize && platform.initialize();
@@ -1500,7 +1514,104 @@ exports.reset();
});
-// file: D:/cordova/cordova-android/cordova-js-src/platform.js
+// file: src/common/modulemapper_b.js
+define("cordova/modulemapper_b", function(require, exports, module) {
+
+var builder = require('cordova/builder'),
+ symbolList = [],
+ deprecationMap;
+
+exports.reset = function() {
+ symbolList = [];
+ deprecationMap = {};
+};
+
+function addEntry(strategy, moduleName, symbolPath, opt_deprecationMessage) {
+ symbolList.push(strategy, moduleName, symbolPath);
+ if (opt_deprecationMessage) {
+ deprecationMap[symbolPath] = opt_deprecationMessage;
+ }
+}
+
+// Note: Android 2.3 does have Function.bind().
+exports.clobbers = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.merges = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) {
+ addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
+};
+
+exports.runs = function(moduleName) {
+ addEntry('r', moduleName, null);
+};
+
+function prepareNamespace(symbolPath, context) {
+ if (!symbolPath) {
+ return context;
+ }
+ var parts = symbolPath.split('.');
+ var cur = context;
+ for (var i = 0, part; part = parts[i]; ++i) {
+ cur = cur[part] = cur[part] || {};
+ }
+ return cur;
+}
+
+exports.mapModules = function(context) {
+ var origSymbols = {};
+ context.CDV_origSymbols = origSymbols;
+ for (var i = 0, len = symbolList.length; i < len; i += 3) {
+ var strategy = symbolList[i];
+ var moduleName = symbolList[i + 1];
+ var module = require(moduleName);
+ // <runs/>
+ if (strategy == 'r') {
+ continue;
+ }
+ var symbolPath = symbolList[i + 2];
+ var lastDot = symbolPath.lastIndexOf('.');
+ var namespace = symbolPath.substr(0, lastDot);
+ var lastName = symbolPath.substr(lastDot + 1);
+
+ var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
+ var parentObj = prepareNamespace(namespace, context);
+ var target = parentObj[lastName];
+
+ if (strategy == 'm' && target) {
+ builder.recursiveMerge(target, module);
+ } else if ((strategy == 'd' && !target) || (strategy != 'd')) {
+ if (!(symbolPath in origSymbols)) {
+ origSymbols[symbolPath] = target;
+ }
+ builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
+ }
+ }
+};
+
+exports.getOriginalSymbol = function(context, symbolPath) {
+ var origSymbols = context.CDV_origSymbols;
+ if (origSymbols && (symbolPath in origSymbols)) {
+ return origSymbols[symbolPath];
+ }
+ var parts = symbolPath.split('.');
+ var obj = context;
+ for (var i = 0; i < parts.length; ++i) {
+ obj = obj && obj[parts[i]];
+ }
+ return obj;
+};
+
+exports.reset();
+
+
+});
+
+// file: /Users/jbowser/cordova/cordova-android/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) {
module.exports = {
@@ -1576,7 +1687,7 @@ function onMessageFromNative(msg) {
});
-// file: D:/cordova/cordova-android/cordova-js-src/plugin/android/app.js
+// file: /Users/jbowser/cordova/cordova-android/cordova-js-src/plugin/android/app.js
define("cordova/plugin/android/app", function(require, exports, module) {
var exec = require('cordova/exec');
@@ -1781,6 +1892,54 @@ exports.load = function(callback) {
});
+// file: src/common/pluginloader_b.js
+define("cordova/pluginloader_b", function(require, exports, module) {
+
+var modulemapper = require('cordova/modulemapper');
+
+// Handler for the cordova_plugins.js content.
+// See plugman's plugin_loader.js for the details of this object.
+function handlePluginsObject(moduleList) {
+ // if moduleList is not defined or empty, we've nothing to do
+ if (!moduleList || !moduleList.length) {
+ return;
+ }
+
+ // Loop through all the modules and then through their clobbers and merges.
+ for (var i = 0, module; module = moduleList[i]; i++) {
+ if (module.clobbers && module.clobbers.length) {
+ for (var j = 0; j < module.clobbers.length; j++) {
+ modulemapper.clobbers(module.id, module.clobbers[j]);
+ }
+ }
+
+ if (module.merges && module.merges.length) {
+ for (var k = 0; k < module.merges.length; k++) {
+ modulemapper.merges(module.id, module.merges[k]);
+ }
+ }
+
+ // Finally, if runs is truthy we want to simply require() the module.
+ if (module.runs) {
+ modulemapper.runs(module.id);
+ }
+ }
+}
+
+// Loads all plugins' js-modules. Plugin loading is syncronous in browserified bundle
+// but the method accepts callback to be compatible with non-browserify flow.
+// onDeviceReady is blocked on onPluginsReady. onPluginsReady is fired when there are
+// no plugins to load, or they are all done.
+exports.load = function(callback) {
+ var moduleList = require("cordova/plugin_list");
+ handlePluginsObject(moduleList);
+
+ callback();
+};
+
+
+});
+
// file: src/common/urlutil.js
define("cordova/urlutil", function(require, exports, module) {
@@ -1860,15 +2019,14 @@ utils.typeName = function(val) {
/**
* Returns an indication of whether the argument is an array or not
*/
-utils.isArray = function(a) {
- return utils.typeName(a) == 'Array';
-};
+utils.isArray = Array.isArray ||
+ function(a) {return utils.typeName(a) == 'Array';};
/**
* Returns an indication of whether the argument is a Date or not
*/
utils.isDate = function(d) {
- return utils.typeName(d) == 'Date';
+ return (d instanceof Date);
};
/**
@@ -1902,17 +2060,25 @@ utils.clone = function(obj) {
* Returns a wrapped version of the function
*/
utils.close = function(context, func, params) {
- if (typeof params == 'undefined') {
- return function() {
- return func.apply(context, arguments);
- };
- } else {
- return function() {
- return func.apply(context, params);
- };
- }
+ return function() {
+ var args = params || arguments;
+ return func.apply(context, args);
+ };
};
+//------------------------------------------------------------------------------
+function UUIDcreatePart(length) {
+ var uuidpart = "";
+ for (var i=0; i<length; i++) {
+ var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
+ if (uuidchar.length == 1) {
+ uuidchar = "0" + uuidchar;
+ }
+ uuidpart += uuidchar;
+ }
+ return uuidpart;
+}
+
/**
* Create a UUID
*/
@@ -1924,6 +2090,7 @@ utils.createUUID = function() {
UUIDcreatePart(6);
};
+
/**
* Extends a child object from a parent object using classical inheritance
* pattern.
@@ -1933,6 +2100,7 @@ utils.extend = (function() {
var F = function() {};
// extend Child from Parent
return function(Child, Parent) {
+
F.prototype = Parent.prototype;
Child.prototype = new F();
Child.__super__ = Parent.prototype;
@@ -1952,18 +2120,7 @@ utils.alert = function(msg) {
};
-//------------------------------------------------------------------------------
-function UUIDcreatePart(length) {
- var uuidpart = "";
- for (var i=0; i<length; i++) {
- var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
- if (uuidchar.length == 1) {
- uuidchar = "0" + uuidchar;
- }
- uuidpart += uuidchar;
- }
- return uuidpart;
-}
+
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[22/45] android commit: CB-9404 Fixed an exception when path
contained -debug or -release
Posted by bo...@apache.org.
CB-9404 Fixed an exception when path contained -debug or -release
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/fb4cc38e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/fb4cc38e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/fb4cc38e
Branch: refs/heads/5.0.x
Commit: fb4cc38e9d27d83f9c346045c6bf22aab12f2961
Parents: 17440a4
Author: alsorokin <al...@akvelon.com>
Authored: Thu Jul 23 18:55:11 2015 +0300
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:40 2015 -0700
----------------------------------------------------------------------
bin/templates/cordova/lib/build.js | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/fb4cc38e/bin/templates/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/cordova/lib/build.js b/bin/templates/cordova/lib/build.js
index aa9f3d0..bbcf171 100644
--- a/bin/templates/cordova/lib/build.js
+++ b/bin/templates/cordova/lib/build.js
@@ -69,12 +69,13 @@ function isAutoGenerated(file) {
function findOutputApksHelper(dir, build_type, arch) {
var ret = findApks(dir).filter(function(candidate) {
+ var apkName = path.basename(candidate);
// Need to choose between release and debug .apk.
if (build_type === 'debug') {
- return /-debug/.exec(candidate) && !/-unaligned|-unsigned/.exec(candidate);
+ return /-debug/.exec(apkName) && !/-unaligned|-unsigned/.exec(apkName);
}
if (build_type === 'release') {
- return /-release/.exec(candidate) && !/-unaligned/.exec(candidate);
+ return /-release/.exec(apkName) && !/-unaligned/.exec(apkName);
}
return true;
});
@@ -83,16 +84,16 @@ function findOutputApksHelper(dir, build_type, arch) {
return ret;
}
// Assume arch-specific build if newest apk has -x86 or -arm.
- var archSpecific = !!/-x86|-arm/.exec(ret[0]);
+ var archSpecific = !!/-x86|-arm/.exec(path.basename(ret[0]));
// And show only arch-specific ones (or non-arch-specific)
ret = ret.filter(function(p) {
/*jshint -W018 */
- return !!/-x86|-arm/.exec(p) == archSpecific;
+ return !!/-x86|-arm/.exec(path.basename(p)) == archSpecific;
/*jshint +W018 */
});
if (archSpecific && ret.length > 1) {
ret = ret.filter(function(p) {
- return p.indexOf('-' + arch) != -1;
+ return path.basename(p).indexOf('-' + arch) != -1;
});
}
@@ -632,16 +633,18 @@ module.exports.detectArchitecture = function(target) {
module.exports.findBestApkForArchitecture = function(buildResults, arch) {
var paths = buildResults.apkPaths.filter(function(p) {
+ var apkName = path.basename(p);
if (buildResults.buildType == 'debug') {
- return /-debug/.exec(p);
+ return /-debug/.exec(apkName);
}
- return !/-debug/.exec(p);
+ return !/-debug/.exec(apkName);
});
var archPattern = new RegExp('-' + arch);
var hasArchPattern = /-x86|-arm/;
for (var i = 0; i < paths.length; ++i) {
- if (hasArchPattern.exec(paths[i])) {
- if (archPattern.exec(paths[i])) {
+ var apkName = path.basename(paths[i]);
+ if (hasArchPattern.exec(apkName)) {
+ if (archPattern.exec(apkName)) {
return paths[i];
}
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[37/45] android commit: Refactoring based on feedback from Andrew
Posted by bo...@apache.org.
Refactoring based on feedback from Andrew
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/d42c53b0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/d42c53b0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/d42c53b0
Branch: refs/heads/5.0.x
Commit: d42c53b0c7fb04f372fa711dd0481c33be5bf0fe
Parents: e766eae
Author: Joe Bowser <bo...@apache.org>
Authored: Fri Aug 28 16:50:16 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:09:29 2015 -0700
----------------------------------------------------------------------
.../src/org/apache/cordova/CordovaActivity.java | 3 +-
.../org/apache/cordova/CordovaInterface.java | 3 +-
.../apache/cordova/CordovaInterfaceImpl.java | 32 ++++++++++++++++++--
.../src/org/apache/cordova/CordovaPlugin.java | 7 -----
.../src/org/apache/cordova/PluginManager.java | 22 --------------
5 files changed, 33 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d42c53b0/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 171e2a8..43e013b 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -493,8 +493,7 @@ public class CordovaActivity extends Activity {
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
int[] grantResults) {
- PluginManager pm = this.appView.getPluginManager();
- pm.onRequestPermissionResult(requestCode, permissions, grantResults);
+ cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d42c53b0/framework/src/org/apache/cordova/CordovaInterface.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterface.java b/framework/src/org/apache/cordova/CordovaInterface.java
index 3fa6e63..2aa0452 100755
--- a/framework/src/org/apache/cordova/CordovaInterface.java
+++ b/framework/src/org/apache/cordova/CordovaInterface.java
@@ -70,5 +70,6 @@ public interface CordovaInterface {
*/
public ExecutorService getThreadPool();
- public void requestPermission(CordovaPlugin plugin);
+ public void requestPermission(CordovaPlugin plugin, String permission);
+ public void requestPermissions(CordovaPlugin plugin);
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d42c53b0/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
index 146bacb..7b436af 100644
--- a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
+++ b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -38,6 +38,7 @@ public class CordovaInterfaceImpl implements CordovaInterface {
protected ActivityResultHolder savedResult;
protected CordovaPlugin activityResultCallback;
+ protected CordovaPlugin permissionResultCallback;
protected String initCallbackService;
protected int activityResultRequestCode;
@@ -162,9 +163,36 @@ public class CordovaInterfaceImpl implements CordovaInterface {
}
}
- public void requestPermission(CordovaPlugin plugin)
+ /**
+ * Called by the system when the user grants permissions
+ *
+ * @param requestCode
+ * @param permissions
+ * @param grantResults
+ */
+ public void onRequestPermissionResult(int requestCode, String[] permissions,
+ int[] grantResults) {
+ if(permissionResultCallback != null)
+ {
+ permissionResultCallback.onRequestPermissionResult(requestCode, permissions, grantResults);
+ permissionResultCallback = null;
+ }
+ }
+
+ public void requestPermission(CordovaPlugin plugin, String permission) {
+ permissionResultCallback = plugin;
+ String[] permissions = new String [1];
+ permissions[0] = permission;
+ int requestCode = 1;
+ getActivity().requestPermissions(permissions, requestCode);
+ }
+
+ public void requestPermissions(CordovaPlugin plugin)
{
- pluginManager.requestPermission(plugin);
+ permissionResultCallback = plugin;
+ String[] permissions = plugin.getPermissionRequest();
+ int requestCode = 1;
+ getActivity().requestPermissions(permissions, requestCode);
}
}
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d42c53b0/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java
index 6cb2a3c..6e82027 100644
--- a/framework/src/org/apache/cordova/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -372,13 +372,6 @@ public class CordovaPlugin {
return permissions;
}
- /**
- * requestPermission
- */
- public void requestPermission() {
- cordova.requestPermission(this);
- }
-
public boolean hasPermisssion() {
for(String p : permissions)
{
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d42c53b0/framework/src/org/apache/cordova/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java
index e543b04..3afbc18 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -511,26 +511,4 @@ public class PluginManager {
}
}
- /**
- * Called by the system when the user grants permissions
- *
- * @param requestCode
- * @param permissions
- * @param grantResults
- */
- public void onRequestPermissionResult(int requestCode, String[] permissions,
- int[] grantResults) {
- if(permissionRequester != null)
- {
- permissionRequester.onRequestPermissionResult(requestCode, permissions, grantResults);
- permissionRequester = null;
- }
- }
-
- public void requestPermission(CordovaPlugin plugin) {
- permissionRequester = plugin;
- String[] permissions = plugin.getPermissionRequest();
- int requestCode = 1;
- ctx.getActivity().requestPermissions(permissions, requestCode);
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[40/45] android commit: Working on getting the Geolocation Plugin to
work by default with the default WebView. Crosswalk will need to make similar
modifications.
Posted by bo...@apache.org.
Working on getting the Geolocation Plugin to work by default with the default WebView. Crosswalk will need to make similar modifications.
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/10c91326
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/10c91326
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/10c91326
Branch: refs/heads/5.0.x
Commit: 10c913268555f5f7745e3d70419ee0efaf1afd96
Parents: e00cae1
Author: Joe Bowser <bo...@apache.org>
Authored: Fri Sep 18 13:52:12 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:09:30 2015 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/engine/SystemWebChromeClient.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/10c91326/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
index d411421..9faae29 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -189,7 +189,7 @@ public class SystemWebChromeClient extends WebChromeClient {
CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("Geolocation");
if(geolocation != null && !geolocation.hasPermisssion())
{
- //cordova.requestPermissions(geolocation);
+ geolocation.cordova.requestPermissions(geolocation, 0);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[23/45] android commit: CB-8320: Setting up gradle so we can use
CordovaLib as a standard Android Library
Posted by bo...@apache.org.
CB-8320: Setting up gradle so we can use CordovaLib as a standard Android Library
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/17440a45
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/17440a45
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/17440a45
Branch: refs/heads/5.0.x
Commit: 17440a453f78d12bd70ea72973a51e3663c58fc5
Parents: 78a2951
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Jul 22 13:23:16 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:40 2015 -0700
----------------------------------------------------------------------
framework/build.gradle | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/17440a45/framework/build.gradle
----------------------------------------------------------------------
diff --git a/framework/build.gradle b/framework/build.gradle
index 70954d6..4d6f36c 100644
--- a/framework/build.gradle
+++ b/framework/build.gradle
@@ -39,11 +39,16 @@ buildscript {
}
}
apply plugin: 'android-library'
+
+ext {
+ apply from: 'cordova.gradle'
+ cdvCompileSdkVersion = privateHelpers.getProjectTarget()
+ cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
+}
+
android {
- // compileSdkVersion cdvCompileSdkVersion
- // buildToolsVersion cdvBuildToolsVersion
- compileSdkVersion 'android-MNC'
- buildToolsVersion '23.0.0 rc3'
+ compileSdkVersion cdvCompileSdkVersion
+ buildToolsVersion cdvBuildToolsVersion
publishNonDefault true
compileOptions {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[10/45] android commit: CB-9394 Updated RELEASENOTES
Posted by bo...@apache.org.
CB-9394 Updated RELEASENOTES
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/3a1d5a1b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/3a1d5a1b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/3a1d5a1b
Branch: refs/heads/5.0.x
Commit: 3a1d5a1bd30866e1ca3293cd631b251949a74b87
Parents: 29ff540
Author: Nikhil Khandelwal <ni...@microsoft.com>
Authored: Mon Jul 20 09:40:18 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:02 2015 -0700
----------------------------------------------------------------------
RELEASENOTES.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3a1d5a1b/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 6a343d8..401564e 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -19,6 +19,71 @@
#
-->
## Release Notes for Cordova (Android) ##
+Update these notes using: git log --pretty=format:'* %s' --topo-order --no-merges *remote*/4.1.x...HEAD
+
+### Release 4.1.0 (Jul 2014) ###
+* CB-9392 Fixed printing flavored versions. This closes #184.
+* CB-9382 [Android] Fix KeepRunning setting when Plugin activity is showed. This closes #200
+* CB-9391 Fixes cdvBuildMultipleApks option casting
+* CB-9343 Split the Content-Type to obtain a clean mimetype
+* CB-9255 Make getUriType case insensitive.
+* CB-9149 Fixes JSHint issue introduced by 899daa9
+* CB-9372: Remove unused files: 'main.js' & 'master.css'. This closes #198
+* CB-9149 Make gradle alias subprojects in order to handle libs that depend on libs. This closes #182
+* Update min SDK version to 14
+* Update licenses. This closes #190
+* CB-9185 Fix signed release build exception. This closes #193.
+* CB-9286 Fixes build failure when ANDROID_HOME is not set.
+* CB-9284 Fix for handling absolute path for keystore in build.json
+* CB-9260 Install Android-22 on Travis-CI
+* Adding .ratignore file.
+* CB-9119 Adding lib/retry.js for retrying promise-returning functions. Retrying 'adb install' in emulator.js because it sometimes hangs.
+* CB-9115 android: Grant Lollipop permission req
+* Remove extra console message
+* CB-8898 Report expected gradle location properly
+* CB-8898 Fixes gradle check failure due to missing quotes
+* CB-9080: -d option is not supported on Android 4.1.1 and lower, removing
+* CB-8954 Adds `requirements` command support to check_reqs module
+* Update JS snapshot to version 4.1.0-dev (via coho)
+* Updating Release Notes
+* CB-8417 updated platform specific files from cordova.js repo
+* Adding tests to confirm that preferences aren't changed by Intents
+* updating existing test code
+* Forgot to remove the method that copied over the intent data
+* Getting around to removing this old Intent code
+* Update JS snapshot to version 4.1.0-dev (via coho)
+* Fix CordovaPluginTest on KitKat (start-up events seem to change)
+* CB-3360 Allow setting a custom User-Agent (close #162)
+* CB-8902 Use immersive mode when available when going fullscreen (close #175)
+* Make BridgeMode methods public (they were always supposed to be)
+* Simplify: EncodingUtils.getBytes(str) -> str.getBytes()
+* Don't show warning when gradlew file is read-only
+* Don't show warning when prepEnv copies gradlew and it's read-only
+* Make gradle wrapper prepEnv code work even when android-sdk is read-only
+* CB-8897 Delete drawable/icon.png since it duplicates drawable-mdpi/icon.png
+* Updating the template to target mininumSdkTarget=14
+* CB-8894: Updating the template to target mininumSdkTarget=14
+* CB-8891 Add a note about when the gradle helpers were added
+* CB-8891 Add a gradle helper for retrieving config.xml preference values
+* CB-8884 Delete Eclipse tweaks from create script
+* CB-8834 Don't fail to install on VERSION_DOWNGRADE
+* Update JS snapshot to version 4.1.0-dev (via coho)
+* Set VERSION to 4.1.0-dev (via coho)
+* Set VERSION to 4.0.2 (via coho)
+* Update JS snapshot to version 4.0.2 (via coho)
+* Automated tools fail, and you have to remember all four places where this is set.
+* Update the package.json
+* CB-9042 coho failed to update version, so here we are
+* CB9042 - Updating Release Notes
+* Adding tests to confirm that preferences aren't changed by Intents
+* updating existing test code
+* Forgot to remove the method that copied over the intent data
+* Getting around to removing this old Intent code
+* Set VERSION to 4.0.1 (via coho)
+* Update JS snapshot to version 4.0.1 (via coho)
+* CB-8834 Don't fail to install on VERSION_DOWNGRADE
+* Set VERSION to 4.0.0 (via coho)
+* Update JS snapshot to version 4.0.0 (via coho)
### Release 4.0.2 (May 2015) ###
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[35/45] android commit: Finally got it kinda working,
Geolocation is not going to work in browser anymore
Posted by bo...@apache.org.
Finally got it kinda working, Geolocation is not going to work in browser anymore
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/e62696e7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/e62696e7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/e62696e7
Branch: refs/heads/5.0.x
Commit: e62696e72e36a62304f39ecf3a8fae5148a36072
Parents: d3044f3
Author: Joe Bowser <bo...@apache.org>
Authored: Tue Jul 14 14:58:55 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Sep 21 18:09:24 2015 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/CordovaPlugin.java | 4 +++-
.../src/org/apache/cordova/engine/SystemWebChromeClient.java | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e62696e7/framework/src/org/apache/cordova/CordovaPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPlugin.java b/framework/src/org/apache/cordova/CordovaPlugin.java
index 8ca1dd1..6cb2a3c 100644
--- a/framework/src/org/apache/cordova/CordovaPlugin.java
+++ b/framework/src/org/apache/cordova/CordovaPlugin.java
@@ -41,7 +41,7 @@ public class CordovaPlugin {
public CordovaInterface cordova;
protected CordovaPreferences preferences;
private String serviceName;
- private String [] permissions;
+ protected String [] permissions;
/**
* Call this after constructing to initialize the plugin.
@@ -387,6 +387,8 @@ public class CordovaPlugin {
return false;
}
}
+
+ return true;
}
/**
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/e62696e7/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
index 8c02bfa..bca847b 100755
--- a/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
+++ b/framework/src/org/apache/cordova/engine/SystemWebChromeClient.java
@@ -183,7 +183,7 @@ public class SystemWebChromeClient extends WebChromeClient {
super.onGeolocationPermissionsShowPrompt(origin, callback);
callback.invoke(origin, true, false);
//Get the plugin, it should be loaded
- CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("org.apache.cordova.geolocation.PermissionHandler");
+ CordovaPlugin geolocation = parentEngine.pluginManager.getPlugin("Geolocation");
if(geolocation != null && !geolocation.hasPermisssion())
{
parentEngine.pluginManager.requestPermission(geolocation);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[24/45] android commit: CB-9428 update script now bumps up
minSdkVersion to 14 if it is less than that.
Posted by bo...@apache.org.
CB-9428 update script now bumps up minSdkVersion to 14 if it is less than that.
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/4126d3ec
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/4126d3ec
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/4126d3ec
Branch: refs/heads/5.0.x
Commit: 4126d3ecfeed50f344ddc81ea52f3e54207d84d7
Parents: 0b6909a
Author: Steve Gill <st...@gmail.com>
Authored: Fri Jul 31 16:32:41 2015 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 14:22:40 2015 -0700
----------------------------------------------------------------------
bin/lib/create.js | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4126d3ec/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 0815870..e804b6e 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -290,12 +290,31 @@ function extractProjectNameFromManifest(projectPath) {
return m[1];
}
+// Cordova-android updates sometimes drop support for older versions. Need to update minSDK in existing projects.
+function updateMinSDKInManifest(projectPath) {
+ var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
+ var manifestData = fs.readFileSync(manifestPath, 'utf8');
+ var minSDKVersion = 14;
+
+ //grab minSdkVersion from Android.
+ var m = /android:minSdkVersion\s*=\s*"(.*?)"/i.exec(manifestData);
+ if (!m) {
+ throw new Error('Could not find minSDKVersion in ' + manifestPath);
+ }
+ //if minSDKVersion in Android.manifest is less than our current min, replace it
+ if(Number(m[1]) < minSDKVersion) {
+ console.log('Updating minSdkVersion from ' + m[1] + ' to ' + minSDKVersion + ' in AndroidManifest.xml');
+ shell.sed('-i', /android:minSdkVersion\s*=\s*"(.*?)"/, 'android:minSdkVersion="'+minSDKVersion+'"', manifestPath);
+ }
+}
+
// Returns a promise.
exports.updateProject = function(projectPath, shared) {
return Q()
.then(function() {
var projectName = extractProjectNameFromManifest(projectPath);
var target_api = check_reqs.get_target();
+ updateMinSDKInManifest(projectPath);
copyJsAndLibrary(projectPath, shared, projectName);
copyScripts(projectPath);
copyBuildRules(projectPath);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[12/45] android commit: CB-9343 Split the Content-Type to obtain a
clean mimetype
Posted by bo...@apache.org.
CB-9343 Split the Content-Type to obtain a clean mimetype
This closes #197
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/662429ad
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/662429ad
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/662429ad
Branch: refs/heads/5.0.x
Commit: 662429ad98d828aa70704c552de9019ed46f9a6f
Parents: c5557f7
Author: Simon Pireyn <sp...@gmail.com>
Authored: Thu Jul 9 20:00:10 2015 +0200
Committer: Joe Bowser <bo...@apache.org>
Committed: Thu Aug 20 13:48:02 2015 -0700
----------------------------------------------------------------------
framework/src/org/apache/cordova/CordovaResourceApi.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/662429ad/framework/src/org/apache/cordova/CordovaResourceApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java b/framework/src/org/apache/cordova/CordovaResourceApi.java
index 0390bb0..e725e25 100644
--- a/framework/src/org/apache/cordova/CordovaResourceApi.java
+++ b/framework/src/org/apache/cordova/CordovaResourceApi.java
@@ -188,7 +188,11 @@ public class CordovaResourceApi {
HttpURLConnection conn = (HttpURLConnection)new URL(uri.toString()).openConnection();
conn.setDoInput(false);
conn.setRequestMethod("HEAD");
- return conn.getHeaderField("Content-Type");
+ String mimeType = conn.getHeaderField("Content-Type");
+ if (mimeType != null) {
+ mimeType = mimeType.split(";")[0];
+ }
+ return mimeType;
} catch (IOException e) {
}
}
@@ -283,6 +287,9 @@ public class CordovaResourceApi {
HttpURLConnection conn = (HttpURLConnection)new URL(uri.toString()).openConnection();
conn.setDoInput(true);
String mimeType = conn.getHeaderField("Content-Type");
+ if (mimeType != null) {
+ mimeType = mimeType.split(";")[0];
+ }
int length = conn.getContentLength();
InputStream inputStream = conn.getInputStream();
return new OpenForReadResult(uri, inputStream, mimeType, length, null);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org