OSDN Git Service

Hiding the docked task from the stack.
authorWinson <winsonc@google.com>
Mon, 23 Nov 2015 17:15:08 +0000 (09:15 -0800)
committerWinson Chung <winsonc@google.com>
Tue, 24 Nov 2015 01:00:46 +0000 (01:00 +0000)
Bug: 25665312

Change-Id: I1e0deb8c3b02604ce4f21d367430d50da9d3b86b

packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java

index 03d5cf1..5026c79 100644 (file)
@@ -342,6 +342,13 @@ public class SystemServicesProxy {
     }
 
     /**
+     * Returns whether the given stack id is the docked stack id.
+     */
+    public static boolean isDockedStack(int stackId) {
+        return stackId == DOCKED_STACK_ID;
+    }
+
+    /**
      * Returns whether the given stack id is the freeform workspace stack id.
      */
     public static boolean isFreeformStack(int stackId) {
index 0e98f87..0970252 100644 (file)
@@ -74,18 +74,17 @@ class FilteredTaskList {
         if (!prevFilteredTasks.equals(mFilteredTasks)) {
             return true;
         } else {
-            // If the tasks are exactly the same pre/post filter, then just reset it
-            mFilter = null;
             return false;
         }
     }
 
-    /** Resets this FilteredTaskList. */
+    /**
+     * Resets the task list, but does not remove the filter.
+     */
     void reset() {
         mTasks.clear();
         mFilteredTasks.clear();
         mTaskIndices.clear();
-        mFilter = null;
     }
 
     /** Removes the task filter and returns the previous touch state */
@@ -294,8 +293,18 @@ public class TaskStack {
     FilteredTaskList mTaskList = new FilteredTaskList();
     TaskStackCallbacks mCb;
 
-    ArrayList<TaskGrouping> mGroups = new ArrayList<TaskGrouping>();
-    HashMap<Integer, TaskGrouping> mAffinitiesGroups = new HashMap<Integer, TaskGrouping>();
+    ArrayList<TaskGrouping> mGroups = new ArrayList<>();
+    HashMap<Integer, TaskGrouping> mAffinitiesGroups = new HashMap<>();
+
+    public TaskStack() {
+        // Ensure that we only show non-docked tasks
+        mTaskList.setFilter(new TaskFilter() {
+            @Override
+            public boolean acceptTask(Task t, int index) {
+                return !SystemServicesProxy.isDockedStack(t.key.stackId);
+            }
+        });
+    }
 
     /** Sets the callbacks for this task stack. */
     public void setCallbacks(TaskStackCallbacks cb) {
@@ -399,7 +408,7 @@ public class TaskStack {
 
     /** Gets the task keys */
     public ArrayList<Task.TaskKey> getTaskKeys() {
-        ArrayList<Task.TaskKey> taskKeys = new ArrayList<Task.TaskKey>();
+        ArrayList<Task.TaskKey> taskKeys = new ArrayList<>();
         ArrayList<Task> tasks = mTaskList.getTasks();
         int taskCount = tasks.size();
         for (int i = 0; i < taskCount; i++) {