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

Commit 649a78d2 authored by Gyehun Jeon's avatar Gyehun Jeon Committed by Cherrypicker Worker
Browse files

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.

Bug: 361438779
Test: Manual
      Setup lock wallpaper
      Turn screen off to go aod state
Flag: com.android.window.flags.aod_transition
(cherry picked from https://partner-android-review.googlesource.com/q/commit:0f4f0a2689a545f2b4cf3f0979b1a89b15162b0d)
Merged-In: I8b9bae3d39124ee6f983975023b9d1d98b3700c6
Change-Id: I8b9bae3d39124ee6f983975023b9d1d98b3700c6
parent 92ae26dc
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -624,6 +624,12 @@ public interface WindowManager extends ViewManager {
     */
    int TRANSIT_FLAG_PHYSICAL_DISPLAY_SWITCH = (1 << 14); // 0x4000

    /**
     * Transition flag: Indicates that aod is showing hidden by entering doze
     * @hide
     */
    int TRANSIT_FLAG_AOD_APPEARING = (1 << 15); // 0x8000

    /**
     * @hide
     */
@@ -643,6 +649,7 @@ public interface WindowManager extends ViewManager {
            TRANSIT_FLAG_KEYGUARD_OCCLUDING,
            TRANSIT_FLAG_KEYGUARD_UNOCCLUDING,
            TRANSIT_FLAG_PHYSICAL_DISPLAY_SWITCH,
            TRANSIT_FLAG_AOD_APPEARING,
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitionFlags {}
@@ -659,7 +666,8 @@ public interface WindowManager extends ViewManager {
            (TRANSIT_FLAG_KEYGUARD_GOING_AWAY
            | TRANSIT_FLAG_KEYGUARD_APPEARING
            | TRANSIT_FLAG_KEYGUARD_OCCLUDING
            | TRANSIT_FLAG_KEYGUARD_UNOCCLUDING);
            | TRANSIT_FLAG_KEYGUARD_UNOCCLUDING
            | TRANSIT_FLAG_AOD_APPEARING);

    /**
     * Remove content mode: Indicates remove content mode is currently not defined.
+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;
@@ -405,7 +406,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
@@ -6629,6 +6629,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
     */
+18 −6
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,27 @@ class KeyguardController {
        state.mAodShowing = aodShowing;
        state.writeEventLog("setKeyguardShown");

        if (keyguardChanged || 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);
                    if (mWindowManager.mFlags.mAodTransition && aodShowing
                            && dc.mTransitionController.isCollecting()) {
                        dc.mTransitionController.getCollectingTransition().addFlag(
                                TRANSIT_FLAG_AOD_APPEARING);
                    }
                }
                dc.mWallpaperController.adjustWallpaperWindows();
                dc.executeAppTransition();
Loading