The app close the custom tab.
The app crashes.
This issue occurs because the way that we are handling the custom tab session id. When we receive a request for a custom tab we are creating a new session but we are not storing it on disk, it just on memory. Then when we switch an Android permission from ON to OFF the app gets restarted and we loose the custom tab session object, the crash happens when we try to use the custom tab session id on the new sessionManager that doesn't contain it.
https://github.com/mozilla-mobile/fenix/blob/75ccce23dce2809ceb1573bfad1752a4e875ff71/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt#L687
Stack trace
java.lang.IllegalArgumentException: Required value was null.
at org.mozilla.fenix.browser.BrowserFragment.getSessionById(BrowserFragment.kt:686)
at org.mozilla.fenix.browser.BrowserFragment.onCreateView(BrowserFragment.kt:137)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2612)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:874)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1228)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1293)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2646)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2600)
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:2639)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:897)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1228)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1293)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2646)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2600)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1391)
at android.app.Activity.performStart(Activity.java:7165)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2975)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Would like to re-test after other crashes are fixed.
@Amejia481 Can we re-test this now?
Sure!
@bifleming The crash doesn't happen, but the custom tab transforms itself in a normal browser, but with functionality, it doesn't show the website anymore.

The screenshot looks similar to #3644, could be related.
Yep looks the same as #3644. I closed that one for this one because we have clear STR here. Thanks for testing @Amejia481 ! Do you think this is something that has to be fixed in AC?
Sorry for the delay, I missed your comment, @ekager I believe it happens because of https://github.com/mozilla-mobile/fenix/issues/2383#issuecomment-491005106
No worries! Yeah I understand that comment but I guess my question was more should Fenix be handling saving the custom tab when the activity is recreated? Or is this something that should change in AC?
No worries! Yeah I understand that comment but I guess my question was more should Fenix be handling saving the custom tab when the activity is recreated? Or is this something that should change in AC?
This should probably be something a-c handles since all browsers would be affected by this.
This is blocked on landing a fix for it by mozilla-mobile/fenix#5041
This is the fix we need to land: https://github.com/mozilla-mobile/reference-browser/pull/894
@jonalmeida is this fixed now, then?
I cannot reproduce this issue, and based on all of the comments before this, I believe we should close this.
I am able to reproduce the blank issue using the latest version of Firefox Preview Nightly 2/7 #20380605.
Steps to reproduce:
Actual result
A blank page is displayed. This time is not opened in the browser, it seems to remain in custom tab but still blank as in https://github.com/mozilla-mobile/fenix/issues/2383#issuecomment-505974349.
Devices:
Till I have more information from the dev. team, I'll let the ticket open and remove the qa:needed flag, thanks.
@jonalmeida Do you know who can help us in AC? How can we get this fix pushed forward?
This is blocked on landing a fix for it by #5041
This is the fix we need to land: mozilla-mobile/reference-browser#894
From my comment, we can use the fix there.
This seems to be ready to work on
Perform additional testing on Nightly 6/12 with Android versions that I have available:
@sflorean will retest to make sure this is fixed, or if we need to work on it.
Wasn't able to reproduce either with Google Pixel 3 (Android 11 Beta) following the steps from video.