[automerger] Use deep shortcuts' icons as a fallback when updating am: a8ccf09597
Change-Id: I6629a5ca0eed641fc575b67dda39ff63b568f71b
This commit is contained in:
@@ -320,6 +320,19 @@ public class LauncherIcons {
|
||||
return createShortcutIcon(shortcutInfo, context, badged, null);
|
||||
}
|
||||
|
||||
public static Bitmap createShortcutIcon(ShortcutInfoCompat shortcutInfo, Context context,
|
||||
final Bitmap fallbackIcon) {
|
||||
Provider<Bitmap> fallbackIconProvider = new Provider<Bitmap>() {
|
||||
@Override
|
||||
public Bitmap get() {
|
||||
// If the shortcut is pinned but no longer has an icon in the system,
|
||||
// keep the current icon instead of reverting to the default icon.
|
||||
return fallbackIcon;
|
||||
}
|
||||
};
|
||||
return createShortcutIcon(shortcutInfo, context, true, fallbackIconProvider);
|
||||
}
|
||||
|
||||
public static Bitmap createShortcutIcon(ShortcutInfoCompat shortcutInfo, Context context,
|
||||
boolean badged, @Nullable Provider<Bitmap> fallbackIconProvider) {
|
||||
LauncherAppState app = LauncherAppState.getInstance(context);
|
||||
|
||||
@@ -85,10 +85,10 @@ public class ShortcutsChangedTask extends BaseModelUpdateTask {
|
||||
removedShortcutInfos.addAll(shortcutInfos);
|
||||
continue;
|
||||
}
|
||||
for (ShortcutInfo shortcutInfo : shortcutInfos) {
|
||||
for (final ShortcutInfo shortcutInfo : shortcutInfos) {
|
||||
shortcutInfo.updateFromDeepShortcutInfo(fullDetails, context);
|
||||
shortcutInfo.iconBitmap =
|
||||
LauncherIcons.createShortcutIcon(fullDetails, context);
|
||||
shortcutInfo.iconBitmap = LauncherIcons.createShortcutIcon(fullDetails, context,
|
||||
shortcutInfo.iconBitmap);
|
||||
updatedShortcutInfos.add(shortcutInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,8 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
|
||||
}
|
||||
si.isDisabled &= ~ShortcutInfo.FLAG_DISABLED_LOCKED_USER;
|
||||
si.updateFromDeepShortcutInfo(shortcut, context);
|
||||
si.iconBitmap = LauncherIcons.createShortcutIcon(shortcut, context);
|
||||
si.iconBitmap = LauncherIcons.createShortcutIcon(shortcut, context,
|
||||
si.iconBitmap);
|
||||
} else {
|
||||
si.isDisabled |= ShortcutInfo.FLAG_DISABLED_LOCKED_USER;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user