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

Commit f8853f75 authored by Issei Suzuki's avatar Issei Suzuki
Browse files

Wait OCCLUDE transition until screen turning on activity becomes ready.

When the screen is off, WindowManger usually skips running an app
transition animation when updating visibility of activities. However, in
case the activity is going to turn on the screen, we should not skip an
app transition animation even if the screen is not yet on.

I extended ActivityRecord#okToAnimate, so that it can ignore screen
status and it can be used with ActivityRecord#canTurnScreenOn predicate.

Bug: 175687166
Bug: 182975035
Change-Id: Id8079df2027becadc9c5e8266149f6eb76b467b6
Test: Receive phone call while the screen is off.
parent 02841faa
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -4437,8 +4437,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }
    }


    @Override
    @Override
    public boolean okToAnimate() {
    public boolean okToAnimate(boolean ignoreScreenOn) {
        return mDefaultDisplayPolicy.isAwake() && !mDeviceGoingToSleep;
        return (ignoreScreenOn || mDefaultDisplayPolicy.isAwake()) && !mDeviceGoingToSleep;
    }
    }


    /** {@inheritDoc} */
    /** {@inheritDoc} */
+2 −1
Original line number Original line Diff line number Diff line
@@ -897,12 +897,13 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
    public boolean isScreenOn();
    public boolean isScreenOn();


    /**
    /**
     * @param ignoreScreenOn {@code true} if screen state should be ignored.
     * @return whether the device is currently allowed to animate.
     * @return whether the device is currently allowed to animate.
     *
     *
     * Note: this can be true even if it is not appropriate to animate for reasons that are outside
     * Note: this can be true even if it is not appropriate to animate for reasons that are outside
     *       of the policy's authority.
     *       of the policy's authority.
     */
     */
    boolean okToAnimate();
    boolean okToAnimate(boolean ignoreScreenOn);


    /**
    /**
     * Tell the policy that the lid switch has changed state.
     * Tell the policy that the lid switch has changed state.
+2 −1
Original line number Original line Diff line number Diff line
@@ -4568,7 +4568,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // still check DC#okToAnimate again if the transition animation is fine to apply.
        // still check DC#okToAnimate again if the transition animation is fine to apply.
        // TODO(new-app-transition): Rewrite this logic using WM Shell.
        // TODO(new-app-transition): Rewrite this logic using WM Shell.
        final boolean recentsAnimating = isAnimating(PARENTS, ANIMATION_TYPE_RECENTS);
        final boolean recentsAnimating = isAnimating(PARENTS, ANIMATION_TYPE_RECENTS);
        if (okToAnimate(true /* ignoreFrozen */) && (appTransition.isTransitionSet()
        if (okToAnimate(true /* ignoreFrozen */, canTurnScreenOn())
                && (appTransition.isTransitionSet()
                || (recentsAnimating && !isActivityTypeHome()))) {
                || (recentsAnimating && !isActivityTypeHome()))) {
            if (visible) {
            if (visible) {
                displayContent.mOpeningApps.add(this);
                displayContent.mOpeningApps.add(this);
+13 −3
Original line number Original line Diff line number Diff line
@@ -4429,9 +4429,14 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    }
    }


    boolean okToDisplay(boolean ignoreFrozen) {
    boolean okToDisplay(boolean ignoreFrozen) {
        return okToDisplay(ignoreFrozen, false /* ignoreScreenOn */);
    }

    boolean okToDisplay(boolean ignoreFrozen, boolean ignoreScreenOn) {
        if (mDisplayId == DEFAULT_DISPLAY) {
        if (mDisplayId == DEFAULT_DISPLAY) {
            return (!mWmService.mDisplayFrozen || ignoreFrozen)
            return (!mWmService.mDisplayFrozen || ignoreFrozen)
                    && mWmService.mDisplayEnabled && mWmService.mPolicy.isScreenOn();
                    && mWmService.mDisplayEnabled
                    && (ignoreScreenOn || mWmService.mPolicy.isScreenOn());
        }
        }
        return mDisplayInfo.state == Display.STATE_ON;
        return mDisplayInfo.state == Display.STATE_ON;
    }
    }
@@ -4441,8 +4446,13 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    }
    }


    boolean okToAnimate(boolean ignoreFrozen) {
    boolean okToAnimate(boolean ignoreFrozen) {
        return okToDisplay(ignoreFrozen) &&
        return okToAnimate(ignoreFrozen, false /* ignoreScreenOn */);
                (mDisplayId != DEFAULT_DISPLAY || mWmService.mPolicy.okToAnimate());
    }

    boolean okToAnimate(boolean ignoreFrozen, boolean ignoreScreenOn) {
        return okToDisplay(ignoreFrozen, ignoreScreenOn)
                && (mDisplayId != DEFAULT_DISPLAY
                || mWmService.mPolicy.okToAnimate(ignoreScreenOn));
    }
    }


    static final class TaskForResizePointSearchResult {
    static final class TaskForResizePointSearchResult {
+1 −1
Original line number Original line Diff line number Diff line
@@ -731,7 +731,7 @@ public class DisplayRotation {
    private RotationAnimationPair selectRotationAnimation() {
    private RotationAnimationPair selectRotationAnimation() {
        // If the screen is off or non-interactive, force a jumpcut.
        // If the screen is off or non-interactive, force a jumpcut.
        final boolean forceJumpcut = !mDisplayPolicy.isScreenOnFully()
        final boolean forceJumpcut = !mDisplayPolicy.isScreenOnFully()
                || !mService.mPolicy.okToAnimate();
                || !mService.mPolicy.okToAnimate(false /* ignoreScreenOn */);
        final WindowState topFullscreen = mDisplayPolicy.getTopFullscreenOpaqueWindow();
        final WindowState topFullscreen = mDisplayPolicy.getTopFullscreenOpaqueWindow();
        if (DEBUG_ANIM) Slog.i(TAG, "selectRotationAnimation topFullscreen="
        if (DEBUG_ANIM) Slog.i(TAG, "selectRotationAnimation topFullscreen="
                + topFullscreen + " rotationAnimation="
                + topFullscreen + " rotationAnimation="
Loading