diff options
author | 2025-02-20 01:18:23 -0800 | |
---|---|---|
committer | 2025-02-20 01:18:23 -0800 | |
commit | db3fb2ee23c46bd73f35ea6c1d50ac26cff7b6e8 (patch) | |
tree | d7ca51601f9c0fb41f2472b2619f06d1e7c4e775 /services | |
parent | aa73fff8dfd805fd4ecd154f85938173ea4941b4 (diff) | |
parent | 5018655702a27f7a69beda9cdfdc2c82d4fc7154 (diff) |
Merge "Remove no-op legacy AppTransition invocation from hierarchy" into main
Diffstat (limited to 'services')
13 files changed, 20 insertions, 598 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index aa3b500c05f6..7b6d408fbe2c 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -109,7 +109,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED; import static android.view.WindowManager.PROPERTY_ALLOW_UNTRUSTED_ACTIVITY_EMBEDDING_STATE_SHARING; -import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_OLD_UNSET; import static android.view.WindowManager.TRANSIT_RELAUNCH; import static android.view.WindowManager.hasWindowExtensionsEnabled; @@ -321,9 +320,7 @@ import android.util.MergedConfiguration; import android.util.Slog; import android.util.TimeUtils; import android.util.proto.ProtoOutputStream; -import android.view.AppTransitionAnimationSpec; import android.view.DisplayInfo; -import android.view.IAppTransitionAnimationSpecsFuture; import android.view.InputApplicationHandle; import android.view.RemoteAnimationAdapter; import android.view.RemoteAnimationDefinition; @@ -2349,7 +2346,8 @@ final class ActivityRecord extends WindowToken { // The snapshot of home is only used once because it won't be updated while screen // is on (see {@link TaskSnapshotController#screenTurningOff}). mWmService.mTaskSnapshotController.removeSnapshotCache(task.mTaskId); - if ((mDisplayContent.mAppTransition.getTransitFlags() + final Transition transition = mTransitionController.getCollectingTransition(); + if (transition != null && (transition.getFlags() & WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0) { // Only use snapshot of home as starting window when unlocking directly. return false; @@ -3638,7 +3636,6 @@ final class ActivityRecord extends WindowToken { if (DEBUG_VISIBILITY || DEBUG_TRANSITION) { Slog.v(TAG_TRANSITION, "Prepare close transition: finishing " + this); } - mDisplayContent.prepareAppTransition(TRANSIT_CLOSE); // When finishing the activity preemptively take the snapshot before the app window // is marked as hidden and any configuration changes take place @@ -3740,7 +3737,6 @@ final class ActivityRecord extends WindowToken { private void prepareActivityHideTransitionAnimation() { final DisplayContent dc = mDisplayContent; - dc.prepareAppTransition(TRANSIT_CLOSE); setVisibility(false); dc.executeAppTransition(); } @@ -4392,13 +4388,6 @@ final class ActivityRecord extends WindowToken { removeStartingWindow(); } - // If app transition animation was running for this activity, then we need to ensure that - // the app transition notifies that animations have completed in - // DisplayContent.handleAnimatingStoppedAndTransition(), so add to that list now - if (isAnimating(TRANSITION | PARENTS, ANIMATION_TYPE_APP_TRANSITION)) { - getDisplayContent().mNoAnimationNotifyOnTransitionFinished.add(token); - } - if (delayed && !isEmpty()) { // set the token aside because it has an active animation to be finished ProtoLog.v(WM_DEBUG_ADD_REMOVE, @@ -5070,8 +5059,6 @@ final class ActivityRecord extends WindowToken { void applyOptionsAnimation() { if (DEBUG_TRANSITION) Slog.i(TAG, "Applying options for " + this); if (mPendingRemoteAnimation != null) { - mDisplayContent.mAppTransition.overridePendingAppTransitionRemote( - mPendingRemoteAnimation); mTransitionController.setStatusBarTransitionDelay( mPendingRemoteAnimation.getStatusBarTransitionDelay()); } else { @@ -5101,14 +5088,6 @@ final class ActivityRecord extends WindowToken { IRemoteCallback finishCallback = null; switch (animationType) { case ANIM_CUSTOM: - displayContent.mAppTransition.overridePendingAppTransition( - pendingOptions.getPackageName(), - pendingOptions.getCustomEnterResId(), - pendingOptions.getCustomExitResId(), - pendingOptions.getCustomBackgroundColor(), - pendingOptions.getAnimationStartedListener(), - pendingOptions.getAnimationFinishedListener(), - pendingOptions.getOverrideTaskTransition()); options = AnimationOptions.makeCustomAnimOptions(pendingOptions.getPackageName(), pendingOptions.getCustomEnterResId(), pendingOptions.getCustomExitResId(), pendingOptions.getCustomBackgroundColor(), @@ -5117,9 +5096,6 @@ final class ActivityRecord extends WindowToken { finishCallback = pendingOptions.getAnimationFinishedListener(); break; case ANIM_CLIP_REVEAL: - displayContent.mAppTransition.overridePendingAppTransitionClipReveal( - pendingOptions.getStartX(), pendingOptions.getStartY(), - pendingOptions.getWidth(), pendingOptions.getHeight()); options = AnimationOptions.makeClipRevealAnimOptions( pendingOptions.getStartX(), pendingOptions.getStartY(), pendingOptions.getWidth(), pendingOptions.getHeight()); @@ -5131,9 +5107,6 @@ final class ActivityRecord extends WindowToken { } break; case ANIM_SCALE_UP: - displayContent.mAppTransition.overridePendingAppTransitionScaleUp( - pendingOptions.getStartX(), pendingOptions.getStartY(), - pendingOptions.getWidth(), pendingOptions.getHeight()); options = AnimationOptions.makeScaleUpAnimOptions( pendingOptions.getStartX(), pendingOptions.getStartY(), pendingOptions.getWidth(), pendingOptions.getHeight(), @@ -5149,10 +5122,6 @@ final class ActivityRecord extends WindowToken { case ANIM_THUMBNAIL_SCALE_DOWN: final boolean scaleUp = (animationType == ANIM_THUMBNAIL_SCALE_UP); final HardwareBuffer buffer = pendingOptions.getThumbnail(); - displayContent.mAppTransition.overridePendingAppTransitionThumb(buffer, - pendingOptions.getStartX(), pendingOptions.getStartY(), - pendingOptions.getAnimationStartedListener(), - scaleUp); options = AnimationOptions.makeThumbnailAnimOptions(buffer, pendingOptions.getStartX(), pendingOptions.getStartY(), scaleUp); startCallback = pendingOptions.getAnimationStartedListener(); @@ -5165,36 +5134,9 @@ final class ActivityRecord extends WindowToken { break; case ANIM_THUMBNAIL_ASPECT_SCALE_UP: case ANIM_THUMBNAIL_ASPECT_SCALE_DOWN: - final AppTransitionAnimationSpec[] specs = pendingOptions.getAnimSpecs(); - final IAppTransitionAnimationSpecsFuture specsFuture = - pendingOptions.getSpecsFuture(); - if (specsFuture != null) { - displayContent.mAppTransition.overridePendingAppTransitionMultiThumbFuture( - specsFuture, pendingOptions.getAnimationStartedListener(), - animationType == ANIM_THUMBNAIL_ASPECT_SCALE_UP); - } else if (animationType == ANIM_THUMBNAIL_ASPECT_SCALE_DOWN - && specs != null) { - displayContent.mAppTransition.overridePendingAppTransitionMultiThumb( - specs, pendingOptions.getAnimationStartedListener(), - pendingOptions.getAnimationFinishedListener(), false); - } else { - displayContent.mAppTransition.overridePendingAppTransitionAspectScaledThumb( - pendingOptions.getThumbnail(), - pendingOptions.getStartX(), pendingOptions.getStartY(), - pendingOptions.getWidth(), pendingOptions.getHeight(), - pendingOptions.getAnimationStartedListener(), - (animationType == ANIM_THUMBNAIL_ASPECT_SCALE_UP)); - if (intent.getSourceBounds() == null) { - intent.setSourceBounds(new Rect(pendingOptions.getStartX(), - pendingOptions.getStartY(), - pendingOptions.getStartX() + pendingOptions.getWidth(), - pendingOptions.getStartY() + pendingOptions.getHeight())); - } - } + // TODO(b/397847511): remove the related types from ActivityOptions. break; case ANIM_OPEN_CROSS_PROFILE_APPS: - displayContent.mAppTransition - .overridePendingAppTransitionStartCrossProfileApps(); options = AnimationOptions.makeCrossProfileAnimOptions(); break; case ANIM_NONE: @@ -5451,8 +5393,6 @@ final class ActivityRecord extends WindowToken { } private void setVisibility(boolean visible, boolean deferHidingClient) { - final AppTransition appTransition = getDisplayContent().mAppTransition; - // Don't set visibility to false if we were already not visible. This prevents WM from // adding the app to the closing app list which doesn't make sense for something that is // already not visible. However, set visibility to true even if we are already visible. @@ -5472,8 +5412,8 @@ final class ActivityRecord extends WindowToken { } ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, - "setAppVisibility(%s, visible=%b): %s visible=%b mVisibleRequested=%b Callers=%s", - token, visible, appTransition, isVisible(), mVisibleRequested, + "setAppVisibility(%s, visible=%b): visible=%b mVisibleRequested=%b Callers=%s", + token, visible, isVisible(), mVisibleRequested, Debug.getCallers(6)); // Before setting mVisibleRequested so we can track changes. @@ -5570,15 +5510,6 @@ final class ActivityRecord extends WindowToken { updateReportedVisibilityLocked(); } - @Override - boolean applyAnimation(LayoutParams lp, @TransitionOldType int transit, boolean enter, - boolean isVoiceInteraction, @Nullable ArrayList<WindowContainer> sources) { - if ((mTransitionChangeFlags & FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT) != 0) { - return false; - } - return super.applyAnimation(lp, transit, enter, isVoiceInteraction, sources); - } - /** * Update visibility to this {@link ActivityRecord}. * @@ -6642,9 +6573,7 @@ final class ActivityRecord extends WindowToken { // starting window is drawn, the transition can start earlier. Exclude finishing and bubble // because it may be a trampoline. if (app == null && !finishing && !mLaunchedFromBubble - && mVisibleRequested && !mDisplayContent.mAppTransition.isReady() - && !mDisplayContent.mAppTransition.isRunning() - && mDisplayContent.isNextTransitionForward()) { + && mVisibleRequested && mDisplayContent.isNextTransitionForward()) { // The pending transition state will be cleared after the transition is started, so // save the state for launching the client later (used by LaunchActivityItem). mStartingData.mIsTransitionForward = true; @@ -7526,7 +7455,6 @@ final class ActivityRecord extends WindowToken { } } - getDisplayContent().mAppTransition.notifyAppTransitionFinishedLocked(token); scheduleAnimation(); // Schedule to handle the stopping and finishing activities which the animation is done diff --git a/services/core/java/com/android/server/wm/DisplayArea.java b/services/core/java/com/android/server/wm/DisplayArea.java index b932ef362aca..6718ae435cd9 100644 --- a/services/core/java/com/android/server/wm/DisplayArea.java +++ b/services/core/java/com/android/server/wm/DisplayArea.java @@ -748,14 +748,9 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { && policy.okToAnimate(true /* ignoreScreenOn */)) { return false; } - // Consider unoccluding only when all unknown visibilities have been - // resolved, as otherwise we just may be starting another occluding activity. - final boolean isUnoccluding = - mDisplayContent.mAppTransition.isUnoccluding() - && mDisplayContent.mUnknownAppVisibilityController.allResolved(); - // If keyguard is showing, or we're unoccluding, force the keyguard's orientation, + // Use keyguard's orientation if it is showing and not occluded // even if SystemUI hasn't updated the attrs yet. - if (policy.isKeyguardShowingAndNotOccluded() || isUnoccluding) { + if (policy.isKeyguardShowingAndNotOccluded()) { return true; } } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index e30c24d87d20..85416903b274 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -88,7 +88,6 @@ import static android.view.inputmethod.ImeTracker.DEBUG_IME_VISIBILITY; import static android.window.DisplayAreaOrganizer.FEATURE_IME; import static android.window.DisplayAreaOrganizer.FEATURE_ROOT; -import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_APP_TRANSITIONS; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_BOOT; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_CONTENT_RECORDING; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_FOCUS; @@ -369,12 +368,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp private MetricsLogger mMetricsLogger; - /** - * List of clients without a transtiton animation that we notify once we are done - * transitioning since they won't be notified through the app window animator. - */ - final List<IBinder> mNoAnimationNotifyOnTransitionFinished = new ArrayList<>(); - // Mapping from a token IBinder to a WindowToken object on this display. private final HashMap<IBinder, WindowToken> mTokenMap = new HashMap(); @@ -1171,8 +1164,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mFixedRotationTransitionListener = new FixedRotationTransitionListener(mDisplayId); mAppTransition = new AppTransition(mWmService.mContext, mWmService, this); - mAppTransition.registerListenerLocked(mWmService.mActivityManagerAppTransitionNotifier); - mAppTransition.registerListenerLocked(mFixedRotationTransitionListener); mTransitionController.registerLegacyListener(mFixedRotationTransitionListener); mUnknownAppVisibilityController = new UnknownAppVisibilityController(mWmService, this); mRemoteDisplayChangeController = new RemoteDisplayChangeController(this); @@ -2858,13 +2849,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp return isVisible() && !mRemoved && !mRemoving; } - @Override - void onAppTransitionDone() { - super.onAppTransitionDone(); - mWmService.mWindowsChanged = true; - onTransitionFinished(); - } - void onTransitionFinished() { // If the transition finished callback cannot match the token for some reason, make sure the // rotated state is cleared if it is already invisible. @@ -3385,9 +3369,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mDeferredRemoval = false; try { mUnknownAppVisibilityController.clear(); - mAppTransition.removeAppTransitionTimeoutCallbacks(); mTransitionController.unregisterLegacyListener(mFixedRotationTransitionListener); - handleAnimatingStoppedAndTransition(); mDeviceStateController.unregisterDeviceStateCallback(mDeviceStateConsumer); super.removeImmediately(); if (DEBUG_DISPLAY) Slog.v(TAG_WM, "Removing display=" + this); @@ -3570,11 +3552,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mDisplayRotation.dumpDebug(proto, DISPLAY_ROTATION); mDisplayFrames.dumpDebug(proto, DISPLAY_FRAMES); proto.write(MIN_SIZE_OF_RESIZEABLE_TASK_DP, mMinSizeOfResizeableTaskDp); - if (mTransitionController.isShellTransitionsEnabled()) { - mTransitionController.dumpDebugLegacy(proto, APP_TRANSITION); - } else { - mAppTransition.dumpDebug(proto, APP_TRANSITION); - } + mTransitionController.dumpDebugLegacy(proto, APP_TRANSITION); if (mFocusedApp != null) { mFocusedApp.writeNameToProto(proto, FOCUSED_APP); } @@ -5635,60 +5613,19 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp */ void requestTransitionAndLegacyPrepare(@WindowManager.TransitionType int transit, @WindowManager.TransitionFlags int flags) { - prepareAppTransition(transit, flags); mTransitionController.requestTransitionIfNeeded(transit, flags, null /* trigger */, this); } void executeAppTransition() { mTransitionController.setReady(this); - if (mAppTransition.isTransitionSet()) { - ProtoLog.w(WM_DEBUG_APP_TRANSITIONS, - "Execute app transition: %s, displayId: %d Callers=%s", - mAppTransition, mDisplayId, Debug.getCallers(5)); - mAppTransition.setReady(); - mWmService.mWindowPlacerLocked.requestTraversal(); - } - } - - /** - * Update pendingLayoutChanges after app transition has finished. - */ - void handleAnimatingStoppedAndTransition() { - int changes = 0; - - mAppTransition.setIdle(); - - for (int i = mNoAnimationNotifyOnTransitionFinished.size() - 1; i >= 0; i--) { - final IBinder token = mNoAnimationNotifyOnTransitionFinished.get(i); - mAppTransition.notifyAppTransitionFinishedLocked(token); - } - mNoAnimationNotifyOnTransitionFinished.clear(); - - mWallpaperController.hideDeferredWallpapersIfNeededLegacy(); - - onAppTransitionDone(); - - changes |= FINISH_LAYOUT_REDO_LAYOUT; - ProtoLog.v(WM_DEBUG_WALLPAPER, "Wallpaper layer changed: assigning layers + relayout"); - computeImeTarget(true /* updateImeTarget */); - mWallpaperMayChange = true; - // Since the window list has been rebuilt, focus might have to be recomputed since the - // actual order of windows might have changed again. - mWmService.mFocusMayChange = true; - - pendingLayoutChanges |= changes; } /** Check if pending app transition is for activity / task launch. */ boolean isNextTransitionForward() { // TODO(b/191375840): decouple "forwardness" from transition system. - if (mTransitionController.isShellTransitionsEnabled()) { - @WindowManager.TransitionType int type = - mTransitionController.getCollectingTransitionType(); - return type == TRANSIT_OPEN || type == TRANSIT_TO_FRONT; - } - return mAppTransition.containsTransitRequest(TRANSIT_OPEN) - || mAppTransition.containsTransitRequest(TRANSIT_TO_FRONT); + final @WindowManager.TransitionType int type = + mTransitionController.getCollectingTransitionType(); + return type == TRANSIT_OPEN || type == TRANSIT_TO_FRONT; } /** diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index fbe850198c50..7aa2101f516c 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -631,7 +631,6 @@ public class DisplayPolicy { mHandler.post(mAppTransitionFinished); } }; - displayContent.mAppTransition.registerListenerLocked(mAppTransitionListener); displayContent.mTransitionController.registerLegacyListener(mAppTransitionListener); // TODO: Make it can take screenshot on external display diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index 40f16c187f20..f309372ab6a2 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -2103,10 +2103,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> removeRootTasksInWindowingModes(WINDOWING_MODE_PINNED); } - // Set a transition to ensure that we don't immediately try and update the visibility - // of the activity entering PIP - r.getDisplayContent().prepareAppTransition(TRANSIT_NONE); - transitionController.collect(task); // Defer the windowing mode change until after the transition to prevent the activity diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 988af44f6e55..8e5e2f311489 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -54,7 +54,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_RESIZEABLE_ACTIVITY_OVERRIDES; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED; -import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; @@ -1658,8 +1657,7 @@ class Task extends TaskFragment { // Prevent the transition from being executed too early if the top activity is // resumed but the mVisibleRequested of any other activity is true, the transition // should wait until next activity resumed. - if (r.isState(RESUMED) || (r.isVisible() - && !mDisplayContent.mAppTransition.containsTransitRequest(TRANSIT_CLOSE))) { + if (r.isState(RESUMED) || r.isVisible()) { r.finishIfPossible(reason, false /* oomAdj */); } else { r.destroyIfPossible(reason); @@ -2335,11 +2333,6 @@ class Task extends TaskFragment { mLastSurfaceSize.set(width, height); } - @VisibleForTesting - boolean isInChangeTransition() { - return AppTransition.isChangeTransitOld(mTransit); - } - @Override void writeIdentifierToProto(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); @@ -5305,11 +5298,9 @@ class Task extends TaskFragment { // Place a new activity at top of root task, so it is next to interact with the user. if ((r.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { - mDisplayContent.prepareAppTransition(TRANSIT_NONE); mTaskSupervisor.mNoAnimActivities.add(r); mTransitionController.setNoAnimation(r); } else { - mDisplayContent.prepareAppTransition(TRANSIT_OPEN); mTaskSupervisor.mNoAnimActivities.remove(r); } if (newTask && !r.mLaunchTaskBehind) { @@ -5707,7 +5698,6 @@ class Task extends TaskFragment { ActivityOptions.abort(options); } } - mDisplayContent.prepareAppTransition(transit); } final void moveTaskToFront(Task tr, boolean noAnimation, ActivityOptions options, @@ -5759,12 +5749,9 @@ class Task extends TaskFragment { if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare to front transition: task=" + tr); if (noAnimation) { - mDisplayContent.prepareAppTransition(TRANSIT_NONE); mTaskSupervisor.mNoAnimActivities.add(top); - if (mTransitionController.isShellTransitionsEnabled()) { - mTransitionController.collect(top); - mTransitionController.setNoAnimation(top); - } + mTransitionController.collect(top); + mTransitionController.setNoAnimation(top); ActivityOptions.abort(options); } else { updateTransitLocked(TRANSIT_TO_FRONT, options); @@ -5874,10 +5861,6 @@ class Task extends TaskFragment { moveTaskToBackInner(tr, transition); }); } else { - // Skip the transition for pinned task. - if (!inPinnedWindowingMode()) { - mDisplayContent.prepareAppTransition(TRANSIT_TO_BACK); - } moveTaskToBackInner(tr, null /* transition */); } return true; diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java index bbda849262b2..9d18d6c4cc89 100644 --- a/services/core/java/com/android/server/wm/TaskFragment.java +++ b/services/core/java/com/android/server/wm/TaskFragment.java @@ -44,10 +44,6 @@ import static android.view.Display.INVALID_DISPLAY; import static android.view.Surface.ROTATION_270; import static android.view.Surface.ROTATION_90; import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND; -import static android.view.WindowManager.TRANSIT_CLOSE; -import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND; -import static android.view.WindowManager.TRANSIT_NONE; -import static android.view.WindowManager.TRANSIT_OPEN; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_STATES; import static com.android.server.wm.ActivityRecord.State.PAUSED; @@ -56,7 +52,6 @@ import static com.android.server.wm.ActivityRecord.State.RESUMED; import static com.android.server.wm.ActivityRecord.State.STOPPING; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_RESULTS; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SWITCH; -import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_TRANSITION; import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_RESULTS; import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_SWITCH; import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_TRANSITION; @@ -1682,36 +1677,15 @@ class TaskFragment extends WindowContainer<WindowContainer> { final DisplayContent dc = taskDisplayArea.mDisplayContent; if (prev != null) { if (prev.finishing) { - if (DEBUG_TRANSITION) { - Slog.v(TAG_TRANSITION, "Prepare close transition: prev=" + prev); - } if (mTaskSupervisor.mNoAnimActivities.contains(prev)) { anim = false; - dc.prepareAppTransition(TRANSIT_NONE); - } else { - dc.prepareAppTransition(TRANSIT_CLOSE); } prev.setVisibility(false); - } else { - if (DEBUG_TRANSITION) { - Slog.v(TAG_TRANSITION, "Prepare open transition: prev=" + prev); - } - if (mTaskSupervisor.mNoAnimActivities.contains(next)) { - anim = false; - dc.prepareAppTransition(TRANSIT_NONE); - } else { - dc.prepareAppTransition(TRANSIT_OPEN, - next.mLaunchTaskBehind ? TRANSIT_FLAG_OPEN_BEHIND : 0); - } - } - } else { - if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare open transition: no previous"); - if (mTaskSupervisor.mNoAnimActivities.contains(next)) { + } else if (mTaskSupervisor.mNoAnimActivities.contains(next)) { anim = false; - dc.prepareAppTransition(TRANSIT_NONE); - } else { - dc.prepareAppTransition(TRANSIT_OPEN); } + } else if (mTaskSupervisor.mNoAnimActivities.contains(next)) { + anim = false; } if (anim) { diff --git a/services/core/java/com/android/server/wm/WallpaperWindowToken.java b/services/core/java/com/android/server/wm/WallpaperWindowToken.java index 7c88abcec7ec..9506ffeb2792 100644 --- a/services/core/java/com/android/server/wm/WallpaperWindowToken.java +++ b/services/core/java/com/android/server/wm/WallpaperWindowToken.java @@ -217,8 +217,7 @@ class WallpaperWindowToken extends WindowToken { } // If in a transition, defer commits for activities that are going invisible - if (!visible && (mTransitionController.inTransition() - || getDisplayContent().mAppTransition.isRunning())) { + if (!visible && mTransitionController.inTransition()) { return; } diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index 45202a29ba97..d0d2067ac4bc 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -16,9 +16,6 @@ package com.android.server.wm; -import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; -import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; -import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; @@ -29,24 +26,15 @@ import static android.content.pm.ActivityInfo.reverseOrientation; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.content.res.Configuration.ORIENTATION_UNDEFINED; -import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; 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.window.TaskFragmentAnimationParams.DEFAULT_ANIMATION_BACKGROUND_COLOR; import static android.window.DesktopModeFlags.ENABLE_CAPTION_COMPAT_INSET_FORCE_CONSUMPTION; 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.internal.protolog.WmProtoLogGroups.WM_DEBUG_ORIENTATION; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_SYNC_ENGINE; -import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; -import static com.android.server.wm.AppTransition.MAX_APP_TRANSITION_DURATION; -import static com.android.server.wm.AppTransition.isActivityTransitOld; -import static com.android.server.wm.AppTransition.isTaskFragmentTransitOld; -import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING; import static com.android.server.wm.IdentifierProto.HASH_CODE; import static com.android.server.wm.IdentifierProto.TITLE; import static com.android.server.wm.IdentifierProto.USER_ID; @@ -65,7 +53,6 @@ import static com.android.server.wm.WindowContainerProto.VISIBLE; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG; 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.WindowStateAnimator.ROOT_TASK_CLIP_AFTER_ANIM; import android.annotation.CallSuper; import android.annotation.ColorInt; @@ -81,10 +68,8 @@ import android.graphics.Rect; import android.os.Debug; import android.os.IBinder; import android.os.RemoteException; -import android.os.Trace; import android.util.ArrayMap; import android.util.ArraySet; -import android.util.Pair; import android.util.Pools; import android.util.RotationUtils; import android.util.Slog; @@ -102,14 +87,11 @@ import android.view.SurfaceControl.Builder; import android.view.SurfaceControlViewHost; import android.view.WindowManager; import android.view.WindowManager.TransitionOldType; -import android.view.animation.Animation; import android.window.IWindowContainerToken; import android.window.WindowContainerToken; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.graphics.ColorUtils; import com.android.internal.protolog.ProtoLog; -import com.android.internal.protolog.common.LogLevel; import com.android.internal.util.ToBooleanFunction; import com.android.server.wm.SurfaceAnimator.Animatable; import com.android.server.wm.SurfaceAnimator.AnimationType; @@ -1315,31 +1297,12 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< } /** - * Returns true if the container or one of its children as some content it can display or wants - * to display (e.g. app views or saved surface). - * - * NOTE: While this method will return true if the there is some content to display, it doesn't - * mean the container is visible. Use {@link #isVisible()} to determine if the container is - * visible. - */ - boolean hasContentToDisplay() { - for (int i = mChildren.size() - 1; i >= 0; --i) { - final WindowContainer wc = mChildren.get(i); - if (wc.hasContentToDisplay()) { - return true; - } - } - return false; - } - - /** * Returns true if the container or one of its children is considered visible from the * WindowManager perspective which usually means valid surface and some other internal state * are true. * * NOTE: While this method will return true if the surface is visible, it doesn't mean the - * client has actually displayed any content. Use {@link #hasContentToDisplay()} to determine if - * the container has any content to display. + * client has actually displayed any content. */ boolean isVisible() { // TODO: Will this be more correct if it checks the visibility of its parents? @@ -1480,13 +1443,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< } } - void onAppTransitionDone() { - for (int i = mChildren.size() - 1; i >= 0; --i) { - final WindowContainer wc = mChildren.get(i); - wc.onAppTransitionDone(); - } - } - /** * Called when this container or one of its descendants changed its requested orientation, and * wants this container to handle it or pass it to its parent. @@ -3039,264 +2995,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< getRelativePosition(outPosition); } - /** - * Applies the app transition animation according the given the layout properties in the - * window hierarchy. - * - * @param lp The layout parameters of the window. - * @param transit The app transition type indicates what kind of transition to be applied. - * @param enter Whether the app transition is entering transition or not. - * @param isVoiceInteraction Whether the container is participating in voice interaction or not. - * @param sources {@link ActivityRecord}s which causes this app transition animation. - * - * @return {@code true} when the container applied the app transition, {@code false} if the - * app transition is disabled or skipped. - * - * @see #getAnimationAdapter - */ - boolean applyAnimation(WindowManager.LayoutParams lp, @TransitionOldType int transit, - boolean enter, boolean isVoiceInteraction, - @Nullable ArrayList<WindowContainer> sources) { - if (mWmService.mDisableTransitionAnimation) { - ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, - "applyAnimation: transition animation is disabled or skipped. " - + "container=%s", this); - cancelAnimation(); - return false; - } - - // Only apply an animation if the display isn't frozen. If it is frozen, there is no reason - // to animate and it can cause strange artifacts when we unfreeze the display if some - // different animation is running. - try { - Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "WC#applyAnimation"); - if (okToAnimate()) { - ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, - "applyAnimation: transit=%s, enter=%b, wc=%s", - AppTransition.appTransitionOldToString(transit), enter, this); - applyAnimationUnchecked(lp, enter, transit, isVoiceInteraction, sources); - } else { - cancelAnimation(); - } - } finally { - Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); - } - - return isAnimating(); - } - - /** - * Gets the {@link AnimationAdapter} according the given window layout properties in the window - * hierarchy. - * - * @return The return value will always contain two elements, one for normal animations and the - * other for thumbnail animation, both can be {@code null}. - * - * @See com.android.server.wm.RemoteAnimationController.RemoteAnimationRecord - * @See LocalAnimationAdapter - */ - Pair<AnimationAdapter, AnimationAdapter> getAnimationAdapter(WindowManager.LayoutParams lp, - @TransitionOldType int transit, boolean enter, boolean isVoiceInteraction) { - final Pair<AnimationAdapter, AnimationAdapter> resultAdapters; - final int appRootTaskClipMode = getDisplayContent().mAppTransition.getAppRootTaskClipMode(); - - // Separate position and size for use in animators. - final Rect screenBounds = getAnimationBounds(appRootTaskClipMode); - mTmpRect.set(screenBounds); - getAnimationPosition(mTmpPoint); - mTmpRect.offsetTo(0, 0); - - final boolean isChanging = AppTransition.isChangeTransitOld(transit); - - if (isChanging) { - final float durationScale = mWmService.getTransitionAnimationScaleLocked(); - final DisplayInfo displayInfo = getDisplayContent().getDisplayInfo(); - mTmpRect.offsetTo(mTmpPoint.x, mTmpPoint.y); - - final AnimationAdapter adapter = new LocalAnimationAdapter( - new WindowChangeAnimationSpec(null /* startBounds */, mTmpRect, - displayInfo, durationScale, true /* isAppAnimation */, - false /* isThumbnail */), - getSurfaceAnimationRunner()); - - final AnimationAdapter thumbnailAdapter = null; - resultAdapters = new Pair<>(adapter, thumbnailAdapter); - mTransit = transit; - mTransitFlags = getDisplayContent().mAppTransition.getTransitFlags(); - } else { - mNeedsAnimationBoundsLayer = (appRootTaskClipMode == ROOT_TASK_CLIP_AFTER_ANIM); - final Animation a = loadAnimation(lp, transit, enter, isVoiceInteraction); - - if (a != null) { - // Only apply corner radius to animation if we're not in multi window mode. - // We don't want rounded corners when in pip or split screen. - final float windowCornerRadius = !inMultiWindowMode() - ? getDisplayContent().getWindowCornerRadius() - : 0; - if (asActivityRecord() != null - && asActivityRecord().isNeedsLetterboxedAnimation()) { - asActivityRecord().getLetterboxInnerBounds(mTmpRect); - } - AnimationAdapter adapter = new LocalAnimationAdapter( - new WindowAnimationSpec(a, mTmpPoint, mTmpRect, - getDisplayContent().mAppTransition.canSkipFirstFrame(), - appRootTaskClipMode, true /* isAppAnimation */, windowCornerRadius), - getSurfaceAnimationRunner()); - - resultAdapters = new Pair<>(adapter, null); - mNeedsZBoost = a.getZAdjustment() == Animation.ZORDER_TOP - || AppTransition.isClosingTransitOld(transit); - mTransit = transit; - mTransitFlags = getDisplayContent().mAppTransition.getTransitFlags(); - } else { - resultAdapters = new Pair<>(null, null); - } - } - return resultAdapters; - } - - protected void applyAnimationUnchecked(WindowManager.LayoutParams lp, boolean enter, - @TransitionOldType int transit, boolean isVoiceInteraction, - @Nullable ArrayList<WindowContainer> sources) { - final Task task = asTask(); - if (task != null && !enter && !task.isActivityTypeHomeOrRecents()) { - final InsetsControlTarget imeTarget = mDisplayContent.getImeTarget(IME_TARGET_LAYERING); - final boolean isImeLayeringTarget = imeTarget != null && imeTarget.getWindow() != null - && imeTarget.getWindow().getTask() == task; - // Attach and show the IME screenshot when the task is the IME target and performing - // task closing transition to the next task. - if (isImeLayeringTarget && AppTransition.isTaskCloseTransitOld(transit)) { - mDisplayContent.showImeScreenshot(); - } - } - final Pair<AnimationAdapter, AnimationAdapter> adapters = getAnimationAdapter(lp, - transit, enter, isVoiceInteraction); - AnimationAdapter adapter = adapters.first; - AnimationAdapter thumbnailAdapter = adapters.second; - if (adapter != null) { - if (sources != null) { - mSurfaceAnimationSources.addAll(sources); - } - - AnimationRunnerBuilder animationRunnerBuilder = new AnimationRunnerBuilder(); - - // Check if the animation requests to show background color for Activity and embedded - // TaskFragment. - final ActivityRecord activityRecord = asActivityRecord(); - final TaskFragment taskFragment = asTaskFragment(); - if (adapter.getShowBackground() - // Check if it is Activity transition. - && ((activityRecord != null && isActivityTransitOld(transit)) - // Check if it is embedded TaskFragment transition. - || (taskFragment != null && taskFragment.isEmbedded() - && isTaskFragmentTransitOld(transit)))) { - final @ColorInt int backgroundColorForTransition; - if (adapter.getBackgroundColor() != 0) { - // If available use the background color provided through getBackgroundColor - // which if set originates from a call to overridePendingAppTransition. - backgroundColorForTransition = adapter.getBackgroundColor(); - } else { - final TaskFragment organizedTf = activityRecord != null - ? activityRecord.getOrganizedTaskFragment() - : taskFragment.getOrganizedTaskFragment(); - if (organizedTf != null && organizedTf.getAnimationParams() - .getAnimationBackgroundColor() != DEFAULT_ANIMATION_BACKGROUND_COLOR) { - // This window is embedded and has an animation background color set on the - // TaskFragment. Pass this color with this window, so the handler can use it - // as the animation background color if needed, - backgroundColorForTransition = organizedTf.getAnimationParams() - .getAnimationBackgroundColor(); - } else { - // Otherwise default to the window's background color if provided through - // the theme as the background color for the animation - the top most window - // with a valid background color and showBackground set takes precedence. - final Task parentTask = activityRecord != null - ? activityRecord.getTask() - : taskFragment.getTask(); - backgroundColorForTransition = parentTask.getTaskDescription() - .getBackgroundColor(); - } - } - // Set to opaque for animation background to prevent it from exposing the blank - // background or content below. - animationRunnerBuilder.setTaskBackgroundColor(ColorUtils.setAlphaComponent( - backgroundColorForTransition, 255)); - } - - animationRunnerBuilder.build() - .startAnimation(getPendingTransaction(), adapter, !isVisible(), - ANIMATION_TYPE_APP_TRANSITION, thumbnailAdapter); - - if (adapter.getShowWallpaper()) { - getDisplayContent().pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER; - } - } - } - final SurfaceAnimationRunner getSurfaceAnimationRunner() { return mWmService.mSurfaceAnimationRunner; } - private Animation loadAnimation(WindowManager.LayoutParams lp, int transit, boolean enter, - boolean isVoiceInteraction) { - if ((isOrganized() - // TODO(b/161711458): Clean-up when moved to shell. - && getWindowingMode() != WINDOWING_MODE_FULLSCREEN - && getWindowingMode() != WINDOWING_MODE_FREEFORM - && getWindowingMode() != WINDOWING_MODE_MULTI_WINDOW)) { - return null; - } - - final DisplayContent displayContent = getDisplayContent(); - final DisplayInfo displayInfo = displayContent.getDisplayInfo(); - final int width = displayInfo.appWidth; - final int height = displayInfo.appHeight; - ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation: container=%s", this); - - // Determine the visible rect to calculate the thumbnail clip with - // getAnimationFrames. - final Rect frame = new Rect(0, 0, width, height); - final Rect displayFrame = new Rect(0, 0, - displayInfo.logicalWidth, displayInfo.logicalHeight); - final Rect insets = new Rect(); - final Rect stableInsets = new Rect(); - final Rect surfaceInsets = new Rect(); - getAnimationFrames(frame, insets, stableInsets, surfaceInsets); - - if (mLaunchTaskBehind) { - // Differentiate the two animations. This one which is briefly on the screen - // gets the !enter animation, and the other one which remains on the - // screen gets the enter animation. Both appear in the mOpeningApps set. - enter = false; - } - ProtoLog.d(WM_DEBUG_APP_TRANSITIONS, - "Loading animation for app transition. transit=%s enter=%b frame=%s insets=%s " - + "surfaceInsets=%s", - AppTransition.appTransitionOldToString(transit), enter, frame, insets, - surfaceInsets); - final Configuration displayConfig = displayContent.getConfiguration(); - final Animation a = getDisplayContent().mAppTransition.loadAnimation(lp, transit, enter, - displayConfig.uiMode, displayConfig.orientation, frame, displayFrame, insets, - surfaceInsets, stableInsets, isVoiceInteraction, inFreeformWindowingMode(), this); - if (a != null) { - if (a != null) { - // Setup the maximum app transition duration to prevent malicious app may set a long - // animation duration or infinite repeat counts for the app transition through - // ActivityOption#makeCustomAnimation or WindowManager#overridePendingTransition. - a.restrictDuration(MAX_APP_TRANSITION_DURATION); - } - if (ProtoLog.isEnabled(WM_DEBUG_ANIM, LogLevel.DEBUG)) { - ProtoLog.i(WM_DEBUG_ANIM, "Loaded animation %s for %s, duration: %d, stack=%s", - a, this, ((a != null) ? a.getDuration() : 0), Debug.getCallers(20)); - } - final int containingWidth = frame.width(); - final int containingHeight = frame.height(); - a.initialize(containingWidth, containingHeight, width, height); - a.scaleCurrentDuration(mWmService.getTransitionAnimationScaleLocked()); - } - return a; - } - boolean canCreateRemoteAnimationTarget() { return false; } diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 92ad2cec364b..bfedc90497ae 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -1698,17 +1698,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP || mActivityRecord.isStartingWindowDisplayed()); } - @Override - boolean hasContentToDisplay() { - if (!isDrawn() && (mViewVisibility == View.VISIBLE - || (isAnimating(TRANSITION | PARENTS) - && !getDisplayContent().mAppTransition.isTransitionSet()))) { - return true; - } - - return super.hasContentToDisplay(); - } - private boolean isVisibleByPolicyOrInsets() { return isVisibleByPolicy() // If we don't have a provider, this window isn't used as a window generating 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 d53ba1d24d8c..301a7544227f 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java @@ -56,8 +56,6 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -import static android.view.WindowManager.TRANSIT_CLOSE; -import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; import static android.view.WindowManager.TRANSIT_PIP; import static android.window.StartingWindowInfo.TYPE_PARAMETER_LEGACY_SPLASH_SCREEN; @@ -921,12 +919,6 @@ public class ActivityRecordTests extends WindowTestsBase { // animation and AR#takeSceneTransitionInfo also clear the AR#mPendingOptions assertNull(activity.takeSceneTransitionInfo()); assertNull(activity.getOptions()); - - final AppTransition appTransition = activity.mDisplayContent.mAppTransition; - spyOn(appTransition); - activity.applyOptionsAnimation(); - - verify(appTransition).overridePendingAppTransitionRemote(any()); } @Test @@ -1190,7 +1182,6 @@ public class ActivityRecordTests extends WindowTestsBase { FINISH_RESULT_REQUESTED, activity.finishIfPossible("test", false /* oomAdj */)); assertEquals(PAUSING, activity.getState()); verify(activity).setVisibility(eq(false)); - verify(activity.mDisplayContent).prepareAppTransition(eq(TRANSIT_CLOSE)); } /** @@ -1237,7 +1228,6 @@ public class ActivityRecordTests extends WindowTestsBase { activity.finishIfPossible("test", false /* oomAdj */); verify(activity).setVisibility(eq(false)); - verify(activity.mDisplayContent).prepareAppTransition(eq(TRANSIT_CLOSE)); verify(activity.mDisplayContent, never()).executeAppTransition(); } @@ -1254,7 +1244,6 @@ public class ActivityRecordTests extends WindowTestsBase { activity.finishIfPossible("test", false /* oomAdj */); verify(activity, atLeast(1)).setVisibility(eq(false)); - verify(activity.mDisplayContent).prepareAppTransition(eq(TRANSIT_CLOSE)); verify(activity.mDisplayContent).executeAppTransition(); } @@ -1275,7 +1264,6 @@ public class ActivityRecordTests extends WindowTestsBase { activity.finishIfPossible("test", false /* oomAdj */); - verify(activity.mDisplayContent, never()).prepareAppTransition(eq(TRANSIT_CLOSE)); assertFalse(activity.inTransition()); // finishIfPossible -> completeFinishing -> addToFinishingAndWaitForIdle @@ -2657,10 +2645,6 @@ public class ActivityRecordTests extends WindowTestsBase { @Presubmit public void testGetOrientation() { mDisplayContent.setIgnoreOrientationRequest(false); - // ActivityBuilder will resume top activities and cause the activity been added into - // opening apps list. Since this test is focus on the effect of visible on getting - // orientation, we skip app transition to avoid interference. - doNothing().when(mDisplayContent).prepareAppTransition(anyInt()); final ActivityRecord activity = new ActivityBuilder(mAtm).setCreateTask(true).build(); activity.setVisible(true); @@ -2925,7 +2909,6 @@ public class ActivityRecordTests extends WindowTestsBase { sources.add(activity2); doReturn(true).when(activity2).okToAnimate(); doReturn(true).when(activity2).isAnimating(); - assertTrue(activity2.applyAnimation(null, TRANSIT_OLD_ACTIVITY_OPEN, true, false, sources)); } @Test public void testTrackingStartingWindowThroughTrampoline() { 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 d5b9751b0f51..181853066f7b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -63,9 +63,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; -import static android.view.WindowManager.TRANSIT_CLOSE; -import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; -import static android.view.WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE; import static android.window.DisplayAreaOrganizer.FEATURE_WINDOWED_MAGNIFICATION; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; @@ -1742,8 +1739,6 @@ public class DisplayContentTests extends WindowTestsBase { public void testFixedRotationWithPip() { final DisplayContent displayContent = mDefaultDisplay; displayContent.setIgnoreOrientationRequest(false); - // Unblock the condition in PinnedTaskController#continueOrientationChangeIfNeeded. - doNothing().when(displayContent).prepareAppTransition(anyInt()); // Make resume-top really update the activity state. setBooted(mAtm); clearInvocations(mWm); @@ -2373,33 +2368,6 @@ public class DisplayContentTests extends WindowTestsBase { @SetupWindows(addWindows = W_INPUT_METHOD) @Test - public void testShowImeScreenshot() { - final Task rootTask = createTask(mDisplayContent); - final Task task = createTaskInRootTask(rootTask, 0 /* userId */); - final ActivityRecord activity = createActivityRecord(mDisplayContent, task); - final WindowState win = newWindowBuilder("win", TYPE_BASE_APPLICATION).setWindowToken( - activity).build(); - task.getDisplayContent().prepareAppTransition(TRANSIT_CLOSE); - doReturn(true).when(task).okToAnimate(); - ArrayList<WindowContainer> sources = new ArrayList<>(); - sources.add(activity); - - mDisplayContent.setImeLayeringTarget(win); - spyOn(mDisplayContent); - - // Expecting the IME screenshot only be attached when performing task closing transition. - task.applyAnimation(null, TRANSIT_OLD_TASK_CLOSE, false /* enter */, - false /* isVoiceInteraction */, sources); - verify(mDisplayContent).showImeScreenshot(); - - clearInvocations(mDisplayContent); - activity.applyAnimation(null, TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE, false /* enter */, - false /* isVoiceInteraction */, sources); - verify(mDisplayContent, never()).showImeScreenshot(); - } - - @SetupWindows(addWindows = W_INPUT_METHOD) - @Test public void testShowImeScreenshot_removeCurSnapshotBeforeCreateNext() { final Task rootTask = createTask(mDisplayContent); final Task task = createTaskInRootTask(rootTask, 0 /* userId */); @@ -2427,32 +2395,6 @@ public class DisplayContentTests extends WindowTestsBase { @UseTestDisplay(addWindows = {W_INPUT_METHOD}) @Test - public void testRemoveImeScreenshot_whenTargetSurfaceWasInvisible() { - final Task rootTask = createTask(mDisplayContent); - final Task task = createTaskInRootTask(rootTask, 0 /* userId */); - final ActivityRecord activity = createActivityRecord(mDisplayContent, task); - final WindowState win = newWindowBuilder("win", TYPE_BASE_APPLICATION).setWindowToken( - activity).build(); - win.onSurfaceShownChanged(true); - makeWindowVisible(win, mDisplayContent.mInputMethodWindow); - task.getDisplayContent().prepareAppTransition(TRANSIT_CLOSE); - doReturn(true).when(task).okToAnimate(); - ArrayList<WindowContainer> sources = new ArrayList<>(); - sources.add(activity); - - mDisplayContent.setImeLayeringTarget(win); - mDisplayContent.setImeInputTarget(win); - mDisplayContent.getInsetsStateController().getImeSourceProvider().setImeShowing(true); - task.applyAnimation(null, TRANSIT_OLD_TASK_CLOSE, false /* enter */, - false /* isVoiceInteraction */, sources); - assertNotNull(mDisplayContent.mImeScreenshot); - - win.onSurfaceShownChanged(false); - assertNull(mDisplayContent.mImeScreenshot); - } - - @UseTestDisplay(addWindows = {W_INPUT_METHOD}) - @Test public void testRemoveImeScreenshot_whenWindowRemoveImmediately() { final Task rootTask = createTask(mDisplayContent); final Task task = createTaskInRootTask(rootTask, 0 /* userId */); 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 cee98fb1b34c..4f310de1e48b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java @@ -30,8 +30,6 @@ import static android.view.WindowInsets.Type.statusBars; import static android.view.WindowInsets.Type.systemOverlays; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -import static android.view.WindowManager.TRANSIT_CLOSE; -import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; import static android.window.DisplayAreaOrganizer.FEATURE_DEFAULT_TASK_CONTAINER; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; @@ -1121,7 +1119,6 @@ public class WindowContainerTests extends WindowTestsBase { final ActivityRecord activity = createActivityRecord(mDisplayContent, task); final WindowState win = newWindowBuilder("win", TYPE_BASE_APPLICATION).setWindowToken( activity).build(); - task.getDisplayContent().prepareAppTransition(TRANSIT_CLOSE); spyOn(win); doReturn(true).when(task).okToAnimate(); ArrayList<WindowContainer> sources = new ArrayList<>(); @@ -1130,8 +1127,6 @@ public class WindowContainerTests extends WindowTestsBase { // Simulate the task applying the exit transition, verify the main window of the task // will be set the frozen insets state before the animation starts activity.setVisibility(false); - task.applyAnimation(null, TRANSIT_OLD_TASK_CLOSE, false /* enter */, - false /* isVoiceInteraction */, sources); verify(win).freezeInsetsState(); // Simulate the task transition finished. |