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

Commit 2c0834c5 authored by Chris Li's avatar Chris Li
Browse files

Invoke keyguard going away when it is collecting for wake

Before, when KEYGUARD_GOING_AWAY is called before WAKE starts,it will
not be passed to the keyguard service to dimiss keyguard. Now, we
merge the flags and add check for that.

Bug: 193564917
Test: check with/without sEnableRemoteKeyguardAnimation
Change-Id: I28d40664b4fbdc0ea199baa32ccefba7dea473f8
parent f74b9ddc
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -381,8 +381,11 @@ public interface WindowManager extends ViewManager {
    int TRANSIT_CHANGE = 6;
    /**
     * The keyguard was visible and has been dismissed.
     * @deprecated use {@link #TRANSIT_TO_BACK} + {@link #TRANSIT_FLAG_KEYGUARD_GOING_AWAY} for
     *             keyguard going away with Shell transition.
     * @hide
     */
    @Deprecated
    int TRANSIT_KEYGUARD_GOING_AWAY = 7;
    /**
     * A window is appearing above a locked keyguard.
@@ -486,6 +489,12 @@ public interface WindowManager extends ViewManager {
     */
    int TRANSIT_FLAG_IS_RECENTS = 0x80;

    /**
     * Transition flag: Indicates that keyguard should go away with this transition.
     * @hide
     */
    int TRANSIT_FLAG_KEYGUARD_GOING_AWAY = 0x100;

    /**
     * @hide
     */
@@ -497,7 +506,8 @@ public interface WindowManager extends ViewManager {
            TRANSIT_FLAG_APP_CRASHED,
            TRANSIT_FLAG_OPEN_BEHIND,
            TRANSIT_FLAG_KEYGUARD_LOCKED,
            TRANSIT_FLAG_IS_RECENTS
            TRANSIT_FLAG_IS_RECENTS,
            TRANSIT_FLAG_KEYGUARD_GOING_AWAY
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitionFlags {}
+9 −0
Original line number Diff line number Diff line
@@ -59,6 +59,9 @@ public final class TransitionFilter implements Parcelable {
    /** All flags must be set on a transition. */
    public @WindowManager.TransitionFlags int mFlags = 0;

    /** All flags must NOT be set on a transition. */
    public @WindowManager.TransitionFlags int mNotFlags = 0;

    /**
     * A list of required changes. To pass, a transition must meet all requirements.
     */
@@ -70,6 +73,7 @@ public final class TransitionFilter implements Parcelable {
    private TransitionFilter(Parcel in) {
        mTypeSet = in.createIntArray();
        mFlags = in.readInt();
        mNotFlags = in.readInt();
        mRequirements = in.createTypedArray(Requirement.CREATOR);
    }

@@ -89,6 +93,9 @@ public final class TransitionFilter implements Parcelable {
        if ((info.getFlags() & mFlags) != mFlags) {
            return false;
        }
        if ((info.getFlags() & mNotFlags) != 0) {
            return false;
        }
        // Make sure info meets all of the requirements.
        if (mRequirements != null) {
            for (int i = 0; i < mRequirements.length; ++i) {
@@ -106,6 +113,7 @@ public final class TransitionFilter implements Parcelable {
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeIntArray(mTypeSet);
        dest.writeInt(mFlags);
        dest.writeInt(mNotFlags);
        dest.writeTypedArray(mRequirements, flags);
    }

@@ -139,6 +147,7 @@ public final class TransitionFilter implements Parcelable {
            }
        }
        sb.append("] flags=0x" + Integer.toHexString(mFlags));
        sb.append("] notFlags=0x" + Integer.toHexString(mNotFlags));
        sb.append(" checks=[");
        if (mRequirements != null) {
            for (int i = 0; i < mRequirements.length; ++i) {
+8 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
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_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK;
@@ -249,6 +250,13 @@ public final class TransitionInfo implements Parcelable {
        mChanges.add(change);
    }

    /**
     * Whether this transition includes keyguard going away.
     */
    public boolean isKeyguardGoingAway() {
        return (mFlags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY) != 0;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
+4 −6
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLES
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_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_RELAUNCH;
@@ -249,10 +248,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
            @NonNull Transitions.TransitionFinishCallback finishCallback) {
        ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
                "start default transition animation, info = %s", info);

        // Fallback for screen wake. This just immediately finishes since there is no
        // animation for screen-wake.
        if (info.getType() == WindowManager.TRANSIT_WAKE) {
        // If keyguard goes away, we should loadKeyguardExitAnimation. Otherwise this just
        // immediately finishes since there is no animation for screen-wake.
        if (info.getType() == WindowManager.TRANSIT_WAKE && !info.isKeyguardGoingAway()) {
            startTransaction.apply();
            finishCallback.onTransitionFinished(null /* wct */, null /* wctCB */);
            return true;
@@ -354,7 +352,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
        final int overrideType = options != null ? options.getType() : ANIM_NONE;
        final boolean canCustomContainer = isTask ? !sDisableCustomTaskAnimationProperty : true;

        if (type == TRANSIT_KEYGUARD_GOING_AWAY) {
        if (info.isKeyguardGoingAway()) {
            a = mTransitionAnimation.loadKeyguardExitAnimation(flags,
                    (changeFlags & FLAG_SHOW_WALLPAPER) != 0);
        } else if (type == TRANSIT_KEYGUARD_UNOCCLUDE) {
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.wm.shell.transition;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FIRST_CUSTOM;
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -230,7 +231,7 @@ public class Transitions implements RemoteCallable<Transitions> {
    public static boolean isOpeningType(@WindowManager.TransitionType int type) {
        return type == TRANSIT_OPEN
                || type == TRANSIT_TO_FRONT
                || type == WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
                || type == TRANSIT_KEYGUARD_GOING_AWAY;
    }

    /** @return true if the transition was triggered by closing something vs opening something */
Loading