cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [1/2] android commit: CB-3949: Adding code to mitigate broken intents with the application installer
Date Mon, 24 Jun 2013 18:32:04 GMT
Updated Branches:
  refs/heads/master 9cb14838e -> 7e15ff930


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/master
Commit: b83610a6534d556c0378c634195197112baddcdd
Parents: b032dcc
Author: Joe Bowser <bowserj@apache.org>
Authored: Mon Jun 24 11:31:32 2013 -0700
Committer: Joe Bowser <bowserj@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);


Mime
View raw message