I'm using a VideoSupportFragment, default LeanbackPlayerAdapter and SimpleExoPlayer.
SurfaceView is created in VideoSupportFragment as well as other UI elements (rows).
Simple PiP logic implementation from google tutorial.
Fullscreen video:

PiP:

Then in 5-7 seconds video is adjusted and all is ok:

But.... if you try to Make Activity Fullscreen Again and exit PiP mode:

The result is:

???
How to fix: reopen player (i.e. restart activity); select another track.
Enter PiP mode and enjoy the unscaled video.
Don't matter.
2.9.2
com.google.android.exoplayer:exoplayer:2.9.2
com.google.android.exoplayer:extension-leanback:2.9.2
Android TV (1080p) API 28 (google emulator)
Note: the same as https://github.com/googlesamples/androidtv-Leanback/issues/143
Note: the same as googlesamples/androidtv-Leanback#143
I wasn't sure if you would redirect me to that repository, so I decided to duplicate the issue.
I can close this or duplicate issue if it's necessary.
We marked it, to make sure people on the other repo are aware someone is looking into it. It's to avoid we are duplicating work. Normally it's best to only start a single issue to not make several people look into the same issue.
I look into this to check whether it is a problem with ExoPlayer or the ExoPlayer leanback extension. If it's a leanback/framework problem we probably have to look for someone else to look into this some further. I'll let you know.
I tried this out with the sample app. It works for me. When coming back from full screen the surface expands back to the full size of the enclosing activity.
I don't think this has something to do with ExoPlayer. Even the screencast you sent shows that rendering actually is properly done by ExoPlayer in the area it gets from the framework.
A few observations/hints/questions:
Testing on a real device is maybe also worth trying. I don't think this should make a difference but I'd try to rule out it's not an emulator issue.
In the video you attached to the bug I think to see that the video is already too small when it comes back from the corner to the center of the screen (before you actually go back to fullscreen). There is this grey border around the video surface which I don't have when I tried (see screenshots):


I'd look into and play around with the PictureInPictureParams which you set to when entering picture in picture mode. I just pass an ew PictureInPictureParams.Builder().build(), but I'm not sure how this behaves with a video which has different aspect ratios then the one I have.
There is this grey border around the video surface
It's not border — it's default app background, so I think it's PlayerFragment (host of SurfaceView).
Looks like:
Is this a stream content protected with DRM?
@marcbaechinger
Is this a stream content protected with DRM?
This is a stream content, but not protected with DRM.
Ok, thanks. I'm not sure whether the fragment is using a textureView vs. a surfaceview and whether you can tell the fragment to use a one or the other.
However, can you please test and reproduce the behaviour on a ATV device? Once you've done this it would be best to do a bugreport right after you've done this. This will give us some more insights specifically around what API version and device you are using.
Closing due to inactivity. Feel free to reopen if you can provide further information.
Most helpful comment
We marked it, to make sure people on the other repo are aware someone is looking into it. It's to avoid we are duplicating work. Normally it's best to only start a single issue to not make several people look into the same issue.
I look into this to check whether it is a problem with ExoPlayer or the ExoPlayer leanback extension. If it's a leanback/framework problem we probably have to look for someone else to look into this some further. I'll let you know.