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

Commit b6569a04 authored by Evan Rosky's avatar Evan Rosky Committed by Android (Google) Code Review
Browse files

Merge "Handle keyguard occlude/unocclude in shell transitions"

parents 9e28c670 58d6cd50
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -417,6 +417,12 @@ public interface WindowManager extends ViewManager {
     */
    int TRANSIT_FLAG_OPEN_BEHIND = 0x20;

    /**
     * Transition flag: The keyguard is locked throughout the whole transition.
     * @hide
     */
    int TRANSIT_FLAG_KEYGUARD_LOCKED = 0x40;

    /**
     * @hide
     */
@@ -426,7 +432,8 @@ public interface WindowManager extends ViewManager {
            TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER,
            TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION,
            TRANSIT_FLAG_APP_CRASHED,
            TRANSIT_FLAG_OPEN_BEHIND
            TRANSIT_FLAG_OPEN_BEHIND,
            TRANSIT_FLAG_KEYGUARD_LOCKED
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitionFlags {}
+12 −2
Original line number Diff line number Diff line
@@ -65,18 +65,22 @@ public final class TransitionInfo implements Parcelable {
    public @interface TransitionMode {}

    private final @WindowManager.TransitionOldType int mType;
    private final @WindowManager.TransitionFlags int mFlags;
    private final ArrayList<Change> mChanges = new ArrayList<>();

    private SurfaceControl mRootLeash;
    private final Point mRootOffset = new Point();

    /** @hide */
    public TransitionInfo(@WindowManager.TransitionOldType int type) {
    public TransitionInfo(@WindowManager.TransitionOldType int type,
            @WindowManager.TransitionFlags int flags) {
        mType = type;
        mFlags = flags;
    }

    private TransitionInfo(Parcel in) {
        mType = in.readInt();
        mFlags = in.readInt();
        in.readList(mChanges, null /* classLoader */);
        mRootLeash = new SurfaceControl();
        mRootLeash.readFromParcel(in);
@@ -87,6 +91,7 @@ public final class TransitionInfo implements Parcelable {
    /** @hide */
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeInt(mType);
        dest.writeInt(mFlags);
        dest.writeList(mChanges);
        mRootLeash.writeToParcel(dest, flags);
        mRootOffset.writeToParcel(dest, flags);
@@ -122,6 +127,10 @@ public final class TransitionInfo implements Parcelable {
        return mType;
    }

    public int getFlags() {
        return mFlags;
    }

    /**
     * @return a surfacecontrol that can serve as a parent surfacecontrol for all the changing
     * participants to animate within. This will generally be placed at the highest-z-order
@@ -170,7 +179,8 @@ public final class TransitionInfo implements Parcelable {
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{t=" + mType + " ro=" + mRootOffset + " c=[");
        sb.append("{t=" + mType + " f=" + Integer.toHexString(mFlags)
                + " ro=" + mRootOffset + " c=[");
        for (int i = 0; i < mChanges.size(); ++i) {
            if (i > 0) {
                sb.append(',');
+8 −1
Original line number Diff line number Diff line
@@ -3134,7 +3134,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway, long duration) {
    @Override
    public int applyKeyguardOcclusionChange() {
        if (mKeyguardOccludedChanged) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "transition/occluded changed occluded="
                    + mPendingKeyguardOccluded);
@@ -3143,6 +3144,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                return FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_WALLPAPER;
            }
        }
        return 0;
    }

    private int handleStartTransitionForKeyguardLw(boolean keyguardGoingAway, long duration) {
        final int res = applyKeyguardOcclusionChange();
        if (res != 0) return res;
        if (keyguardGoingAway) {
            if (DEBUG_KEYGUARD) Slog.d(TAG, "Starting keyguard exit animation");
            startKeyguardExitAnimation(SystemClock.uptimeMillis(), duration);
+3 −0
Original line number Diff line number Diff line
@@ -172,6 +172,9 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
     */
    void onKeyguardOccludedChangedLw(boolean occluded);

    /** Applies a keyguard occlusion change if one happened. */
    int applyKeyguardOcclusionChange();

    /**
     * Interface to the Window Manager state associated with a particular
     * window. You can hold on to an instance of this interface from the call
+12 −4
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANI
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED;
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;

import android.annotation.IntDef;
@@ -282,9 +283,13 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
        mState = STATE_PLAYING;
        mController.moveToPlaying(this);

        if (mController.mAtm.mTaskSupervisor.getKeyguardController().isKeyguardLocked()) {
            mFlags |= TRANSIT_FLAG_KEYGUARD_LOCKED;
        }

        // Resolve the animating targets from the participants
        mTargets = calculateTargets(mParticipants, mChanges);
        final TransitionInfo info = calculateTransitionInfo(mType, mTargets, mChanges);
        final TransitionInfo info = calculateTransitionInfo(mType, mFlags, mTargets, mChanges);
        mRootLeash = info.getRootLeash();

        handleNonAppWindowsInTransition(displayId, mType, mFlags);
@@ -337,6 +342,9 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
            mController.mAtm.mWindowManager.mPolicy.startKeyguardExitAnimation(
                    SystemClock.uptimeMillis(), 0 /* duration */);
        }
        if ((flags & TRANSIT_FLAG_KEYGUARD_LOCKED) != 0) {
            mController.mAtm.mWindowManager.mPolicy.applyKeyguardOcclusionChange();
        }
    }

    @Override
@@ -587,9 +595,9 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
     */
    @VisibleForTesting
    @NonNull
    static TransitionInfo calculateTransitionInfo(int type, ArraySet<WindowContainer> targets,
            ArrayMap<WindowContainer, ChangeInfo> changes) {
        final TransitionInfo out = new TransitionInfo(type);
    static TransitionInfo calculateTransitionInfo(int type, int flags,
            ArraySet<WindowContainer> targets, ArrayMap<WindowContainer, ChangeInfo> changes) {
        final TransitionInfo out = new TransitionInfo(type, flags);
        if (targets.isEmpty()) {
            out.setRootLeash(new SurfaceControl(), 0, 0);
            return out;
Loading