diff options
| author | Chris Li <lihongyu@google.com> | 2021-07-20 15:08:22 -0700 |
|---|---|---|
| committer | Chris Li <lihongyu@google.com> | 2021-07-23 14:03:52 -0700 |
| commit | 99b93b7dfa5b55a3d9ee48a5f9b21302dc7b9d5c (patch) | |
| tree | 7c9c9ee9740ebc4ac1e4787ecb9eb82cddd3c6d5 /core/java/android/window/WindowContainerTransaction.java | |
| parent | c9d779caa3863cb929992441d105712531e135ad (diff) | |
Add WCT#setAdjacentTaskFragments
Similar to WCT#setAdjacentRoots, but can be called with fragmentTokens
in case the TaskFragments may not be created yet.
Bug: 190433129
Change-Id: I41dd515fb9722ea6e95d0c3fb040cc0d196ad78d
Test: atest WmTests:TaskFragmentOrganizerControllerTest
Diffstat (limited to 'core/java/android/window/WindowContainerTransaction.java')
| -rw-r--r-- | core/java/android/window/WindowContainerTransaction.java | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/core/java/android/window/WindowContainerTransaction.java b/core/java/android/window/WindowContainerTransaction.java index 095be8c00419..380032b83db6 100644 --- a/core/java/android/window/WindowContainerTransaction.java +++ b/core/java/android/window/WindowContainerTransaction.java @@ -442,7 +442,7 @@ public final class WindowContainerTransaction implements Parcelable { /** * Starts an activity in the TaskFragment. * @param fragmentToken client assigned unique token to create TaskFragment with specified in - * {@link TaskFragmentCreationParams#fragmentToken}. + * {@link TaskFragmentCreationParams#getFragmentToken()}. * @param callerToken the activity token that initialized the activity launch. * @param activityIntent intent to start the activity. * @param activityOptions ActivityOptions to start the activity with. @@ -468,7 +468,7 @@ public final class WindowContainerTransaction implements Parcelable { /** * Moves an activity into the TaskFragment. * @param fragmentToken client assigned unique token to create TaskFragment with specified in - * {@link TaskFragmentCreationParams#fragmentToken}. + * {@link TaskFragmentCreationParams#getFragmentToken()}. * @param activityToken activity to be reparented. * @hide */ @@ -506,6 +506,30 @@ public final class WindowContainerTransaction implements Parcelable { } /** + * Sets to TaskFragments adjacent to each other. Containers below two visible adjacent + * TaskFragments will be made invisible. This is similar to + * {@link #setAdjacentRoots(WindowContainerToken, WindowContainerToken)}, but can be used with + * fragmentTokens when that TaskFragments haven't been created (but will be created in the same + * {@link WindowContainerTransaction}). + * @param fragmentToken1 client assigned unique token to create TaskFragment with specified + * in {@link TaskFragmentCreationParams#getFragmentToken()}. + * @param fragmentToken2 client assigned unique token to create TaskFragment with specified + * in {@link TaskFragmentCreationParams#getFragmentToken()}. + * @hide + */ + @NonNull + public WindowContainerTransaction setAdjacentTaskFragments( + @NonNull IBinder fragmentToken1, @NonNull IBinder fragmentToken2) { + final HierarchyOp hierarchyOp = + new HierarchyOp.Builder(HierarchyOp.HIERARCHY_OP_TYPE_SET_ADJACENT_TASK_FRAGMENTS) + .setContainer(fragmentToken1) + .setReparentContainer(fragmentToken2) + .build(); + mHierarchyOps.add(hierarchyOp); + return this; + } + + /** * When this {@link WindowContainerTransaction} failed to finish on the server side, it will * trigger callback with this {@param errorCallbackToken}. * @param errorCallbackToken client provided token that will be passed back as parameter in @@ -908,6 +932,7 @@ public final class WindowContainerTransaction implements Parcelable { public static final int HIERARCHY_OP_TYPE_REPARENT_ACTIVITY_TO_TASK_FRAGMENT = 10; public static final int HIERARCHY_OP_TYPE_REPARENT_CHILDREN = 11; public static final int HIERARCHY_OP_TYPE_PENDING_INTENT = 12; + public static final int HIERARCHY_OP_TYPE_SET_ADJACENT_TASK_FRAGMENTS = 13; // The following key(s) are for use with mLaunchOptions: // When launching a task (eg. from recents), this is the taskId to be launched. @@ -1136,6 +1161,9 @@ public final class WindowContainerTransaction implements Parcelable { case HIERARCHY_OP_TYPE_REPARENT_CHILDREN: return "{ReparentChildren: oldParent=" + mContainer + " newParent=" + mReparent + "}"; + case HIERARCHY_OP_TYPE_SET_ADJACENT_TASK_FRAGMENTS: + return "{SetAdjacentTaskFragments: container=" + mContainer + + " adjacentContainer=" + mReparent + "}"; default: return "{mType=" + mType + " container=" + mContainer + " reparent=" + mReparent + " mToTop=" + mToTop + " mWindowingMode=" + mWindowingModes |
