Bug 1165856 - Nightly app does not appear in task switcher when opening external links

This commit is contained in:
Martyn Haigh 2015-05-20 10:08:41 +01:00
parent 0ec7e4ecd9
commit 8492c318fa
2 changed files with 14 additions and 8 deletions

View File

@ -254,8 +254,7 @@
<!-- The main reason for the Tab Queue build flag is to not mess with the VIEW intent filter
before the rest of the plumbing is in place -->
<service android:name="org.mozilla.gecko.tabqueue.TabQueueService"
android:taskAffinity="@ANDROID_PACKAGE_NAME@.TABQUEUE" />
<service android:name="org.mozilla.gecko.tabqueue.TabQueueService" />
<activity android:name="org.mozilla.gecko.tabqueue.TabQueuePrompt"
android:launchMode="singleTop"
@ -265,6 +264,7 @@
android:label="@MOZ_APP_DISPLAYNAME@"
android:launchMode="singleTask"
android:excludeFromRecents="true"
android:taskAffinity="@ANDROID_PACKAGE_NAME@.TABQUEUE"
android:theme="@style/TabQueueActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

View File

@ -11,7 +11,6 @@ import org.mozilla.gecko.GeckoSharedPrefs;
import org.mozilla.gecko.Locales;
import org.mozilla.gecko.mozglue.ContextUtils;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.sync.setup.activities.WebURLFinder;
import android.content.Intent;
import android.os.Bundle;
@ -33,17 +32,24 @@ public class TabQueueDispatcher extends Locales.LocaleAwareActivity {
GeckoAppShell.ensureCrashHandling();
ContextUtils.SafeIntent intent = new ContextUtils.SafeIntent(getIntent());
// The EXCLUDE_FROM_RECENTS flag is sticky
// (see http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.0_r1/com/android/server/am/ActivityRecord.java/#468)
// So let's remove this whilst keeping all other flags the same, otherwise BrowserApp will vanish from Recents!
Intent intent = getIntent();
int flags = intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
intent.setFlags(flags);
ContextUtils.SafeIntent safeIntent = new ContextUtils.SafeIntent(intent);
// For the moment lets exit early and start fennec as normal if we're not in nightly with
// the tab queue build flag.
if (!AppConstants.MOZ_ANDROID_TAB_QUEUE || !AppConstants.NIGHTLY_BUILD) {
loadNormally(intent.getUnsafe());
loadNormally(safeIntent.getUnsafe());
return;
}
// The URL is usually hiding somewhere in the extra text. Extract it.
final String dataString = intent.getDataString();
final String dataString = safeIntent.getDataString();
if (TextUtils.isEmpty(dataString)) {
abortDueToNoURL(dataString);
return;
@ -52,9 +58,9 @@ public class TabQueueDispatcher extends Locales.LocaleAwareActivity {
boolean shouldShowOpenInBackgroundToast = GeckoSharedPrefs.forApp(this).getBoolean(GeckoPreferences.PREFS_TAB_QUEUE, false);
if (shouldShowOpenInBackgroundToast) {
showToast(intent.getUnsafe());
showToast(safeIntent.getUnsafe());
} else {
loadNormally(intent.getUnsafe());
loadNormally(safeIntent.getUnsafe());
}
}