From e90ddb1f386b791036cacf7ca2f265e4b417a7ae Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Wed, 16 Sep 2020 16:29:01 +0200 Subject: [PATCH] [fenix] Issue https://github.com/mozilla-mobile/fenix/issues/14225: Remove task when finishing ExternalAppBrowserActivity. --- .../org/mozilla/fenix/customtabs/CustomTabsIntegration.kt | 2 +- .../mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt | 2 +- .../fenix/customtabs/ExternalAppBrowserActivityTest.kt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt index 452f1b0d61..d34b038dda 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/CustomTabsIntegration.kt @@ -89,7 +89,7 @@ class CustomTabsIntegration( menuItemIndex = START_OF_MENU_ITEMS_INDEX, window = activity.window, shareListener = { onItemTapped.invoke(ToolbarMenu.Item.Share) }, - closeListener = { activity.finish() } + closeListener = { activity.finishAndRemoveTask() } ) override fun start() = feature.start() diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt b/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt index 40c64d5bd9..f7dc5dbc12 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivity.kt @@ -44,7 +44,7 @@ open class ExternalAppBrowserActivity : HomeActivity() { customTabSessionId: String? ): NavDirections? { if (customTabSessionId == null) { - finish() + finishAndRemoveTask() return null } diff --git a/app/src/test/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivityTest.kt b/app/src/test/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivityTest.kt index 33393e224c..a0b117af87 100644 --- a/app/src/test/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivityTest.kt +++ b/app/src/test/java/org/mozilla/fenix/customtabs/ExternalAppBrowserActivityTest.kt @@ -58,10 +58,10 @@ class ExternalAppBrowserActivityTest { var directions = activity.getNavDirections(BrowserDirection.FromGlobal, "id") assertNotNull(directions) - verify(exactly = 0) { activity.finish() } + verify(exactly = 0) { activity.finishAndRemoveTask() } directions = activity.getNavDirections(BrowserDirection.FromGlobal, null) assertNull(directions) - verify { activity.finish() } + verify { activity.finishAndRemoveTask() } } }