From e6d896f1bd692854a2e63c7c6435eb49818d01d8 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 27 Aug 2021 12:59:26 -0700 Subject: [PATCH] Add GroupedTaskView to recents view only if needed Fixes: 197712963 Test: Got into the state of the exception once, but didn't seem to repro after change. Change-Id: Ifebf198ba0d1d0cca83935a700711fb22a8a276a --- .../com/android/quickstep/views/RecentsView.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 597467766a..629d59cd74 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1278,7 +1278,8 @@ public abstract class RecentsView requiredTaskViewCount) { removeView(getChildAt(getChildCount() - 1)); } - while (requiredGroupTaskViews > 0) { + int groupedTaskViewCount = getGroupedTaskViewCount(); + while (requiredGroupTaskViews > groupedTaskViewCount) { // Add to front of list addView(getTaskViewFromPool(true), 0); requiredGroupTaskViews--; @@ -1405,6 +1406,16 @@ public abstract class RecentsView