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

Commit 20742b28 authored by wilsonshih's avatar wilsonshih
Browse files

Fix shell transition for showWhenLocked + translucent activity.

Fix two issues if AOD is disabled:
- There should request to adjust wallpaper target after
  ActivityRecord#commitVisibility. The NotificationShade can
  accidentally be wallpaper target when AOD is enabled.
- If resumeTopActivity happen eailer than DisplayPolicy#setAwake, there
  will no transition to collecting the resuming activity, try to
  request a wake transition before resume top activity if default
  display is not awake. When AOD is enabled, usually setAwake will
  be called earlier.

Bug: 209906849
Test: 1. enable shell transition. 2. Disable AOD
3. run atest KeyguardTests

Change-Id: Ifc3ce28424fe87b1e0a0a2af07bdad559575ebec
parent 43f53011
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -5228,10 +5228,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        final boolean delayed = isAnimating(PARENTS | CHILDREN,
                ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION
                        | ANIMATION_TYPE_RECENTS);
        if (!delayed && !usingShellTransitions) {
        if (!delayed) {
            // We aren't delayed anything, but exiting windows rely on the animation finished
            // callback being called in case the ActivityRecord was pretending to be delayed,
            // which we might have done because we were in closing/opening apps list.
            if (!usingShellTransitions) {
                onAnimationFinished(ANIMATION_TYPE_APP_TRANSITION, null /* AnimationAdapter */);
                if (visible) {
                    // The token was made immediately visible, there will be no entrance animation.
@@ -5240,6 +5241,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                    mWmService.mActivityManagerAppTransitionNotifier.onAppTransitionFinishedLocked(
                            token);
                }
            } else {
                // update wallpaper target
                setAppLayoutChanges(FINISH_LAYOUT_REDO_WALLPAPER, "ActivityRecord");
            }
        }

        // If we're becoming visible, immediately change client visibility as well. there seem
+2 −1
Original line number Diff line number Diff line
@@ -787,7 +787,8 @@ public class DisplayPolicy {
            if (!mDisplayContent.isDefaultDisplay) {
                return;
            }
            if (mAwake) {
            if (mAwake && mDisplayContent.mTransitionController.isShellTransitionsEnabled()
                    && !mDisplayContent.mTransitionController.isCollecting()) {
                // Start a transition for waking. This is needed for showWhenLocked activities.
                mDisplayContent.mTransitionController.requestTransitionIfNeeded(TRANSIT_WAKE,
                        0 /* flags */, null /* trigger */, mDisplayContent);
+9 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED;
import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_PIP;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_WAKE;

import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS_LIGHT;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_KEEP_SCREEN_ON;
@@ -2338,6 +2339,14 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                continue;
            }

            // Prepare transition before resume top activity, so it can be collected.
            if (!displayShouldSleep && display.isDefaultDisplay
                    && !display.getDisplayPolicy().isAwake()
                    && display.mTransitionController.isShellTransitionsEnabled()
                    && !display.mTransitionController.isCollecting()) {
                display.mTransitionController.requestTransitionIfNeeded(TRANSIT_WAKE,
                        0 /* flags */, null /* trigger */, display);
            }
            // Set the sleeping state of the root tasks on the display.
            display.forAllRootTasks(rootTask -> {
                if (displayShouldSleep) {