diff options
author | Mario Bertschler <bmario@google.com> | 2017-03-22 13:14:24 -0700 |
---|---|---|
committer | Mario Bertschler <bmario@google.com> | 2017-03-22 13:14:24 -0700 |
commit | 0eb6326b5f8fbc2450ac9156fdf05c41f73f5876 (patch) | |
tree | 5026a7a7870932581bb71fef5af268a09ccbb2f3 | |
parent | f2be11ccc80cc2ffb356e889d5466646b1969a2b (diff) | |
download | android_packages_apps_Trebuchet-0eb6326b5f8fbc2450ac9156fdf05c41f73f5876.tar.gz android_packages_apps_Trebuchet-0eb6326b5f8fbc2450ac9156fdf05c41f73f5876.tar.bz2 android_packages_apps_Trebuchet-0eb6326b5f8fbc2450ac9156fdf05c41f73f5876.zip |
Fixes a crash in the AllAppsFastScrollHelper where on updating the activated flag
on the views it was trying to retrieve an item from the model for a non-existing
position in the model.
The fix is to check the position to the model size. It's not clear in what circumstance
the model (ArrayList) can differ to the position returned from the view-holder's
getAdapterPosition().
Bug: 36176501
Change-Id: I01b8daaad884702f9ed0e1caaa03d0ebaca69d39
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsFastScrollHelper.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsFastScrollHelper.java b/src/com/android/launcher3/allapps/AllAppsFastScrollHelper.java index a1ff8223a..7d70a3e96 100644 --- a/src/com/android/launcher3/allapps/AllAppsFastScrollHelper.java +++ b/src/com/android/launcher3/allapps/AllAppsFastScrollHelper.java @@ -210,7 +210,9 @@ public class AllAppsFastScrollHelper implements AllAppsGridAdapter.BindViewCallb for (RecyclerView.ViewHolder viewHolder : mTrackedFastScrollViews) { int pos = viewHolder.getAdapterPosition(); boolean isActive = false; - if (mCurrentFastScrollSection != null && pos > -1) { + if (mCurrentFastScrollSection != null + && pos > RecyclerView.NO_POSITION + && pos < mApps.getAdapterItems().size()) { AlphabeticalAppsList.AdapterItem item = mApps.getAdapterItems().get(pos); isActive = item != null && mCurrentFastScrollSection.equals(item.sectionName) && |