Add TASK_LAUNCHING_BEHIND to change flags

When ActivityRecord#mLaunchTaskBehind is true, the newly-launched
task is positioned behind home. However, for compatibility reasons,
it's marked as visible, so there's no way for Shell to tell if a
newly launched task should be shown to the user or not.

This CL adds a transition change flag for this purpose.

Bug: 268178951
Bug: 268130984
Bug: 268131581
Test: atest StartActivityTests#testStartActivityTaskLaunchBehind
Change-Id: I3c5b517de5c56fe365cc9dd487e7d42dfa584513
Merged-In: I3c5b517de5c56fe365cc9dd487e7d42dfa584513
(cherry picked from commit 7c56142676)
This commit is contained in:
Kazuki Takise
2023-02-15 20:40:24 +09:00
parent 144c515715
commit 134ca1cc4b
2 changed files with 13 additions and 1 deletions

View File

@@ -144,8 +144,11 @@ public final class TransitionInfo implements Parcelable {
/** The window should have no animation (by policy). */
public static final int FLAG_NO_ANIMATION = 1 << 18;
/** The task is launching behind home. */
public static final int FLAG_TASK_LAUNCHING_BEHIND = 1 << 19;
/** 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 << 19;
public static final int FLAG_FIRST_CUSTOM = 1 << 20;
/** The change belongs to a window that won't contain activities. */
public static final int FLAGS_IS_NON_APP_WINDOW =
@@ -173,6 +176,7 @@ public final class TransitionInfo implements Parcelable {
FLAG_IS_SYSTEM_WINDOW,
FLAG_BACK_GESTURE_ANIMATED,
FLAG_NO_ANIMATION,
FLAG_TASK_LAUNCHING_BEHIND,
FLAG_FIRST_CUSTOM
})
public @interface ChangeFlags {}
@@ -395,6 +399,9 @@ public final class TransitionInfo implements Parcelable {
if ((flags & FLAG_NO_ANIMATION) != 0) {
sb.append(sb.length() == 0 ? "" : "|").append("NO_ANIMATION");
}
if ((flags & FLAG_TASK_LAUNCHING_BEHIND) != 0) {
sb.append((sb.length() == 0 ? "" : "|") + "TASK_LAUNCHING_BEHIND");
}
if ((flags & FLAG_FIRST_CUSTOM) != 0) {
sb.append(sb.length() == 0 ? "" : "|").append("FIRST_CUSTOM");
}

View File

@@ -53,6 +53,7 @@ import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
import static android.window.TransitionInfo.FLAG_NO_ANIMATION;
import static android.window.TransitionInfo.FLAG_OCCLUDES_KEYGUARD;
import static android.window.TransitionInfo.FLAG_SHOW_WALLPAPER;
import static android.window.TransitionInfo.FLAG_TASK_LAUNCHING_BEHIND;
import static android.window.TransitionInfo.FLAG_TRANSLUCENT;
import static android.window.TransitionInfo.FLAG_WILL_IME_SHOWN;
@@ -2272,6 +2273,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
.isMonitorTransitionTarget(topActivity)) {
flags |= TransitionInfo.FLAG_BACK_GESTURE_ANIMATED;
}
if (topActivity != null && topActivity.mLaunchTaskBehind) {
Slog.e(TAG, "Unexpected launch-task-behind operation in shell transition");
flags |= FLAG_TASK_LAUNCHING_BEHIND;
}
} else {
if (task.mAtmService.mBackNavigationController
.isMonitorTransitionTarget(task)) {