Closes #16430: ExternalAppBrowserActivity should not handle incoming intents

upstream-sync
Christian Sadilek 4 years ago committed by Sebastian Kaspari
parent 2fb7383684
commit 0fbc8410a4

@ -397,8 +397,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
*/
final override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
intent ?: return
intent?.let {
handleNewIntent(it)
}
}
open fun handleNewIntent(intent: Intent) {
// Diagnostic breadcrumb for "Display already aquired" crash:
// https://github.com/mozilla-mobile/android-components/issues/7960
breadcrumb(

@ -4,6 +4,7 @@
package org.mozilla.fenix.customtabs
import android.content.Intent
import androidx.navigation.NavDestination
import androidx.navigation.NavDirections
import kotlinx.android.synthetic.main.activity_home.*
@ -50,6 +51,10 @@ open class ExternalAppBrowserActivity : HomeActivity() {
// No-op for external app
}
override fun handleNewIntent(intent: Intent) {
// No-op for external app
}
override fun getNavDirections(
from: BrowserDirection,
customTabSessionId: String?

@ -7,6 +7,7 @@ package org.mozilla.fenix.customtabs
import android.content.Intent
import android.os.Bundle
import androidx.navigation.NavDirections
import io.mockk.Called
import io.mockk.every
import io.mockk.mockk
import io.mockk.spyk
@ -58,6 +59,15 @@ class ExternalAppBrowserActivityTest {
verify(exactly = 0) { activity.openToBrowser(BrowserDirection.FromGlobal, null) }
}
@Test
fun `handleNewIntent does nothing for external app browser activity`() {
val activity = spyk(ExternalAppBrowserActivity())
val intent: Intent = mockk(relaxed = true)
activity.handleNewIntent(intent)
verify { intent wasNot Called }
}
@Test
fun `getNavDirections finishes activity if session ID is null`() {
val activity = spyk(object : ExternalAppBrowserActivity() {

Loading…
Cancel
Save