Loading core/java/android/window/TaskFragmentOperation.java +14 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,18 @@ public final class TaskFragmentOperation implements Parcelable { */ public static final int OP_TYPE_REORDER_TO_TOP_OF_TASK = 13; /** * Creates a decor surface in the parent Task of the TaskFragment. The created decor surface * will be provided in {@link TaskFragmentTransaction#TYPE_TASK_FRAGMENT_PARENT_INFO_CHANGED} * event callback. */ public static final int OP_TYPE_CREATE_TASK_FRAGMENT_DECOR_SURFACE = 14; /** * Removes the decor surface in the parent Task of the TaskFragment. */ public static final int OP_TYPE_REMOVE_TASK_FRAGMENT_DECOR_SURFACE = 15; @IntDef(prefix = { "OP_TYPE_" }, value = { OP_TYPE_UNKNOWN, OP_TYPE_CREATE_TASK_FRAGMENT, Loading @@ -124,6 +136,8 @@ public final class TaskFragmentOperation implements Parcelable { OP_TYPE_SET_ISOLATED_NAVIGATION, OP_TYPE_REORDER_TO_BOTTOM_OF_TASK, OP_TYPE_REORDER_TO_TOP_OF_TASK, OP_TYPE_CREATE_TASK_FRAGMENT_DECOR_SURFACE, OP_TYPE_REMOVE_TASK_FRAGMENT_DECOR_SURFACE, }) @Retention(RetentionPolicy.SOURCE) public @interface OperationType {} Loading core/java/android/window/TaskFragmentParentInfo.java +21 −3 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import android.app.WindowConfiguration; import android.content.res.Configuration; import android.os.Parcel; import android.os.Parcelable; import android.view.SurfaceControl; import java.util.Objects; /** * The information about the parent Task of a particular TaskFragment Loading @@ -37,12 +40,15 @@ public class TaskFragmentParentInfo implements Parcelable { private final boolean mHasDirectActivity; @Nullable private final SurfaceControl mDecorSurface; public TaskFragmentParentInfo(@NonNull Configuration configuration, int displayId, boolean visible, boolean hasDirectActivity) { boolean visible, boolean hasDirectActivity, @Nullable SurfaceControl decorSurface) { mConfiguration.setTo(configuration); mDisplayId = displayId; mVisible = visible; mHasDirectActivity = hasDirectActivity; mDecorSurface = decorSurface; } public TaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) { Loading @@ -50,6 +56,7 @@ public class TaskFragmentParentInfo implements Parcelable { mDisplayId = info.mDisplayId; mVisible = info.mVisible; mHasDirectActivity = info.mHasDirectActivity; mDecorSurface = info.mDecorSurface; } /** The {@link Configuration} of the parent Task */ Loading Loading @@ -92,7 +99,13 @@ public class TaskFragmentParentInfo implements Parcelable { return false; } return getWindowingMode() == that.getWindowingMode() && mDisplayId == that.mDisplayId && mVisible == that.mVisible && mHasDirectActivity == that.mHasDirectActivity; && mVisible == that.mVisible && mHasDirectActivity == that.mHasDirectActivity && mDecorSurface == that.mDecorSurface; } @Nullable public SurfaceControl getDecorSurface() { return mDecorSurface; } @WindowConfiguration.WindowingMode Loading @@ -107,6 +120,7 @@ public class TaskFragmentParentInfo implements Parcelable { + ", displayId=" + mDisplayId + ", visible=" + mVisible + ", hasDirectActivity=" + mHasDirectActivity + ", decorSurface=" + mDecorSurface + "}"; } Loading @@ -128,7 +142,8 @@ public class TaskFragmentParentInfo implements Parcelable { return mConfiguration.equals(that.mConfiguration) && mDisplayId == that.mDisplayId && mVisible == that.mVisible && mHasDirectActivity == that.mHasDirectActivity; && mHasDirectActivity == that.mHasDirectActivity && mDecorSurface == that.mDecorSurface; } @Override Loading @@ -137,6 +152,7 @@ public class TaskFragmentParentInfo implements Parcelable { result = 31 * result + mDisplayId; result = 31 * result + (mVisible ? 1 : 0); result = 31 * result + (mHasDirectActivity ? 1 : 0); result = 31 * result + Objects.hashCode(mDecorSurface); return result; } Loading @@ -146,6 +162,7 @@ public class TaskFragmentParentInfo implements Parcelable { dest.writeInt(mDisplayId); dest.writeBoolean(mVisible); dest.writeBoolean(mHasDirectActivity); dest.writeTypedObject(mDecorSurface, flags); } private TaskFragmentParentInfo(Parcel in) { Loading @@ -153,6 +170,7 @@ public class TaskFragmentParentInfo implements Parcelable { mDisplayId = in.readInt(); mVisible = in.readBoolean(); mHasDirectActivity = in.readBoolean(); mDecorSurface = in.readTypedObject(SurfaceControl.CREATOR); } public static final Creator<TaskFragmentParentInfo> CREATOR = Loading libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/OverlayPresentationTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -443,7 +443,8 @@ public class OverlayPresentationTest { assertThat(taskContainer.getTaskFragmentContainers()).containsExactly(overlayContainer); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(Configuration.EMPTY, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); mSplitController.updateOverlayContainer(mTransaction, overlayContainer); Loading libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/SplitControllerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -1139,7 +1139,8 @@ public class SplitControllerTest { public void testOnTransactionReady_taskFragmentParentInfoChanged() { final TaskFragmentTransaction transaction = new TaskFragmentTransaction(); final TaskFragmentParentInfo parentInfo = new TaskFragmentParentInfo(Configuration.EMPTY, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */); transaction.addChange(new TaskFragmentTransaction.Change( TYPE_TASK_FRAGMENT_PARENT_INFO_CHANGED) .setTaskId(TASK_ID) Loading libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/TaskContainerTest.java +8 −4 Original line number Diff line number Diff line Loading @@ -79,14 +79,16 @@ public class TaskContainerTest { configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FULLSCREEN); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(configuration, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); assertEquals(WINDOWING_MODE_MULTI_WINDOW, taskContainer.getWindowingModeForSplitTaskFragment(splitBounds)); configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(configuration, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); assertEquals(WINDOWING_MODE_FREEFORM, taskContainer.getWindowingModeForSplitTaskFragment(splitBounds)); Loading @@ -106,13 +108,15 @@ public class TaskContainerTest { configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FULLSCREEN); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(configuration, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); assertFalse(taskContainer.isInPictureInPicture()); configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_PINNED); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(configuration, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); assertTrue(taskContainer.isInPictureInPicture()); } Loading Loading
core/java/android/window/TaskFragmentOperation.java +14 −0 Original line number Diff line number Diff line Loading @@ -108,6 +108,18 @@ public final class TaskFragmentOperation implements Parcelable { */ public static final int OP_TYPE_REORDER_TO_TOP_OF_TASK = 13; /** * Creates a decor surface in the parent Task of the TaskFragment. The created decor surface * will be provided in {@link TaskFragmentTransaction#TYPE_TASK_FRAGMENT_PARENT_INFO_CHANGED} * event callback. */ public static final int OP_TYPE_CREATE_TASK_FRAGMENT_DECOR_SURFACE = 14; /** * Removes the decor surface in the parent Task of the TaskFragment. */ public static final int OP_TYPE_REMOVE_TASK_FRAGMENT_DECOR_SURFACE = 15; @IntDef(prefix = { "OP_TYPE_" }, value = { OP_TYPE_UNKNOWN, OP_TYPE_CREATE_TASK_FRAGMENT, Loading @@ -124,6 +136,8 @@ public final class TaskFragmentOperation implements Parcelable { OP_TYPE_SET_ISOLATED_NAVIGATION, OP_TYPE_REORDER_TO_BOTTOM_OF_TASK, OP_TYPE_REORDER_TO_TOP_OF_TASK, OP_TYPE_CREATE_TASK_FRAGMENT_DECOR_SURFACE, OP_TYPE_REMOVE_TASK_FRAGMENT_DECOR_SURFACE, }) @Retention(RetentionPolicy.SOURCE) public @interface OperationType {} Loading
core/java/android/window/TaskFragmentParentInfo.java +21 −3 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import android.app.WindowConfiguration; import android.content.res.Configuration; import android.os.Parcel; import android.os.Parcelable; import android.view.SurfaceControl; import java.util.Objects; /** * The information about the parent Task of a particular TaskFragment Loading @@ -37,12 +40,15 @@ public class TaskFragmentParentInfo implements Parcelable { private final boolean mHasDirectActivity; @Nullable private final SurfaceControl mDecorSurface; public TaskFragmentParentInfo(@NonNull Configuration configuration, int displayId, boolean visible, boolean hasDirectActivity) { boolean visible, boolean hasDirectActivity, @Nullable SurfaceControl decorSurface) { mConfiguration.setTo(configuration); mDisplayId = displayId; mVisible = visible; mHasDirectActivity = hasDirectActivity; mDecorSurface = decorSurface; } public TaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) { Loading @@ -50,6 +56,7 @@ public class TaskFragmentParentInfo implements Parcelable { mDisplayId = info.mDisplayId; mVisible = info.mVisible; mHasDirectActivity = info.mHasDirectActivity; mDecorSurface = info.mDecorSurface; } /** The {@link Configuration} of the parent Task */ Loading Loading @@ -92,7 +99,13 @@ public class TaskFragmentParentInfo implements Parcelable { return false; } return getWindowingMode() == that.getWindowingMode() && mDisplayId == that.mDisplayId && mVisible == that.mVisible && mHasDirectActivity == that.mHasDirectActivity; && mVisible == that.mVisible && mHasDirectActivity == that.mHasDirectActivity && mDecorSurface == that.mDecorSurface; } @Nullable public SurfaceControl getDecorSurface() { return mDecorSurface; } @WindowConfiguration.WindowingMode Loading @@ -107,6 +120,7 @@ public class TaskFragmentParentInfo implements Parcelable { + ", displayId=" + mDisplayId + ", visible=" + mVisible + ", hasDirectActivity=" + mHasDirectActivity + ", decorSurface=" + mDecorSurface + "}"; } Loading @@ -128,7 +142,8 @@ public class TaskFragmentParentInfo implements Parcelable { return mConfiguration.equals(that.mConfiguration) && mDisplayId == that.mDisplayId && mVisible == that.mVisible && mHasDirectActivity == that.mHasDirectActivity; && mHasDirectActivity == that.mHasDirectActivity && mDecorSurface == that.mDecorSurface; } @Override Loading @@ -137,6 +152,7 @@ public class TaskFragmentParentInfo implements Parcelable { result = 31 * result + mDisplayId; result = 31 * result + (mVisible ? 1 : 0); result = 31 * result + (mHasDirectActivity ? 1 : 0); result = 31 * result + Objects.hashCode(mDecorSurface); return result; } Loading @@ -146,6 +162,7 @@ public class TaskFragmentParentInfo implements Parcelable { dest.writeInt(mDisplayId); dest.writeBoolean(mVisible); dest.writeBoolean(mHasDirectActivity); dest.writeTypedObject(mDecorSurface, flags); } private TaskFragmentParentInfo(Parcel in) { Loading @@ -153,6 +170,7 @@ public class TaskFragmentParentInfo implements Parcelable { mDisplayId = in.readInt(); mVisible = in.readBoolean(); mHasDirectActivity = in.readBoolean(); mDecorSurface = in.readTypedObject(SurfaceControl.CREATOR); } public static final Creator<TaskFragmentParentInfo> CREATOR = Loading
libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/OverlayPresentationTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -443,7 +443,8 @@ public class OverlayPresentationTest { assertThat(taskContainer.getTaskFragmentContainers()).containsExactly(overlayContainer); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(Configuration.EMPTY, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); mSplitController.updateOverlayContainer(mTransaction, overlayContainer); Loading
libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/SplitControllerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -1139,7 +1139,8 @@ public class SplitControllerTest { public void testOnTransactionReady_taskFragmentParentInfoChanged() { final TaskFragmentTransaction transaction = new TaskFragmentTransaction(); final TaskFragmentParentInfo parentInfo = new TaskFragmentParentInfo(Configuration.EMPTY, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */); transaction.addChange(new TaskFragmentTransaction.Change( TYPE_TASK_FRAGMENT_PARENT_INFO_CHANGED) .setTaskId(TASK_ID) Loading
libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/embedding/TaskContainerTest.java +8 −4 Original line number Diff line number Diff line Loading @@ -79,14 +79,16 @@ public class TaskContainerTest { configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FULLSCREEN); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(configuration, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); assertEquals(WINDOWING_MODE_MULTI_WINDOW, taskContainer.getWindowingModeForSplitTaskFragment(splitBounds)); configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(configuration, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); assertEquals(WINDOWING_MODE_FREEFORM, taskContainer.getWindowingModeForSplitTaskFragment(splitBounds)); Loading @@ -106,13 +108,15 @@ public class TaskContainerTest { configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FULLSCREEN); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(configuration, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); assertFalse(taskContainer.isInPictureInPicture()); configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_PINNED); taskContainer.updateTaskFragmentParentInfo(new TaskFragmentParentInfo(configuration, DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */)); DEFAULT_DISPLAY, true /* visible */, false /* hasDirectActivity */, null /* decorSurface */)); assertTrue(taskContainer.isInPictureInPicture()); } Loading