Reset adjacent TaskFragments while updating split container

The TaskFragments were set to adjacent only when registering
a new split container.

It should also be done while updating the split container, like
when the user navigated back and a TaskFragment was removed.

Bug: 200504061
Test: repo steps on the bug
Change-Id: I432662fd098c98d96f8b2fd5fc4277f77be430d7
This commit is contained in:
Louis Chang
2021-09-29 17:03:23 +08:00
parent 125ff5d696
commit 8e0d7c8616

View File

@@ -252,7 +252,8 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer {
// Getting the parent bounds using the updated container - it will have the recent value.
final Rect parentBounds = getParentContainerBounds(updatedContainer);
final SplitRule rule = splitContainer.getSplitRule();
final Activity activity = splitContainer.getPrimaryContainer().getTopNonFinishingActivity();
final TaskFragmentContainer primaryContainer = splitContainer.getPrimaryContainer();
final Activity activity = primaryContainer.getTopNonFinishingActivity();
if (activity == null) {
return;
}
@@ -264,10 +265,12 @@ class SplitPresenter extends JetpackTaskFragmentOrganizer {
// If the task fragments are not registered yet, the positions will be updated after they
// are created again.
resizeTaskFragmentIfRegistered(wct, splitContainer.getPrimaryContainer(),
primaryRectBounds);
resizeTaskFragmentIfRegistered(wct, splitContainer.getSecondaryContainer(),
secondaryRectBounds);
resizeTaskFragmentIfRegistered(wct, primaryContainer, primaryRectBounds);
final TaskFragmentContainer secondaryContainer = splitContainer.getSecondaryContainer();
resizeTaskFragmentIfRegistered(wct, secondaryContainer, secondaryRectBounds);
setAdjacentTaskFragments(wct, primaryContainer.getTaskFragmentToken(),
secondaryContainer.getTaskFragmentToken(), rule);
}
/**