Bug 1318633 - Check launch intent action to determine skip new startup page tab or not, r=sebastian draft
authormaliu <max@mxli.us>
Thu, 24 Nov 2016 17:02:28 +0800
changeset 443323 7d29f84295d5f58dd76b61cb7328c0ee8d34ec8f
parent 442420 097b3595fb739cff8af432f63916dfb02a6400e2
child 538026 d44a365039a9d05328b2bc71595e2928b278cb4b
push id36963
push userbmo:max@mxli.us
push dateThu, 24 Nov 2016 09:07:34 +0000
reviewerssebastian
bugs1318633
milestone53.0a1
Bug 1318633 - Check launch intent action to determine skip new startup page tab or not, r=sebastian MozReview-Commit-ID: 4DAYikBnzz2
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
@@ -1483,20 +1483,19 @@ public abstract class GeckoApp
     }
 
     /**
      * Loads the initial tab at Fennec startup. If we don't restore tabs, this
      * tab will be about:home, or the homepage if the user has set one.
      * If we've temporarily disabled restoring to break out of a crash loop, we'll show
      * the Recent Tabs folder of the Combined History panel, so the user can manually
      * restore tabs as needed.
-     * If we restore tabs, we don't need to create a new tab.
      */
     protected void loadStartupTab(final int flags) {
-        if (!mShouldRestore) {
+        if (flags != Tabs.LOADURL_NONE) {
             if (mLastSessionCrashed) {
                 // The Recent Tabs panel no longer exists, but BrowserApp will redirect us
                 // to the Recent Tabs folder of the Combined History panel.
                 Tabs.getInstance().loadUrl(AboutPages.getURLForBuiltinPanelType(PanelType.DEPRECATED_RECENT_TABS), flags);
             } else {
                 final String homepage = getHomepage();
                 Tabs.getInstance().loadUrl(!TextUtils.isEmpty(homepage) ? homepage : AboutPages.HOME, flags);
             }
@@ -1591,17 +1590,23 @@ public abstract class GeckoApp
                     if (isFirstTab) {
                         flags |= Tabs.LOADURL_FIRST_AFTER_ACTIVITY_UNHIDDEN;
                     }
                     loadStartupTab(passedUri, intent, flags);
                 }
             });
         } else {
             if (!mIsRestoringActivity) {
-                loadStartupTab(Tabs.LOADURL_NEW_TAB);
+                final int flags;
+                if (Intent.ACTION_MAIN.equals(action)) {
+                    flags = Tabs.LOADURL_NONE;
+                } else {
+                    flags = Tabs.LOADURL_NEW_TAB;
+                }
+                loadStartupTab(flags);
             }
 
             Tabs.getInstance().notifyListeners(null, Tabs.TabEvents.RESTORED);
 
             processTabQueue();
         }
 
         recordStartupActionTelemetry(passedUri, action);