commit | bc08503e0bd393f661bae68d6ea47b24b4902ebb | [log] [tgz] |
---|---|---|
author | Tony Wickham <twickham@google.com> | Tue Mar 09 11:01:02 2021 -0800 |
committer | Tony Wickham <twickham@google.com> | Tue Mar 09 11:01:02 2021 -0800 |
tree | e1060fc73298c5dc43f54d3504b5140f8c4f2920 | |
parent | 2b860d29cac49caf01693b04ff4b9f98844f2ce2 [diff] |
Ensure taskbar hotseat array index is in bounds Test: switch from 5x5 grid to 4x4 grid, ensure no crash Fixes: 181981906 Change-Id: Ic23e3d5f1debcfd2307e48c6aaac38d143fd95c3
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarHotseatController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarHotseatController.java index 082343e..b1bafdb 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarHotseatController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarHotseatController.java
@@ -78,7 +78,10 @@ CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams(); // Since the hotseat might be laid out vertically or horizontally, use whichever // index is higher. - hotseatItemInfos[Math.max(lp.cellX, lp.cellY)] = itemInfo; + int index = Math.max(lp.cellX, lp.cellY); + if (0 <= index && index < hotseatItemInfos.length) { + hotseatItemInfos[index] = itemInfo; + } } }