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

Commit 5b895b73 authored by Winson Chung's avatar Winson Chung
Browse files

Removing check preventing pinned stack tasks from matching by affinity.

- As of ag/1892768, we prefer matching non-affinity matching tasks,
  followed by affinity matching tasks as long as they are on the same
  display (priority from the bottom stack up). As a result, we don't need
  to exclude the pinned stack when attempting to match by affinity, as it
  can be used later when determining the match.

Bug: 37640324
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testLaunchTaskByComponentMatchMultipleTasks
Test: #testLaunchTaskByAffinityMatchMultipleTasks
Test: #testLaunchTaskByAffinityMatchSingleTask

Change-Id: Idfe797cd51bf827876f3f0ba8ea35e1f4fcd8655
parent 1c9e549c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -987,7 +987,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                result.matchedByRootAffinity = false;
                break;
            } else if (!isDocument && !taskIsDocument
                    && result.r == null && task.canMatchRootAffinity()) {
                    && result.r == null && task.rootAffinity != null) {
                if (task.rootAffinity.equals(target.taskAffinity)) {
                    if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Found matching affinity candidate!");
                    // It is possible for multiple tasks to have the same root affinity especially
+4 −0
Original line number Diff line number Diff line
@@ -3043,11 +3043,15 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                    if (!mTmpFindTaskResult.matchedByRootAffinity) {
                        return mTmpFindTaskResult.r;
                    } else if (mTmpFindTaskResult.r.getDisplayId() == displayId) {
                        // Note: since the traversing through the stacks is top down, the floating
                        // tasks should always have lower priority than any affinity-matching tasks
                        // in the fullscreen stacks
                        affinityMatch = mTmpFindTaskResult.r;
                    }
                }
            }
        }

        if (DEBUG_TASKS && affinityMatch == null) Slog.d(TAG_TASKS, "No task found");
        return affinityMatch;
    }
+0 −6
Original line number Diff line number Diff line
@@ -2229,12 +2229,6 @@ final class TaskRecord extends ConfigurationContainer implements TaskWindowConta
        return mLastNonFullscreenBounds;
    }

    boolean canMatchRootAffinity() {
        // We don't allow root affinity matching on the pinned stack as no other task should
        // be launching in it based on affinity.
        return rootAffinity != null && getStackId() != PINNED_STACK_ID;
    }

    void addStartingWindowsForVisibleActivities(boolean taskSwitch) {
        for (int activityNdx = mActivities.size() - 1; activityNdx >= 0; --activityNdx) {
            final ActivityRecord r = mActivities.get(activityNdx);