mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Revert "cache shourtcut image"
This reverts commit 050f9b1279.
Reason for revert: Test failure on ub-launcher3-master (b/140998509)
Possible Root Cause: This happens when fallback image or default icon was
used for shortcut icon, but shortcut caching logic do not have the logic
to create either fallback image or default icon. So upon updating icon cache,
the icon remains to be null, causing an NPE.
Change-Id: I1ee3bb7a3cab2af5730c2ee77d9370c1578a9ad6
This commit is contained in:
@@ -63,7 +63,6 @@ import com.android.launcher3.icons.ComponentWithLabel.ComponentCachingLogic;
|
||||
import com.android.launcher3.icons.IconCache;
|
||||
import com.android.launcher3.icons.LauncherActivityCachingLogic;
|
||||
import com.android.launcher3.icons.LauncherIcons;
|
||||
import com.android.launcher3.icons.ShortcutCachingLogic;
|
||||
import com.android.launcher3.icons.cache.IconCacheUpdateHandler;
|
||||
import com.android.launcher3.logging.FileLog;
|
||||
import com.android.launcher3.provider.ImportDataTask;
|
||||
@@ -171,8 +170,7 @@ public class LoaderTask implements Runnable {
|
||||
TraceHelper.beginSection(TAG);
|
||||
try (LauncherModel.LoaderTransaction transaction = mApp.getModel().beginLoader(this)) {
|
||||
TraceHelper.partitionSection(TAG, "step 1.1: loading workspace");
|
||||
List<ShortcutInfo> allShortcuts = new ArrayList<>();
|
||||
loadWorkspace(allShortcuts);
|
||||
loadWorkspace();
|
||||
|
||||
verifyNotStopped();
|
||||
TraceHelper.partitionSection(TAG, "step 1.2: bind workspace workspace");
|
||||
@@ -191,23 +189,18 @@ public class LoaderTask implements Runnable {
|
||||
TraceHelper.partitionSection(TAG, "step 2.1: loading all apps");
|
||||
List<LauncherActivityInfo> allActivityList = loadAllApps();
|
||||
|
||||
TraceHelper.partitionSection(TAG, "step 2.2: binding all apps");
|
||||
TraceHelper.partitionSection(TAG, "step 2.2: Binding all apps");
|
||||
verifyNotStopped();
|
||||
mResults.bindAllApps();
|
||||
|
||||
verifyNotStopped();
|
||||
TraceHelper.partitionSection(TAG, "step 2.3: save app icons in icon cache");
|
||||
TraceHelper.partitionSection(TAG, "step 2.3: Update icon cache");
|
||||
IconCacheUpdateHandler updateHandler = mIconCache.getUpdateHandler();
|
||||
setIgnorePackages(updateHandler);
|
||||
updateHandler.updateIcons(allActivityList,
|
||||
LauncherActivityCachingLogic.newInstance(mApp.getContext()),
|
||||
mApp.getModel()::onPackageIconsUpdated);
|
||||
|
||||
verifyNotStopped();
|
||||
TraceHelper.partitionSection(TAG, "step 2.4: save shortcuts in icon cache");
|
||||
updateHandler.updateIcons(allShortcuts, new ShortcutCachingLogic(),
|
||||
mApp.getModel()::onPackageIconsUpdated);
|
||||
|
||||
// Take a break
|
||||
TraceHelper.partitionSection(TAG, "step 2 completed, wait for idle");
|
||||
waitForIdle();
|
||||
@@ -215,17 +208,12 @@ public class LoaderTask implements Runnable {
|
||||
|
||||
// third step
|
||||
TraceHelper.partitionSection(TAG, "step 3.1: loading deep shortcuts");
|
||||
List<ShortcutInfo> allDeepShortcuts = loadDeepShortcuts();
|
||||
loadDeepShortcuts();
|
||||
|
||||
verifyNotStopped();
|
||||
TraceHelper.partitionSection(TAG, "step 3.2: bind deep shortcuts");
|
||||
mResults.bindDeepShortcuts();
|
||||
|
||||
verifyNotStopped();
|
||||
TraceHelper.partitionSection(TAG, "step 3.3: save deep shortcuts in icon cache");
|
||||
updateHandler.updateIcons(allDeepShortcuts,
|
||||
new ShortcutCachingLogic(), (pkgs, user) -> { });
|
||||
|
||||
// Take a break
|
||||
TraceHelper.partitionSection(TAG, "step 3 completed, wait for idle");
|
||||
waitForIdle();
|
||||
@@ -240,7 +228,7 @@ public class LoaderTask implements Runnable {
|
||||
mResults.bindWidgets();
|
||||
|
||||
verifyNotStopped();
|
||||
TraceHelper.partitionSection(TAG, "step 4.3: save widgets in icon cache");
|
||||
TraceHelper.partitionSection(TAG, "step 4.3: Update icon cache");
|
||||
updateHandler.updateIcons(allWidgetsList, new ComponentCachingLogic(mApp.getContext()),
|
||||
mApp.getModel()::onWidgetLabelsUpdated);
|
||||
|
||||
@@ -261,7 +249,7 @@ public class LoaderTask implements Runnable {
|
||||
this.notify();
|
||||
}
|
||||
|
||||
private void loadWorkspace(List<ShortcutInfo> allDeepShortcuts) {
|
||||
private void loadWorkspace() {
|
||||
final Context context = mApp.getContext();
|
||||
final ContentResolver contentResolver = context.getContentResolver();
|
||||
final PackageManagerHelper pmHelper = new PackageManagerHelper(context);
|
||||
@@ -510,7 +498,6 @@ public class LoaderTask implements Runnable {
|
||||
info.runtimeStatusFlags |= FLAG_DISABLED_SUSPENDED;
|
||||
}
|
||||
intent = info.intent;
|
||||
allDeepShortcuts.add(pinnedShortcut);
|
||||
} else {
|
||||
// Create a shortcut info in disabled mode for now.
|
||||
info = c.loadSimpleWorkspaceItem();
|
||||
@@ -856,8 +843,7 @@ public class LoaderTask implements Runnable {
|
||||
return allActivityList;
|
||||
}
|
||||
|
||||
private List<ShortcutInfo> loadDeepShortcuts() {
|
||||
List<ShortcutInfo> allShortcuts = new ArrayList<>();
|
||||
private void loadDeepShortcuts() {
|
||||
mBgDataModel.deepShortcutMap.clear();
|
||||
mBgDataModel.hasShortcutHostPermission = mShortcutManager.hasHostPermission();
|
||||
if (mBgDataModel.hasShortcutHostPermission) {
|
||||
@@ -865,12 +851,10 @@ public class LoaderTask implements Runnable {
|
||||
if (mUserManager.isUserUnlocked(user)) {
|
||||
List<ShortcutInfo> shortcuts =
|
||||
mShortcutManager.queryForAllShortcuts(user);
|
||||
allShortcuts.addAll(shortcuts);
|
||||
mBgDataModel.updateDeepShortcutCounts(null, user, shortcuts);
|
||||
}
|
||||
}
|
||||
}
|
||||
return allShortcuts;
|
||||
}
|
||||
|
||||
public static boolean isValidProvider(AppWidgetProviderInfo provider) {
|
||||
|
||||
Reference in New Issue
Block a user