diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index be1750d5ca..65efb553ac 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -108,7 +108,14 @@ android:taskAffinity="" android:windowSoftInputMode="adjustResize|stateAlwaysHidden" /> - + + diff --git a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt index ed60886e6c..8d86a5484b 100644 --- a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt @@ -57,6 +57,15 @@ class IntentReceiverActivity : Activity() { modeDependentProcessors + NewTabShortcutIntentProcessor() + // Explicitly remove the new task and clear task flags (Our browser activity is a single + // task activity and we never want to start a second task here). + intent.flags = intent.flags and Intent.FLAG_ACTIVITY_NEW_TASK.inv() + intent.flags = intent.flags and Intent.FLAG_ACTIVITY_CLEAR_TASK.inv() + + // IntentReceiverActivity is started with the "excludeFromRecents" flag (set in manifest). We + // do not want to propagate this flag from the intent receiver activity to the browser. + intent.flags = intent.flags and Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS.inv() + // Call process for side effects, short on the first that returns true intentProcessors.any { it.process(intent) } @@ -66,8 +75,8 @@ class IntentReceiverActivity : Activity() { intent.setClassName(applicationContext, intentProcessorType.activityClassName) intent.putExtra(HomeActivity.OPEN_TO_BROWSER, intentProcessorType.shouldOpenToBrowser(intent)) - // finish() before starting another activity. Don't keep this on the activities back stack. - finish() startActivity(intent) + // must finish() after starting the other activity + finish() } } diff --git a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt index adb770c4fc..db1e49364a 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BaseBrowserFragment.kt @@ -191,7 +191,6 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session }, openInFenixIntent = Intent(context, IntentReceiverActivity::class.java).apply { action = Intent.ACTION_VIEW - flags = Intent.FLAG_ACTIVITY_NEW_TASK }, bookmarkTapped = { lifecycleScope.launch { bookmarkTapped(it) } }, scope = lifecycleScope,