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

Commit 3d29027e authored by Chris Li's avatar Chris Li Committed by Automerger Merge Worker
Browse files

Merge "Don't override with TasmFragmentRemoteAnimation for wallpaper/non-app"...

Merge "Don't override with TasmFragmentRemoteAnimation for wallpaper/non-app" into sc-v2-dev am: ffe31629

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

Change-Id: I1209013acf69b8881e30d4bf0b852a590bc20682
parents 59dbf8d3 ffe31629
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -2371,12 +2371,6 @@
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "457951957": {
      "message": "\tNot visible=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/WallpaperAnimationAdapter.java"
    },
    "463993897": {
      "message": "Aborted waiting for drawn: %s",
      "level": "WARN",
@@ -3697,6 +3691,12 @@
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "2024493888": {
      "message": "\tWallpaper of display=%s is not visible",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/WallpaperAnimationAdapter.java"
    },
    "2028163120": {
      "message": "applyAnimation: anim=%s nextAppTransition=ANIM_SCALE_UP transit=%s isEntrance=%s Callers=%s",
      "level": "VERBOSE",
@@ -3721,12 +3721,6 @@
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
    },
    "2057434754": {
      "message": "\tvisible=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/WallpaperAnimationAdapter.java"
    },
    "2060978050": {
      "message": "moveWindowTokenToDisplay: Attempted to move token: %s to non-exiting displayId=%d",
      "level": "WARN",
+61 −21
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ public class AppTransitionController {
    @interface TransitContainerType {}

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

    AppTransitionController(WindowManagerService service, DisplayContent displayContent) {
        mService = service;
@@ -523,26 +524,44 @@ public class AppTransitionController {
        }
    }

    private boolean transitionMayContainNonAppWindows(@TransitionOldType int transit) {
        // We don't want to have the client to animate any non-app windows.
        // Having {@code transit} of those types doesn't mean it will contain non-app windows, but
        // non-app windows will only be included with those transition types. And we don't currently
        // have any use case of those for TaskFragment transition.
        // @see NonAppWindowAnimationAdapter#startNonAppWindowAnimations
        if (transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY
                || transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER
                || transit == TRANSIT_OLD_TASK_OPEN || transit == TRANSIT_OLD_TASK_TO_FRONT
                || transit == TRANSIT_OLD_WALLPAPER_CLOSE) {
            return true;
        }

        // Check if the wallpaper is going to participate in the transition. We don't want to have
        // the client to animate the wallpaper windows.
        // @see WallpaperAnimationAdapter#startWallpaperAnimations
        return mDisplayContent.mWallpaperController.isWallpaperVisible();
    }

    /**
     * Overrides the pending transition with the remote animation defined by the
     * {@link ITaskFragmentOrganizer} if all windows in the transition are children of
     * {@link TaskFragment} that are organized by the same organizer.
     *
     * @return {@code true} if the transition is overridden.
     * Finds the common {@link android.window.TaskFragmentOrganizer} that organizes all app windows
     * in the current transition.
     * @return {@code null} if there is no such organizer, or if there are more than one.
     */
    private boolean overrideWithTaskFragmentRemoteAnimation(@TransitionOldType int transit,
            ArraySet<Integer> activityTypes) {
        final ArrayList<WindowContainer> allWindows = new ArrayList<>();
        allWindows.addAll(mDisplayContent.mClosingApps);
        allWindows.addAll(mDisplayContent.mOpeningApps);
        allWindows.addAll(mDisplayContent.mChangingContainers);
    @Nullable
    private ITaskFragmentOrganizer findTaskFragmentOrganizerForAllWindows() {
        mTempTransitionWindows.clear();
        mTempTransitionWindows.addAll(mDisplayContent.mClosingApps);
        mTempTransitionWindows.addAll(mDisplayContent.mOpeningApps);
        mTempTransitionWindows.addAll(mDisplayContent.mChangingContainers);

        // It should only animated by the organizer if all windows are below the same leaf Task.
        Task leafTask = null;
        for (int i = allWindows.size() - 1; i >= 0; i--) {
            final ActivityRecord r = getAppFromContainer(allWindows.get(i));
        for (int i = mTempTransitionWindows.size() - 1; i >= 0; i--) {
            final ActivityRecord r = getAppFromContainer(mTempTransitionWindows.get(i));
            if (r == null) {
                return false;
                leafTask = null;
                break;
            }
            // The activity may be a child of embedded Task, but we want to find the owner Task.
            // As a result, find the organized TaskFragment first.
@@ -561,26 +580,31 @@ public class AppTransitionController {
                    ? organizedTaskFragment.getTask()
                    : r.getTask();
            if (task == null) {
                return false;
                leafTask = null;
                break;
            }
            // We don't want the organizer to handle transition of other non-embedded Task.
            if (leafTask != null && leafTask != task) {
                return false;
                leafTask = null;
                break;
            }
            final ActivityRecord rootActivity = task.getRootActivity();
            // We don't want the organizer to handle transition when the whole app is closing.
            if (rootActivity == null) {
                return false;
                leafTask = null;
                break;
            }
            // We don't want the organizer to handle transition of non-embedded activity of other
            // app.
            if (r.getUid() != rootActivity.getUid() && !r.isEmbedded()) {
                return false;
                leafTask = null;
                break;
            }
            leafTask = task;
        }
        mTempTransitionWindows.clear();
        if (leafTask == null) {
            return false;
            return null;
        }

        // We don't support remote animation for Task with multiple TaskFragmentOrganizers.
@@ -599,12 +623,28 @@ public class AppTransitionController {
        if (hasMultipleOrganizers) {
            ProtoLog.e(WM_DEBUG_APP_TRANSITIONS, "We don't support remote animation for"
                    + " Task with multiple TaskFragmentOrganizers.");
            return null;
        }
        return organizer[0];
    }

    /**
     * Overrides the pending transition with the remote animation defined by the
     * {@link ITaskFragmentOrganizer} if all windows in the transition are children of
     * {@link TaskFragment} that are organized by the same organizer.
     *
     * @return {@code true} if the transition is overridden.
     */
    private boolean overrideWithTaskFragmentRemoteAnimation(@TransitionOldType int transit,
            ArraySet<Integer> activityTypes) {
        if (transitionMayContainNonAppWindows(transit)) {
            return false;
        }

        final RemoteAnimationDefinition definition = organizer[0] != null
        final ITaskFragmentOrganizer organizer = findTaskFragmentOrganizerForAllWindows();
        final RemoteAnimationDefinition definition = organizer != null
                ? mDisplayContent.mAtmService.mTaskFragmentOrganizerController
                    .getRemoteAnimationDefinition(organizer[0])
                    .getRemoteAnimationDefinition(organizer)
                : null;
        final RemoteAnimationAdapter adapter = definition != null
                ? definition.getAdapter(transit, activityTypes)
+1 −1
Original line number Diff line number Diff line
@@ -793,7 +793,7 @@ public class RecentsAnimationController implements DeathRecipient {

    private RemoteAnimationTarget[] createWallpaperAnimations() {
        ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS, "createWallpaperAnimations()");
        return WallpaperAnimationAdapter.startWallpaperAnimations(mService, 0L, 0L,
        return WallpaperAnimationAdapter.startWallpaperAnimations(mDisplayContent, 0L, 0L,
                adapter -> {
                    synchronized (mService.mGlobalLock) {
                        // If the wallpaper animation is canceled, continue with the recents
+3 −3
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ class RemoteAnimationController implements DeathRecipient {
                if (wrappers.mThumbnailAdapter != null
                        && wrappers.mThumbnailAdapter.mCapturedFinishCallback != null) {
                    wrappers.mThumbnailAdapter.mCapturedFinishCallback
                            .onAnimationFinished(wrappers.mAdapter.mAnimationType,
                            .onAnimationFinished(wrappers.mThumbnailAdapter.mAnimationType,
                                    wrappers.mThumbnailAdapter);
                }
                mPendingAnimations.remove(i);
@@ -218,7 +218,7 @@ class RemoteAnimationController implements DeathRecipient {

    private RemoteAnimationTarget[] createWallpaperAnimations() {
        ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "createWallpaperAnimations()");
        return WallpaperAnimationAdapter.startWallpaperAnimations(mService,
        return WallpaperAnimationAdapter.startWallpaperAnimations(mDisplayContent,
                mRemoteAnimationAdapter.getDuration(),
                mRemoteAnimationAdapter.getStatusBarTransitionDelay(),
                adapter -> {
@@ -260,7 +260,7 @@ class RemoteAnimationController implements DeathRecipient {
                    }
                    if (adapters.mThumbnailAdapter != null) {
                        adapters.mThumbnailAdapter.mCapturedFinishCallback
                                .onAnimationFinished(adapters.mAdapter.mAnimationType,
                                .onAnimationFinished(adapters.mThumbnailAdapter.mAnimationType,
                                        adapters.mThumbnailAdapter);
                    }
                    mPendingAnimations.remove(i);
+7 −8
Original line number Diff line number Diff line
@@ -64,18 +64,17 @@ class WallpaperAnimationAdapter implements AnimationAdapter {
     *
     * @return RemoteAnimationTarget[] targets for all the visible wallpaper windows
     */
    public static RemoteAnimationTarget[] startWallpaperAnimations(WindowManagerService service,
    public static RemoteAnimationTarget[] startWallpaperAnimations(DisplayContent displayContent,
            long durationHint, long statusBarTransitionDelay,
            Consumer<WallpaperAnimationAdapter> animationCanceledRunnable,
            ArrayList<WallpaperAnimationAdapter> adaptersOut) {
        final ArrayList<RemoteAnimationTarget> targets = new ArrayList<>();
        service.mRoot.forAllWallpaperWindows(wallpaperWindow -> {
            if (!wallpaperWindow.getDisplayContent().mWallpaperController.isWallpaperVisible()) {
                ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "\tNot visible=%s", wallpaperWindow);
                return;
        if (!displayContent.mWallpaperController.isWallpaperVisible()) {
            ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS,
                    "\tWallpaper of display=%s is not visible", displayContent);
            return new RemoteAnimationTarget[0];
        }

            ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "\tvisible=%s", wallpaperWindow);
        final ArrayList<RemoteAnimationTarget> targets = new ArrayList<>();
        displayContent.forAllWallpaperWindows(wallpaperWindow -> {
            final WallpaperAnimationAdapter wallpaperAdapter = new WallpaperAnimationAdapter(
                    wallpaperWindow, durationHint, statusBarTransitionDelay,
                    animationCanceledRunnable);
Loading