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

Commit

Permalink
For #18727: Exit PiP when launched externally with Intents
Browse files Browse the repository at this point in the history
  • Loading branch information
czlucius committed Aug 31, 2021
1 parent 6034adc commit 7f159cb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/main/java/org/mozilla/fenix/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package org.mozilla.fenix
import android.content.Context
import android.content.Intent
import android.content.Intent.ACTION_MAIN
import android.content.Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
import android.content.res.Configuration
import android.os.Build
import android.os.Bundle
Expand Down Expand Up @@ -188,6 +189,12 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
super.onCreate(savedInstanceState)
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && isInPictureInPictureMode && intent != null) {
// Exit PiP mode
moveTaskToBack(false)
startActivity(Intent(this, this::class.java).setFlags(FLAG_ACTIVITY_REORDER_TO_FRONT))
}

// Diagnostic breadcrumb for "Display already aquired" crash:
// https://github.com/mozilla-mobile/android-components/issues/7960
breadcrumb(
Expand Down

0 comments on commit 7f159cb

Please sign in to comment.