Do not send split info update when TaskFragmentContainer
...in a split has no activities If a TaskFragmentContainer in a SplitContainer has no activities, then that means that either the entire split is going to be removed or the empty TaskFragmentContainer is about to get a running activity. This CL prevents a split info update from sent in this case because the info will soon be stale by another update. Bug: b/204193051 Test: atest CtsWindowManagerJetpackTestCases:ActivityEmbeddingLaunchTests Change-Id: I4b6f684b8d8e9a9b3fefd54b399d8a7d83c6cfb0
This commit is contained in:
@@ -497,7 +497,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
||||
return;
|
||||
}
|
||||
List<SplitInfo> currentSplitStates = getActiveSplitStates();
|
||||
if (mLastReportedSplitStates.equals(currentSplitStates)) {
|
||||
if (currentSplitStates == null || mLastReportedSplitStates.equals(currentSplitStates)) {
|
||||
return;
|
||||
}
|
||||
mLastReportedSplitStates.clear();
|
||||
@@ -506,15 +506,19 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of descriptors for currently active split states.
|
||||
* @return a list of descriptors for currently active split states. If the value returned is
|
||||
* null, that indicates that the active split states are in an intermediate state and should
|
||||
* not be reported.
|
||||
*/
|
||||
@Nullable
|
||||
private List<SplitInfo> getActiveSplitStates() {
|
||||
List<SplitInfo> splitStates = new ArrayList<>();
|
||||
for (SplitContainer container : mSplitContainers) {
|
||||
if (container.getPrimaryContainer().isEmpty()
|
||||
|| container.getSecondaryContainer().isEmpty()) {
|
||||
// Skipping containers that do not have any activities to report.
|
||||
continue;
|
||||
// We are in an intermediate state because either the split container is about to be
|
||||
// removed or the primary or secondary container are about to receive an activity.
|
||||
return null;
|
||||
}
|
||||
ActivityStack primaryContainer = container.getPrimaryContainer().toActivityStack();
|
||||
ActivityStack secondaryContainer = container.getSecondaryContainer().toActivityStack();
|
||||
|
||||
Reference in New Issue
Block a user