Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca96867f authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Hide PiP menu upon display change

Hide the PiP menu upon any display change to eliminate the chance that
PiP menu bounds mismatches with the window.

This change applies to both pip1 and pip2

Flag: EXEMPT bugfix
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/g0DgR8nravwAFMLJAkEBRm
Bug: 382001243
Test: Unfold the device while PiP menu is present, see video
Change-Id: I9d8ff41a30870bcd51bb7543ef74045955166f2c
parent 9a81b7d2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ public abstract class Pip2Module {
            PipTransitionState pipTransitionState,
            PipTouchHandler pipTouchHandler,
            PipAppOpsListener pipAppOpsListener,
            PhonePipMenuController pipMenuController,
            @ShellMainThread ShellExecutor mainExecutor) {
        if (!PipUtils.isPip2ExperimentEnabled()) {
            return Optional.empty();
@@ -123,7 +124,8 @@ public abstract class Pip2Module {
                    context, shellInit, shellCommandHandler, shellController, displayController,
                    displayInsetsController, pipBoundsState, pipBoundsAlgorithm,
                    pipDisplayLayoutState, pipScheduler, taskStackListener, shellTaskOrganizer,
                    pipTransitionState, pipTouchHandler, pipAppOpsListener, mainExecutor));
                    pipTransitionState, pipTouchHandler, pipAppOpsListener, pipMenuController,
                    mainExecutor));
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -781,6 +781,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
                // cancel any running animator, as it is using stale display layout information
                animator.cancel();
            }
            mMenuController.hideMenu();
            onDisplayChangedUncheck(layout, saveRestoreSnapFraction);
        }
    }
+7 −1
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ public class PipController implements ConfigurationChangeListener,
    private final PipTransitionState mPipTransitionState;
    private final PipTouchHandler mPipTouchHandler;
    private final PipAppOpsListener mPipAppOpsListener;
    private final PhonePipMenuController mPipMenuController;
    private final ShellExecutor mMainExecutor;
    private final PipImpl mImpl;
    private final List<Consumer<Boolean>> mOnIsInPipStateChangedListeners = new ArrayList<>();
@@ -141,6 +142,7 @@ public class PipController implements ConfigurationChangeListener,
            PipTransitionState pipTransitionState,
            PipTouchHandler pipTouchHandler,
            PipAppOpsListener pipAppOpsListener,
            PhonePipMenuController pipMenuController,
            ShellExecutor mainExecutor) {
        mContext = context;
        mShellCommandHandler = shellCommandHandler;
@@ -157,6 +159,7 @@ public class PipController implements ConfigurationChangeListener,
        mPipTransitionState.addPipTransitionStateChangedListener(this);
        mPipTouchHandler = pipTouchHandler;
        mPipAppOpsListener = pipAppOpsListener;
        mPipMenuController = pipMenuController;
        mMainExecutor = mainExecutor;
        mImpl = new PipImpl();

@@ -183,6 +186,7 @@ public class PipController implements ConfigurationChangeListener,
            PipTransitionState pipTransitionState,
            PipTouchHandler pipTouchHandler,
            PipAppOpsListener pipAppOpsListener,
            PhonePipMenuController pipMenuController,
            ShellExecutor mainExecutor) {
        if (!context.getPackageManager().hasSystemFeature(FEATURE_PICTURE_IN_PICTURE)) {
            ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
@@ -192,7 +196,8 @@ public class PipController implements ConfigurationChangeListener,
        return new PipController(context, shellInit, shellCommandHandler, shellController,
                displayController, displayInsetsController, pipBoundsState, pipBoundsAlgorithm,
                pipDisplayLayoutState, pipScheduler, taskStackListener, shellTaskOrganizer,
                pipTransitionState, pipTouchHandler, pipAppOpsListener, mainExecutor);
                pipTransitionState, pipTouchHandler, pipAppOpsListener, pipMenuController,
                mainExecutor);
    }

    public PipImpl getPipImpl() {
@@ -329,6 +334,7 @@ public class PipController implements ConfigurationChangeListener,
        }

        mPipTouchHandler.updateMinMaxSize(mPipBoundsState.getAspectRatio());
        mPipMenuController.hideMenu();

        if (mPipTransitionState.isInFixedRotation()) {
            // Do not change the bounds when in fixed rotation, but do update the movement bounds