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

Commit 1689d780 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Do not change surface of system window token for transition

The collected WindowToken's (e.g. status bar, navigation bar)
isVisibleRequested may be changed according to its WindowState's
visibility policy or the visibility of who is controlling the insets.
They are not aware of the WindowToken surface visibility, so keep
them untouched unless shell transition supports general window
animation or even insets animation.

Bug: 251214841
Test: atest FlickerTests:CloseImeAutoOpenWindowToAppTest
Test: Launch an activity that requests to hide system bars.
      And use shell command to change display size at the same time.
      After the launch transition is finished, the system bars
      can still be visible when swiping from bottom or top.
Change-Id: I2403e2dcbc6684774c9c3b74768a32c7b7a3b8ae
parent 9e3020b2
Loading
Loading
Loading
Loading
+39 −9
Original line number Diff line number Diff line
@@ -135,8 +135,11 @@ public final class TransitionInfo implements Parcelable {
    /** This change happened underneath something else. */
    public static final int FLAG_IS_OCCLUDED = 1 << 15;

    /** The container is a system window, excluding wallpaper and input-method. */
    public static final int FLAG_IS_SYSTEM_WINDOW = 1 << 16;

    /** The first unused bit. This can be used by remotes to attach custom flags to this change. */
    public static final int FLAG_FIRST_CUSTOM = 1 << 16;
    public static final int FLAG_FIRST_CUSTOM = 1 << 17;

    /** @hide */
    @IntDef(prefix = { "FLAG_" }, value = {
@@ -157,6 +160,7 @@ public final class TransitionInfo implements Parcelable {
            FLAG_CROSS_PROFILE_WORK_THUMBNAIL,
            FLAG_IS_BEHIND_STARTING_WINDOW,
            FLAG_IS_OCCLUDED,
            FLAG_IS_SYSTEM_WINDOW,
            FLAG_FIRST_CUSTOM
    })
    public @interface ChangeFlags {}
@@ -369,6 +373,9 @@ public final class TransitionInfo implements Parcelable {
        if ((flags & FLAG_IS_OCCLUDED) != 0) {
            sb.append(sb.length() == 0 ? "" : "|").append("IS_OCCLUDED");
        }
        if ((flags & FLAG_IS_SYSTEM_WINDOW) != 0) {
            sb.append(sb.length() == 0 ? "" : "|").append("FLAG_IS_SYSTEM_WINDOW");
        }
        if ((flags & FLAG_FIRST_CUSTOM) != 0) {
            sb.append(sb.length() == 0 ? "" : "|").append("FIRST_CUSTOM");
        }
@@ -701,14 +708,37 @@ public final class TransitionInfo implements Parcelable {

        @Override
        public String toString() {
            String out = "{" + mContainer + "(" + mParent + ") leash=" + mLeash
                    + " m=" + modeToString(mMode) + " f=" + flagsToString(mFlags) + " sb="
                    + mStartAbsBounds + " eb=" + mEndAbsBounds + " eo=" + mEndRelOffset + " r="
                    + mStartRotation + "->" + mEndRotation + ":" + mRotationAnimation
                    + " endFixedRotation=" + mEndFixedRotation;
            if (mSnapshot != null) out += " snapshot=" + mSnapshot;
            if (mLastParent != null) out += " lastParent=" + mLastParent;
            return out + "}";
            final StringBuilder sb = new StringBuilder();
            sb.append('{'); sb.append(mContainer);
            sb.append(" m="); sb.append(modeToString(mMode));
            sb.append(" f="); sb.append(flagsToString(mFlags));
            if (mParent != null) {
                sb.append(" p="); sb.append(mParent);
            }
            if (mLeash != null) {
                sb.append(" leash="); sb.append(mLeash);
            }
            sb.append(" sb="); sb.append(mStartAbsBounds);
            sb.append(" eb="); sb.append(mEndAbsBounds);
            if (mEndRelOffset.x != 0 || mEndRelOffset.y != 0) {
                sb.append(" eo="); sb.append(mEndRelOffset);
            }
            if (mStartRotation != mEndRotation) {
                sb.append(" r="); sb.append(mStartRotation);
                sb.append("->"); sb.append(mEndRotation);
                sb.append(':'); sb.append(mRotationAnimation);
            }
            if (mEndFixedRotation != ROTATION_UNDEFINED) {
                sb.append(" endFixedRotation="); sb.append(mEndFixedRotation);
            }
            if (mSnapshot != null) {
                sb.append(" snapshot="); sb.append(mSnapshot);
            }
            if (mLastParent != null) {
                sb.append(" lastParent="); sb.append(mLastParent);
            }
            sb.append('}');
            return sb.toString();
        }
    }

+5 −0
Original line number Diff line number Diff line
@@ -322,6 +322,11 @@ public class Transitions implements RemoteCallable<Transitions> {
        boolean isOpening = isOpeningType(info.getType());
        for (int i = info.getChanges().size() - 1; i >= 0; --i) {
            final TransitionInfo.Change change = info.getChanges().get(i);
            if ((change.getFlags() & TransitionInfo.FLAG_IS_SYSTEM_WINDOW) != 0) {
                // Currently system windows are controlled by WindowState, so don't change their
                // surfaces. Otherwise their window tokens could be hidden unexpectedly.
                continue;
            }
            final SurfaceControl leash = change.getLeash();
            final int mode = info.getChanges().get(i).getMode();

+21 −15
Original line number Diff line number Diff line
@@ -1878,15 +1878,15 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
                flags |= FLAG_TRANSLUCENT;
            }
            final Task task = wc.asTask();
            if (task != null && task.voiceSession != null) {
                flags |= FLAG_IS_VOICE_INTERACTION;
            }
            if (task != null) {
                final ActivityRecord topActivity = task.getTopNonFinishingActivity();
                if (topActivity != null && topActivity.mStartingData != null
                        && topActivity.mStartingData.hasImeSurface()) {
                    flags |= FLAG_WILL_IME_SHOWN;
                }
                if (task.voiceSession != null) {
                    flags |= FLAG_IS_VOICE_INTERACTION;
                }
            }
            Task parentTask = null;
            final ActivityRecord record = wc.asActivityRecord();
@@ -1914,19 +1914,25 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
                    // Whether the container fills its parent Task bounds.
                    flags |= FLAG_FILLS_TASK;
                }
            }
            } else {
                final DisplayContent dc = wc.asDisplayContent();
                if (dc != null) {
                    flags |= FLAG_IS_DISPLAY;
                    if (dc.hasAlertWindowSurfaces()) {
                        flags |= FLAG_DISPLAY_HAS_ALERT_WINDOWS;
                    }
            }
            if (isWallpaper(wc)) {
                } else if (isWallpaper(wc)) {
                    flags |= FLAG_IS_WALLPAPER;
            }
            if (isInputMethod(wc)) {
                } else if (isInputMethod(wc)) {
                    flags |= FLAG_IS_INPUT_METHOD;
                } else {
                    // In this condition, the wc can only be WindowToken or DisplayArea.
                    final int type = wc.getWindowType();
                    if (type >= WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW
                            && type <= WindowManager.LayoutParams.LAST_SYSTEM_WINDOW) {
                        flags |= TransitionInfo.FLAG_IS_SYSTEM_WINDOW;
                    }
                }
            }
            if (occludesKeyguard(wc)) {
                flags |= FLAG_OCCLUDES_KEYGUARD;