Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32a8335c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent reiterating over same stack tasks when calculating running tasks"

parents 3cee66e1 d2199604
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -54,19 +54,17 @@ class RunningTasks {

        // Gather all of the tasks across all of the tasks, and add them to the sorted set
        mTmpSortedSet.clear();
        mTmpStackTasks.clear();
        final int numDisplays = activityDisplays.size();
        for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
            final ActivityDisplay display = activityDisplays.valueAt(displayNdx);
            for (int stackNdx = display.getChildCount() - 1; stackNdx >= 0; --stackNdx) {
                final ActivityStack stack = display.getChildAt(stackNdx);
                mTmpStackTasks.clear();
                stack.getRunningTasks(mTmpStackTasks, ignoreActivityType, ignoreWindowingMode,
                        callingUid, allowed);
                for (int i = mTmpStackTasks.size() - 1; i >= 0; i--) {
                mTmpSortedSet.addAll(mTmpStackTasks);
            }
        }
        }

        // Take the first {@param maxNum} tasks and create running task infos for them
        final Iterator<TaskRecord> iter = mTmpSortedSet.iterator();
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ import org.junit.runner.RunWith;
import java.util.ArrayList;

/**
 * runtest --path frameworks/base/services/tests/servicestests/src/com/android/server/am/RunningTasksTest.java
 * atest FrameworksServicesTests:RunningTasksTest
 */
@MediumTest
@Presubmit