mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 02:38:20 +00:00
Ensuring that ShortcutInfo always has an icon
> Making iconBitmap public instead of a getter (similar to AppInfo) > Removing getIcon() which can lead to IO on UI thread > Removing updateIcon and handling the update at the caller Bug: 21325319 Change-Id: I6a49b9043f974e9629ea25e77012d97cc04c0594
This commit is contained in:
@@ -25,6 +25,7 @@ import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.LauncherModel.CallbackTask;
|
||||
import com.android.launcher3.LauncherModel.Callbacks;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.ShortcutInfo;
|
||||
import com.android.launcher3.compat.UserHandleCompat;
|
||||
|
||||
@@ -61,9 +62,10 @@ public class CacheDataUpdatedTask extends ExtendedModelTask {
|
||||
if (info instanceof ShortcutInfo && mUser.equals(info.user)) {
|
||||
ShortcutInfo si = (ShortcutInfo) info;
|
||||
ComponentName cn = si.getTargetComponent();
|
||||
if (isValidShortcut(si) &&
|
||||
cn != null && mPackages.contains(cn.getPackageName())) {
|
||||
si.updateIcon(iconCache);
|
||||
if (si.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION
|
||||
&& isValidShortcut(si) && cn != null
|
||||
&& mPackages.contains(cn.getPackageName())) {
|
||||
iconCache.getTitleAndIcon(si, si.getPromisedIntent(), si.user, si.usingLowResIcon);
|
||||
updatedShortcuts.add(si);
|
||||
}
|
||||
}
|
||||
@@ -85,7 +87,7 @@ public class CacheDataUpdatedTask extends ExtendedModelTask {
|
||||
public boolean isValidShortcut(ShortcutInfo si) {
|
||||
switch (mOp) {
|
||||
case OP_CACHE_UPDATE:
|
||||
return si.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
|
||||
return true;
|
||||
case OP_SESSION_UPDATE:
|
||||
return si.isPromise();
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user