diff options
| author | 2022-10-11 21:53:39 +0800 | |
|---|---|---|
| committer | 2022-10-13 17:24:43 +0800 | |
| commit | 1689d780d3c7e80ae251ebb8ac421094e4dc73e3 (patch) | |
| tree | cfb48c80ea3ab68903cd057052e7b033397e6458 | |
| parent | 9e3020b2339f5066f1496f6c9caf96e8d291c53a (diff) | |
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
3 files changed, 65 insertions, 24 deletions
diff --git a/core/java/android/window/TransitionInfo.java b/core/java/android/window/TransitionInfo.java index 1bc8e6d7ef65..8815ab35b671 100644 --- a/core/java/android/window/TransitionInfo.java +++ b/core/java/android/window/TransitionInfo.java @@ -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(); } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index d1bc7384d78c..db1f19aa87b6 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -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(); diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index b1862b6f274f..46253c1933b6 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -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,20 +1914,26 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe // Whether the container fills its parent Task bounds. flags |= FLAG_FILLS_TASK; } - } - final DisplayContent dc = wc.asDisplayContent(); - if (dc != null) { - flags |= FLAG_IS_DISPLAY; - if (dc.hasAlertWindowSurfaces()) { - flags |= FLAG_DISPLAY_HAS_ALERT_WINDOWS; + } else { + final DisplayContent dc = wc.asDisplayContent(); + if (dc != null) { + flags |= FLAG_IS_DISPLAY; + if (dc.hasAlertWindowSurfaces()) { + flags |= FLAG_DISPLAY_HAS_ALERT_WINDOWS; + } + } else if (isWallpaper(wc)) { + flags |= FLAG_IS_WALLPAPER; + } 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 (isWallpaper(wc)) { - flags |= FLAG_IS_WALLPAPER; - } - if (isInputMethod(wc)) { - flags |= FLAG_IS_INPUT_METHOD; - } if (occludesKeyguard(wc)) { flags |= FLAG_OCCLUDES_KEYGUARD; } |