From 51ee2e378d01ad4775cb9f8b6e2d2825a28e7a3e Mon Sep 17 00:00:00 2001 From: Chris Li Date: Mon, 24 Oct 2022 18:30:49 +0800 Subject: [PATCH] Exclude embedded TaskFragment from non-app windows Before, when a TaskFragment is included in the transition, it is treated as non-app window, which caused flicker when open/close Task with embedded TF. Bug: 207070762 Test: atest SystemUITests:RemoteTransitionTest Change-Id: Iaf26b70e33f82d86988cde0a7eea10acc4e0d6bb --- .../systemui/shared/system/RemoteAnimationTargetCompat.java | 4 +++- .../systemui/shared/system/RemoteTransitionTest.java | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java index 8d1768c41589a..e1e806319ba05 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteAnimationTargetCompat.java @@ -26,6 +26,7 @@ import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.view.WindowManager.TRANSIT_TO_BACK; import static android.view.WindowManager.TRANSIT_TO_FRONT; +import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; import static android.window.TransitionInfo.FLAG_IS_WALLPAPER; import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT; @@ -228,7 +229,8 @@ public class RemoteAnimationTargetCompat { public static RemoteAnimationTarget[] wrapNonApps(TransitionInfo info, boolean wallpapers, SurfaceControl.Transaction t, ArrayMap leashMap) { return wrap(info, t, leashMap, (change, taskInfo) -> (taskInfo == null) - && wallpapers == ((change.getFlags() & TransitionInfo.FLAG_IS_WALLPAPER) != 0)); + && wallpapers == change.hasFlags(FLAG_IS_WALLPAPER) + && !change.hasFlags(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY)); } private static RemoteAnimationTarget[] wrap(TransitionInfo info, diff --git a/packages/SystemUI/tests/src/com/android/systemui/shared/system/RemoteTransitionTest.java b/packages/SystemUI/tests/src/com/android/systemui/shared/system/RemoteTransitionTest.java index 64dc9568030be..4478039912c8d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shared/system/RemoteTransitionTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shared/system/RemoteTransitionTest.java @@ -25,6 +25,7 @@ import static android.view.WindowManager.TRANSIT_CHANGE; import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_OPEN; import static android.window.TransitionInfo.FLAG_FIRST_CUSTOM; +import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; import static android.window.TransitionInfo.FLAG_IS_WALLPAPER; import static android.window.TransitionInfo.FLAG_SHOW_WALLPAPER; import static android.window.TransitionInfo.FLAG_TRANSLUCENT; @@ -69,10 +70,13 @@ public class RemoteTransitionTest extends SysuiTestCase { TransitionInfo combined = new TransitionInfoBuilder(TRANSIT_CLOSE) .addChange(TRANSIT_CHANGE, FLAG_SHOW_WALLPAPER, createTaskInfo(1 /* taskId */, ACTIVITY_TYPE_STANDARD)) + // Embedded TaskFragment should be excluded when animated with Task. + .addChange(TRANSIT_CLOSE, FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY, null /* taskInfo */) .addChange(TRANSIT_CLOSE, 0 /* flags */, createTaskInfo(2 /* taskId */, ACTIVITY_TYPE_STANDARD)) .addChange(TRANSIT_OPEN, FLAG_IS_WALLPAPER, null /* taskInfo */) - .addChange(TRANSIT_CHANGE, FLAG_FIRST_CUSTOM, null /* taskInfo */).build(); + .addChange(TRANSIT_CHANGE, FLAG_FIRST_CUSTOM, null /* taskInfo */) + .build(); // Check apps extraction RemoteAnimationTarget[] wrapped = RemoteAnimationTargetCompat.wrapApps(combined, mock(SurfaceControl.Transaction.class), null /* leashes */);