Skip excluded MW mode tasks from recents and running tasks

- Skip multi-window mode tasks with the exclude-from-recents flag from
  the visible recent tasks list
- Expose a method in LauncherApps to be able to start a shortcut with
  additional intent flags (to add the exclude-from-recents flag)
- Remove unused ActMan path (only ActTaskMan call is used now)
- Refactor the call to get the running tasks, there are currently only
  two usages of getFilteredTasks(), one is to get all the tasks, the
  other is really to get tasks that we will end up using for transitioning
  into the task in recents.

  As such, we can remove the individual ignore flags (it would get more
  complicated if we wanted to filter based on logic like MW mode +
  excluded recents only), and instead have a boolean that filters the
  running tasks based on whether they would ever show in recents at all,
  with the exception of the home and recent tasks.

Bug: 152133859
Test: atest WmTests:RunningTasksTest
Test: atest WmTests:RecentTasksTest
Change-Id: Ia4f5fd37228c72ce449490f948e923afba821bb2
Signed-off-by: Winson Chung <winsonc@google.com>
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index a5b0026..bf92542 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -32,7 +32,6 @@
 import static android.app.ActivityTaskManager.INVALID_TASK_ID;
 import static android.app.ActivityTaskManager.RESIZE_MODE_PRESERVE_WINDOW;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
 import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
 import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
@@ -2615,13 +2614,16 @@
 
     @Override
     public List<ActivityManager.RunningTaskInfo> getTasks(int maxNum) {
-        return getFilteredTasks(maxNum, ACTIVITY_TYPE_UNDEFINED, WINDOWING_MODE_UNDEFINED);
+        return getFilteredTasks(maxNum, false /* filterForVisibleRecents */);
     }
 
+    /**
+     * @param filterOnlyVisibleRecents whether to filter the tasks based on whether they would ever
+     *                                 be visible in the recent task list in systemui
+     */
     @Override
     public List<ActivityManager.RunningTaskInfo> getFilteredTasks(int maxNum,
-            @WindowConfiguration.ActivityType int ignoreActivityType,
-            @WindowConfiguration.WindowingMode int ignoreWindowingMode) {
+            boolean filterOnlyVisibleRecents) {
         final int callingUid = Binder.getCallingUid();
         final int callingPid = Binder.getCallingPid();
         final boolean crossUser = isCrossUserAllowed(callingPid, callingUid);
@@ -2637,8 +2639,8 @@
             if (DEBUG_ALL) Slog.v(TAG, "getTasks: max=" + maxNum);
 
             final boolean allowed = isGetTasksAllowed("getTasks", callingPid, callingUid);
-            mRootWindowContainer.getRunningTasks(maxNum, list, ignoreActivityType,
-                    ignoreWindowingMode, callingUid, allowed, crossUser, callingProfileIds);
+            mRootWindowContainer.getRunningTasks(maxNum, list, filterOnlyVisibleRecents, callingUid,
+                    allowed, crossUser, callingProfileIds);
         }
 
         return list;