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
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 61d185f..a3252c5 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -3043,11 +3043,15 @@
                     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;
     }