Loading services/core/java/com/android/server/wm/DisplayContent.java +32 −4 Original line number Original line Diff line number Diff line Loading @@ -490,6 +490,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp */ */ private ActivityRecord mFixedRotationLaunchingApp; private ActivityRecord mFixedRotationLaunchingApp; /** The delay to avoid toggling the animation quickly. */ private static final long FIXED_ROTATION_HIDE_ANIMATION_DEBOUNCE_DELAY_MS = 250; private FixedRotationAnimationController mFixedRotationAnimationController; private FixedRotationAnimationController mFixedRotationAnimationController; final FixedRotationTransitionListener mFixedRotationTransitionListener = final FixedRotationTransitionListener mFixedRotationTransitionListener = Loading Loading @@ -1524,10 +1526,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp void setFixedRotationLaunchingAppUnchecked(@Nullable ActivityRecord r, int rotation) { void setFixedRotationLaunchingAppUnchecked(@Nullable ActivityRecord r, int rotation) { if (mFixedRotationLaunchingApp == null && r != null) { if (mFixedRotationLaunchingApp == null && r != null) { mWmService.mDisplayNotificationController.dispatchFixedRotationStarted(this, rotation); mWmService.mDisplayNotificationController.dispatchFixedRotationStarted(this, rotation); if (mFixedRotationAnimationController == null) { startFixedRotationAnimation( mFixedRotationAnimationController = new FixedRotationAnimationController(this); // Delay the hide animation to avoid blinking by clicking navigation bar that mFixedRotationAnimationController.hide(); // may toggle fixed rotation in a short time. } r == mFixedRotationTransitionListener.mAnimatingRecents /* shouldDebounce */); } else if (mFixedRotationLaunchingApp != null && r == null) { } else if (mFixedRotationLaunchingApp != null && r == null) { mWmService.mDisplayNotificationController.dispatchFixedRotationFinished(this); mWmService.mDisplayNotificationController.dispatchFixedRotationFinished(this); finishFixedRotationAnimationIfPossible(); finishFixedRotationAnimationIfPossible(); Loading Loading @@ -1625,6 +1627,32 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } } } /** * Starts the hide animation for the windows which will be rotated seamlessly. * * @return {@code true} if the animation is executed right now. */ private boolean startFixedRotationAnimation(boolean shouldDebounce) { if (shouldDebounce) { mWmService.mH.postDelayed(() -> { synchronized (mWmService.mGlobalLock) { if (mFixedRotationLaunchingApp != null && startFixedRotationAnimation(false /* shouldDebounce */)) { // Apply the transaction so the animation leash can take effect immediately. getPendingTransaction().apply(); } } }, FIXED_ROTATION_HIDE_ANIMATION_DEBOUNCE_DELAY_MS); return false; } if (mFixedRotationAnimationController == null) { mFixedRotationAnimationController = new FixedRotationAnimationController(this); mFixedRotationAnimationController.hide(); return true; } return false; } /** Re-show the previously hidden windows if all seamless rotated windows are done. */ /** Re-show the previously hidden windows if all seamless rotated windows are done. */ void finishFixedRotationAnimationIfPossible() { void finishFixedRotationAnimationIfPossible() { final FixedRotationAnimationController controller = mFixedRotationAnimationController; final FixedRotationAnimationController controller = mFixedRotationAnimationController; Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +32 −4 Original line number Original line Diff line number Diff line Loading @@ -490,6 +490,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp */ */ private ActivityRecord mFixedRotationLaunchingApp; private ActivityRecord mFixedRotationLaunchingApp; /** The delay to avoid toggling the animation quickly. */ private static final long FIXED_ROTATION_HIDE_ANIMATION_DEBOUNCE_DELAY_MS = 250; private FixedRotationAnimationController mFixedRotationAnimationController; private FixedRotationAnimationController mFixedRotationAnimationController; final FixedRotationTransitionListener mFixedRotationTransitionListener = final FixedRotationTransitionListener mFixedRotationTransitionListener = Loading Loading @@ -1524,10 +1526,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp void setFixedRotationLaunchingAppUnchecked(@Nullable ActivityRecord r, int rotation) { void setFixedRotationLaunchingAppUnchecked(@Nullable ActivityRecord r, int rotation) { if (mFixedRotationLaunchingApp == null && r != null) { if (mFixedRotationLaunchingApp == null && r != null) { mWmService.mDisplayNotificationController.dispatchFixedRotationStarted(this, rotation); mWmService.mDisplayNotificationController.dispatchFixedRotationStarted(this, rotation); if (mFixedRotationAnimationController == null) { startFixedRotationAnimation( mFixedRotationAnimationController = new FixedRotationAnimationController(this); // Delay the hide animation to avoid blinking by clicking navigation bar that mFixedRotationAnimationController.hide(); // may toggle fixed rotation in a short time. } r == mFixedRotationTransitionListener.mAnimatingRecents /* shouldDebounce */); } else if (mFixedRotationLaunchingApp != null && r == null) { } else if (mFixedRotationLaunchingApp != null && r == null) { mWmService.mDisplayNotificationController.dispatchFixedRotationFinished(this); mWmService.mDisplayNotificationController.dispatchFixedRotationFinished(this); finishFixedRotationAnimationIfPossible(); finishFixedRotationAnimationIfPossible(); Loading Loading @@ -1625,6 +1627,32 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } } } /** * Starts the hide animation for the windows which will be rotated seamlessly. * * @return {@code true} if the animation is executed right now. */ private boolean startFixedRotationAnimation(boolean shouldDebounce) { if (shouldDebounce) { mWmService.mH.postDelayed(() -> { synchronized (mWmService.mGlobalLock) { if (mFixedRotationLaunchingApp != null && startFixedRotationAnimation(false /* shouldDebounce */)) { // Apply the transaction so the animation leash can take effect immediately. getPendingTransaction().apply(); } } }, FIXED_ROTATION_HIDE_ANIMATION_DEBOUNCE_DELAY_MS); return false; } if (mFixedRotationAnimationController == null) { mFixedRotationAnimationController = new FixedRotationAnimationController(this); mFixedRotationAnimationController.hide(); return true; } return false; } /** Re-show the previously hidden windows if all seamless rotated windows are done. */ /** Re-show the previously hidden windows if all seamless rotated windows are done. */ void finishFixedRotationAnimationIfPossible() { void finishFixedRotationAnimationIfPossible() { final FixedRotationAnimationController controller = mFixedRotationAnimationController; final FixedRotationAnimationController controller = mFixedRotationAnimationController; Loading