Bug 1318633 - Check launch intent action to determine skip new startup page tab or not, r=sebastian
MozReview-Commit-ID: 4DAYikBnzz2
--- 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);