Do not send split info update when TaskFragmentContainer am: 5cb70ee9d4 am: 1f83ba9a7a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16144437

Change-Id: Id2905e9d5dd0c1064c08ff6884dd9e31d1f6e17e
This commit is contained in:
Shivam Agrawal
2021-11-10 03:56:24 +00:00
committed by Automerger Merge Worker

View File

@@ -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();