Loading services/core/java/com/android/server/wm/FadeRotationAnimationController.java→services/core/java/com/android/server/wm/AsyncRotationController.java +6 −6 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import java.util.ArrayList; * both fixed rotation and normal rotation to hide some non-activity windows. The caller should show * the windows until they are drawn with the new rotation. */ public class FadeRotationAnimationController extends FadeAnimationController { public class AsyncRotationController extends FadeAnimationController { /** The map of window token to its animation leash. */ private final ArrayMap<WindowToken, SurfaceControl> mTargetWindowTokens = new ArrayMap<>(); Loading Loading @@ -70,7 +70,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { private final int mOriginalRotation; private final boolean mHasScreenRotationAnimation; public FadeRotationAnimationController(DisplayContent displayContent) { public AsyncRotationController(DisplayContent displayContent) { super(displayContent); mService = displayContent.mWmService; mOriginalRotation = displayContent.getWindowConfiguration().getRotation(); Loading @@ -81,7 +81,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { mIsStartTransactionCommitted = !mIsChangeTransition; mTimeoutRunnable = displayContent.inTransition() ? () -> { synchronized (mService.mGlobalLock) { displayContent.finishFadeRotationAnimationIfPossible(); displayContent.finishAsyncRotationIfPossible(); mService.mWindowPlacerLocked.performSurfacePlacement(); } } : null; Loading Loading @@ -277,7 +277,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { mIsStartTransactionCommitted = true; if (mPendingShowTokens == null) return; for (int i = mPendingShowTokens.size() - 1; i >= 0; i--) { mDisplayContent.finishFadeRotationAnimation(mPendingShowTokens.get(i)); mDisplayContent.finishAsyncRotation(mPendingShowTokens.get(i)); } mPendingShowTokens = null; } Loading @@ -298,7 +298,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { // Only fade in the drawn windows. If the remaining windows are drawn later, // show(WindowToken) will be called to fade in them. if (token.getChildAt(j).isDrawFinishedLw()) { mDisplayContent.finishFadeRotationAnimation(token); mDisplayContent.finishAsyncRotation(token); break; } } Loading @@ -320,7 +320,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { } return true; } mDisplayContent.finishFadeRotationAnimation(w.mToken); mDisplayContent.finishAsyncRotation(w.mToken); return false; } Loading services/core/java/com/android/server/wm/DisplayContent.java +24 −24 Original line number Diff line number Diff line Loading @@ -553,7 +553,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp /** The delay to avoid toggling the animation quickly. */ private static final long FIXED_ROTATION_HIDE_ANIMATION_DEBOUNCE_DELAY_MS = 250; private FadeRotationAnimationController mFadeRotationAnimationController; private AsyncRotationController mAsyncRotationController; final FixedRotationTransitionListener mFixedRotationTransitionListener = new FixedRotationTransitionListener(); Loading Loading @@ -1731,8 +1731,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } @VisibleForTesting @Nullable FadeRotationAnimationController getFadeRotationAnimationController() { return mFadeRotationAnimationController; @Nullable AsyncRotationController getAsyncRotationController() { return mAsyncRotationController; } void setFixedRotationLaunchingAppUnchecked(@Nullable ActivityRecord r) { Loading @@ -1742,13 +1742,13 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp void setFixedRotationLaunchingAppUnchecked(@Nullable ActivityRecord r, int rotation) { if (mFixedRotationLaunchingApp == null && r != null) { mWmService.mDisplayNotificationController.dispatchFixedRotationStarted(this, rotation); startFadeRotationAnimation( startAsyncRotation( // Delay the hide animation to avoid blinking by clicking navigation bar that // may toggle fixed rotation in a short time. r == mFixedRotationTransitionListener.mAnimatingRecents /* shouldDebounce */); } else if (mFixedRotationLaunchingApp != null && r == null) { mWmService.mDisplayNotificationController.dispatchFixedRotationFinished(this); finishFadeRotationAnimationIfPossible(); finishAsyncRotationIfPossible(); } mFixedRotationLaunchingApp = r; } Loading Loading @@ -1861,9 +1861,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp return mDisplayRotation.getRotation() != getWindowConfiguration().getRotation(); } private void startFadeRotationAnimationIfNeeded() { private void startAsyncRotationIfNeeded() { if (isRotationChanging()) { startFadeRotationAnimation(false /* shouldDebounce */); startAsyncRotation(false /* shouldDebounce */); } } Loading @@ -1872,12 +1872,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp * * @return {@code true} if the animation is executed right now. */ private boolean startFadeRotationAnimation(boolean shouldDebounce) { private boolean startAsyncRotation(boolean shouldDebounce) { if (shouldDebounce) { mWmService.mH.postDelayed(() -> { synchronized (mWmService.mGlobalLock) { if (mFixedRotationLaunchingApp != null && startFadeRotationAnimation(false /* shouldDebounce */)) { && startAsyncRotation(false /* shouldDebounce */)) { // Apply the transaction so the animation leash can take effect immediately. getPendingTransaction().apply(); } Loading @@ -1885,28 +1885,28 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp }, FIXED_ROTATION_HIDE_ANIMATION_DEBOUNCE_DELAY_MS); return false; } if (mFadeRotationAnimationController == null) { mFadeRotationAnimationController = new FadeRotationAnimationController(this); mFadeRotationAnimationController.hide(); if (mAsyncRotationController == null) { mAsyncRotationController = new AsyncRotationController(this); mAsyncRotationController.hide(); return true; } return false; } /** Re-show the previously hidden windows if all seamless rotated windows are done. */ void finishFadeRotationAnimationIfPossible() { final FadeRotationAnimationController controller = mFadeRotationAnimationController; void finishAsyncRotationIfPossible() { final AsyncRotationController controller = mAsyncRotationController; if (controller != null && !mDisplayRotation.hasSeamlessRotatingWindow()) { controller.show(); mFadeRotationAnimationController = null; mAsyncRotationController = null; } } /** Shows the given window which may be hidden for screen rotation. */ void finishFadeRotationAnimation(WindowToken windowToken) { final FadeRotationAnimationController controller = mFadeRotationAnimationController; void finishAsyncRotation(WindowToken windowToken) { final AsyncRotationController controller = mAsyncRotationController; if (controller != null && controller.show(windowToken)) { mFadeRotationAnimationController = null; mAsyncRotationController = null; } } Loading @@ -1916,7 +1916,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // The window should look no different before and after rotation. return false; } final FadeRotationAnimationController controller = mFadeRotationAnimationController; final AsyncRotationController controller = mAsyncRotationController; return controller == null || !controller.isHandledToken(w.mToken); } Loading Loading @@ -3226,7 +3226,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Hide the windows which are not significant in rotation animation. So that the windows // don't need to block the unfreeze time. if (screenRotationAnimation != null && screenRotationAnimation.hasScreenshot()) { startFadeRotationAnimationIfNeeded(); startAsyncRotationIfNeeded(); } } Loading @@ -3248,7 +3248,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } if (!controller.isCollecting(this)) { controller.collect(this); startFadeRotationAnimationIfNeeded(); startAsyncRotationIfNeeded(); } return; } Loading @@ -3260,7 +3260,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mWmService.mLatencyTracker.onActionStart(ACTION_ROTATE_SCREEN); controller.mTransitionMetricsReporter.associate(t, startTime -> mWmService.mLatencyTracker.onActionEnd(ACTION_ROTATE_SCREEN)); startFadeRotationAnimation(false /* shouldDebounce */); startAsyncRotation(false /* shouldDebounce */); } t.setKnownConfigChanges(this, changes); } Loading Loading @@ -4005,8 +4005,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mInputMethodWindow.mToken.linkFixedRotationTransform(mImeLayeringTarget.mToken); // Hide the window until the rotation is done to avoid intermediate artifacts if the // parent surface of IME container is changed. if (mFadeRotationAnimationController != null) { mFadeRotationAnimationController.hideImmediately(mInputMethodWindow.mToken); if (mAsyncRotationController != null) { mAsyncRotationController.hideImmediately(mInputMethodWindow.mToken); } } } Loading services/core/java/com/android/server/wm/DisplayRotation.java +2 −2 Original line number Diff line number Diff line Loading @@ -638,7 +638,7 @@ public class DisplayRotation { }, true /* traverseTopToBottom */); mSeamlessRotationCount = 0; mRotatingSeamlessly = false; mDisplayContent.finishFadeRotationAnimationIfPossible(); mDisplayContent.finishAsyncRotationIfPossible(); } private void prepareSeamlessRotation() { Loading Loading @@ -729,7 +729,7 @@ public class DisplayRotation { "Performing post-rotate rotation after seamless rotation"); // Finish seamless rotation. mRotatingSeamlessly = false; mDisplayContent.finishFadeRotationAnimationIfPossible(); mDisplayContent.finishAsyncRotationIfPossible(); updateRotationAndSendNewConfigIfChanged(); } Loading services/core/java/com/android/server/wm/InsetsSourceProvider.java +3 −3 Original line number Diff line number Diff line Loading @@ -298,9 +298,9 @@ class InsetsSourceProvider { private Point getWindowFrameSurfacePosition() { if (mControl != null) { final FadeRotationAnimationController fadeController = mWin.mDisplayContent.getFadeRotationAnimationController(); if (fadeController != null && fadeController.shouldFreezeInsetsPosition(mWin)) { final AsyncRotationController controller = mWin.mDisplayContent.getAsyncRotationController(); if (controller != null && controller.shouldFreezeInsetsPosition(mWin)) { // Use previous position because the fade-out animation runs in old rotation. return mControl.getSurfacePosition(); } Loading services/core/java/com/android/server/wm/NavBarFadeAnimationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -80,8 +80,8 @@ public class NavBarFadeAnimationController extends FadeAnimationController{ * @param show true for fade-in, otherwise for fade-out. */ public void fadeWindowToken(boolean show) { final FadeRotationAnimationController controller = mDisplayContent.getFadeRotationAnimationController(); final AsyncRotationController controller = mDisplayContent.getAsyncRotationController(); final Runnable fadeAnim = () -> fadeWindowToken(show, mNavigationBar.mToken, ANIMATION_TYPE_APP_TRANSITION); if (controller == null) { Loading Loading
services/core/java/com/android/server/wm/FadeRotationAnimationController.java→services/core/java/com/android/server/wm/AsyncRotationController.java +6 −6 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ import java.util.ArrayList; * both fixed rotation and normal rotation to hide some non-activity windows. The caller should show * the windows until they are drawn with the new rotation. */ public class FadeRotationAnimationController extends FadeAnimationController { public class AsyncRotationController extends FadeAnimationController { /** The map of window token to its animation leash. */ private final ArrayMap<WindowToken, SurfaceControl> mTargetWindowTokens = new ArrayMap<>(); Loading Loading @@ -70,7 +70,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { private final int mOriginalRotation; private final boolean mHasScreenRotationAnimation; public FadeRotationAnimationController(DisplayContent displayContent) { public AsyncRotationController(DisplayContent displayContent) { super(displayContent); mService = displayContent.mWmService; mOriginalRotation = displayContent.getWindowConfiguration().getRotation(); Loading @@ -81,7 +81,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { mIsStartTransactionCommitted = !mIsChangeTransition; mTimeoutRunnable = displayContent.inTransition() ? () -> { synchronized (mService.mGlobalLock) { displayContent.finishFadeRotationAnimationIfPossible(); displayContent.finishAsyncRotationIfPossible(); mService.mWindowPlacerLocked.performSurfacePlacement(); } } : null; Loading Loading @@ -277,7 +277,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { mIsStartTransactionCommitted = true; if (mPendingShowTokens == null) return; for (int i = mPendingShowTokens.size() - 1; i >= 0; i--) { mDisplayContent.finishFadeRotationAnimation(mPendingShowTokens.get(i)); mDisplayContent.finishAsyncRotation(mPendingShowTokens.get(i)); } mPendingShowTokens = null; } Loading @@ -298,7 +298,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { // Only fade in the drawn windows. If the remaining windows are drawn later, // show(WindowToken) will be called to fade in them. if (token.getChildAt(j).isDrawFinishedLw()) { mDisplayContent.finishFadeRotationAnimation(token); mDisplayContent.finishAsyncRotation(token); break; } } Loading @@ -320,7 +320,7 @@ public class FadeRotationAnimationController extends FadeAnimationController { } return true; } mDisplayContent.finishFadeRotationAnimation(w.mToken); mDisplayContent.finishAsyncRotation(w.mToken); return false; } Loading
services/core/java/com/android/server/wm/DisplayContent.java +24 −24 Original line number Diff line number Diff line Loading @@ -553,7 +553,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp /** The delay to avoid toggling the animation quickly. */ private static final long FIXED_ROTATION_HIDE_ANIMATION_DEBOUNCE_DELAY_MS = 250; private FadeRotationAnimationController mFadeRotationAnimationController; private AsyncRotationController mAsyncRotationController; final FixedRotationTransitionListener mFixedRotationTransitionListener = new FixedRotationTransitionListener(); Loading Loading @@ -1731,8 +1731,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } @VisibleForTesting @Nullable FadeRotationAnimationController getFadeRotationAnimationController() { return mFadeRotationAnimationController; @Nullable AsyncRotationController getAsyncRotationController() { return mAsyncRotationController; } void setFixedRotationLaunchingAppUnchecked(@Nullable ActivityRecord r) { Loading @@ -1742,13 +1742,13 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp void setFixedRotationLaunchingAppUnchecked(@Nullable ActivityRecord r, int rotation) { if (mFixedRotationLaunchingApp == null && r != null) { mWmService.mDisplayNotificationController.dispatchFixedRotationStarted(this, rotation); startFadeRotationAnimation( startAsyncRotation( // Delay the hide animation to avoid blinking by clicking navigation bar that // may toggle fixed rotation in a short time. r == mFixedRotationTransitionListener.mAnimatingRecents /* shouldDebounce */); } else if (mFixedRotationLaunchingApp != null && r == null) { mWmService.mDisplayNotificationController.dispatchFixedRotationFinished(this); finishFadeRotationAnimationIfPossible(); finishAsyncRotationIfPossible(); } mFixedRotationLaunchingApp = r; } Loading Loading @@ -1861,9 +1861,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp return mDisplayRotation.getRotation() != getWindowConfiguration().getRotation(); } private void startFadeRotationAnimationIfNeeded() { private void startAsyncRotationIfNeeded() { if (isRotationChanging()) { startFadeRotationAnimation(false /* shouldDebounce */); startAsyncRotation(false /* shouldDebounce */); } } Loading @@ -1872,12 +1872,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp * * @return {@code true} if the animation is executed right now. */ private boolean startFadeRotationAnimation(boolean shouldDebounce) { private boolean startAsyncRotation(boolean shouldDebounce) { if (shouldDebounce) { mWmService.mH.postDelayed(() -> { synchronized (mWmService.mGlobalLock) { if (mFixedRotationLaunchingApp != null && startFadeRotationAnimation(false /* shouldDebounce */)) { && startAsyncRotation(false /* shouldDebounce */)) { // Apply the transaction so the animation leash can take effect immediately. getPendingTransaction().apply(); } Loading @@ -1885,28 +1885,28 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp }, FIXED_ROTATION_HIDE_ANIMATION_DEBOUNCE_DELAY_MS); return false; } if (mFadeRotationAnimationController == null) { mFadeRotationAnimationController = new FadeRotationAnimationController(this); mFadeRotationAnimationController.hide(); if (mAsyncRotationController == null) { mAsyncRotationController = new AsyncRotationController(this); mAsyncRotationController.hide(); return true; } return false; } /** Re-show the previously hidden windows if all seamless rotated windows are done. */ void finishFadeRotationAnimationIfPossible() { final FadeRotationAnimationController controller = mFadeRotationAnimationController; void finishAsyncRotationIfPossible() { final AsyncRotationController controller = mAsyncRotationController; if (controller != null && !mDisplayRotation.hasSeamlessRotatingWindow()) { controller.show(); mFadeRotationAnimationController = null; mAsyncRotationController = null; } } /** Shows the given window which may be hidden for screen rotation. */ void finishFadeRotationAnimation(WindowToken windowToken) { final FadeRotationAnimationController controller = mFadeRotationAnimationController; void finishAsyncRotation(WindowToken windowToken) { final AsyncRotationController controller = mAsyncRotationController; if (controller != null && controller.show(windowToken)) { mFadeRotationAnimationController = null; mAsyncRotationController = null; } } Loading @@ -1916,7 +1916,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // The window should look no different before and after rotation. return false; } final FadeRotationAnimationController controller = mFadeRotationAnimationController; final AsyncRotationController controller = mAsyncRotationController; return controller == null || !controller.isHandledToken(w.mToken); } Loading Loading @@ -3226,7 +3226,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Hide the windows which are not significant in rotation animation. So that the windows // don't need to block the unfreeze time. if (screenRotationAnimation != null && screenRotationAnimation.hasScreenshot()) { startFadeRotationAnimationIfNeeded(); startAsyncRotationIfNeeded(); } } Loading @@ -3248,7 +3248,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } if (!controller.isCollecting(this)) { controller.collect(this); startFadeRotationAnimationIfNeeded(); startAsyncRotationIfNeeded(); } return; } Loading @@ -3260,7 +3260,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mWmService.mLatencyTracker.onActionStart(ACTION_ROTATE_SCREEN); controller.mTransitionMetricsReporter.associate(t, startTime -> mWmService.mLatencyTracker.onActionEnd(ACTION_ROTATE_SCREEN)); startFadeRotationAnimation(false /* shouldDebounce */); startAsyncRotation(false /* shouldDebounce */); } t.setKnownConfigChanges(this, changes); } Loading Loading @@ -4005,8 +4005,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mInputMethodWindow.mToken.linkFixedRotationTransform(mImeLayeringTarget.mToken); // Hide the window until the rotation is done to avoid intermediate artifacts if the // parent surface of IME container is changed. if (mFadeRotationAnimationController != null) { mFadeRotationAnimationController.hideImmediately(mInputMethodWindow.mToken); if (mAsyncRotationController != null) { mAsyncRotationController.hideImmediately(mInputMethodWindow.mToken); } } } Loading
services/core/java/com/android/server/wm/DisplayRotation.java +2 −2 Original line number Diff line number Diff line Loading @@ -638,7 +638,7 @@ public class DisplayRotation { }, true /* traverseTopToBottom */); mSeamlessRotationCount = 0; mRotatingSeamlessly = false; mDisplayContent.finishFadeRotationAnimationIfPossible(); mDisplayContent.finishAsyncRotationIfPossible(); } private void prepareSeamlessRotation() { Loading Loading @@ -729,7 +729,7 @@ public class DisplayRotation { "Performing post-rotate rotation after seamless rotation"); // Finish seamless rotation. mRotatingSeamlessly = false; mDisplayContent.finishFadeRotationAnimationIfPossible(); mDisplayContent.finishAsyncRotationIfPossible(); updateRotationAndSendNewConfigIfChanged(); } Loading
services/core/java/com/android/server/wm/InsetsSourceProvider.java +3 −3 Original line number Diff line number Diff line Loading @@ -298,9 +298,9 @@ class InsetsSourceProvider { private Point getWindowFrameSurfacePosition() { if (mControl != null) { final FadeRotationAnimationController fadeController = mWin.mDisplayContent.getFadeRotationAnimationController(); if (fadeController != null && fadeController.shouldFreezeInsetsPosition(mWin)) { final AsyncRotationController controller = mWin.mDisplayContent.getAsyncRotationController(); if (controller != null && controller.shouldFreezeInsetsPosition(mWin)) { // Use previous position because the fade-out animation runs in old rotation. return mControl.getSurfacePosition(); } Loading
services/core/java/com/android/server/wm/NavBarFadeAnimationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -80,8 +80,8 @@ public class NavBarFadeAnimationController extends FadeAnimationController{ * @param show true for fade-in, otherwise for fade-out. */ public void fadeWindowToken(boolean show) { final FadeRotationAnimationController controller = mDisplayContent.getFadeRotationAnimationController(); final AsyncRotationController controller = mDisplayContent.getAsyncRotationController(); final Runnable fadeAnim = () -> fadeWindowToken(show, mNavigationBar.mToken, ANIMATION_TYPE_APP_TRANSITION); if (controller == null) { Loading