PiP: Re-attach PiP menu when display changes.

When changing the display (e.g. foldables that fold/unfolds) while the
menu is showing, it seems the SF layers go through some changes that get
the menu in a bad state and no longer renders correctly. Just teardown
and recreate/re-attach the menu instead.

Bug: 218987352
Test: Unfold/fold device while menu is showing, menu still shows up
afterwards

Change-Id: I4255191c3298cf663b6a0428ece6f34fd96ff3a6
This commit is contained in:
Ben Lin
2022-04-20 14:14:36 -07:00
parent 765bbec608
commit 7c64525d1c
2 changed files with 2 additions and 1 deletions

View File

@@ -171,7 +171,7 @@ public class PhonePipMenuController implements PipMenuController {
detachPipMenuView();
}
private void attachPipMenuView() {
void attachPipMenuView() {
// In case detach was not called (e.g. PIP unexpectedly closed)
if (mPipMenuView != null) {
detachPipMenuView();

View File

@@ -521,6 +521,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
};
if (mPipTaskOrganizer.isInPip() && saveRestoreSnapFraction) {
mMenuController.attachPipMenuView();
// Calculate the snap fraction of the current stack along the old movement bounds
final PipSnapAlgorithm pipSnapAlgorithm = mPipBoundsAlgorithm.getSnapAlgorithm();
final Rect postChangeStackBounds = new Rect(mPipBoundsState.getBounds());