title: How to not separate task when entering picture in picture mode
body: <p>I am creating a media player application and I would like to support picture in picture. My problem is whenever I enter PIP, the player activity separates itself from the previous activity and such.</p>
  
  <p><a href="https://i.stack.imgur.com/Wz4Tr.png" rel="nofollow noreferrer">Screenshot: multiple tasks</a></p>
  
  <p>Here is my activity declaration:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;activity
              android:name=".ui.player.PlayerActivity"
              android:allowTaskReparenting="true"
              android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
              android:exported="true"
              android:icon="@mipmap/ic_launcher"
              android:label="@string/player"
              android:launchMode="singleTask"
              android:roundIcon="@mipmap/ic_launcher_round"
              android:supportsPictureInPicture="true"&gt;
  </code></pre>
  
  <p>Here is the code that I use to enter PIP:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>    override fun onUserLeaveHint() {
          enterPictureInPicture()
      }
  
      private fun enterPictureInPicture() {
          val player = manager.currentPlayer
          if (player is SimpleExoPlayer) {
              val format = player.videoFormat
              val params = PictureInPictureParams.Builder()
                  .setAspectRatio(format?.let { Rational(it.width, it.height) } ?: Rational(16, 9))
                  .build()
              enterPictureInPictureMode(params)
          }
      }
  </code></pre>