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

Commit 5ad6ca66 authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "Move attach/detach PiP menu calls to onTaskAppear/Vanish."

parents d1bd9998 d4459553
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -495,6 +495,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
            mOnDisplayIdChangeCallback.accept(info.displayId);
        }

        mMenuActivityController.onTaskAppeared();

        if (mShouldIgnoreEnteringPipTransition) {
            final Rect destinationBounds = mPipBoundsState.getBounds();
            // animation is finished in the Launcher and here we directly apply the final touch.
@@ -666,6 +668,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        mPictureInPictureParams = null;
        mState = State.UNDEFINED;
        mPipUiEventLoggerLogger.setTaskInfo(null);
        mMenuActivityController.onTaskVanished();
    }

    @Override
+0 −2
Original line number Diff line number Diff line
@@ -277,7 +277,6 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
        mMainExecutor.execute(() -> {
            mTouchHandler.onActivityPinned();
            mMediaController.onActivityPinned();
            mMenuController.onActivityPinned();
            mAppOpsListener.onActivityPinned(packageName);
        });
    }
@@ -285,7 +284,6 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
    @Override
    public void onActivityUnpinned(ComponentName topActivity) {
        mMainExecutor.execute(() -> {
            mMenuController.onActivityUnpinned();
            mTouchHandler.onActivityUnpinned(topActivity);
            mAppOpsListener.onActivityUnpinned();
        });
+13 −5
Original line number Diff line number Diff line
@@ -135,15 +135,22 @@ public class PipMenuActivityController {
        return mPipMenuView != null && mMenuState != MENU_STATE_NONE;
    }

    public void onActivityPinned() {
    /**
     * Attach the menu when the PiP task first appears.
     */
    public void onTaskAppeared() {
        attachPipMenuView();
    }

    public void onActivityUnpinned() {
    /**
     * Detach the menu when the PiP task is gone.
     */
    public void onTaskVanished() {
        hideMenu();
        detachPipMenuView();
    }


    public void onPinnedStackAnimationEnded() {
        if (isMenuVisible()) {
            mPipMenuView.onPipAnimationEnded();
@@ -151,10 +158,11 @@ public class PipMenuActivityController {
    }

    private void attachPipMenuView() {
        if (mPipMenuView == null) {
            mPipMenuView = new PipMenuView(mContext, this);
        // In case detach was not called (e.g. PIP unexpectedly closed)
        if (mPipMenuView != null) {
            detachPipMenuView();
        }

        mPipMenuView = new PipMenuView(mContext, this);
        mSystemWindows.addView(mPipMenuView, getPipMenuLayoutParams(0, 0), 0, SHELL_ROOT_LAYER_PIP);
    }