From 2b365ae7f06cf1beb0335b7070bf1f580779a4e7 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 25 Jul 2019 12:27:29 -0700 Subject: [PATCH] Fix incorrect task index bounds Should have been using min, not max. Added lower bound for good measure. Bug: 138025252 Change-Id: Icd8c7d62dca7605fe63e83602e4c9fceb91f68a6 --- .../launcher3/uioverrides/states/BackgroundAppState.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index 5ee08c12d2..50cfac8e43 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -19,6 +19,7 @@ import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; +import com.android.launcher3.Utilities; import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.util.LayoutUtils; @@ -68,8 +69,8 @@ public class BackgroundAppState extends OverviewState { if (taskCount == 0) { return super.getOverviewScaleAndTranslation(launcher); } - TaskView dummyTask = recentsView.getTaskViewAt(Math.max(taskCount - 1, - recentsView.getCurrentPage())); + TaskView dummyTask = recentsView.getTaskViewAt(Utilities.boundToRange( + recentsView.getCurrentPage(), 0, taskCount - 1)); return recentsView.getTempClipAnimationHelper().updateForFullscreenOverview(dummyTask) .getScaleAndTranslation(); }