Skip to content

Commit

Permalink
Add logcat to verify issue 184664890
Browse files Browse the repository at this point in the history
  • Loading branch information
luizgrp committed Apr 7, 2021
1 parent 596d081 commit 828f1cf
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@

package com.example.android.pictureinpicture

import android.app.PendingIntent
import android.app.PictureInPictureParams
import android.app.RemoteAction
import android.app.*
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.res.Configuration
import android.graphics.drawable.Icon
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.util.Rational
import android.view.View
import android.widget.Button
Expand Down Expand Up @@ -178,6 +178,7 @@ class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
registerActivityLifecycleCallbacks()
setContentView(R.layout.activity_main)

// View references
Expand Down Expand Up @@ -268,6 +269,42 @@ class MainActivity : AppCompatActivity() {
}
}

private fun registerActivityLifecycleCallbacks() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
registerActivityLifecycleCallbacks(object : Application.ActivityLifecycleCallbacks {
private val TAG = MainActivity::class.java.simpleName

override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
Log.d(TAG, "onActivityCreated: [isInPictureInPictureMode=$isInPictureInPictureMode]")
}

override fun onActivityStarted(activity: Activity) {
Log.d(TAG, "onActivityStarted: [isInPictureInPictureMode=$isInPictureInPictureMode]")
}

override fun onActivityResumed(activity: Activity) {
Log.d(TAG, "onActivityResumed: [isInPictureInPictureMode=$isInPictureInPictureMode]")
}

override fun onActivityPaused(activity: Activity) {
Log.d(TAG, "onActivityPaused: [isInPictureInPictureMode=$isInPictureInPictureMode] [isFinishing=$isFinishing]")
}

override fun onActivityStopped(activity: Activity) {
Log.d(TAG, "onActivityStopped: [isInPictureInPictureMode=$isInPictureInPictureMode] [isFinishing=$isFinishing]")
}

override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
Log.d(TAG, "onActivitySaveInstanceState: [isInPictureInPictureMode=$isInPictureInPictureMode]")
}

override fun onActivityDestroyed(activity: Activity) {
Log.d(TAG, "onActivityDestroyed: [isInPictureInPictureMode=$isInPictureInPictureMode]")
}
})
}
}

/**
* Launches [MediaSessionPlaybackActivity] and closes this activity.
*/
Expand Down
52 changes: 52 additions & 0 deletions documents/REPORT.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
### Scenario: launch player, go to Pip, dismiss Pip (dragging to the bottom)

##### Android 10
```
2021-04-07 14:22:35.434 18884-18884/com.example.android.pictureinpicture D/MainActivity: onActivityStarted: [isInPictureInPictureMode=false]
2021-04-07 14:22:35.438 18884-18884/com.example.android.pictureinpicture D/MainActivity: onActivityResumed: [isInPictureInPictureMode=false]
2021-04-07 14:22:59.436 18884-18884/com.example.android.pictureinpicture D/MainActivity: onActivityPaused: [isInPictureInPictureMode=true] [isFinishing=false]
2021-04-07 14:23:04.868 18884-18884/com.example.android.pictureinpicture D/MainActivity: onActivityStopped: [isInPictureInPictureMode=false] [isFinishing=false]
2021-04-07 14:23:04.898 18884-18884/com.example.android.pictureinpicture D/MainActivity: onActivitySaveInstanceState: [isInPictureInPictureMode=false]
```

##### Android 11

```
2021-04-07 14:24:22.956 10452-10452/com.example.android.pictureinpicture D/MainActivity: onActivityStarted: [isInPictureInPictureMode=false]
2021-04-07 14:24:22.959 10452-10452/com.example.android.pictureinpicture D/MainActivity: onActivityResumed: [isInPictureInPictureMode=false]
2021-04-07 14:24:34.530 10452-10452/com.example.android.pictureinpicture D/MainActivity: onActivityPaused: [isInPictureInPictureMode=true] [isFinishing=false]
2021-04-07 14:24:38.336 10452-10452/com.example.android.pictureinpicture D/MainActivity: onActivityStopped: [isInPictureInPictureMode=true] [isFinishing=false]
2021-04-07 14:24:38.337 10452-10452/com.example.android.pictureinpicture D/MainActivity: onActivitySaveInstanceState: [isInPictureInPictureMode=true]
```

##### Observations:
- in onStop, Android10 reports isInPictureInPictureMode=false whereas Android 11 reports isInPictureInPictureMode=true


### Scenario: launch player, go to Pip, close Pip (with the x button)
Same logs and results from previous scenario.

### Scenario: launch player, go to Pip, lock the device

##### Android 10
```
2021-04-07 14:54:48.415 23945-23945/com.example.android.pictureinpicture D/MainActivity: onActivityStarted: [isInPictureInPictureMode=false]
2021-04-07 14:54:48.416 23945-23945/com.example.android.pictureinpicture D/MainActivity: onActivityResumed: [isInPictureInPictureMode=false]
2021-04-07 14:54:50.705 23945-23945/com.example.android.pictureinpicture D/MainActivity: onActivityPaused: [isInPictureInPictureMode=true] [isFinishing=false]
2021-04-07 14:54:55.116 23945-23945/com.example.android.pictureinpicture D/MainActivity: onActivityStopped: [isInPictureInPictureMode=true] [isFinishing=false]
2021-04-07 14:54:55.117 23945-23945/com.example.android.pictureinpicture D/MainActivity: onActivitySaveInstanceState: [isInPictureInPictureMode=true]
```

##### Android 11

```
2021-04-07 14:59:01.788 8046-8046/com.example.android.pictureinpicture D/MainActivity: onActivityStarted: [isInPictureInPictureMode=false]
2021-04-07 14:59:01.790 8046-8046/com.example.android.pictureinpicture D/MainActivity: onActivityResumed: [isInPictureInPictureMode=false]
2021-04-07 14:59:04.876 8046-8046/com.example.android.pictureinpicture D/MainActivity: onActivityPaused: [isInPictureInPictureMode=true] [isFinishing=false]
2021-04-07 14:59:09.917 8046-8046/com.example.android.pictureinpicture D/MainActivity: onActivityStopped: [isInPictureInPictureMode=true] [isFinishing=false]
2021-04-07 14:59:09.919 8046-8046/com.example.android.pictureinpicture D/MainActivity: onActivitySaveInstanceState: [isInPictureInPictureMode=true]
```

##### Observations:
- no differences between Android 10 and Android 11
- in onStop, Android 10 reports isInPictureInPictureMode=true, but in the scenario where the Pip is dismissed or closed, it returns isInPictureInPictureMode=false in onStop
Binary file added documents/str.webm
Binary file not shown.

0 comments on commit 828f1cf

Please sign in to comment.