From 3c2ee27a0141ff1cd1c9bcfbb43e361bde55ae80 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 5 Jan 2023 14:52:01 -0800 Subject: [PATCH] Fixing work tab is not updated when work-mode changes Bug: 263399769 Test: Verified on device Change-Id: I94d8f20bc70f2299d11d539d4821ba7e13253522 --- .../allapps/AlphabeticalAppsList.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index fc1b830aed..29767bf465 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -239,23 +239,24 @@ public class AlphabeticalAppsList implement mAdapterItems.addAll(mSearchResults); } else { int position = 0; + boolean addApps = true; if (mWorkProviderManager != null) { position += mWorkProviderManager.addWorkItems(mAdapterItems); - if (!mWorkProviderManager.shouldShowWorkApps()) { - return; - } + addApps = mWorkProviderManager.shouldShowWorkApps(); } - String lastSectionName = null; - for (AppInfo info : mApps) { - mAdapterItems.add(AdapterItem.asApp(info)); + if (addApps) { + String lastSectionName = null; + for (AppInfo info : mApps) { + mAdapterItems.add(AdapterItem.asApp(info)); - String sectionName = info.sectionName; - // Create a new section if the section names do not match - if (!sectionName.equals(lastSectionName)) { - lastSectionName = sectionName; - mFastScrollerSections.add(new FastScrollSectionInfo(sectionName, position)); + String sectionName = info.sectionName; + // Create a new section if the section names do not match + if (!sectionName.equals(lastSectionName)) { + lastSectionName = sectionName; + mFastScrollerSections.add(new FastScrollSectionInfo(sectionName, position)); + } + position++; } - position++; } } mAccessibilityResultsCount = (int) mAdapterItems.stream()