Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #24040: App should not crash when the search widget is clicked wh…
Browse files Browse the repository at this point in the history
…ile PIP mode is active (#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 <[email protected]>

Co-authored-by: indu <[email protected]>
  • Loading branch information
Mugurell and indurs authored May 27, 2022
1 parent ab36146 commit 666c839
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/src/main/java/org/mozilla/fenix/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 666c839

Please sign in to comment.