From 781b21497ef9817c731df04e8341a530cc6327ec Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Sat, 8 Feb 2025 16:56:57 +0800 Subject: Remove AppTransitionController It is dead code since shell transition is enabled. Also migrate some unit tests to use shell transition. For example, some visibility tests rely on ActivityRecord#deferCommitVisibilityChange while mTransitionController.isShellTransitionsEnabled() is false if registerTransitionPlayer is not called. Bug: 365884835 Flag: EXEMPT remove outdated code Test: atest ActivityRecordTests Change-Id: I8e7c7c6a24f5e40fb93919f3b95b443a21beb514 --- .../java/com/android/server/wm/ActivityRecord.java | 106 +- .../server/wm/ActivityTaskManagerService.java | 17 +- .../java/com/android/server/wm/AppTransition.java | 2 +- .../android/server/wm/AppTransitionController.java | 1352 -------------------- .../java/com/android/server/wm/DisplayContent.java | 27 +- .../com/android/server/wm/RootWindowContainer.java | 64 - .../com/android/server/wm/SnapshotController.java | 5 - .../android/server/wm/TaskSnapshotController.java | 21 - .../com/android/server/wm/WindowContainer.java | 2 +- .../android/server/wm/WindowManagerService.java | 12 - .../com/android/server/wm/ActivityRecordTests.java | 54 +- .../server/wm/AppTransitionControllerTest.java | 1306 ------------------- .../com/android/server/wm/AppTransitionTests.java | 520 -------- .../com/android/server/wm/DisplayContentTests.java | 6 +- .../server/wm/RootWindowContainerTests.java | 25 - .../src/com/android/server/wm/SizeCompatTests.java | 6 +- .../android/server/wm/WindowContainerTests.java | 78 -- .../src/com/android/server/wm/WindowTestsBase.java | 13 +- 18 files changed, 29 insertions(+), 3587 deletions(-) delete mode 100644 services/core/java/com/android/server/wm/AppTransitionController.java delete mode 100644 services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java delete mode 100644 services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index f38394e2a259..3dc3b9d79f41 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -113,7 +113,6 @@ 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_FLAG_OPEN_BEHIND; import static android.view.WindowManager.TRANSIT_OLD_UNSET; import static android.view.WindowManager.TRANSIT_RELAUNCH; import static android.view.WindowManager.hasWindowExtensionsEnabled; @@ -864,12 +863,6 @@ final class ActivityRecord extends WindowToken { }) @interface SplashScreenBehavior { } - // Force an app transition to be ran in the case the visibility of the app did not change. - // We use this for the case of moving a Root Task to the back with multiple activities, and the - // top activity enters PIP; the bottom activity's visibility stays the same, but we need to - // run the transition. - boolean mRequestForceTransition; - boolean mEnteringAnimation; boolean mOverrideTaskTransition; boolean mDismissKeyguardIfInsecure; @@ -1798,7 +1791,6 @@ final class ActivityRecord extends WindowToken { if (prevDc.mOpeningApps.remove(this)) { // Transfer opening transition to new display. mDisplayContent.mOpeningApps.add(this); - mDisplayContent.transferAppTransitionFrom(prevDc); mDisplayContent.executeAppTransition(); } @@ -4641,12 +4633,6 @@ final class ActivityRecord extends WindowToken { } } - // In this case, the starting icon has already been displayed, so start - // letting windows get shown immediately without any more transitions. - if (fromActivity.mVisible) { - mDisplayContent.mSkipAppTransitionAnimation = true; - } - ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Moving existing starting %s" + " from %s to %s", tStartingWindow, fromActivity, this); @@ -5676,76 +5662,17 @@ final class ActivityRecord extends WindowToken { mTransitionController.mValidateCommitVis.add(this); return; } - // If we are preparing an app transition, then delay changing - // the visibility of this token until we execute that transition. - if (deferCommitVisibilityChange(visible)) { - return; - } commitVisibility(visible, true /* performLayout */); updateReportedVisibilityLocked(); } - /** - * Returns {@code true} if this activity is either added to opening-apps or closing-apps. - * Then its visibility will be committed until the transition is ready. - */ - private boolean deferCommitVisibilityChange(boolean visible) { - if (mTransitionController.isShellTransitionsEnabled()) { - // Shell transition doesn't use opening/closing sets. - return false; - } - if (!mDisplayContent.mAppTransition.isTransitionSet()) { - return false; - } - if (mWaitForEnteringPinnedMode && mVisible == visible) { - // If the visibility is not changed during enter PIP, we don't want to include it in - // app transition to affect the animation theme, because the Pip organizer will - // animate the entering PIP instead. - return false; - } - - // The animation will be visible soon so do not skip by screen off. - final boolean ignoreScreenOn = canTurnScreenOn() || mTaskSupervisor.getKeyguardController() - .isKeyguardGoingAway(mDisplayContent.mDisplayId); - // Ignore display frozen so the opening / closing transition type can be updated correctly - // even if the display is frozen. And it's safe since in applyAnimation will still check - // DC#okToAnimate again if the transition animation is fine to apply. - if (!okToAnimate(true /* ignoreFrozen */, ignoreScreenOn)) { - return false; - } - if (visible) { - mDisplayContent.mOpeningApps.add(this); - mEnteringAnimation = true; - } else if (mVisible) { - mDisplayContent.mClosingApps.add(this); - mEnteringAnimation = false; - } - if ((mDisplayContent.mAppTransition.getTransitFlags() & TRANSIT_FLAG_OPEN_BEHIND) != 0) { - // Add the launching-behind activity to mOpeningApps. - final WindowState win = mDisplayContent.findFocusedWindow(); - if (win != null) { - final ActivityRecord focusedActivity = win.mActivityRecord; - if (focusedActivity != null) { - ProtoLog.d(WM_DEBUG_APP_TRANSITIONS, - "TRANSIT_FLAG_OPEN_BEHIND, adding %s to mOpeningApps", - focusedActivity); - // Force animation to be loaded. - mDisplayContent.mOpeningApps.add(focusedActivity); - } - } - } - return true; - } - @Override boolean applyAnimation(LayoutParams lp, @TransitionOldType int transit, boolean enter, boolean isVoiceInteraction, @Nullable ArrayList sources) { if ((mTransitionChangeFlags & FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT) != 0) { return false; } - // If it was set to true, reset the last request to force the transition. - mRequestForceTransition = false; return super.applyAnimation(lp, transit, enter, isVoiceInteraction, sources); } @@ -5914,27 +5841,6 @@ final class ActivityRecord extends WindowToken { } } - /** - * Check if visibility of this {@link ActivityRecord} should be updated as part of an app - * transition. - * - *