You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/06/28 18:00:59 UTC

[39/50] [abbrv] android commit: CB-3949: Adding code to mitigate broken intents with the application installer

CB-3949: Adding code to mitigate broken intents with the application installer


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/b83610a6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/b83610a6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/b83610a6

Branch: refs/heads/2.9.x
Commit: b83610a6534d556c0378c634195197112baddcdd
Parents: b032dcc
Author: Joe Bowser <bo...@apache.org>
Authored: Mon Jun 24 11:31:32 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Mon Jun 24 11:31:32 2013 -0700

----------------------------------------------------------------------
 framework/src/org/apache/cordova/CordovaActivity.java | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/b83610a6/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 1b7ff5a..a68e546 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -250,6 +250,19 @@ public class CordovaActivity extends Activity implements CordovaInterface {
         }
     }
 
+    //CB-3949: Workaround for weird Android Launcher Bug!
+    private void checkIntents()
+    {
+        Intent intent = getIntent();
+        String intentAction = intent.getAction();
+        if (!isTaskRoot() && intent.hasCategory(Intent.CATEGORY_LAUNCHER) && intentAction != null) {
+            if(intentAction.equals(Intent.ACTION_MAIN)) {
+                Log.d("Cordova", "This isn't the root activity. Clearing it and returning to the root activity.");
+                finish();
+                return;
+            }
+        }
+    }
     /**
      * Called when the activity is first created.
      *
@@ -258,6 +271,7 @@ public class CordovaActivity extends Activity implements CordovaInterface {
     @SuppressWarnings("deprecation")
     @Override
     public void onCreate(Bundle savedInstanceState) {
+        checkIntents();
         Config.init(this);
         LOG.d(TAG, "CordovaActivity.onCreate()");
         super.onCreate(savedInstanceState);