Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java +5 −5 Original line number Diff line number Diff line Loading @@ -855,7 +855,9 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen if (!parentInfo.isVisible()) { // Only making the TaskContainer invisible and drops the other info, and perform the // update when the next time the Task becomes visible. taskContainer.setIsVisible(false); if (taskContainer.isVisible()) { taskContainer.setInvisible(); } return; } Loading Loading @@ -3228,11 +3230,9 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen @NonNull WindowContainerTransaction wct, @NonNull TaskContainer taskContainer) { final DividerPresenter dividerPresenter = mDividerPresenters.get(taskContainer.getTaskId()); final TaskFragmentParentInfo parentInfo = taskContainer.getTaskFragmentParentInfo(); if (parentInfo != null) { dividerPresenter.updateDivider( wct, parentInfo, taskContainer.getTopNonFinishingSplitContainer()); } } @Override public void onStartDragging(@NonNull Consumer<WindowContainerTransaction> action) { Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java +24 −35 Original line number Diff line number Diff line Loading @@ -78,16 +78,7 @@ class TaskContainer { private TaskFragmentContainer mAlwaysOnTopOverlayContainer; @NonNull private final Configuration mConfiguration; private int mDisplayId; private boolean mIsVisible; private boolean mHasDirectActivity; @Nullable private TaskFragmentParentInfo mTaskFragmentParentInfo; private TaskFragmentParentInfo mInfo; /** * TaskFragments that the organizer has requested to be closed. They should be removed when Loading Loading @@ -131,12 +122,14 @@ class TaskContainer { mTaskId = taskId; final TaskProperties taskProperties = TaskProperties .getTaskPropertiesFromActivity(activityInTask); mConfiguration = taskProperties.getConfiguration(); mDisplayId = taskProperties.getDisplayId(); // Note that it is always called when there's a new Activity is started, which implies // the host task is visible and has an activity in the task. mIsVisible = true; mHasDirectActivity = true; mInfo = new TaskFragmentParentInfo( taskProperties.getConfiguration(), taskProperties.getDisplayId(), // Note that it is always called when there's a new Activity is started, which // implies the host task is visible and has an activity in the task. true /* visible */, true /* hasDirectActivity */, null /* decorSurface */); } int getTaskId() { Loading @@ -144,43 +137,39 @@ class TaskContainer { } int getDisplayId() { return mDisplayId; return mInfo.getDisplayId(); } boolean isVisible() { return mIsVisible; return mInfo.isVisible(); } void setIsVisible(boolean visible) { mIsVisible = visible; void setInvisible() { mInfo = new TaskFragmentParentInfo(mInfo.getConfiguration(), mInfo.getDisplayId(), false /* visible */, mInfo.hasDirectActivity(), mInfo.getDecorSurface()); } boolean hasDirectActivity() { return mHasDirectActivity; return mInfo.hasDirectActivity(); } @NonNull Rect getBounds() { return mConfiguration.windowConfiguration.getBounds(); return mInfo.getConfiguration().windowConfiguration.getBounds(); } @NonNull TaskProperties getTaskProperties() { return new TaskProperties(mDisplayId, mConfiguration); return new TaskProperties(mInfo.getDisplayId(), mInfo.getConfiguration()); } void updateTaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) { // TODO(b/293654166): cache the TaskFragmentParentInfo and remove these fields. mConfiguration.setTo(info.getConfiguration()); mDisplayId = info.getDisplayId(); mIsVisible = info.isVisible(); mHasDirectActivity = info.hasDirectActivity(); mTaskFragmentParentInfo = info; mInfo = info; } @Nullable @NonNull TaskFragmentParentInfo getTaskFragmentParentInfo() { return mTaskFragmentParentInfo; return mInfo; } /** Loading @@ -196,8 +185,8 @@ class TaskContainer { // If the task properties equals regardless of starting position, don't // need to update the container. return mConfiguration.diffPublicOnly(configuration) != 0 || mDisplayId != info.getDisplayId(); return mInfo.getConfiguration().diffPublicOnly(configuration) != 0 || mInfo.getDisplayId() != info.getDisplayId(); } /** Loading @@ -224,7 +213,7 @@ class TaskContainer { } boolean isInPictureInPicture() { return isInPictureInPicture(mConfiguration); return isInPictureInPicture(mInfo.getConfiguration()); } private static boolean isInPictureInPicture(@NonNull Configuration configuration) { Loading @@ -237,7 +226,7 @@ class TaskContainer { @WindowingMode private int getWindowingMode() { return mConfiguration.windowConfiguration.getWindowingMode(); return mInfo.getConfiguration().windowConfiguration.getWindowingMode(); } /** Whether there is any {@link TaskFragmentContainer} below this Task. */ Loading services/tests/wmtests/src/com/android/server/wm/TaskFragmentOrganizerControllerTest.java +0 −7 Original line number Diff line number Diff line Loading @@ -1894,11 +1894,7 @@ public class TaskFragmentOrganizerControllerTest extends WindowTestsBase { public void testApplyTransaction_createTaskFragmentDecorSurface() { mSetFlagsRule.enableFlags(Flags.FLAG_TASK_FRAGMENT_SYSTEM_ORGANIZER_FLAG); // TODO(b/293654166) remove system organizer requirement once security review is cleared. mController.unregisterOrganizer(mIOrganizer); registerTaskFragmentOrganizer(mIOrganizer, true /* isSystemOrganizer */); final Task task = createTask(mDisplayContent); final TaskFragment tf = createTaskFragment(task); final TaskFragmentOperation operation = new TaskFragmentOperation.Builder( OP_TYPE_CREATE_OR_MOVE_TASK_FRAGMENT_DECOR_SURFACE).build(); Loading @@ -1913,9 +1909,6 @@ public class TaskFragmentOrganizerControllerTest extends WindowTestsBase { public void testApplyTransaction_removeTaskFragmentDecorSurface() { mSetFlagsRule.enableFlags(Flags.FLAG_TASK_FRAGMENT_SYSTEM_ORGANIZER_FLAG); // TODO(b/293654166) remove system organizer requirement once security review is cleared. mController.unregisterOrganizer(mIOrganizer); registerTaskFragmentOrganizer(mIOrganizer, true /* isSystemOrganizer */); final Task task = createTask(mDisplayContent); final TaskFragment tf = createTaskFragment(task); Loading Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java +5 −5 Original line number Diff line number Diff line Loading @@ -855,7 +855,9 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen if (!parentInfo.isVisible()) { // Only making the TaskContainer invisible and drops the other info, and perform the // update when the next time the Task becomes visible. taskContainer.setIsVisible(false); if (taskContainer.isVisible()) { taskContainer.setInvisible(); } return; } Loading Loading @@ -3228,11 +3230,9 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen @NonNull WindowContainerTransaction wct, @NonNull TaskContainer taskContainer) { final DividerPresenter dividerPresenter = mDividerPresenters.get(taskContainer.getTaskId()); final TaskFragmentParentInfo parentInfo = taskContainer.getTaskFragmentParentInfo(); if (parentInfo != null) { dividerPresenter.updateDivider( wct, parentInfo, taskContainer.getTopNonFinishingSplitContainer()); } } @Override public void onStartDragging(@NonNull Consumer<WindowContainerTransaction> action) { Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskContainer.java +24 −35 Original line number Diff line number Diff line Loading @@ -78,16 +78,7 @@ class TaskContainer { private TaskFragmentContainer mAlwaysOnTopOverlayContainer; @NonNull private final Configuration mConfiguration; private int mDisplayId; private boolean mIsVisible; private boolean mHasDirectActivity; @Nullable private TaskFragmentParentInfo mTaskFragmentParentInfo; private TaskFragmentParentInfo mInfo; /** * TaskFragments that the organizer has requested to be closed. They should be removed when Loading Loading @@ -131,12 +122,14 @@ class TaskContainer { mTaskId = taskId; final TaskProperties taskProperties = TaskProperties .getTaskPropertiesFromActivity(activityInTask); mConfiguration = taskProperties.getConfiguration(); mDisplayId = taskProperties.getDisplayId(); // Note that it is always called when there's a new Activity is started, which implies // the host task is visible and has an activity in the task. mIsVisible = true; mHasDirectActivity = true; mInfo = new TaskFragmentParentInfo( taskProperties.getConfiguration(), taskProperties.getDisplayId(), // Note that it is always called when there's a new Activity is started, which // implies the host task is visible and has an activity in the task. true /* visible */, true /* hasDirectActivity */, null /* decorSurface */); } int getTaskId() { Loading @@ -144,43 +137,39 @@ class TaskContainer { } int getDisplayId() { return mDisplayId; return mInfo.getDisplayId(); } boolean isVisible() { return mIsVisible; return mInfo.isVisible(); } void setIsVisible(boolean visible) { mIsVisible = visible; void setInvisible() { mInfo = new TaskFragmentParentInfo(mInfo.getConfiguration(), mInfo.getDisplayId(), false /* visible */, mInfo.hasDirectActivity(), mInfo.getDecorSurface()); } boolean hasDirectActivity() { return mHasDirectActivity; return mInfo.hasDirectActivity(); } @NonNull Rect getBounds() { return mConfiguration.windowConfiguration.getBounds(); return mInfo.getConfiguration().windowConfiguration.getBounds(); } @NonNull TaskProperties getTaskProperties() { return new TaskProperties(mDisplayId, mConfiguration); return new TaskProperties(mInfo.getDisplayId(), mInfo.getConfiguration()); } void updateTaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) { // TODO(b/293654166): cache the TaskFragmentParentInfo and remove these fields. mConfiguration.setTo(info.getConfiguration()); mDisplayId = info.getDisplayId(); mIsVisible = info.isVisible(); mHasDirectActivity = info.hasDirectActivity(); mTaskFragmentParentInfo = info; mInfo = info; } @Nullable @NonNull TaskFragmentParentInfo getTaskFragmentParentInfo() { return mTaskFragmentParentInfo; return mInfo; } /** Loading @@ -196,8 +185,8 @@ class TaskContainer { // If the task properties equals regardless of starting position, don't // need to update the container. return mConfiguration.diffPublicOnly(configuration) != 0 || mDisplayId != info.getDisplayId(); return mInfo.getConfiguration().diffPublicOnly(configuration) != 0 || mInfo.getDisplayId() != info.getDisplayId(); } /** Loading @@ -224,7 +213,7 @@ class TaskContainer { } boolean isInPictureInPicture() { return isInPictureInPicture(mConfiguration); return isInPictureInPicture(mInfo.getConfiguration()); } private static boolean isInPictureInPicture(@NonNull Configuration configuration) { Loading @@ -237,7 +226,7 @@ class TaskContainer { @WindowingMode private int getWindowingMode() { return mConfiguration.windowConfiguration.getWindowingMode(); return mInfo.getConfiguration().windowConfiguration.getWindowingMode(); } /** Whether there is any {@link TaskFragmentContainer} below this Task. */ Loading
services/tests/wmtests/src/com/android/server/wm/TaskFragmentOrganizerControllerTest.java +0 −7 Original line number Diff line number Diff line Loading @@ -1894,11 +1894,7 @@ public class TaskFragmentOrganizerControllerTest extends WindowTestsBase { public void testApplyTransaction_createTaskFragmentDecorSurface() { mSetFlagsRule.enableFlags(Flags.FLAG_TASK_FRAGMENT_SYSTEM_ORGANIZER_FLAG); // TODO(b/293654166) remove system organizer requirement once security review is cleared. mController.unregisterOrganizer(mIOrganizer); registerTaskFragmentOrganizer(mIOrganizer, true /* isSystemOrganizer */); final Task task = createTask(mDisplayContent); final TaskFragment tf = createTaskFragment(task); final TaskFragmentOperation operation = new TaskFragmentOperation.Builder( OP_TYPE_CREATE_OR_MOVE_TASK_FRAGMENT_DECOR_SURFACE).build(); Loading @@ -1913,9 +1909,6 @@ public class TaskFragmentOrganizerControllerTest extends WindowTestsBase { public void testApplyTransaction_removeTaskFragmentDecorSurface() { mSetFlagsRule.enableFlags(Flags.FLAG_TASK_FRAGMENT_SYSTEM_ORGANIZER_FLAG); // TODO(b/293654166) remove system organizer requirement once security review is cleared. mController.unregisterOrganizer(mIOrganizer); registerTaskFragmentOrganizer(mIOrganizer, true /* isSystemOrganizer */); final Task task = createTask(mDisplayContent); final TaskFragment tf = createTaskFragment(task); Loading