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

Commit 10ad2ad6 authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Add timeout when re-enable PiP touch interaction" into main

parents 175aabe1 8431c898
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -122,6 +122,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb
    private static final long PIP_KEEP_CLEAR_AREAS_DELAY =
            SystemProperties.getLong("persist.wm.debug.pip_keep_clear_areas_delay", 200);

    private static final long ENABLE_TOUCH_DELAY_MS = 200L;

    private Context mContext;
    protected ShellExecutor mMainExecutor;
    private DisplayController mDisplayController;
@@ -152,6 +154,8 @@ public class PipController implements PipTransitionController.PipTransitionCallb
    private final Runnable mMovePipInResponseToKeepClearAreasChangeCallback =
            this::onKeepClearAreasChangedCallback;

    private final Runnable mEnableTouchCallback = () -> mTouchHandler.setTouchEnabled(true);

    private void onKeepClearAreasChangedCallback() {
        if (mIsKeyguardShowingOrAnimating) {
            // early bail out if the change was caused by keyguard showing up
@@ -1037,6 +1041,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
            saveReentryState(pipBounds);
        }
        // Disable touches while the animation is running
        mMainExecutor.removeCallbacks(mEnableTouchCallback);
        mTouchHandler.setTouchEnabled(false);
        if (mPinnedStackAnimationRecentsCallback != null) {
            mPinnedStackAnimationRecentsCallback.onPipAnimationStarted();
@@ -1067,7 +1072,7 @@ public class PipController implements PipTransitionController.PipTransitionCallb
        InteractionJankMonitor.getInstance().end(CUJ_PIP_TRANSITION);

        // Re-enable touches after the animation completes
        mTouchHandler.setTouchEnabled(true);
        mMainExecutor.executeDelayed(mEnableTouchCallback, ENABLE_TOUCH_DELAY_MS);
        mTouchHandler.onPinnedStackAnimationEnded(direction);
    }