Merge "Do not change surface of system window token for transition" into tm-qpr-dev am: 8af9006eb3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20165443

Change-Id: I5deb62d2fc59b58a6dc8da904db3ac82225e2b07
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Riddle Hsu
2022-10-13 17:35:30 +00:00
committed by Automerger Merge Worker
3 changed files with 65 additions and 24 deletions

View File

@@ -135,8 +135,11 @@ public final class TransitionInfo implements Parcelable {
/** This change happened underneath something else. */ /** This change happened underneath something else. */
public static final int FLAG_IS_OCCLUDED = 1 << 15; 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. */ /** 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 */ /** @hide */
@IntDef(prefix = { "FLAG_" }, value = { @IntDef(prefix = { "FLAG_" }, value = {
@@ -157,6 +160,7 @@ public final class TransitionInfo implements Parcelable {
FLAG_CROSS_PROFILE_WORK_THUMBNAIL, FLAG_CROSS_PROFILE_WORK_THUMBNAIL,
FLAG_IS_BEHIND_STARTING_WINDOW, FLAG_IS_BEHIND_STARTING_WINDOW,
FLAG_IS_OCCLUDED, FLAG_IS_OCCLUDED,
FLAG_IS_SYSTEM_WINDOW,
FLAG_FIRST_CUSTOM FLAG_FIRST_CUSTOM
}) })
public @interface ChangeFlags {} public @interface ChangeFlags {}
@@ -369,6 +373,9 @@ public final class TransitionInfo implements Parcelable {
if ((flags & FLAG_IS_OCCLUDED) != 0) { if ((flags & FLAG_IS_OCCLUDED) != 0) {
sb.append(sb.length() == 0 ? "" : "|").append("IS_OCCLUDED"); 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) { if ((flags & FLAG_FIRST_CUSTOM) != 0) {
sb.append(sb.length() == 0 ? "" : "|").append("FIRST_CUSTOM"); sb.append(sb.length() == 0 ? "" : "|").append("FIRST_CUSTOM");
} }
@@ -701,14 +708,37 @@ public final class TransitionInfo implements Parcelable {
@Override @Override
public String toString() { public String toString() {
String out = "{" + mContainer + "(" + mParent + ") leash=" + mLeash final StringBuilder sb = new StringBuilder();
+ " m=" + modeToString(mMode) + " f=" + flagsToString(mFlags) + " sb=" sb.append('{'); sb.append(mContainer);
+ mStartAbsBounds + " eb=" + mEndAbsBounds + " eo=" + mEndRelOffset + " r=" sb.append(" m="); sb.append(modeToString(mMode));
+ mStartRotation + "->" + mEndRotation + ":" + mRotationAnimation sb.append(" f="); sb.append(flagsToString(mFlags));
+ " endFixedRotation=" + mEndFixedRotation; if (mParent != null) {
if (mSnapshot != null) out += " snapshot=" + mSnapshot; sb.append(" p="); sb.append(mParent);
if (mLastParent != null) out += " lastParent=" + mLastParent; }
return out + "}"; 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();
} }
} }

View File

@@ -322,6 +322,11 @@ public class Transitions implements RemoteCallable<Transitions> {
boolean isOpening = isOpeningType(info.getType()); boolean isOpening = isOpeningType(info.getType());
for (int i = info.getChanges().size() - 1; i >= 0; --i) { for (int i = info.getChanges().size() - 1; i >= 0; --i) {
final TransitionInfo.Change change = info.getChanges().get(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 SurfaceControl leash = change.getLeash();
final int mode = info.getChanges().get(i).getMode(); final int mode = info.getChanges().get(i).getMode();

View File

@@ -1878,15 +1878,15 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
flags |= FLAG_TRANSLUCENT; flags |= FLAG_TRANSLUCENT;
} }
final Task task = wc.asTask(); final Task task = wc.asTask();
if (task != null && task.voiceSession != null) {
flags |= FLAG_IS_VOICE_INTERACTION;
}
if (task != null) { if (task != null) {
final ActivityRecord topActivity = task.getTopNonFinishingActivity(); final ActivityRecord topActivity = task.getTopNonFinishingActivity();
if (topActivity != null && topActivity.mStartingData != null if (topActivity != null && topActivity.mStartingData != null
&& topActivity.mStartingData.hasImeSurface()) { && topActivity.mStartingData.hasImeSurface()) {
flags |= FLAG_WILL_IME_SHOWN; flags |= FLAG_WILL_IME_SHOWN;
} }
if (task.voiceSession != null) {
flags |= FLAG_IS_VOICE_INTERACTION;
}
} }
Task parentTask = null; Task parentTask = null;
final ActivityRecord record = wc.asActivityRecord(); final ActivityRecord record = wc.asActivityRecord();
@@ -1914,20 +1914,26 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
// Whether the container fills its parent Task bounds. // Whether the container fills its parent Task bounds.
flags |= FLAG_FILLS_TASK; flags |= FLAG_FILLS_TASK;
} }
} } else {
final DisplayContent dc = wc.asDisplayContent(); final DisplayContent dc = wc.asDisplayContent();
if (dc != null) { if (dc != null) {
flags |= FLAG_IS_DISPLAY; flags |= FLAG_IS_DISPLAY;
if (dc.hasAlertWindowSurfaces()) { if (dc.hasAlertWindowSurfaces()) {
flags |= FLAG_DISPLAY_HAS_ALERT_WINDOWS; 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)) { if (occludesKeyguard(wc)) {
flags |= FLAG_OCCLUDES_KEYGUARD; flags |= FLAG_OCCLUDES_KEYGUARD;
} }