OSDN Git Service

Fixing index bounds exception when TaskViews are added while dismissing.
authorWinson <winsonc@google.com>
Wed, 21 Sep 2016 19:13:55 +0000 (12:13 -0700)
committerWinson Chung <winsonc@google.com>
Thu, 22 Sep 2016 19:47:41 +0000 (19:47 +0000)
Bug: 31518216
Change-Id: I749aa45f54d80d524f069922ac09d2f781c87f86

packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java

index 67a2595..d44aa84 100644 (file)
@@ -634,6 +634,12 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
             }
 
             int taskIndex = mCurrentTasks.indexOf(task);
+            if (taskIndex == -1) {
+                // If a task was added to the stack view after the start of the dismiss gesture,
+                // just ignore it
+                continue;
+            }
+
             TaskViewTransform fromTransform = mCurrentTaskTransforms.get(taskIndex);
             TaskViewTransform toTransform = mFinalTaskTransforms.get(taskIndex);