diff options
15 files changed, 21 insertions, 272 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java index 6cc17d4fa009..a94183849bc5 100644 --- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java +++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java @@ -857,8 +857,7 @@ class ActivityMetricsLogger { info.mWindowsDrawnDelayMs = info.calculateDelay(timestampNs); info.mIsDrawn = true; final TransitionInfoSnapshot infoSnapshot = new TransitionInfoSnapshot(info); - if (info.mLoggedTransitionStarting || (!r.mDisplayContent.mOpeningApps.contains(r) - && !r.mTransitionController.isCollecting(r))) { + if (info.mLoggedTransitionStarting || !r.mTransitionController.isCollecting(r)) { done(false /* abort */, info, "notifyWindowsDrawn", timestampNs); } diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index c37b5a055140..333d91a1b08f 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -159,7 +159,6 @@ import static com.android.server.wm.ActivityRecordProto.FRONT_OF_TASK; import static com.android.server.wm.ActivityRecordProto.IN_SIZE_COMPAT_MODE; import static com.android.server.wm.ActivityRecordProto.IS_ANIMATING; import static com.android.server.wm.ActivityRecordProto.IS_USER_FULLSCREEN_OVERRIDE_ENABLED; -import static com.android.server.wm.ActivityRecordProto.IS_WAITING_FOR_TRANSITION_START; import static com.android.server.wm.ActivityRecordProto.LAST_ALL_DRAWN; import static com.android.server.wm.ActivityRecordProto.LAST_DROP_INPUT_MODE; import static com.android.server.wm.ActivityRecordProto.LAST_SURFACE_SHOWING; @@ -330,7 +329,6 @@ import android.view.RemoteAnimationDefinition; import android.view.SurfaceControl; import android.view.SurfaceControl.Transaction; import android.view.WindowInsets; -import android.view.WindowInsets.Type; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.view.WindowManager.TransitionOldType; @@ -1519,17 +1517,7 @@ final class ActivityRecord extends WindowToken { this.task = newTask; if (shouldStartChangeTransition(newParent, oldParent)) { - if (mTransitionController.isShellTransitionsEnabled()) { - // For Shell transition, call #initializeChangeTransition directly to take the - // screenshot at the Activity level. And Shell will be in charge of handling the - // surface reparent and crop. - initializeChangeTransition(getBounds()); - } else { - // For legacy app transition, we want to take a screenshot of the Activity surface, - // but animate the change transition on TaskFragment level to get the correct window - // crop. - newParent.initializeChangeTransition(getBounds(), getSurfaceControl()); - } + mTransitionController.collectVisibleChange(this); } super.onParentChanged(newParent, oldParent); @@ -1557,16 +1545,6 @@ final class ActivityRecord extends WindowToken { mLastReportedPictureInPictureMode = inPinnedWindowingMode(); } - // When the associated task is {@code null}, the {@link ActivityRecord} can no longer - // access visual elements like the {@link DisplayContent}. We must remove any associations - // such as animations. - if (task == null) { - // It is possible we have been marked as a closing app earlier. We must remove ourselves - // from this list so we do not participate in any future animations. - if (getDisplayContent() != null) { - getDisplayContent().mClosingApps.remove(this); - } - } final Task rootTask = getRootTask(); if (task == mLastParentBeforePip && task != null) { // Notify the TaskFragmentOrganizer that the activity is reparented back from pip. @@ -1749,14 +1727,6 @@ final class ActivityRecord extends WindowToken { return; } prevDc.onRunningActivityChanged(); - - if (prevDc.mOpeningApps.remove(this)) { - // Transfer opening transition to new display. - mDisplayContent.mOpeningApps.add(this); - mDisplayContent.executeAppTransition(); - } - - prevDc.mClosingApps.remove(this); prevDc.getDisplayPolicy().removeRelaunchingApp(this); if (prevDc.mFocusedApp == this) { @@ -4392,7 +4362,6 @@ final class ActivityRecord extends WindowToken { ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Removing app token: %s", this); - getDisplayContent().mOpeningApps.remove(this); getDisplayContent().mUnknownAppVisibilityController.appRemovedOrHidden(this); mWmService.mSnapshotController.onAppRemoved(this); mAtmService.mStartingProcessActivities.remove(this); @@ -4404,20 +4373,9 @@ final class ActivityRecord extends WindowToken { mAppCompatController.getTransparentPolicy().stop(); // Defer removal of this activity when either a child is animating, or app transition is on - // going. App transition animation might be applied on the parent task not on the activity, - // but the actual frame buffer is associated with the activity, so we have to keep the - // activity while a parent is animating. - boolean delayed = isAnimating(TRANSITION | PARENTS | CHILDREN, - ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION); - if (getDisplayContent().mClosingApps.contains(this)) { - delayed = true; - } else if (getDisplayContent().mAppTransition.isTransitionSet()) { - getDisplayContent().mClosingApps.add(this); - delayed = true; - } else if (mTransitionController.inTransition()) { - delayed = true; - } - + // going. The handleCompleteDeferredRemoval will continue the removal. + final boolean delayed = isAnimating(CHILDREN, ANIMATION_TYPE_WINDOW_ANIMATION) + || mTransitionController.inTransition(); // Don't commit visibility if it is waiting to animate. It will be set post animation. if (!delayed) { commitVisibility(false /* visible */, true /* performLayout */); @@ -5552,9 +5510,6 @@ final class ActivityRecord extends WindowToken { mAtmService.mBackNavigationController.onAppVisibilityChanged(this, visible); - final DisplayContent displayContent = getDisplayContent(); - displayContent.mOpeningApps.remove(this); - displayContent.mClosingApps.remove(this); setVisibleRequested(visible); mLastDeferHidingClient = deferHidingClient; @@ -5567,13 +5522,6 @@ final class ActivityRecord extends WindowToken { setClientVisible(false); } } else { - if (!appTransition.isTransitionSet() - && appTransition.isReady()) { - // Add the app mOpeningApps if transition is unset but ready. This means - // we're doing a screen freeze, and the unfreeze will wait for all opening - // apps to be ready. - displayContent.mOpeningApps.add(this); - } startingMoved = false; // If the token is currently hidden (should be the common case), or has been // stopped, then we need to set up to wait for its windows to be ready. @@ -6775,7 +6723,7 @@ final class ActivityRecord extends WindowToken { setAppLayoutChanges(FINISH_LAYOUT_REDO_ANIM, "checkAppWindowsReadyToShow"); // We can now show all of the drawn windows! - if (!getDisplayContent().mOpeningApps.contains(this) && canShowWindows()) { + if (canShowWindows()) { showAllWindowsLocked(); } } @@ -7449,15 +7397,6 @@ final class ActivityRecord extends WindowToken { return boundsLayer; } - @Override - boolean isWaitingForTransitionStart() { - final DisplayContent dc = getDisplayContent(); - return dc != null && dc.mAppTransition.isTransitionSet() - && (dc.mOpeningApps.contains(this) - || dc.mClosingApps.contains(this) - || dc.mChangingContainers.contains(this)); - } - boolean isTransitionForward() { return (mStartingData != null && mStartingData.mIsTransitionForward) || mDisplayContent.isNextTransitionForward(); @@ -9561,7 +9500,6 @@ final class ActivityRecord extends WindowToken { writeNameToProto(proto, NAME); super.dumpDebug(proto, WINDOW_TOKEN, logLevel); proto.write(LAST_SURFACE_SHOWING, mLastSurfaceShowing); - proto.write(IS_WAITING_FOR_TRANSITION_START, isWaitingForTransitionStart()); proto.write(IS_ANIMATING, isAnimating(TRANSITION | PARENTS | CHILDREN, ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION)); proto.write(FILLS_PARENT, fillsParent()); diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java index d98ad8bb9e05..12d4a210400c 100644 --- a/services/core/java/com/android/server/wm/AppTransition.java +++ b/services/core/java/com/android/server/wm/AppTransition.java @@ -89,7 +89,6 @@ import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpe import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation; import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_ANIM; -import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_APP_TRANSITIONS; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_APP_TRANSITIONS_ANIM; import static com.android.server.wm.AppTransitionProto.APP_TRANSITION_STATE; import static com.android.server.wm.AppTransitionProto.LAST_USED_APP_TRANSITION; @@ -1554,26 +1553,6 @@ public class AppTransition implements Dump { } private void handleAppTransitionTimeout() { - synchronized (mService.mGlobalLock) { - final DisplayContent dc = mDisplayContent; - if (dc == null) { - return; - } - notifyAppTransitionTimeoutLocked(); - if (isTransitionSet() || !dc.mOpeningApps.isEmpty() || !dc.mClosingApps.isEmpty() - || !dc.mChangingContainers.isEmpty()) { - ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, - "*** APP TRANSITION TIMEOUT. displayId=%d isTransitionSet()=%b " - + "mOpeningApps.size()=%d mClosingApps.size()=%d " - + "mChangingApps.size()=%d", - dc.getDisplayId(), dc.mAppTransition.isTransitionSet(), - dc.mOpeningApps.size(), dc.mClosingApps.size(), - dc.mChangingContainers.size()); - - setTimeout(); - mService.mWindowPlacerLocked.performSurfacePlacement(); - } - } } private static void doAnimationCallback(@NonNull IRemoteCallback callback) { diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 703ce7d24468..ea6514c66e3d 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -108,7 +108,6 @@ import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_W import static com.android.server.wm.ActivityRecord.State.RESUMED; import static com.android.server.wm.ActivityTaskManagerService.POWER_MODE_REASON_CHANGE_DISPLAY; import static com.android.server.wm.DisplayContentProto.APP_TRANSITION; -import static com.android.server.wm.DisplayContentProto.CLOSING_APPS; import static com.android.server.wm.DisplayContentProto.CURRENT_FOCUS; import static com.android.server.wm.DisplayContentProto.DISPLAY_FRAMES; import static com.android.server.wm.DisplayContentProto.DISPLAY_INFO; @@ -125,7 +124,6 @@ import static com.android.server.wm.DisplayContentProto.INPUT_METHOD_TARGET; import static com.android.server.wm.DisplayContentProto.IS_SLEEPING; import static com.android.server.wm.DisplayContentProto.KEEP_CLEAR_AREAS; import static com.android.server.wm.DisplayContentProto.MIN_SIZE_OF_RESIZEABLE_TASK_DP; -import static com.android.server.wm.DisplayContentProto.OPENING_APPS; import static com.android.server.wm.DisplayContentProto.RESUMED_ACTIVITY; import static com.android.server.wm.DisplayContentProto.ROOT_DISPLAY_AREA; import static com.android.server.wm.DisplayContentProto.SLEEP_TOKENS; @@ -196,7 +194,6 @@ import android.os.UserHandle; import android.os.UserManager; import android.os.WorkSource; import android.provider.Settings; -import android.util.ArrayMap; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.DisplayUtils; @@ -367,15 +364,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp final AppTransition mAppTransition; - final ArraySet<ActivityRecord> mOpeningApps = new ArraySet<>(); - final ArraySet<ActivityRecord> mClosingApps = new ArraySet<>(); - final ArraySet<WindowContainer> mChangingContainers = new ArraySet<>(); final UnknownAppVisibilityController mUnknownAppVisibilityController; - /** - * If a container is closing when resizing, keeps track of its starting bounds when it is - * removed from {@link #mChangingContainers}. - */ - final ArrayMap<WindowContainer, Rect> mClosingChangingContainers = new ArrayMap<>(); private MetricsLogger mMetricsLogger; @@ -1910,17 +1899,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp return false; } if (checkOpening) { - if (mTransitionController.isShellTransitionsEnabled()) { - if (!mTransitionController.isCollecting(r)) { - return false; - } - } else { - if (!mAppTransition.isTransitionSet() || !mOpeningApps.contains(r)) { - // Apply normal rotation animation in case of the activity set different - // requested orientation without activity switch, or the transition is unset due - // to starting window was transferred ({@link #mSkipAppTransitionAnimation}). - return false; - } + if (!mTransitionController.isCollecting(r)) { + // Apply normal rotation animation in case the activity changes requested + // orientation without activity switch. + return false; } if (r.isState(RESUMED) && !r.getTask().mInResumeTopActivity) { // If the activity is executing or has done the lifecycle callback, use normal @@ -3372,10 +3354,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp void removeImmediately() { mDeferredRemoval = false; try { - // Clear all transitions & screen frozen states when removing display. - mOpeningApps.clear(); - mClosingApps.clear(); - mChangingContainers.clear(); mUnknownAppVisibilityController.clear(); mAppTransition.removeAppTransitionTimeoutCallbacks(); mTransitionController.unregisterLegacyListener(mFixedRotationTransitionListener); @@ -3567,12 +3545,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (mFocusedApp != null) { mFocusedApp.writeNameToProto(proto, FOCUSED_APP); } - for (int i = mOpeningApps.size() - 1; i >= 0; i--) { - mOpeningApps.valueAt(i).writeIdentifierToProto(proto, OPENING_APPS); - } - for (int i = mClosingApps.size() - 1; i >= 0; i--) { - mClosingApps.valueAt(i).writeIdentifierToProto(proto, CLOSING_APPS); - } final Task focusedRootTask = getFocusedRootTask(); if (focusedRootTask != null) { @@ -4831,19 +4803,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } - if (!mOpeningApps.isEmpty() || !mClosingApps.isEmpty() || !mChangingContainers.isEmpty()) { - pw.println(); - if (mOpeningApps.size() > 0) { - pw.print(" mOpeningApps="); pw.println(mOpeningApps); - } - if (mClosingApps.size() > 0) { - pw.print(" mClosingApps="); pw.println(mClosingApps); - } - if (mChangingContainers.size() > 0) { - pw.print(" mChangingApps="); pw.println(mChangingContainers); - } - } - mUnknownAppVisibilityController.dump(pw, " "); } diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index bf9883c76a06..6b3499a5d68c 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -2028,7 +2028,7 @@ class Task extends TaskFragment { } if (shouldStartChangeTransition(prevWinMode, mTmpPrevBounds)) { - initializeChangeTransition(mTmpPrevBounds); + mTransitionController.collectVisibleChange(this); } // If the configuration supports persistent bounds (eg. Freeform), keep track of the diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java index 74059c1cc9b1..a698a9e82929 100644 --- a/services/core/java/com/android/server/wm/TaskFragment.java +++ b/services/core/java/com/android/server/wm/TaskFragment.java @@ -2779,9 +2779,7 @@ class TaskFragment extends WindowContainer<WindowContainer> { } // If this TaskFragment is closing while resizing, crop to the starting bounds instead. - final Rect bounds = isClosingWhenResizing() - ? mDisplayContent.mClosingChangingContainers.get(this) - : getBounds(); + final Rect bounds = getBounds(); final int width = bounds.width(); final int height = bounds.height(); if (!forceUpdate && width == mLastSurfaceSize.x && height == mLastSurfaceSize.y) { diff --git a/services/core/java/com/android/server/wm/WallpaperController.java b/services/core/java/com/android/server/wm/WallpaperController.java index c1ef208d1d4d..a8b9fedcdc73 100644 --- a/services/core/java/com/android/server/wm/WallpaperController.java +++ b/services/core/java/com/android/server/wm/WallpaperController.java @@ -292,12 +292,6 @@ class WallpaperController { return false; } - boolean isWallpaperTargetAnimating() { - return mWallpaperTarget != null && mWallpaperTarget.isAnimating(TRANSITION | PARENTS) - && (mWallpaperTarget.mActivityRecord == null - || !mWallpaperTarget.mActivityRecord.isWaitingForTransitionStart()); - } - void hideDeferredWallpapersIfNeededLegacy() { for (int i = mWallpaperTokens.size() - 1; i >= 0; i--) { final WallpaperWindowToken token = mWallpaperTokens.get(i); @@ -837,14 +831,6 @@ class WallpaperController { // Use the old target if new target is hidden but old target // is not. If they're both hidden, still use the new target. mWallpaperTarget = prevWallpaperTarget; - } else if (newTargetHidden == oldTargetHidden - && !mDisplayContent.mOpeningApps.contains(wallpaperTarget.mActivityRecord) - && (mDisplayContent.mOpeningApps.contains(prevWallpaperTarget.mActivityRecord) - || mDisplayContent.mClosingApps.contains(prevWallpaperTarget.mActivityRecord))) { - // If they're both hidden (or both not hidden), prefer the one that's currently in - // opening or closing app list, this allows transition selection logic to better - // determine the wallpaper status of opening/closing apps. - mWallpaperTarget = prevWallpaperTarget; } result.setWallpaperTarget(wallpaperTarget); diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index 95cdf46ea488..45202a29ba97 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -34,7 +34,6 @@ import static android.os.UserHandle.USER_NULL; import static android.view.SurfaceControl.Transaction; import static android.view.WindowInsets.Type.InsetsType; import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE; -import static android.view.WindowManager.TRANSIT_CHANGE; import static android.window.TaskFragmentAnimationParams.DEFAULT_ANIMATION_BACKGROUND_COLOR; import static android.window.DesktopModeFlags.ENABLE_CAPTION_COMPAT_INSET_FORCE_CONSUMPTION; @@ -901,10 +900,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< */ @CallSuper void removeImmediately() { - final DisplayContent dc = getDisplayContent(); - if (dc != null) { - dc.mClosingChangingContainers.remove(this); - } while (!mChildren.isEmpty()) { final E child = mChildren.getLast(); child.removeImmediately(); @@ -1116,10 +1111,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< if (asWindowState() == null) { mTransitionController.collect(this); } - // Cancel any change transition queued-up for this container on the old display when - // this container is moved from the old display. - mDisplayContent.mClosingChangingContainers.remove(this); - mDisplayContent.mChangingContainers.remove(this); } mDisplayContent = dc; if (dc != null && dc != this && mPendingTransaction != null) { @@ -1268,14 +1259,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< } /** - * @return {@code true} when the container is waiting the app transition start, {@code false} - * otherwise. - */ - boolean isWaitingForTransitionStart() { - return false; - } - - /** * @return {@code true} if in this subtree of the hierarchy we have an * {@code ActivityRecord#isAnimating(TRANSITION)}, {@code false} otherwise. */ @@ -1302,13 +1285,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< return isAnimating(0 /* self only */); } - /** - * @return {@code true} if the container is in changing app transition. - */ - boolean isChangingAppTransition() { - return mDisplayContent != null && mDisplayContent.mChangingContainers.contains(this); - } - boolean inTransition() { return mTransitionController.inTransition(this); } @@ -1427,12 +1403,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< return setVisibleRequested(newVisReq); } - /** Whether this window is closing while resizing. */ - boolean isClosingWhenResizing() { - return mDisplayContent != null - && mDisplayContent.mClosingChangingContainers.containsKey(this); - } - void writeIdentifierToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); proto.write(HASH_CODE, System.identityHashCode(this)); @@ -3044,36 +3014,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< || (getParent() != null && getParent().inPinnedWindowingMode()); } - /** - * Initializes a change transition. - * - * For now, this will only be called for the following cases: - * 1. {@link Task} is changing windowing mode between fullscreen and freeform. - * 2. {@link TaskFragment} is organized and is changing window bounds. - * 3. {@link ActivityRecord} is reparented into an organized {@link TaskFragment}. (The - * transition will happen on the {@link TaskFragment} for this case). - * - * This shouldn't be called on other {@link WindowContainer} unless there is a valid - * use case. - * - * @param startBounds The original bounds (on screen) of the surface we are snapshotting. - */ - void initializeChangeTransition(Rect startBounds, @Nullable SurfaceControl freezeTarget) { - if (mDisplayContent.mTransitionController.isShellTransitionsEnabled()) { - mDisplayContent.mTransitionController.collectVisibleChange(this); - return; - } - mDisplayContent.prepareAppTransition(TRANSIT_CHANGE); - mDisplayContent.mChangingContainers.add(this); - // Calculate the relative position in parent container. - final Rect parentBounds = getParent().getBounds(); - mTmpPoint.set(startBounds.left - parentBounds.left, startBounds.top - parentBounds.top); - } - - void initializeChangeTransition(Rect startBounds) { - initializeChangeTransition(startBounds, null /* freezeTarget */); - } - ArraySet<WindowContainer> getAnimationSources() { return mSurfaceAnimationSources; } @@ -3166,8 +3106,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< getAnimationPosition(mTmpPoint); mTmpRect.offsetTo(0, 0); - final boolean isChanging = AppTransition.isChangeTransitOld(transit) && enter - && isChangingAppTransition(); + final boolean isChanging = AppTransition.isChangeTransitOld(transit); if (isChanging) { final float durationScale = mWmService.getTransitionAnimationScaleLocked(); @@ -3519,9 +3458,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< && (mSurfaceAnimator.getAnimationType() & typesToCheck) > 0) { return true; } - if ((flags & TRANSITION) != 0 && isWaitingForTransitionStart()) { - return true; - } return false; } @@ -3603,13 +3539,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< return; } - if (isClosingWhenResizing()) { - // This container is closing while resizing, keep its surface at the starting position - // to prevent animation flicker. - getRelativePosition(mDisplayContent.mClosingChangingContainers.get(this), mTmpPos); - } else { - getRelativePosition(mTmpPos); - } + getRelativePosition(mTmpPos); final int deltaRotation = getRelativeDisplayRotation(); if (mTmpPos.equals(mLastSurfacePosition) && deltaRotation == mLastDeltaRotation) { return; diff --git a/services/core/java/com/android/server/wm/WindowOrganizerController.java b/services/core/java/com/android/server/wm/WindowOrganizerController.java index 4c53ba53a506..4b4736ec6c59 100644 --- a/services/core/java/com/android/server/wm/WindowOrganizerController.java +++ b/services/core/java/com/android/server/wm/WindowOrganizerController.java @@ -1060,7 +1060,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub effects |= applyChanges(taskFragment, c); if (taskFragment.shouldStartChangeTransition(mTmpBounds0, mTmpBounds1)) { - taskFragment.initializeChangeTransition(mTmpBounds0); + mTransitionController.collectVisibleChange(taskFragment); } taskFragment.continueOrganizedTaskFragmentSurfaceUpdate(); return effects; diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 589724182980..9f1289b2c12a 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -3272,13 +3272,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mDestroying = false; destroyedSomething = true; } - - // Since mDestroying will affect ActivityRecord#allDrawn, we need to perform another - // traversal in case we are waiting on this window to start the transition. - if (getDisplayContent().mAppTransition.isTransitionSet() - && getDisplayContent().mOpeningApps.contains(mActivityRecord)) { - mWmService.mWindowPlacerLocked.requestTraversal(); - } } return destroyedSomething; diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java index 9e7575f1c644..f5bda9f2b9e3 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java @@ -104,7 +104,6 @@ public class ActivityMetricsLaunchObserverTests extends WindowTestsBase { .setTask(mTrampolineActivity.getTask()) .setComponent(createRelative(DEFAULT_COMPONENT_PACKAGE_NAME, "TopActivity")) .build(); - mTopActivity.mDisplayContent.mOpeningApps.add(mTopActivity); mTransition = new Transition(TRANSIT_OPEN, 0 /* flags */, mTopActivity.mTransitionController, createTestBLASTSyncEngine()); mTransition.mParticipants.add(mTopActivity); @@ -485,7 +484,6 @@ public class ActivityMetricsLaunchObserverTests extends WindowTestsBase { @Test public void testActivityDrawnWithoutTransition() { - mTopActivity.mDisplayContent.mOpeningApps.remove(mTopActivity); mTransition.mParticipants.remove(mTopActivity); onIntentStarted(mTopActivity.intent); notifyAndVerifyActivityLaunched(mTopActivity); diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java index bb296148dad1..280e432f0245 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java @@ -3326,16 +3326,13 @@ public class ActivityRecordTests extends WindowTestsBase { makeWindowVisibleAndDrawn(app); // Put the activity in close transition. - mDisplayContent.mOpeningApps.clear(); - mDisplayContent.mClosingApps.add(app.mActivityRecord); - mDisplayContent.prepareAppTransition(TRANSIT_CLOSE); + requestTransition(app.mActivityRecord, WindowManager.TRANSIT_CLOSE); // Remove window during transition, so it is requested to hide, but won't be committed until // the transition is finished. app.mActivityRecord.onRemovedFromDisplay(); app.mActivityRecord.prepareSurfaces(); - assertTrue(mDisplayContent.mClosingApps.contains(app.mActivityRecord)); assertFalse(app.mActivityRecord.isVisibleRequested()); assertTrue(app.mActivityRecord.isVisible()); assertTrue(app.mActivityRecord.isSurfaceShowing()); @@ -3353,11 +3350,6 @@ public class ActivityRecordTests extends WindowTestsBase { makeWindowVisibleAndDrawn(app); app.mActivityRecord.prepareSurfaces(); - // Put the activity in close transition. - mDisplayContent.mOpeningApps.clear(); - mDisplayContent.mClosingApps.add(app.mActivityRecord); - mDisplayContent.prepareAppTransition(TRANSIT_CLOSE); - // Commit visibility before start transition. app.mActivityRecord.commitVisibility(false, false); diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java index 6e109a8d4eaf..d5b9751b0f51 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -1800,8 +1800,7 @@ public class DisplayContentTests extends WindowTestsBase { final ActivityRecord app = new ActivityBuilder(mAtm).setCreateTask(true).build(); app.setVisible(false); app.setState(ActivityRecord.State.RESUMED, "test"); - mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_OPEN); - mDisplayContent.mOpeningApps.add(app); + requestTransition(app, WindowManager.TRANSIT_OPEN); final int newOrientation = getRotatedOrientation(mDisplayContent); app.setRequestedOrientation(newOrientation); diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java index 7ab55bf7e874..cc2a76dcc9f2 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskFragmentTest.java @@ -189,11 +189,12 @@ public class TaskFragmentTest extends WindowTestsBase { doReturn(true).when(mTaskFragment).isVisible(); doReturn(true).when(mTaskFragment).isVisibleRequested(); + spyOn(mTaskFragment.mTransitionController); clearInvocations(mTransaction); mTaskFragment.setBounds(endBounds); // No change transition, but update the organized surface position. - verify(mTaskFragment, never()).initializeChangeTransition(any(), any()); + verify(mTaskFragment.mTransitionController, never()).collectVisibleChange(any()); verify(mTransaction).setPosition(mLeash, endBounds.left, endBounds.top); } diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java index edffab801499..cee98fb1b34c 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java @@ -409,17 +409,6 @@ public class WindowContainerTests extends WindowTestsBase { } @Test - public void testIsAnimating_TransitionFlag() { - final TestWindowContainerBuilder builder = new TestWindowContainerBuilder(mWm); - final TestWindowContainer root = builder.setLayer(0).build(); - final TestWindowContainer child1 = root.addChildWindow( - builder.setWaitForTransitionStart(true)); - - assertFalse(root.isAnimating(TRANSITION)); - assertTrue(child1.isAnimating(TRANSITION)); - } - - @Test public void testIsAnimating_ParentsFlag() { final TestWindowContainerBuilder builder = new TestWindowContainerBuilder(mWm); final TestWindowContainer root = builder.setLayer(0).build(); @@ -1655,7 +1644,7 @@ public class WindowContainerTests extends WindowTestsBase { }; TestWindowContainer(WindowManagerService wm, int layer, boolean isAnimating, - boolean isVisible, boolean waitTransitStart, Integer orientation, WindowState ws) { + boolean isVisible, Integer orientation, WindowState ws) { super(wm); mLayer = layer; @@ -1663,7 +1652,6 @@ public class WindowContainerTests extends WindowTestsBase { mIsVisible = isVisible; mFillsParent = true; mOrientation = orientation; - mWaitForTransitStart = waitTransitStart; mWindowState = ws; spyOn(mSurfaceAnimator); doReturn(mIsAnimating).when(mSurfaceAnimator).isAnimating(); @@ -1729,11 +1717,6 @@ public class WindowContainerTests extends WindowTestsBase { } @Override - boolean isWaitingForTransitionStart() { - return mWaitForTransitStart; - } - - @Override WindowState asWindowState() { return mWindowState; } @@ -1744,7 +1727,6 @@ public class WindowContainerTests extends WindowTestsBase { private int mLayer; private boolean mIsAnimating; private boolean mIsVisible; - private boolean mIsWaitTransitStart; private Integer mOrientation; private WindowState mWindowState; @@ -1782,14 +1764,9 @@ public class WindowContainerTests extends WindowTestsBase { return this; } - TestWindowContainerBuilder setWaitForTransitionStart(boolean waitTransitStart) { - mIsWaitTransitStart = waitTransitStart; - return this; - } - TestWindowContainer build() { return new TestWindowContainer(mWm, mLayer, mIsAnimating, mIsVisible, - mIsWaitTransitStart, mOrientation, mWindowState); + mOrientation, mWindowState); } } |