Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6a33081 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Hide window immediately if itself doesn't run hide animation" into...

Merge "Hide window immediately if itself doesn't run hide animation" into sc-dev am: 5b695073 am: 9a3e20e5 am: 92eaaf42 am: 109c2724 am: ae6cbab7 am: 13cc549f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/26151073



Change-Id: I46811e7df2c49d9ced65af6583b280f1cdaa72a7
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 9f326daf 13cc549f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3089,8 +3089,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            return false;
        }
        if (doAnimation) {
            mWinAnimator.applyAnimationLocked(TRANSIT_EXIT, false);
            if (!isAnimating(TRANSITION | PARENTS)) {
            // If a hide animation is applied, then let onAnimationFinished
            // -> checkPolicyVisibilityChange hide the window. Otherwise make doAnimation false
            // to commit invisible immediately.
            if (!mWinAnimator.applyAnimationLocked(TRANSIT_EXIT, false /* isEntrance */)) {
                doAnimation = false;
            }
        }
+20 −0
Original line number Diff line number Diff line
@@ -229,6 +229,26 @@ public class WindowStateTests extends WindowTestsBase {
        assertTrue(window.isOnScreen());
        window.hide(false /* doAnimation */, false /* requestAnim */);
        assertFalse(window.isOnScreen());

        // Verifies that a window without animation can be hidden even if its parent is animating.
        window.show(false /* doAnimation */, false /* requestAnim */);
        assertTrue(window.isVisibleByPolicy());
        window.getParent().startAnimation(mTransaction, mock(AnimationAdapter.class),
                false /* hidden */, SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION);
        window.mAttrs.windowAnimations = 0;
        window.hide(true /* doAnimation */, true /* requestAnim */);
        assertFalse(window.isSelfAnimating(0, SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION));
        assertFalse(window.isVisibleByPolicy());
        assertFalse(window.isOnScreen());

        // Verifies that a window with animation can be hidden after the hide animation is finished.
        window.show(false /* doAnimation */, false /* requestAnim */);
        window.mAttrs.windowAnimations = android.R.style.Animation_Dialog;
        window.hide(true /* doAnimation */, true /* requestAnim */);
        assertTrue(window.isSelfAnimating(0, SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION));
        assertTrue(window.isVisibleByPolicy());
        window.cancelAnimation();
        assertFalse(window.isVisibleByPolicy());
    }

    @Test