cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [31/50] [abbrv] git commit: CB-5487: Remote Debugging is on when your Android app is debuggable.
Date Wed, 22 Jan 2014 19:38:42 GMT
CB-5487: Remote Debugging is on when your Android app is debuggable.


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/8b67088c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/8b67088c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/8b67088c

Branch: refs/heads/master
Commit: 8b67088c9f3c0128c8044e92a744a12baf358423
Parents: bbac797
Author: Joe Bowser <bowserj@apache.org>
Authored: Fri Nov 29 15:54:07 2013 -0800
Committer: Joe Bowser <bowserj@apache.org>
Committed: Wed Jan 22 11:37:19 2014 -0800

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaWebView.java  | 27 +++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/8b67088c/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 9e70a9d..767ea00 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -38,6 +38,9 @@ import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
 import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
@@ -334,7 +337,7 @@ public class CordovaWebView extends AmazonWebView {
         // while we do this
         if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
             Level16Apis.enableUniversalAccess(settings);
-                
+        
         if (getWebViewBackend(this.cordova.getFactory()) == WebViewBackend.ANDROID) {
         	File appCacheDir = this.cordova.getActivity().getDir(APPCACHE_DIR, Context.MODE_PRIVATE);
             if (appCacheDir.exists()) {
@@ -364,6 +367,28 @@ public class CordovaWebView extends AmazonWebView {
             // enable the local storage database normally with the Chromium back-end
             settings.setDatabaseEnabled(true);
         }
+        
+        
+        //Determine whether we're in debug or release mode, and turn on Debugging!
+        try {
+            final String packageName = this.cordova.getActivity().getPackageName();
+            final PackageManager pm = this.cordova.getActivity().getPackageManager();
+            ApplicationInfo appInfo;
+            
+            appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_META_DATA);
+            
+            if((appInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0 &&  
+                android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
+            {
+                setWebContentsDebuggingEnabled(true);
+            }
+        } catch (IllegalArgumentException e) {
+            Log.d(TAG, "You have one job! To turn on Remote Web Debugging! YOU HAVE FAILED!
");
+            e.printStackTrace();
+        } catch (NameNotFoundException e) {
+            Log.d(TAG, "This should never happen: Your application's package can't be found.");
+            e.printStackTrace();
+        }  
 
         // Enable DOM storage
         settings.setDomStorageEnabled(true);


Mime
View raw message