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

Commit 3b8bbc8e authored by lumark's avatar lumark
Browse files

Fix opening/closing apps isn't add during device rotating

When animating during device rotation, there may have a timing that
the display is waiting for the orientation change to complete but
the transiting apps won't be added into the opening/closing list by
the waiting state.

It caused when app transition set ready to go, but no opening or closing app can
check if the app has been drawn, check if the app is wallpaper target, or
check if can upgrade to wallpaper transition.

SplitScreenTests#testMinimizeAndUnminimizeThenGoingHome is an example that will hit
this potential problem and failed to update transition from TRANSIT_TASK_TO_FRONT
to TRANSIT_WALLPAPER_OPEN.

The fix is:
- Add DC#okToDisplay(ignoreFrozen) / WC#okToAnimate(ignoreFrozen) methods to ignore
  DisplalyFrozen check in ActivityRecord#setAppVisibility to ensure
  that apps in transition are added to opening/closing list and can
  update wallpaper transition.

Change-Id: I226da85aceca903bd431cc3f90dc2d2c962a632a
Fix: 145151475
Test: SplitScreenTests#testMinimizeAndUnminimizeThenGoingHome
parent 9fbcad49
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -3990,7 +3990,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        // If we are preparing an app transition, then delay changing
        // the visibility of this token until we execute that transition.
        if (okToAnimate() && appTransition.isTransitionSet()) {
        // Note that we ignore display frozen since we want the opening / closing transition type
        // can be updated correctly even display frozen, and it's safe since in applyAnimation will
        // still check DC#okToAnimate again if the transition animation is fine to apply.
        if (okToAnimate(true /* ignoreFrozen */) && appTransition.isTransitionSet()) {
            if (visible) {
                displayContent.mOpeningApps.add(this);
                mEnteringAnimation = true;
+2 −2
Original line number Diff line number Diff line
@@ -499,8 +499,8 @@ public class AppTransitionController {
            // If we start the app transition at this point, we will interrupt it halfway with a
            // new rotation animation after the old one finally finishes. It's better to defer the
            // app transition.
            if (screenRotationAnimation != null && screenRotationAnimation.isAnimating() &&
                    mDisplayContent.getDisplayRotation().needsUpdate()) {
            if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()
                    && mDisplayContent.getDisplayRotation().needsUpdate()) {
                ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
                        "Delaying app transition for screen rotation animation to finish");
                return false;
+10 −2
Original line number Diff line number Diff line
@@ -3988,15 +3988,23 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
    }

    boolean okToDisplay() {
        return okToDisplay(false);
    }

    boolean okToDisplay(boolean ignoreFrozen) {
        if (mDisplayId == DEFAULT_DISPLAY) {
            return !mWmService.mDisplayFrozen
            return (!mWmService.mDisplayFrozen || ignoreFrozen)
                    && mWmService.mDisplayEnabled && mWmService.mPolicy.isScreenOn();
        }
        return mDisplayInfo.state == Display.STATE_ON;
    }

    boolean okToAnimate() {
        return okToDisplay() &&
        return okToAnimate(false);
    }

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

+5 −1
Original line number Diff line number Diff line
@@ -2036,7 +2036,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    }

    boolean okToAnimate() {
        return mDisplayContent != null && mDisplayContent.okToAnimate();
        return okToAnimate(false /* ignoreFrozen */);
    }

    boolean okToAnimate(boolean ignoreFrozen) {
        return mDisplayContent != null && mDisplayContent.okToAnimate(ignoreFrozen);
    }

    @Override