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

Commit cdc5d37d authored by Android Build Prod User's avatar Android Build Prod User Committed by Automerger Merge Worker
Browse files

Merge "Revert "Introduce TaskFragment transition type"" into sc-v2-dev am:...

Merge "Revert "Introduce TaskFragment transition type"" into sc-v2-dev am: 4de48937 am: 45524130

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

Change-Id: I877c2ad08b8e798d8cbf9d867ce3ca04efe45291
parents 108a43fc 45524130
Loading
Loading
Loading
Loading
+1 −16
Original line number Original line Diff line number Diff line
@@ -319,19 +319,6 @@ public interface WindowManager extends ViewManager {
     */
     */
    int TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE = 27;
    int TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE = 27;


    /**
     * A window in a new task fragment is being opened.
     * @hide
     */
    int TRANSIT_OLD_TASK_FRAGMENT_OPEN = 28;

    /**
     * A window in the top-most activity of task fragment is being closed to reveal the activity
     * below.
     * @hide
     */
    int TRANSIT_OLD_TASK_FRAGMENT_CLOSE = 29;

    /**
    /**
     * @hide
     * @hide
     */
     */
@@ -357,9 +344,7 @@ public interface WindowManager extends ViewManager {
            TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN,
            TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN,
            TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE,
            TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE,
            TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE,
            TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE,
            TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
            TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE
            TRANSIT_OLD_TASK_FRAGMENT_OPEN,
            TRANSIT_OLD_TASK_FRAGMENT_CLOSE
    })
    })
    @Retention(RetentionPolicy.SOURCE)
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitionOldType {}
    @interface TransitionOldType {}
+0 −1
Original line number Original line Diff line number Diff line
@@ -670,7 +670,6 @@ final class AccessibilityController {
            if (magnifying) {
            if (magnifying) {
                switch (transition) {
                switch (transition) {
                    case WindowManager.TRANSIT_OLD_ACTIVITY_OPEN:
                    case WindowManager.TRANSIT_OLD_ACTIVITY_OPEN:
                    case WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN:
                    case WindowManager.TRANSIT_OLD_TASK_OPEN:
                    case WindowManager.TRANSIT_OLD_TASK_OPEN:
                    case WindowManager.TRANSIT_OLD_TASK_TO_FRONT:
                    case WindowManager.TRANSIT_OLD_TASK_TO_FRONT:
                    case WindowManager.TRANSIT_OLD_WALLPAPER_OPEN:
                    case WindowManager.TRANSIT_OLD_WALLPAPER_OPEN:
+0 −23
Original line number Original line Diff line number Diff line
@@ -40,8 +40,6 @@ import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_OLD_NONE;
import static android.view.WindowManager.TRANSIT_OLD_NONE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_BACK;
import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_BACK;
@@ -1007,21 +1005,6 @@ public class AppTransition implements Dump {
                    animAttr = enter
                    animAttr = enter
                            ? WindowAnimation_launchTaskBehindSourceAnimation
                            ? WindowAnimation_launchTaskBehindSourceAnimation
                            : WindowAnimation_launchTaskBehindTargetAnimation;
                            : WindowAnimation_launchTaskBehindTargetAnimation;
                    break;
                // TODO(b/189386466): Use activity transition as the fallback. Investigate if we
                //  need new TaskFragment transition.
                case TRANSIT_OLD_TASK_FRAGMENT_OPEN:
                    animAttr = enter
                            ? WindowAnimation_activityOpenEnterAnimation
                            : WindowAnimation_activityOpenExitAnimation;
                    break;
                // TODO(b/189386466): Use activity transition as the fallback. Investigate if we
                //  need new TaskFragment transition.
                case TRANSIT_OLD_TASK_FRAGMENT_CLOSE:
                    animAttr = enter
                            ? WindowAnimation_activityCloseEnterAnimation
                            : WindowAnimation_activityCloseExitAnimation;
                    break;
            }
            }
            a = animAttr != 0 ? loadAnimationAttr(lp, animAttr, transit) : null;
            a = animAttr != 0 ? loadAnimationAttr(lp, animAttr, transit) : null;
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,
@@ -1332,12 +1315,6 @@ public class AppTransition implements Dump {
            case TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE: {
            case TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE: {
                return "TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE";
                return "TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE";
            }
            }
            case TRANSIT_OLD_TASK_FRAGMENT_OPEN: {
                return "TRANSIT_OLD_TASK_FRAGMENT_OPEN";
            }
            case TRANSIT_OLD_TASK_FRAGMENT_CLOSE: {
                return "TRANSIT_OLD_TASK_FRAGMENT_CLOSE";
            }
            default: {
            default: {
                return "<UNKNOWN: " + transition + ">";
                return "<UNKNOWN: " + transition + ">";
            }
            }
+13 −54
Original line number Original line Diff line number Diff line
@@ -39,8 +39,6 @@ import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_OLD_NONE;
import static android.view.WindowManager.TRANSIT_OLD_NONE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_BACK;
import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_BACK;
@@ -70,7 +68,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACT
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;


import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.os.Trace;
import android.os.Trace;
import android.util.ArrayMap;
import android.util.ArrayMap;
@@ -89,8 +86,6 @@ import android.view.animation.Animation;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.common.ProtoLog;
import com.android.internal.protolog.common.ProtoLog;


import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.LinkedList;
import java.util.function.Predicate;
import java.util.function.Predicate;
@@ -107,20 +102,6 @@ public class AppTransitionController {
    private RemoteAnimationDefinition mRemoteAnimationDefinition = null;
    private RemoteAnimationDefinition mRemoteAnimationDefinition = null;
    private static final int KEYGUARD_GOING_AWAY_ANIMATION_DURATION = 400;
    private static final int KEYGUARD_GOING_AWAY_ANIMATION_DURATION = 400;


    private static final int TYPE_NONE = 0;
    private static final int TYPE_ACTIVITY = 1;
    private static final int TYPE_TASK_FRAGMENT = 2;
    private static final int TYPE_TASK = 3;

    @IntDef(prefix = { "TYPE_" }, value = {
            TYPE_NONE,
            TYPE_ACTIVITY,
            TYPE_TASK_FRAGMENT,
            TYPE_TASK
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitContainerType {}

    private final ArrayMap<WindowContainer, Integer> mTempTransitionReasons = new ArrayMap<>();
    private final ArrayMap<WindowContainer, Integer> mTempTransitionReasons = new ArrayMap<>();


    AppTransitionController(WindowManagerService service, DisplayContent displayContent) {
    AppTransitionController(WindowManagerService service, DisplayContent displayContent) {
@@ -406,38 +387,33 @@ public class AppTransitionController {
                openingApps, closingApps, true /* visible */);
                openingApps, closingApps, true /* visible */);
        final ArraySet<WindowContainer> closingWcs = getAnimationTargets(
        final ArraySet<WindowContainer> closingWcs = getAnimationTargets(
                openingApps, closingApps, false /* visible */);
                openingApps, closingApps, false /* visible */);
        final WindowContainer<?> openingContainer = !openingWcs.isEmpty()
        final boolean isActivityOpening = !openingWcs.isEmpty()
                ? openingWcs.valueAt(0) : null;
                && openingWcs.valueAt(0).asActivityRecord() != null;
        final WindowContainer<?> closingContainer = !closingWcs.isEmpty()
        final boolean isActivityClosing = !closingWcs.isEmpty()
                ? closingWcs.valueAt(0) : null;
                && closingWcs.valueAt(0).asActivityRecord() != null;
        @TransitContainerType int openingType = getTransitContainerType(openingContainer);
        final boolean isTaskOpening = !openingWcs.isEmpty() && !isActivityOpening;
        @TransitContainerType int closingType = getTransitContainerType(closingContainer);
        final boolean isTaskClosing = !closingWcs.isEmpty() && !isActivityClosing;
        if (appTransition.containsTransitRequest(TRANSIT_TO_FRONT) && openingType == TYPE_TASK) {

        if (appTransition.containsTransitRequest(TRANSIT_TO_FRONT) && isTaskOpening) {
            return TRANSIT_OLD_TASK_TO_FRONT;
            return TRANSIT_OLD_TASK_TO_FRONT;
        }
        }
        if (appTransition.containsTransitRequest(TRANSIT_TO_BACK) && closingType == TYPE_TASK) {
        if (appTransition.containsTransitRequest(TRANSIT_TO_BACK) && isTaskClosing) {
            return TRANSIT_OLD_TASK_TO_BACK;
            return TRANSIT_OLD_TASK_TO_BACK;
        }
        }
        if (appTransition.containsTransitRequest(TRANSIT_OPEN)) {
        if (appTransition.containsTransitRequest(TRANSIT_OPEN)) {
            if (openingType == TYPE_TASK) {
            if (isTaskOpening) {
                return (appTransition.getTransitFlags() & TRANSIT_FLAG_OPEN_BEHIND) != 0
                return (appTransition.getTransitFlags() & TRANSIT_FLAG_OPEN_BEHIND) != 0
                        ? TRANSIT_OLD_TASK_OPEN_BEHIND : TRANSIT_OLD_TASK_OPEN;
                        ? TRANSIT_OLD_TASK_OPEN_BEHIND : TRANSIT_OLD_TASK_OPEN;
            }
            }
            if (openingType == TYPE_ACTIVITY) {
            if (isActivityOpening) {
                return TRANSIT_OLD_ACTIVITY_OPEN;
                return TRANSIT_OLD_ACTIVITY_OPEN;
            }
            }
            if (openingType == TYPE_TASK_FRAGMENT) {
                return TRANSIT_OLD_TASK_FRAGMENT_OPEN;
            }
        }
        }
        if (appTransition.containsTransitRequest(TRANSIT_CLOSE)) {
        if (appTransition.containsTransitRequest(TRANSIT_CLOSE)) {
            if (closingType == TYPE_TASK) {
            if (isTaskClosing) {
                return TRANSIT_OLD_TASK_CLOSE;
                return TRANSIT_OLD_TASK_CLOSE;
            }
            }
            if (closingType == TYPE_TASK_FRAGMENT) {
            if (isActivityClosing) {
                return TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
            }
            if (closingType == TYPE_ACTIVITY) {
                for (int i = closingApps.size() - 1; i >= 0; i--) {
                for (int i = closingApps.size() - 1; i >= 0; i--) {
                    if (closingApps.valueAt(i).visibleIgnoringKeyguard) {
                    if (closingApps.valueAt(i).visibleIgnoringKeyguard) {
                        return TRANSIT_OLD_ACTIVITY_CLOSE;
                        return TRANSIT_OLD_ACTIVITY_CLOSE;
@@ -454,23 +430,6 @@ public class AppTransitionController {
        return TRANSIT_OLD_NONE;
        return TRANSIT_OLD_NONE;
    }
    }


    @TransitContainerType
    private static int getTransitContainerType(@Nullable WindowContainer<?> container) {
        if (container == null) {
            return TYPE_NONE;
        }
        if (container.asTask() != null) {
            return TYPE_TASK;
        }
        if (container.asTaskFragment() != null) {
            return TYPE_TASK_FRAGMENT;
        }
        if (container.asActivityRecord() != null) {
            return TYPE_ACTIVITY;
        }
        return TYPE_NONE;
    }

    private static WindowManager.LayoutParams getAnimLp(ActivityRecord activity) {
    private static WindowManager.LayoutParams getAnimLp(ActivityRecord activity) {
        final WindowState mainWindow = activity != null ? activity.findMainWindow() : null;
        final WindowState mainWindow = activity != null ? activity.findMainWindow() : null;
        return mainWindow != null ? mainWindow.mAttrs : null;
        return mainWindow != null ? mainWindow.mAttrs : null;
+1 −1
Original line number Original line Diff line number Diff line
@@ -219,7 +219,7 @@ public class ActivityRecordTests extends WindowTestsBase {
    public void testNoCleanupMovingActivityInSameStack() {
    public void testNoCleanupMovingActivityInSameStack() {
        final ActivityRecord activity = createActivityWith2LevelTask();
        final ActivityRecord activity = createActivityWith2LevelTask();
        final Task rootTask = activity.getRootTask();
        final Task rootTask = activity.getRootTask();
        final Task newTask = createTaskInRootTask(rootTask, 0 /* userId */);
        final Task newTask = new TaskBuilder(mAtm.mTaskSupervisor).setParentTask(rootTask).build();
        activity.reparent(newTask, 0, null /*reason*/);
        activity.reparent(newTask, 0, null /*reason*/);
        verify(rootTask, times(0)).cleanUpActivityReferences(any());
        verify(rootTask, times(0)).cleanUpActivityReferences(any());
    }
    }
Loading