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
--- 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;
}