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

Commit 2b6b43a1 authored by Robin Lee's avatar Robin Lee
Browse files

Reland: Implements the aod appearing transition

This is to show lock wallpaper according to transition
lifecycle. WmCore requests the appearing transition when
aod is showing. And then, transition collects all wallpapers
including system and lock. KeyguardService can apply
cross-fade animation for wallpapers.

Also, separate the aod appearing and keyguard appearing transition.

When aod is changed without keyguard changed, keyguard appearing
flag is set unnecessarily. This may confuse keyguard service.

Also, when aod changes while feature is turned off, keyguard appearing
transition may operate causing problems.

We only enable code to send keygaurd appearing. if keyguardChanged and
only enable code to send aod if aodChanged. This is more in line with
what the original code was doing and wouldn't introduce any new behavior
with the flag turned off.

It is related to commit 649a78d2

Bug: 361438779
Test: Manual: feature off; turn screen off to go aod state
Test: Manual: Setup lock wallpaper; Turn screen off to go aod state
Flag: com.android.window.flags.aod_transition
Change-Id: I6f0067de2a754c25515a6cc4bc8c9dcfb78ede80
parent c396ff18
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static android.view.Display.INVALID_DISPLAY;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_AOD_APPEARING;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_APPEARING;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_NONE;
@@ -375,7 +376,8 @@ public final class TransitionInfo implements Parcelable {
     */
    public boolean hasChangesOrSideEffects() {
        return !mChanges.isEmpty() || isKeyguardGoingAway()
                || (mFlags & TRANSIT_FLAG_KEYGUARD_APPEARING) != 0;
                || (mFlags & TRANSIT_FLAG_KEYGUARD_APPEARING) != 0
                || (mFlags & TRANSIT_FLAG_AOD_APPEARING) != 0;
    }

    /**
+3 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.service.dreams.Flags.dismissDreamOnKeyguardDismiss;
import static android.view.WindowManager.KEYGUARD_VISIBILITY_TRANSIT_FLAGS;
import static android.view.WindowManager.TRANSIT_FLAG_AOD_APPEARING;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_APPEARING;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED;
@@ -200,7 +201,8 @@ public class KeyguardTransitionHandler
                    transition, info, startTransaction, finishTransaction, finishCallback);
        }

        if ((info.getFlags() & TRANSIT_FLAG_KEYGUARD_APPEARING) != 0) {
        if ((info.getFlags() & TRANSIT_FLAG_KEYGUARD_APPEARING) != 0
                || (info.getFlags() & TRANSIT_FLAG_AOD_APPEARING) != 0) {
            return startAnimation(mAppearTransition, "appearing",
                    transition, info, startTransaction, finishTransaction, finishCallback);
        }
+16 −0
Original line number Diff line number Diff line
@@ -6575,6 +6575,22 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                .getKeyguardController().isKeyguardLocked(mDisplayId);
    }

    boolean isKeyguardLockedOrAodShowing() {
        return isKeyguardLocked() || isAodShowing();
    }

    /**
     * @return whether aod is showing for this display
     */
    boolean isAodShowing() {
        final boolean isAodShowing = mRootWindowContainer.mTaskSupervisor
                .getKeyguardController().isAodShowing(mDisplayId);
        if (mDisplayId == DEFAULT_DISPLAY && isAodShowing) {
            return !isKeyguardGoingAway();
        }
        return isAodShowing;
    }

    /**
     * @return whether keyguard is going away on this display
     */
+21 −8
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.wm;

import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.TRANSIT_FLAG_AOD_APPEARING;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_APPEARING;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION;
@@ -216,6 +217,9 @@ class KeyguardController {
                } else if (keyguardShowing && !state.mKeyguardShowing) {
                    transition.addFlag(TRANSIT_FLAG_KEYGUARD_APPEARING);
                }
                if (mWindowManager.mFlags.mAodTransition && aodShowing && !state.mAodShowing) {
                    transition.addFlag(TRANSIT_FLAG_AOD_APPEARING);
                }
            }
        }
        // Update the task snapshot if the screen will not be turned off. To make sure that the
@@ -238,19 +242,28 @@ class KeyguardController {
        state.mAodShowing = aodShowing;
        state.writeEventLog("setKeyguardShown");

        if (keyguardChanged || (mWindowManager.mFlags.mAodTransition && aodChanged)) {
            if (keyguardChanged) {
                // Irrelevant to AOD.
                state.mKeyguardGoingAway = false;
                if (keyguardShowing) {
                    state.mDismissalRequested = false;
                }
            }
            if (goingAwayRemoved
                    || (keyguardShowing && !Display.isOffState(dc.getDisplayInfo().state))) {
                    || (keyguardShowing && !Display.isOffState(dc.getDisplayInfo().state))
                    || (mWindowManager.mFlags.mAodTransition && aodShowing)) {
                // Keyguard decided to show or stopped going away. Send a transition to animate back
                // to the locked state before holding the sleep token again
                if (!ENABLE_NEW_KEYGUARD_SHELL_TRANSITIONS) {
                    dc.requestTransitionAndLegacyPrepare(
                            TRANSIT_TO_FRONT, TRANSIT_FLAG_KEYGUARD_APPEARING, /* trigger= */ null);
                    if (keyguardChanged) {
                        dc.requestTransitionAndLegacyPrepare(TRANSIT_TO_FRONT,
                                TRANSIT_FLAG_KEYGUARD_APPEARING, /* trigger= */ null);
                    }
                    if (mWindowManager.mFlags.mAodTransition && aodChanged && aodShowing) {
                        dc.requestTransitionAndLegacyPrepare(TRANSIT_TO_FRONT,
                                TRANSIT_FLAG_AOD_APPEARING, /* trigger= */ null);
                    }
                }
                dc.mWallpaperController.adjustWallpaperWindows();
                dc.executeAppTransition();
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_AOD_APPEARING;
import static android.view.WindowManager.TRANSIT_FLAG_IS_RECENTS;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED;
import static android.view.WindowManager.TRANSIT_OPEN;
@@ -980,6 +981,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        return false;
    }

    boolean isInAodAppearTransition() {
        return (mFlags & TRANSIT_FLAG_AOD_APPEARING) != 0;
    }

    /**
     * Specifies configuration change explicitly for the window container, so it can be chosen as
     * transition target. This is usually used with transition mode
Loading