Bug 1359531 - Part 7 - Don't ignore last selected tab for Intent.ACTION_MAIN. r?sebastian, walkingice draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 05 May 2017 20:31:15 +0200
changeset 582515 cc45edff37ea657a45346e14eb88934a5fd29978
parent 582514 6526cb9fc61a427fa2ed4a6d0e19bc05531f7d92
child 582516 1e917efd731c8721a91c983d77110942bb6aaf54
push id60121
push usermozilla@buttercookie.de
push dateMon, 22 May 2017 19:37:24 +0000
reviewerssebastian, walkingice
bugs1359531
milestone55.0a1
Bug 1359531 - Part 7 - Don't ignore last selected tab for Intent.ACTION_MAIN. r?sebastian, walkingice Normally, receiving a new intent means we want to switch tabs/open a new tab, so we need to turn off our "last selected tab in this activity" logic, however this is not true when we receive a simple Intent.ACTION_MAIN, e.g. when we're being brought into the foreground from a launcher icon (as opposed to the activity/task switcher). MozReview-Commit-ID: ExiM3c8iaEA
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -2145,30 +2145,31 @@ public abstract class GeckoApp extends G
         }
     }
 
     @Override
     protected void onNewIntent(Intent externalIntent) {
         super.onNewIntent(externalIntent);
 
         final SafeIntent intent = new SafeIntent(externalIntent);
+        final String action = intent.getAction();
 
         final boolean isFirstTab = !mWasFirstTabShownAfterActivityUnhidden;
         mWasFirstTabShownAfterActivityUnhidden = true; // Reset since we'll be loading a tab.
-        mIgnoreLastSelectedTab = true;
+        if (!Intent.ACTION_MAIN.equals(action)) {
+            mIgnoreLastSelectedTab = true;
+        }
 
         // if we were previously OOM killed, we can end up here when launching
         // from external shortcuts, so set this as the intent for initialization
         if (!mInitialized) {
             setIntent(externalIntent);
             return;
         }
 
-        final String action = intent.getAction();
-
         final String uri = getURIFromIntent(intent);
         final String passedUri;
         if (!TextUtils.isEmpty(uri)) {
             passedUri = uri;
         } else {
             passedUri = null;
         }