Prevent trimming recent tasks belonging in different stacks.

- When launching an adjacent task, we usually have the same activity
  not necessarily launched with MULTIPLE_TASK, so the old recent task
  is incorrectly found removed.

Bug: 29121819
Change-Id: Id3bbafe0d3c535fd1a05bb373e521345c18f43d5
diff --git a/services/core/java/com/android/server/am/RecentTasks.java b/services/core/java/com/android/server/am/RecentTasks.java
index cea76f2..ab5d4b6 100644
--- a/services/core/java/com/android/server/am/RecentTasks.java
+++ b/services/core/java/com/android/server/am/RecentTasks.java
@@ -621,6 +621,9 @@
         for (int i = 0; i < recentsCount; i++) {
             final TaskRecord tr = get(i);
             if (task != tr) {
+                if (task.stack != tr.stack) {
+                    continue;
+                }
                 if (task.userId != tr.userId) {
                     continue;
                 }