From c34ba5ad0195f05572cef3115c68621d896eaea7 Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Fri, 25 Oct 2024 13:28:52 -0700 Subject: [PATCH] Fix crash when pausing work profile. The issue happens when bindFastScrollbar is called during switching to a paused work tab and since there are no letters to display (no sections in work tab because workProfile is paused) createVerticalChain complains because it needs two views to be present when there are none. So just early check if there are sections existing will fix this. bug:373533884 Test manually video: https://drive.google.com/file/d/1K9zdZthHNj4Gbdn-m30KINm3VFfwFfiM/view?usp=sharing Flag: com.android.launcher3.letter_fast_scroller Change-Id: I7a8501fa5e7d048fe5a2fe4525f96cc9809cfbfd --- src/com/android/launcher3/allapps/AllAppsRecyclerView.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index e705d94d23..51d1c9f028 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -331,6 +331,9 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView { public void setLettersToScrollLayout( List fastScrollSections) { + if (fastScrollSections.isEmpty()) { + return; + } if (mLetterList != null) { mLetterList.removeAllViews(); } @@ -364,6 +367,8 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView { mLetterList.addView(lastLetterListTextView); constraintTextViewsVertically(mLetterList, textViews); mLetterList.setVisibility(VISIBLE); + // Set the alpha to 0 to avoid the letter list being shown when it shouldn't be. + mLetterList.setAlpha(0); } private void constraintTextViewsVertically(ConstraintLayout constraintLayout,