android / android/platform-samples
[Bug]: SourceRectHint Animation messes up during PIP restore after `setPictureInPictureParams` in Android 15
- Dominant language
- Kotlin
- Stars
- 1.7k
- Forks
- 541
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 3
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### In which area is the issue?
User Interface
### In a specific sample?
PiPMovieActivity.kt
### What happened?
In Android 15 If you first enter Picture-in-Picture mode using `setSourceRectHint`, then call `setPictureInPictureParams` again later—even if `PictureInPictureParams.Builder().build()`—it totally breaks the smooth restore animation based on the original SourceRect.
How to Reproduce :
Add this line into `PiPMovieActivity.kt:297`:
```kotlin
override fun onPause() {
movieView.pause()
setPictureInPictureParams(PictureInPictureParams.Builder().build())
}
```
Then follow: enter PiP → pause and start the video → expand
Check the videos below:
normal:
https://github.com/user-attachments/assets/1db0cc90-ea99-4203-8bbb-1c29cbbc3a2d
error:
https://github.com/user-attachments/assets/69ad386b-84aa-4ab5-a314-89f0a2971330
### Relevant logcat output
```shell
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start with PiPMovieActivity.kt around line 297 and reproduce the Android 15 flow: enter PiP, pause and start the video, then expand after calling setPictureInPictureParams. Compare the result with the linked normal and error videos; done means restoring from PiP preserves the smooth animation based on the original SourceRect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100