[fenix] For https://github.com/mozilla-mobile/fenix/issues/24040: App should not crash when the search widget is clicked while PIP mode is active (https://github.com/mozilla-mobile/fenix/pull/25410)

When the search event is from the search widget while PIP is active, the search fragment opens after the screen is unlocked. This avoids the issue of the search page opening in landscape mode and also the app doesn't crash.

Co-Authored-By: Mugurell <Mugurell@users.noreply.github.com>

Co-authored-by: indu <indu@ramkystech.com>
pull/600/head
Mugurell 2 years ago committed by GitHub
parent 27a979c45c
commit 54f5cd82aa

@ -52,6 +52,7 @@ import mozilla.components.concept.storage.BookmarkNode
import mozilla.components.concept.storage.BookmarkNodeType
import mozilla.components.concept.storage.HistoryMetadataKey
import mozilla.components.feature.contextmenu.DefaultSelectionActionDelegate
import mozilla.components.feature.media.ext.findActiveMediaTab
import mozilla.components.feature.privatemode.notification.PrivateNotificationFeature
import mozilla.components.feature.search.BrowserStoreSearchAdapter
import mozilla.components.service.fxa.sync.SyncReason
@ -511,6 +512,11 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
)
)
val tab = components.core.store.state.findActiveMediaTab()
if (tab != null) {
components.useCases.sessionUseCases.exitFullscreen(tab.id)
}
val intentProcessors =
listOf(
CrashReporterIntentProcessor(components.appStore)

@ -1321,7 +1321,7 @@ abstract class BaseBrowserFragment :
* Exit fullscreen mode when exiting PIP mode
*/
private fun pipModeChanged(session: SessionState) {
if (!session.content.pictureInPictureEnabled && session.content.fullScreen) {
if (!session.content.pictureInPictureEnabled && session.content.fullScreen && isAdded) {
onBackPressed()
fullScreenChanged(false)
}

Loading…
Cancel
Save