Loading services/core/java/com/android/server/wm/ActivityRecord.java +2 −20 Original line number Diff line number Diff line Loading @@ -880,8 +880,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A }) @interface SplashScreenBehavior { } // TODO: Have a WindowContainer state for tracking exiting/deferred removal. boolean mIsExiting; // 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 Loading Loading @@ -1227,10 +1225,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.print(" lastAllDrawn="); pw.print(mLastAllDrawn); pw.println(")"); } if (mStartingData != null || firstWindowDrawn || mIsExiting) { if (mStartingData != null || firstWindowDrawn) { pw.print(prefix); pw.print("startingData="); pw.print(mStartingData); pw.print(" firstWindowDrawn="); pw.print(firstWindowDrawn); pw.print(" mIsExiting="); pw.println(mIsExiting); pw.print(" firstWindowDrawn="); pw.println(firstWindowDrawn); } if (mStartingWindow != null || mStartingData != null || mStartingSurface != null || startingMoved || mVisibleSetFromTransferredStartingWindow) { Loading Loading @@ -4370,21 +4367,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A super.removeImmediately(); } @Override void removeIfPossible() { mIsExiting = false; removeAllWindowsIfPossible(); removeImmediately(); } @Override boolean handleCompleteDeferredRemoval() { if (mIsExiting) { removeIfPossible(); } return super.handleCompleteDeferredRemoval(); } void onRemovedFromDisplay() { if (mRemovingFromDisplay) { return; Loading services/core/java/com/android/server/wm/Transition.java +0 −1 Original line number Diff line number Diff line Loading @@ -1753,7 +1753,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE) static boolean containsChangeFor(WindowContainer wc, ArrayList<ChangeInfo> list) { for (int i = list.size() - 1; i >= 0; --i) { if (list.get(i).mContainer == wc) return true; Loading services/core/java/com/android/server/wm/TransitionController.java +10 −0 Original line number Diff line number Diff line Loading @@ -471,6 +471,16 @@ class TransitionController { return false; } /** Returns {@code true} if the `wc` is a target of a playing transition. */ boolean isPlayingTarget(@NonNull WindowContainer<?> wc) { for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) { if (Transition.containsChangeFor(wc, mPlayingTransitions.get(i).mTargets)) { return true; } } return false; } /** Returns {@code true} if the finishing transition contains `wc`. */ boolean inFinishingTransition(WindowContainer<?> wc) { return mFinishingTransition != null && mFinishingTransition.isInTransition(wc); Loading services/core/java/com/android/server/wm/WindowManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2109,7 +2109,7 @@ public class WindowManagerService extends IWindowManager.Stub ProtoLog.v(WM_DEBUG_ADD_REMOVE, "Removing %s from %s", win, token); // Window will already be removed from token before this post clean-up method is called. if (token.isEmpty() && !token.mPersistOnEmpty) { token.removeImmediately(); token.removeIfPossible(); } if (win.mActivityRecord != null) { Loading services/core/java/com/android/server/wm/WindowToken.java +28 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,9 @@ class WindowToken extends WindowContainer<WindowState> { // Is key dispatching paused for this token? boolean paused = false; /** Whether this container should be removed when it no longer animates. */ boolean mIsExiting; /** The owner has {@link android.Manifest.permission#MANAGE_APP_TOKENS} */ final boolean mOwnerCanManageAppTokens; Loading Loading @@ -276,6 +279,28 @@ class WindowToken extends WindowContainer<WindowState> { } } @Override void removeIfPossible() { if (mTransitionController.isPlayingTarget(this)) { // Defer removing this container until the transition is finished. So the removal can // execute after the finish transaction (see Transition#buildFinishTransaction) which // may reparent it to original parent. mIsExiting = true; return; } mIsExiting = false; removeAllWindowsIfPossible(); removeImmediately(); } @Override boolean handleCompleteDeferredRemoval() { if (mIsExiting) { removeIfPossible(); } return super.handleCompleteDeferredRemoval(); } /** * @return The scale for applications running in compatibility mode. Multiply the size in the * application by this scale will be the size in the screen. Loading Loading @@ -725,6 +750,9 @@ class WindowToken extends WindowContainer<WindowState> { pw.print("fixedRotationConfig="); pw.println(mFixedRotationTransformState.mRotatedOverrideConfiguration); } if (mIsExiting) { pw.print(prefix); pw.println("isExiting=true"); } } @Override Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +2 −20 Original line number Diff line number Diff line Loading @@ -880,8 +880,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A }) @interface SplashScreenBehavior { } // TODO: Have a WindowContainer state for tracking exiting/deferred removal. boolean mIsExiting; // 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 Loading Loading @@ -1227,10 +1225,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.print(" lastAllDrawn="); pw.print(mLastAllDrawn); pw.println(")"); } if (mStartingData != null || firstWindowDrawn || mIsExiting) { if (mStartingData != null || firstWindowDrawn) { pw.print(prefix); pw.print("startingData="); pw.print(mStartingData); pw.print(" firstWindowDrawn="); pw.print(firstWindowDrawn); pw.print(" mIsExiting="); pw.println(mIsExiting); pw.print(" firstWindowDrawn="); pw.println(firstWindowDrawn); } if (mStartingWindow != null || mStartingData != null || mStartingSurface != null || startingMoved || mVisibleSetFromTransferredStartingWindow) { Loading Loading @@ -4370,21 +4367,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A super.removeImmediately(); } @Override void removeIfPossible() { mIsExiting = false; removeAllWindowsIfPossible(); removeImmediately(); } @Override boolean handleCompleteDeferredRemoval() { if (mIsExiting) { removeIfPossible(); } return super.handleCompleteDeferredRemoval(); } void onRemovedFromDisplay() { if (mRemovingFromDisplay) { return; Loading
services/core/java/com/android/server/wm/Transition.java +0 −1 Original line number Diff line number Diff line Loading @@ -1753,7 +1753,6 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE) static boolean containsChangeFor(WindowContainer wc, ArrayList<ChangeInfo> list) { for (int i = list.size() - 1; i >= 0; --i) { if (list.get(i).mContainer == wc) return true; Loading
services/core/java/com/android/server/wm/TransitionController.java +10 −0 Original line number Diff line number Diff line Loading @@ -471,6 +471,16 @@ class TransitionController { return false; } /** Returns {@code true} if the `wc` is a target of a playing transition. */ boolean isPlayingTarget(@NonNull WindowContainer<?> wc) { for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) { if (Transition.containsChangeFor(wc, mPlayingTransitions.get(i).mTargets)) { return true; } } return false; } /** Returns {@code true} if the finishing transition contains `wc`. */ boolean inFinishingTransition(WindowContainer<?> wc) { return mFinishingTransition != null && mFinishingTransition.isInTransition(wc); Loading
services/core/java/com/android/server/wm/WindowManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2109,7 +2109,7 @@ public class WindowManagerService extends IWindowManager.Stub ProtoLog.v(WM_DEBUG_ADD_REMOVE, "Removing %s from %s", win, token); // Window will already be removed from token before this post clean-up method is called. if (token.isEmpty() && !token.mPersistOnEmpty) { token.removeImmediately(); token.removeIfPossible(); } if (win.mActivityRecord != null) { Loading
services/core/java/com/android/server/wm/WindowToken.java +28 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,9 @@ class WindowToken extends WindowContainer<WindowState> { // Is key dispatching paused for this token? boolean paused = false; /** Whether this container should be removed when it no longer animates. */ boolean mIsExiting; /** The owner has {@link android.Manifest.permission#MANAGE_APP_TOKENS} */ final boolean mOwnerCanManageAppTokens; Loading Loading @@ -276,6 +279,28 @@ class WindowToken extends WindowContainer<WindowState> { } } @Override void removeIfPossible() { if (mTransitionController.isPlayingTarget(this)) { // Defer removing this container until the transition is finished. So the removal can // execute after the finish transaction (see Transition#buildFinishTransaction) which // may reparent it to original parent. mIsExiting = true; return; } mIsExiting = false; removeAllWindowsIfPossible(); removeImmediately(); } @Override boolean handleCompleteDeferredRemoval() { if (mIsExiting) { removeIfPossible(); } return super.handleCompleteDeferredRemoval(); } /** * @return The scale for applications running in compatibility mode. Multiply the size in the * application by this scale will be the size in the screen. Loading Loading @@ -725,6 +750,9 @@ class WindowToken extends WindowContainer<WindowState> { pw.print("fixedRotationConfig="); pw.println(mFixedRotationTransformState.mRotatedOverrideConfiguration); } if (mIsExiting) { pw.print(prefix); pw.println("isExiting=true"); } } @Override Loading