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

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

Add SYSUI_STATE_DISABLE_GESTURE_PIP_INVOCATION

This is a re-land of ag/28059459 and ag/28274821

original message:

This SysUiState flag would be set to true when PiP animation starts and
false when it finishes.

This is to prevent the Recents transition that may conflict with PiP.

what's changed:

- Added protolog for sending the transition callbacks
- Fixed the issue that onTaskVanished cancels the ongoing transition and
  no callback is sent

Flag: EXEMPT bug fix
Bug: 340724371
Test: Swipe to show TaskBar while expanding PiP to FS mode
Test: Start new Task from PiP and finish the PiP activity immediately
Test: atest --iteration 2 CtsWindowManagerDeviceOther:PinnedStackTests
Change-Id: Ie3b8ae963ed17a9e0241148c0e2ae59c80574a3d
parent 4a12a946
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -206,12 +206,13 @@ public abstract class Pip1Module {
    @WMSingleton
    @Provides
    static PipMotionHelper providePipMotionHelper(Context context,
            @ShellMainThread ShellExecutor mainExecutor,
            PipBoundsState pipBoundsState, PipTaskOrganizer pipTaskOrganizer,
            PhonePipMenuController menuController, PipSnapAlgorithm pipSnapAlgorithm,
            PipTransitionController pipTransitionController,
            FloatingContentCoordinator floatingContentCoordinator,
            Optional<PipPerfHintController> pipPerfHintControllerOptional) {
        return new PipMotionHelper(context, pipBoundsState, pipTaskOrganizer,
        return new PipMotionHelper(context, mainExecutor, pipBoundsState, pipTaskOrganizer,
                menuController, pipSnapAlgorithm, pipTransitionController,
                floatingContentCoordinator, pipPerfHintControllerOptional);
    }
+7 −4
Original line number Diff line number Diff line
@@ -16,10 +16,12 @@

package com.android.wm.shell.pip;

import android.annotation.NonNull;
import android.graphics.Rect;

import com.android.wm.shell.shared.annotations.ExternalThread;

import java.util.concurrent.Executor;
import java.util.function.Consumer;

/**
@@ -69,9 +71,10 @@ public interface Pip {
    default void removePipExclusionBoundsChangeListener(Consumer<Rect> listener) { }

    /**
     * @return {@link PipTransitionController} instance.
     * Register {@link PipTransitionController.PipTransitionCallback} to listen on PiP transition
     * started / finished callbacks.
     */
    default PipTransitionController getPipTransitionController() {
        return null;
    }
    default void registerPipTransitionCallback(
            @NonNull PipTransitionController.PipTransitionCallback callback,
            @NonNull Executor executor) { }
}
+1 −0
Original line number Diff line number Diff line
@@ -230,6 +230,7 @@ public class PipAnimationController {

    /**
     * Quietly cancel the animator by removing the listeners first.
     * TODO(b/275003573): deprecate this, cancelling without the proper callbacks is problematic.
     */
    static void quietCancel(@NonNull ValueAnimator animator) {
        animator.removeAllUpdateListeners();
+6 −3
Original line number Diff line number Diff line
@@ -423,7 +423,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
            });
            mPipTransitionController.setPipOrganizer(this);
            displayController.addDisplayWindowListener(this);
            pipTransitionController.registerPipTransitionCallback(mPipTransitionCallback);
            pipTransitionController.registerPipTransitionCallback(
                    mPipTransitionCallback, mMainExecutor);
        }
    }

@@ -495,7 +496,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "startSwipePipToHome: %s, state=%s", componentName, mPipTransitionState);
        mPipTransitionState.setInSwipePipToHomeTransition(true);
        if (!ENABLE_SHELL_TRANSITIONS) {
            sendOnPipTransitionStarted(TRANSITION_DIRECTION_TO_PIP);
        }
        setBoundsStateForEntry(componentName, pictureInPictureParams, activityInfo);
        return mPipBoundsAlgorithm.getEntryDestinationBounds();
    }
@@ -2023,7 +2026,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
            removeContentOverlay(mPipOverlay, null /* callback */);
        }
        if (animator != null) {
            PipAnimationController.quietCancel(animator);
            animator.cancel();
            mPipAnimationController.resetAnimatorState();
        }
    }
+1 −0
Original line number Diff line number Diff line
@@ -1173,6 +1173,7 @@ public class PipTransition extends PipTransitionController {
                    .setLayer(swipePipToHomeOverlay, Integer.MAX_VALUE);
        }

        sendOnPipTransitionStarted(TRANSITION_DIRECTION_TO_PIP);
        // Both Shell and Launcher calculate their own "adjusted" source-rect-hint values based on
        // appBounds being source bounds when entering PiP.
        final Rect sourceBounds = swipePipToHomeOverlay == null
Loading