From b83610a6534d556c0378c634195197112baddcdd Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Mon, 24 Jun 2013 11:31:32 -0700 Subject: [PATCH] CB-3949: Adding code to mitigate broken intents with the application installer --- .../src/org/apache/cordova/CordovaActivity.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index 1b7ff5a4..a68e5469 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);