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

Commit 006496c2 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "[PB] Do not cancel animation from transition." into main

parents cc7d61cc c005809a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -483,6 +483,11 @@ public interface WindowManager extends ViewManager {
     * @hide
     */
    int TRANSIT_PREPARE_BACK_NAVIGATION = 13;
    /**
     * An Activity was going to be invisible from back navigation.
     * @hide
     */
    int TRANSIT_CLOSE_PREPARE_BACK_NAVIGATION = 14;

    /**
     * The first slot for custom transition types. Callers (like Shell) can make use of custom
@@ -513,6 +518,7 @@ public interface WindowManager extends ViewManager {
            TRANSIT_WAKE,
            TRANSIT_SLEEP,
            TRANSIT_PREPARE_BACK_NAVIGATION,
            TRANSIT_CLOSE_PREPARE_BACK_NAVIGATION,
            TRANSIT_FIRST_CUSTOM
    })
    @Retention(RetentionPolicy.SOURCE)
@@ -1927,6 +1933,7 @@ public interface WindowManager extends ViewManager {
            case TRANSIT_WAKE: return "WAKE";
            case TRANSIT_SLEEP: return "SLEEP";
            case TRANSIT_PREPARE_BACK_NAVIGATION: return "PREDICTIVE_BACK";
            case TRANSIT_CLOSE_PREPARE_BACK_NAVIGATION: return "CLOSE_PREDICTIVE_BACK";
            case TRANSIT_FIRST_CUSTOM: return "FIRST_CUSTOM";
            default:
                if (type > TRANSIT_FIRST_CUSTOM) {
+13 −0
Original line number Diff line number Diff line
@@ -699,6 +699,18 @@ public final class WindowContainerTransaction implements Parcelable {
        return this;
    }

    /**
     * Restore the back navigation target from visible to invisible for canceling gesture animation.
     * @hide
     */
    @NonNull
    public WindowContainerTransaction restoreBackNavi() {
        final HierarchyOp hierarchyOp =
                new HierarchyOp.Builder(HierarchyOp.HIERARCHY_OP_TYPE_RESTORE_BACK_NAVIGATION)
                        .build();
        mHierarchyOps.add(hierarchyOp);
        return this;
    }
    /**
     * Adds a given {@code Rect} as an insets source frame on the {@code receiver}.
     *
@@ -1436,6 +1448,7 @@ public final class WindowContainerTransaction implements Parcelable {
        public static final int HIERARCHY_OP_TYPE_ADD_TASK_FRAGMENT_OPERATION = 17;
        public static final int HIERARCHY_OP_TYPE_MOVE_PIP_ACTIVITY_TO_PINNED_TASK = 18;
        public static final int HIERARCHY_OP_TYPE_SET_IS_TRIMMABLE = 19;
        public static final int HIERARCHY_OP_TYPE_RESTORE_BACK_NAVIGATION = 20;

        // The following key(s) are for use with mLaunchOptions:
        // When launching a task (eg. from recents), this is the taskId to be launched.
+3 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_PREPARE_BACK_NAVIGATION;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -59,7 +60,8 @@ public class TransitionUtil {
    public static boolean isOpeningType(@WindowManager.TransitionType int type) {
        return type == TRANSIT_OPEN
                || type == TRANSIT_TO_FRONT
                || type == TRANSIT_KEYGUARD_GOING_AWAY;
                || type == TRANSIT_KEYGUARD_GOING_AWAY
                || type == TRANSIT_PREPARE_BACK_NAVIGATION;
    }

    /** @return true if the transition was triggered by closing something vs opening something */
+268 −14

File changed.

Preview size limit exceeded, changes collapsed.

+11 −0
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@ package com.android.wm.shell.transition;
import static android.app.ActivityOptions.ANIM_FROM_STYLE;
import static android.app.ActivityOptions.ANIM_NONE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_CLOSE_PREPARE_BACK_NAVIGATION;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_PREPARE_BACK_NAVIGATION;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.WindowManager.transitTypeToString;
@@ -221,6 +223,15 @@ public class TransitionAnimationHelper {
     */
    public static int getTransitionTypeFromInfo(@NonNull TransitionInfo info) {
        final int type = info.getType();
        // This back navigation is canceled, check whether the transition should be open or close
        if (type == TRANSIT_PREPARE_BACK_NAVIGATION
                || type == TRANSIT_CLOSE_PREPARE_BACK_NAVIGATION) {
            if (!info.getChanges().isEmpty()) {
                final TransitionInfo.Change change = info.getChanges().get(0);
                return TransitionUtil.isOpeningMode(change.getMode())
                        ? TRANSIT_OPEN : TRANSIT_CLOSE;
            }
        }
        // If the info transition type is opening transition, iterate its changes to see if it
        // has any opening change, if none, returns TRANSIT_CLOSE type for closing animation.
        if (type == TRANSIT_OPEN) {
Loading