Loading libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import static android.view.WindowManager.fixScale; import static android.window.TransitionInfo.FLAGS_IS_NON_APP_WINDOW; import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; import static android.window.TransitionInfo.FLAG_IS_BEHIND_STARTING_WINDOW; import static android.window.TransitionInfo.FLAG_IS_DISPLAY; import static android.window.TransitionInfo.FLAG_IS_OCCLUDED; import static android.window.TransitionInfo.FLAG_IS_WALLPAPER; import static android.window.TransitionInfo.FLAG_NO_ANIMATION; Loading Loading @@ -664,6 +665,10 @@ public class Transitions implements RemoteCallable<Transitions>, if (!TransitionInfo.isIndependent(change, info)) { continue; } // Don't reparent display level if only changing order (since root will be inside it). if (change.hasFlags(FLAG_IS_DISPLAY) && TransitionUtil.isOrderOnly(change)) { continue; } boolean hasParent = change.getParent() != null; Loading services/core/java/com/android/server/wm/Transition.java +16 −2 Original line number Diff line number Diff line Loading @@ -3326,6 +3326,14 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } } /** Mirrors {@link com.android.wm.shell.shared.TransitionUtil#isOrderOnly}. */ private static boolean isOrderOnly(ChangeInfo chgInfo) { final WindowContainer wc = chgInfo.mContainer; return (chgInfo.mFlags & ChangeInfo.FLAG_CHANGE_MOVED_TO_TOP) != 0 && chgInfo.getTransitMode(wc) == TRANSIT_CHANGE && wc.getBounds().equals(chgInfo.mAbsoluteBounds); } /** * Finds the top-most common ancestor of app targets. * Loading @@ -3333,8 +3341,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { * be covered by other windows below the previous parent. For example, when reparenting an * activity from PiP Task to split screen Task. */ @VisibleForTesting @NonNull private static WindowContainer<?> findCommonAncestor( static WindowContainer<?> findCommonAncestor( @NonNull ArrayList<ChangeInfo> targets, @NonNull WindowContainer<?> topApp) { final int displayId = getDisplayId(topApp); Loading @@ -3348,6 +3357,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // Skip the non-app window or windows on a different display continue; } // Skip order-only display-level changes since the display itself isn't changing. if (wc.asDisplayContent() != null && isOrderOnly(change)) { continue; } // Re-initiate the last parent as the initial ancestor instead of the top target. // When move a leaf task from organized task to display area, try to keep the transition // root be the original organized task for close transition animation. Loading Loading @@ -3606,7 +3619,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { private static final int FLAG_CHANGE_YES_ANIMATION = 0x10; /** Whether this change's container moved to the top. */ private static final int FLAG_CHANGE_MOVED_TO_TOP = 0x20; @VisibleForTesting static final int FLAG_CHANGE_MOVED_TO_TOP = 0x20; /** Whether this change contains config-at-end members. */ private static final int FLAG_CHANGE_CONFIG_AT_END = 0x40; Loading services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +23 −0 Original line number Diff line number Diff line Loading @@ -3057,6 +3057,29 @@ public class TransitionTests extends WindowTestsBase { assertEquals("reason1", condition1.mAlternate); } @Test public void testCommonAncestor_excludeOrderOnlyDisplay() { DisplayContent otherDisplay = createNewDisplay(); final Task display0Task = createTask(mDisplayContent); final Task display1Task = createTask(otherDisplay); display0Task.setVisibleRequested(true); display1Task.setVisibleRequested(true); // Build target-list as-if originally task 0 was focused/front and then the user focused // task 1 (bringing it and display 1 to front). final ArrayList<Transition.ChangeInfo> sortedTargets = new ArrayList<>(); sortedTargets.add( new Transition.ChangeInfo(display1Task, true /* vis */, false /* exChg */)); sortedTargets.getLast().mFlags |= Transition.ChangeInfo.FLAG_CHANGE_MOVED_TO_TOP; sortedTargets.add( new Transition.ChangeInfo(otherDisplay, true /* vis */, false /* exChg */)); sortedTargets.getLast().mFlags |= Transition.ChangeInfo.FLAG_CHANGE_MOVED_TO_TOP; WindowContainer ancestor = Transition.findCommonAncestor(sortedTargets, display1Task); assertTrue(ancestor.isDescendantOf(otherDisplay.getParent())); } private void tryFinishTransitionSyncSet(Transition transition) { transition.setAllReady(); transition.start(); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import static android.view.WindowManager.fixScale; import static android.window.TransitionInfo.FLAGS_IS_NON_APP_WINDOW; import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; import static android.window.TransitionInfo.FLAG_IS_BEHIND_STARTING_WINDOW; import static android.window.TransitionInfo.FLAG_IS_DISPLAY; import static android.window.TransitionInfo.FLAG_IS_OCCLUDED; import static android.window.TransitionInfo.FLAG_IS_WALLPAPER; import static android.window.TransitionInfo.FLAG_NO_ANIMATION; Loading Loading @@ -664,6 +665,10 @@ public class Transitions implements RemoteCallable<Transitions>, if (!TransitionInfo.isIndependent(change, info)) { continue; } // Don't reparent display level if only changing order (since root will be inside it). if (change.hasFlags(FLAG_IS_DISPLAY) && TransitionUtil.isOrderOnly(change)) { continue; } boolean hasParent = change.getParent() != null; Loading
services/core/java/com/android/server/wm/Transition.java +16 −2 Original line number Diff line number Diff line Loading @@ -3326,6 +3326,14 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } } /** Mirrors {@link com.android.wm.shell.shared.TransitionUtil#isOrderOnly}. */ private static boolean isOrderOnly(ChangeInfo chgInfo) { final WindowContainer wc = chgInfo.mContainer; return (chgInfo.mFlags & ChangeInfo.FLAG_CHANGE_MOVED_TO_TOP) != 0 && chgInfo.getTransitMode(wc) == TRANSIT_CHANGE && wc.getBounds().equals(chgInfo.mAbsoluteBounds); } /** * Finds the top-most common ancestor of app targets. * Loading @@ -3333,8 +3341,9 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { * be covered by other windows below the previous parent. For example, when reparenting an * activity from PiP Task to split screen Task. */ @VisibleForTesting @NonNull private static WindowContainer<?> findCommonAncestor( static WindowContainer<?> findCommonAncestor( @NonNull ArrayList<ChangeInfo> targets, @NonNull WindowContainer<?> topApp) { final int displayId = getDisplayId(topApp); Loading @@ -3348,6 +3357,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { // Skip the non-app window or windows on a different display continue; } // Skip order-only display-level changes since the display itself isn't changing. if (wc.asDisplayContent() != null && isOrderOnly(change)) { continue; } // Re-initiate the last parent as the initial ancestor instead of the top target. // When move a leaf task from organized task to display area, try to keep the transition // root be the original organized task for close transition animation. Loading Loading @@ -3606,7 +3619,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { private static final int FLAG_CHANGE_YES_ANIMATION = 0x10; /** Whether this change's container moved to the top. */ private static final int FLAG_CHANGE_MOVED_TO_TOP = 0x20; @VisibleForTesting static final int FLAG_CHANGE_MOVED_TO_TOP = 0x20; /** Whether this change contains config-at-end members. */ private static final int FLAG_CHANGE_CONFIG_AT_END = 0x40; Loading
services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +23 −0 Original line number Diff line number Diff line Loading @@ -3057,6 +3057,29 @@ public class TransitionTests extends WindowTestsBase { assertEquals("reason1", condition1.mAlternate); } @Test public void testCommonAncestor_excludeOrderOnlyDisplay() { DisplayContent otherDisplay = createNewDisplay(); final Task display0Task = createTask(mDisplayContent); final Task display1Task = createTask(otherDisplay); display0Task.setVisibleRequested(true); display1Task.setVisibleRequested(true); // Build target-list as-if originally task 0 was focused/front and then the user focused // task 1 (bringing it and display 1 to front). final ArrayList<Transition.ChangeInfo> sortedTargets = new ArrayList<>(); sortedTargets.add( new Transition.ChangeInfo(display1Task, true /* vis */, false /* exChg */)); sortedTargets.getLast().mFlags |= Transition.ChangeInfo.FLAG_CHANGE_MOVED_TO_TOP; sortedTargets.add( new Transition.ChangeInfo(otherDisplay, true /* vis */, false /* exChg */)); sortedTargets.getLast().mFlags |= Transition.ChangeInfo.FLAG_CHANGE_MOVED_TO_TOP; WindowContainer ancestor = Transition.findCommonAncestor(sortedTargets, display1Task); assertTrue(ancestor.isDescendantOf(otherDisplay.getParent())); } private void tryFinishTransitionSyncSet(Transition transition) { transition.setAllReady(); transition.start(); Loading