Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitController.java +34 −1 Original line number Diff line number Diff line Loading @@ -149,6 +149,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen * Checks if the activity start should be routed to a particular container. It can create a new * container for the activity and a new split container if necessary. */ // TODO(b/190433398): Break down into smaller functions. void onActivityCreated(@NonNull Activity launchedActivity) { final ComponentName componentName = launchedActivity.getComponentName(); Loading Loading @@ -202,6 +203,18 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen return; } // Check if the split is already set. final TaskFragmentContainer activityBelowContainer = getContainerWithActivity( activityBelow.getActivityToken()); if (currentContainer != null && activityBelowContainer != null) { final SplitContainer existingSplit = getActiveSplitForContainers(currentContainer, activityBelowContainer); if (existingSplit != null) { // There is already an active split with the activity below. return; } } final ExtensionSplitPairRule splitPairRule = getSplitRule( activityBelow.getComponentName(), componentName, splitRules); if (splitPairRule == null) { Loading Loading @@ -339,7 +352,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen } /** * Returns the top active split container that has the provided container. * Returns the top active split container that has the provided container, if available. */ @Nullable private SplitContainer getActiveSplitForContainer(@NonNull TaskFragmentContainer container) { Loading @@ -353,6 +366,26 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen return null; } /** * Returns the active split that has the provided containers as primary and secondary or as * secondary and primary, if available. */ @Nullable private SplitContainer getActiveSplitForContainers( @NonNull TaskFragmentContainer firstContainer, @NonNull TaskFragmentContainer secondContainer) { for (int i = mSplitContainers.size() - 1; i >= 0; i--) { SplitContainer splitContainer = mSplitContainers.get(i); final TaskFragmentContainer primary = splitContainer.getPrimaryContainer(); final TaskFragmentContainer secondary = splitContainer.getSecondaryContainer(); if ((firstContainer == secondary && secondContainer == primary) || (firstContainer == primary && secondContainer == secondary)) { return splitContainer; } } return null; } /** * Checks if the container requires a placeholder and launches it if necessary. */ Loading Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/organizer/SplitController.java +34 −1 Original line number Diff line number Diff line Loading @@ -149,6 +149,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen * Checks if the activity start should be routed to a particular container. It can create a new * container for the activity and a new split container if necessary. */ // TODO(b/190433398): Break down into smaller functions. void onActivityCreated(@NonNull Activity launchedActivity) { final ComponentName componentName = launchedActivity.getComponentName(); Loading Loading @@ -202,6 +203,18 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen return; } // Check if the split is already set. final TaskFragmentContainer activityBelowContainer = getContainerWithActivity( activityBelow.getActivityToken()); if (currentContainer != null && activityBelowContainer != null) { final SplitContainer existingSplit = getActiveSplitForContainers(currentContainer, activityBelowContainer); if (existingSplit != null) { // There is already an active split with the activity below. return; } } final ExtensionSplitPairRule splitPairRule = getSplitRule( activityBelow.getComponentName(), componentName, splitRules); if (splitPairRule == null) { Loading Loading @@ -339,7 +352,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen } /** * Returns the top active split container that has the provided container. * Returns the top active split container that has the provided container, if available. */ @Nullable private SplitContainer getActiveSplitForContainer(@NonNull TaskFragmentContainer container) { Loading @@ -353,6 +366,26 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen return null; } /** * Returns the active split that has the provided containers as primary and secondary or as * secondary and primary, if available. */ @Nullable private SplitContainer getActiveSplitForContainers( @NonNull TaskFragmentContainer firstContainer, @NonNull TaskFragmentContainer secondContainer) { for (int i = mSplitContainers.size() - 1; i >= 0; i--) { SplitContainer splitContainer = mSplitContainers.get(i); final TaskFragmentContainer primary = splitContainer.getPrimaryContainer(); final TaskFragmentContainer secondary = splitContainer.getSecondaryContainer(); if ((firstContainer == secondary && secondContainer == primary) || (firstContainer == primary && secondContainer == secondary)) { return splitContainer; } } return null; } /** * Checks if the container requires a placeholder and launches it if necessary. */ Loading