Merge "Fix the same active time tasks disappeared on RunngintTasks" am: e55bd1600f

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

Change-Id: Ia42e95fc32765a6163ddbef0da0648764ead6a1b
This commit is contained in:
William McVicker
2022-03-10 00:51:45 +00:00
committed by Automerger Merge Worker

View File

@@ -43,7 +43,11 @@ class RunningTasks {
// Comparator to sort by last active time (descending) // Comparator to sort by last active time (descending)
private static final Comparator<Task> LAST_ACTIVE_TIME_COMPARATOR = private static final Comparator<Task> LAST_ACTIVE_TIME_COMPARATOR =
(o1, o2) -> Long.signum(o2.lastActiveTime - o1.lastActiveTime); (o1, o2) -> {
return o1.lastActiveTime == o2.lastActiveTime
? Integer.signum(o2.mTaskId - o1.mTaskId) :
Long.signum(o2.lastActiveTime - o1.lastActiveTime);
};
private final TreeSet<Task> mTmpSortedSet = new TreeSet<>(LAST_ACTIVE_TIME_COMPARATOR); private final TreeSet<Task> mTmpSortedSet = new TreeSet<>(LAST_ACTIVE_TIME_COMPARATOR);