From b095f86cbf938f25ac7d451943837e05a2bd61fb Mon Sep 17 00:00:00 2001 From: Colin Lee Date: Fri, 31 May 2019 17:03:58 -0500 Subject: [PATCH] [fenix] No issue: Store the Custom Tab Session ID to avoid a crash (https://github.com/mozilla-mobile/fenix/pull/3062) --- .../java/org/mozilla/fenix/browser/BrowserFragment.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt index e9ee1bf9df..3e9bda34c8 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt @@ -547,6 +547,16 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope { } } + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + outState.putString(KEY_CUSTOM_TAB_SESSION_ID, customTabSessionId) + } + + override fun onViewStateRestored(savedInstanceState: Bundle?) { + super.onViewStateRestored(savedInstanceState) + customTabSessionId = savedInstanceState?.getString(KEY_CUSTOM_TAB_SESSION_ID) + } + override fun onStop() { super.onStop() sessionObserver?.let { @@ -823,6 +833,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope { companion object { private const val SHARED_TRANSITION_MS = 200L private const val TAB_ITEM_TRANSITION_NAME = "tab_item" + private const val KEY_CUSTOM_TAB_SESSION_ID = "custom_tab_session_id" private const val REQUEST_CODE_DOWNLOAD_PERMISSIONS = 1 private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2 private const val REQUEST_CODE_APP_PERMISSIONS = 3