From db221e1d095921a4c989f634b4cda742b1dac550 Mon Sep 17 00:00:00 2001 From: Pun Butrach Date: Sat, 17 Jan 2026 23:48:27 +0700 Subject: [PATCH] fix: Tried to make the app drawer listing list in alphabetical order when loading icon in bulk Signed-off-by: Pun Butrach --- GITHUB_CHANGELOG.md | 1 + .../android/launcher3/model/AllAppsList.java | 8 +++++++- src/com/android/launcher3/model/LoaderTask.java | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/GITHUB_CHANGELOG.md b/GITHUB_CHANGELOG.md index 5b5e71cb3b..23750cd89f 100644 --- a/GITHUB_CHANGELOG.md +++ b/GITHUB_CHANGELOG.md @@ -43,6 +43,7 @@ Compatibility list: * [Build] Update dependency to fully support 16-kb page size in Android (x86_64 architecture) * [Lawnchair] Crash due to unable to access Window/Display context on Android 8.0 and above * [Lawnchair] Reimplement Backup & Restore +* [Launcher] Fix or **_tried_** to make the app drawer listing listed in alphabetical order when loading icon in bulk ### 🥞 Development 4 Release 1 (Snapshot 10) diff --git a/src/com/android/launcher3/model/AllAppsList.java b/src/com/android/launcher3/model/AllAppsList.java index 91aac6e456..862ad7d735 100644 --- a/src/com/android/launcher3/model/AllAppsList.java +++ b/src/com/android/launcher3/model/AllAppsList.java @@ -29,6 +29,7 @@ import android.content.pm.LauncherActivityInfo; import android.content.pm.LauncherApps; import android.os.LocaleList; import android.os.UserHandle; +import android.text.TextUtils; import android.util.Log; import androidx.annotation.NonNull; @@ -315,9 +316,14 @@ public class AllAppsList { public void updateIconsAndLabels(HashSet packages, UserHandle user) { for (AppInfo info : data) { if (info.user.equals(user) && packages.contains(info.componentName.getPackageName())) { + CharSequence oldTitle = info.title; + String oldSectionName = info.sectionName; mIconCache.updateTitleAndIcon(info); info.sectionName = mIndex.computeSectionName(info.title); - mDataChanged = true; + if (!TextUtils.equals(oldTitle, info.title) + || !TextUtils.equals(oldSectionName, info.sectionName)) { + mDataChanged = true; + } } } } diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java index 9a193cb17e..39bdf113ef 100644 --- a/src/com/android/launcher3/model/LoaderTask.java +++ b/src/com/android/launcher3/model/LoaderTask.java @@ -708,6 +708,23 @@ public class LoaderTask implements Runnable { } finally { Trace.endSection(); } + } else { + // LC-Note: This code dark magic sorting fallback is powered by Opus 4.5 + Trace.beginSection("LoadAllAppsIconsIndividually"); + try { + for (IconRequestInfo iconRequestInfo : allAppsItemRequestInfos) { + AppInfo appInfo = iconRequestInfo.itemInfo; + if (iconRequestInfo.launcherActivityInfo != null) { + mIconCache.getTitleAndIcon(appInfo, iconRequestInfo.launcherActivityInfo, + appInfo.getMatchingLookupFlag()); + } else { + mIconCache.getTitleAndIcon(appInfo, appInfo.getMatchingLookupFlag()); + } + mBgAllAppsList.updateSectionName(appInfo); + } + } finally { + Trace.endSection(); + } } if (Flags.enablePrivateSpace()) {