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

Commit f498ab83 authored by Jiaming Liu's avatar Jiaming Liu
Browse files

[Divider] Jump cut for TF resize when decor surface is boosted

When the decor surface is boosted, the content of the TFs are hidden, so
no animation is needed. This happens when the user drags the interactive
divider, and it should do a jump cut transition when dragging is finished.

Bug: 327067596
Test: atest TaskFragmentOrganizerControllerTest TaskTests
Change-Id: Ia41b4b2d6fb00bbd1d615fca57139a1bc44fa3f1
parent c8615ba4
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.window;

import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FIRST_CUSTOM;
import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_OPEN;

@@ -93,6 +94,19 @@ public class TaskFragmentOrganizer extends WindowOrganizer {
    @TaskFragmentTransitionType
    public static final int TASK_FRAGMENT_TRANSIT_CHANGE = TRANSIT_CHANGE;


    /**
     * The task fragment drag resize transition used by activity embedding.
     *
     * This value is also used in Transitions.TRANSIT_TASK_FRAGMENT_DRAG_RESIZE and must not
     * conflict with other predefined transition types.
     *
     * @hide
     */
    @WindowManager.TransitionType
    @TaskFragmentTransitionType
    public static final int TASK_FRAGMENT_TRANSIT_DRAG_RESIZE = TRANSIT_FIRST_CUSTOM + 17;

    /**
     * Introduced a sub set of {@link WindowManager.TransitionType} for the types that are used for
     * TaskFragment transition.
@@ -106,6 +120,7 @@ public class TaskFragmentOrganizer extends WindowOrganizer {
            TASK_FRAGMENT_TRANSIT_OPEN,
            TASK_FRAGMENT_TRANSIT_CLOSE,
            TASK_FRAGMENT_TRANSIT_CHANGE,
            TASK_FRAGMENT_TRANSIT_DRAG_RESIZE,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface TaskFragmentTransitionType {}
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import static android.window.TaskFragmentOrganizer.KEY_ERROR_CALLBACK_OP_TYPE;
import static android.window.TaskFragmentOrganizer.KEY_ERROR_CALLBACK_TASK_FRAGMENT_INFO;
import static android.window.TaskFragmentOrganizer.KEY_ERROR_CALLBACK_THROWABLE;
import static android.window.TaskFragmentOrganizer.TASK_FRAGMENT_TRANSIT_CLOSE;
import static android.window.TaskFragmentOrganizer.TASK_FRAGMENT_TRANSIT_DRAG_RESIZE;
import static android.window.TaskFragmentOrganizer.TASK_FRAGMENT_TRANSIT_OPEN;
import static android.window.TaskFragmentTransaction.TYPE_ACTIVITY_REPARENTED_TO_TASK;
import static android.window.TaskFragmentTransaction.TYPE_TASK_FRAGMENT_APPEARED;
@@ -3240,6 +3241,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
        synchronized (mLock) {
            final TransactionRecord transactionRecord =
                    mTransactionManager.startNewTransaction();
            transactionRecord.setOriginType(TASK_FRAGMENT_TRANSIT_DRAG_RESIZE);
            final WindowContainerTransaction wct = transactionRecord.getTransaction();
            final TaskContainer taskContainer = mTaskContainers.get(taskId);
            if (taskContainer != null) {
+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static com.android.wm.shell.activityembedding.ActivityEmbeddingAnimationS
import static com.android.wm.shell.transition.TransitionAnimationHelper.addBackgroundToTransition;
import static com.android.wm.shell.transition.TransitionAnimationHelper.edgeExtendWindow;
import static com.android.wm.shell.transition.TransitionAnimationHelper.getTransitionBackgroundColorIfSet;
import static com.android.wm.shell.transition.Transitions.TRANSIT_TASK_FRAGMENT_DRAG_RESIZE;

import android.animation.Animator;
import android.animation.ValueAnimator;
@@ -190,6 +191,10 @@ class ActivityEmbeddingAnimationRunner {
    @NonNull
    private List<ActivityEmbeddingAnimationAdapter> createAnimationAdapters(
            @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction startTransaction) {
        if (info.getType() == TRANSIT_TASK_FRAGMENT_DRAG_RESIZE) {
            // Jump cut for AE drag resizing because the content is veiled.
            return new ArrayList<>();
        }
        boolean isChangeTransition = false;
        for (TransitionInfo.Change change : info.getChanges()) {
            if (change.hasFlags(FLAG_IS_BEHIND_STARTING_WINDOW)) {
+7 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.window.TransitionInfo.FLAG_FILLS_TASK;
import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;

import static com.android.wm.shell.transition.DefaultTransitionHandler.isSupportedOverrideAnimation;
import static com.android.wm.shell.transition.Transitions.TRANSIT_TASK_FRAGMENT_DRAG_RESIZE;

import static java.util.Objects.requireNonNull;

@@ -90,6 +91,12 @@ public class ActivityEmbeddingController implements Transitions.TransitionHandle

    /** Whether ActivityEmbeddingController should animate this transition. */
    public boolean shouldAnimate(@NonNull TransitionInfo info) {
        if (info.getType() == TRANSIT_TASK_FRAGMENT_DRAG_RESIZE) {
            // The TRANSIT_TASK_FRAGMENT_DRAG_RESIZE type happens when the user drags the
            // interactive divider to resize the split containers. The content is veiled, so we will
            // handle the transition with a jump cut.
            return true;
        }
        boolean containsEmbeddingChange = false;
        for (TransitionInfo.Change change : info.getChanges()) {
            if (!change.hasFlags(FLAG_FILLS_TASK) && change.hasFlags(
+8 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import android.view.SurfaceControl;
import android.view.WindowManager;
import android.window.ITransitionPlayer;
import android.window.RemoteTransition;
import android.window.TaskFragmentOrganizer;
import android.window.TransitionFilter;
import android.window.TransitionInfo;
import android.window.TransitionMetrics;
@@ -183,6 +184,13 @@ public class Transitions implements RemoteCallable<Transitions>,
    /** Transition to resize PiP task. */
    public static final int TRANSIT_RESIZE_PIP = TRANSIT_FIRST_CUSTOM + 16;

    /**
     * The task fragment drag resize transition used by activity embedding.
     */
    public static final int TRANSIT_TASK_FRAGMENT_DRAG_RESIZE =
            // TRANSIT_FIRST_CUSTOM + 17
            TaskFragmentOrganizer.TASK_FRAGMENT_TRANSIT_DRAG_RESIZE;

    private final ShellTaskOrganizer mOrganizer;
    private final Context mContext;
    private final ShellExecutor mMainExecutor;
Loading