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

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

Change-Id: I003f824b893a2e0e878ae3c9441864abbbd60b50
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:43:52 +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. */
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();
}
}

View File

@@ -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();

View File

@@ -1844,15 +1844,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();
@@ -1880,20 +1880,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;
}