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

Commit 1fc30238 authored by Mateusz Cicheński's avatar Mateusz Cicheński Committed by Automerger Merge Worker
Browse files

Merge "Refactor isAnimating to PipAnimationController, and update references."...

Merge "Refactor isAnimating to PipAnimationController, and update references." into tm-qpr-dev am: 5e05a02c am: 3dfcf6c0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20002275



Change-Id: I7a83223ffa454eeafe9b3116a34bcc0587cecb68
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b747b390 3dfcf6c0
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -318,6 +318,7 @@ public abstract class WMShellModule {
            ShellCommandHandler shellCommandHandler,
            ShellController shellController,
            DisplayController displayController,
            PipAnimationController pipAnimationController,
            PipAppOpsListener pipAppOpsListener,
            PipBoundsAlgorithm pipBoundsAlgorithm,
            PhonePipKeepClearAlgorithm pipKeepClearAlgorithm,
@@ -337,11 +338,12 @@ public abstract class WMShellModule {
            @ShellMainThread ShellExecutor mainExecutor) {
        return Optional.ofNullable(PipController.create(
                context, shellInit, shellCommandHandler, shellController,
                displayController, pipAppOpsListener, pipBoundsAlgorithm, pipKeepClearAlgorithm,
                pipBoundsState, pipMotionHelper, pipMediaController, phonePipMenuController,
                pipTaskOrganizer, pipTransitionState, pipTouchHandler, pipTransitionController,
                windowManagerShellWrapper, taskStackListener, pipParamsChangedForwarder,
                displayInsetsController, oneHandedController, mainExecutor));
                displayController, pipAnimationController, pipAppOpsListener, pipBoundsAlgorithm,
                pipKeepClearAlgorithm, pipBoundsState, pipMotionHelper, pipMediaController,
                phonePipMenuController, pipTaskOrganizer, pipTransitionState, pipTouchHandler,
                pipTransitionController, windowManagerShellWrapper, taskStackListener,
                pipParamsChangedForwarder, displayInsetsController, oneHandedController,
                mainExecutor));
    }

    @WMSingleton
+11 −0
Original line number Diff line number Diff line
@@ -194,6 +194,17 @@ public class PipAnimationController {
        return animator;
    }

    /**
     * Returns true if the PiP window is currently being animated.
     */
    public boolean isAnimating() {
        PipAnimationController.PipTransitionAnimator animator = getCurrentAnimator();
        if (animator != null && animator.isRunning()) {
            return true;
        }
        return false;
    }

    /**
     * Quietly cancel the animator by removing the listeners first.
     */
+0 −13
Original line number Diff line number Diff line
@@ -324,19 +324,6 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        return mPipTransitionController;
    }

    /**
     * Returns true if the PiP window is currently being animated.
     */
    public boolean isAnimating() {
        // TODO(b/183746978) move this to PipAnimationController, and inject that in PipController
        PipAnimationController.PipTransitionAnimator animator =
                mPipAnimationController.getCurrentAnimator();
        if (animator != null && animator.isRunning()) {
            return true;
        }
        return false;
    }

    public Rect getCurrentOrAnimatingBounds() {
        PipAnimationController.PipTransitionAnimator animator =
                mPipAnimationController.getCurrentAnimator();
+11 −6
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
    private DisplayController mDisplayController;
    private PipInputConsumer mPipInputConsumer;
    private WindowManagerShellWrapper mWindowManagerShellWrapper;
    private PipAnimationController mPipAnimationController;
    private PipAppOpsListener mAppOpsListener;
    private PipMediaController mMediaController;
    private PipBoundsAlgorithm mPipBoundsAlgorithm;
@@ -158,7 +159,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
            return;
        }
        // if there is another animation ongoing, wait for it to finish and try again
        if (mPipTaskOrganizer.isAnimating()) {
        if (mPipAnimationController.isAnimating()) {
            mMainExecutor.removeCallbacks(
                    mMovePipInResponseToKeepClearAreasChangeCallback);
            mMainExecutor.executeDelayed(
@@ -368,6 +369,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
            ShellCommandHandler shellCommandHandler,
            ShellController shellController,
            DisplayController displayController,
            PipAnimationController pipAnimationController,
            PipAppOpsListener pipAppOpsListener,
            PipBoundsAlgorithm pipBoundsAlgorithm,
            PipKeepClearAlgorithm pipKeepClearAlgorithm,
@@ -392,11 +394,12 @@ public class PipController implements PipTransitionController.PipTransitionCallb
        }

        return new PipController(context, shellInit, shellCommandHandler, shellController,
                displayController, pipAppOpsListener, pipBoundsAlgorithm, pipKeepClearAlgorithm,
                pipBoundsState, pipMotionHelper, pipMediaController, phonePipMenuController,
                pipTaskOrganizer, pipTransitionState, pipTouchHandler, pipTransitionController,
                windowManagerShellWrapper, taskStackListener, pipParamsChangedForwarder,
                displayInsetsController, oneHandedController, mainExecutor)
                displayController, pipAnimationController, pipAppOpsListener,
                pipBoundsAlgorithm, pipKeepClearAlgorithm, pipBoundsState, pipMotionHelper,
                pipMediaController, phonePipMenuController, pipTaskOrganizer, pipTransitionState,
                pipTouchHandler, pipTransitionController, windowManagerShellWrapper,
                taskStackListener, pipParamsChangedForwarder, displayInsetsController,
                oneHandedController, mainExecutor)
                .mImpl;
    }

@@ -405,6 +408,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
            ShellCommandHandler shellCommandHandler,
            ShellController shellController,
            DisplayController displayController,
            PipAnimationController pipAnimationController,
            PipAppOpsListener pipAppOpsListener,
            PipBoundsAlgorithm pipBoundsAlgorithm,
            PipKeepClearAlgorithm pipKeepClearAlgorithm,
@@ -445,6 +449,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
        mMediaController = pipMediaController;
        mMenuController = phonePipMenuController;
        mTouchHandler = pipTouchHandler;
        mPipAnimationController = pipAnimationController;
        mAppOpsListener = pipAppOpsListener;
        mOneHandedController = oneHandedController;
        mPipTransitionController = pipTransitionController;
+6 −4
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.TaskStackListenerImpl;
import com.android.wm.shell.onehanded.OneHandedController;
import com.android.wm.shell.pip.PipAnimationController;
import com.android.wm.shell.pip.PipAppOpsListener;
import com.android.wm.shell.pip.PipBoundsAlgorithm;
import com.android.wm.shell.pip.PipBoundsState;
@@ -85,6 +86,7 @@ public class PipControllerTest extends ShellTestCase {
    @Mock private ShellCommandHandler mMockShellCommandHandler;
    @Mock private DisplayController mMockDisplayController;
    @Mock private PhonePipMenuController mMockPhonePipMenuController;
    @Mock private PipAnimationController mMockPipAnimationController;
    @Mock private PipAppOpsListener mMockPipAppOpsListener;
    @Mock private PipBoundsAlgorithm mMockPipBoundsAlgorithm;
    @Mock private PhonePipKeepClearAlgorithm mMockPipKeepClearAlgorithm;
@@ -117,8 +119,8 @@ public class PipControllerTest extends ShellTestCase {
        mShellController = spy(new ShellController(mShellInit, mMockShellCommandHandler,
                mMockExecutor));
        mPipController = new PipController(mContext, mShellInit, mMockShellCommandHandler,
                mShellController, mMockDisplayController, mMockPipAppOpsListener,
                mMockPipBoundsAlgorithm, mMockPipKeepClearAlgorithm,
                mShellController, mMockDisplayController, mMockPipAnimationController,
                mMockPipAppOpsListener, mMockPipBoundsAlgorithm, mMockPipKeepClearAlgorithm,
                mMockPipBoundsState, mMockPipMotionHelper, mMockPipMediaController,
                mMockPhonePipMenuController, mMockPipTaskOrganizer, mMockPipTransitionState,
                mMockPipTouchHandler, mMockPipTransitionController, mMockWindowManagerShellWrapper,
@@ -183,8 +185,8 @@ public class PipControllerTest extends ShellTestCase {

        ShellInit shellInit = new ShellInit(mMockExecutor);
        assertNull(PipController.create(spyContext, shellInit, mMockShellCommandHandler,
                mShellController, mMockDisplayController, mMockPipAppOpsListener,
                mMockPipBoundsAlgorithm, mMockPipKeepClearAlgorithm,
                mShellController, mMockDisplayController, mMockPipAnimationController,
                mMockPipAppOpsListener, mMockPipBoundsAlgorithm, mMockPipKeepClearAlgorithm,
                mMockPipBoundsState, mMockPipMotionHelper, mMockPipMediaController,
                mMockPhonePipMenuController, mMockPipTaskOrganizer, mMockPipTransitionState,
                mMockPipTouchHandler, mMockPipTransitionController, mMockWindowManagerShellWrapper,