diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 6c706bec09..fac372b07e 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2708,6 +2708,10 @@ public class Launcher extends StatefulActivity mWidgetPickerDataProvider.dump(prefix, writer); mDeviceProfile.dump(this, prefix, writer); mAppsView.getAppsStore().dump(prefix, writer); + mAppsView.getPersonalAppList().dump(prefix, writer); + if (mAppsView.shouldShowTabs()) { + mAppsView.getWorkAppList().dump(prefix, writer); + } try { FileLog.flushAll(writer); diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index ad660d22ba..227ac2bb4a 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -18,6 +18,7 @@ package com.android.launcher3.allapps; import static com.android.launcher3.Flags.enableExpandingPauseWorkButton; import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.MAIN; import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.SEARCH; +import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.WORK; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_PRIVATE_SPACE_HEADER; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_DISABLED_CARD; import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_EDU_CARD; @@ -1313,6 +1314,10 @@ public class ActivityAllAppsContainerView return mAH.get(MAIN).mAppsList; } + public AlphabeticalAppsList getWorkAppList() { + return mAH.get(WORK).mAppsList; + } + public FloatingHeaderView getFloatingHeaderView() { return mHeader; } diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index a3cabc283f..6dd811a98d 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -26,6 +26,7 @@ import android.content.Context; import android.text.Spannable; import android.text.SpannableString; import android.text.style.ImageSpan; +import android.util.Log; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; @@ -39,6 +40,7 @@ import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.util.LabelComparator; import com.android.launcher3.views.ActivityContext; +import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -270,6 +272,7 @@ public class AlphabeticalAppsList implement List oldItems = new ArrayList<>(mAdapterItems); // Prepare to update the list of sections, filtered apps, etc. mFastScrollerSections.clear(); + Log.d(TAG, "Clearing FastScrollerSections."); mAdapterItems.clear(); mAccessibilityResultsCount = 0; @@ -290,6 +293,7 @@ public class AlphabeticalAppsList implement mFastScrollerSections.add(new FastScrollSectionInfo( mActivityContext.getResources().getString( R.string.work_profile_edu_section), 0)); + Log.d(TAG, "Adding FastScrollSection for work edu card."); } position = addAppsWithSections(mApps, position); } @@ -303,6 +307,7 @@ public class AlphabeticalAppsList implement mFastScrollerSections.add(new FastScrollSectionInfo( mFastScrollerSections.get(mFastScrollerSections.size() - 1).sectionName, position++)); + Log.d(TAG, "Adding FastScrollSection duplicate to scroll to the bottom."); } } mAccessibilityResultsCount = (int) mAdapterItems.stream() @@ -346,6 +351,7 @@ public class AlphabeticalAppsList implement && !mPrivateApps.isEmpty()) { // Always add PS Header if Space is present and visible. position = mPrivateProviderManager.addPrivateSpaceHeader(mAdapterItems); + Log.d(TAG, "Adding FastScrollSection for Private Space header. "); mFastScrollerSections.add(new FastScrollSectionInfo( mPrivateProfileAppScrollerBadge, position)); int privateSpaceState = mPrivateProviderManager.getCurrentState(); @@ -407,6 +413,7 @@ public class AlphabeticalAppsList implement hasPrivateApps = appList.stream(). allMatch(mPrivateProviderManager.getItemInfoMatcher()); } + Log.d(TAG, "Adding apps with sections. HasPrivateApps: " + hasPrivateApps); for (int i = 0; i < appList.size(); i++) { AppInfo info = appList.get(i); // Apply decorator to private apps. @@ -421,6 +428,8 @@ public class AlphabeticalAppsList implement String sectionName = info.sectionName; // Create a new section if the section names do not match if (!sectionName.equals(lastSectionName)) { + Log.d(TAG, "addAppsWithSections: adding sectionName: " + sectionName + + " with appInfoTitle: " + info.title); lastSectionName = sectionName; mFastScrollerSections.add(new FastScrollSectionInfo(hasPrivateApps ? mPrivateProfileAppScrollerBadge : sectionName, position)); @@ -471,6 +480,13 @@ public class AlphabeticalAppsList implement return mPrivateProviderManager; } + public void dump(String prefix, PrintWriter writer) { + writer.println(prefix + "SectionInfo[] size: " + mFastScrollerSections.size()); + for (int i = 0; i < mFastScrollerSections.size(); i++) { + writer.println("\tFastScrollSection: " + mFastScrollerSections.get(i).sectionName); + } + } + private static class MyDiffCallback extends DiffUtil.Callback { private final List mOldList; diff --git a/src/com/android/launcher3/compat/AlphabeticIndexCompat.java b/src/com/android/launcher3/compat/AlphabeticIndexCompat.java index 4f8d53e11c..d593f80756 100644 --- a/src/com/android/launcher3/compat/AlphabeticIndexCompat.java +++ b/src/com/android/launcher3/compat/AlphabeticIndexCompat.java @@ -3,6 +3,7 @@ package com.android.launcher3.compat; import android.content.Context; import android.icu.text.AlphabeticIndex; import android.os.LocaleList; +import android.util.Log; import androidx.annotation.NonNull; @@ -12,6 +13,9 @@ import java.util.Locale; public class AlphabeticIndexCompat { + // TODO(b/336947811): Set to false after root causing is done. + private static final boolean DEBUG = true; + private static final String TAG = "AlphabeticIndexCompat"; private static final String MID_DOT = "\u2219"; private final String mDefaultMiscLabel; @@ -49,6 +53,9 @@ public class AlphabeticIndexCompat { public String computeSectionName(@NonNull CharSequence cs) { String s = Utilities.trim(cs); String sectionName = mBaseIndex.getBucket(mBaseIndex.getBucketIndex(s)).getLabel(); + if (DEBUG) { + Log.d(TAG, "computeSectionName: cs: " + cs + " sectionName: " + sectionName); + } if (Utilities.trim(sectionName).isEmpty() && s.length() > 0) { int c = s.codePointAt(0); boolean startsWithDigit = Character.isDigit(c);