Loading src/com/android/launcher3/Launcher.java +2 −2 Original line number Diff line number Diff line Loading @@ -2801,7 +2801,7 @@ public class Launcher extends Activity if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { String id = ((ShortcutInfo) info).getDeepShortcutId(); String packageName = intent.getPackage(); LauncherAppsCompat.getInstance(this).startShortcut( LauncherAppState.getInstance().getShortcutManager().startShortcut( packageName, id, intent.getSourceBounds(), optsBundle, info.user); } else { // Could be launching some bookkeeping activity Loading src/com/android/launcher3/LauncherModel.java +3 −3 Original line number Diff line number Diff line Loading @@ -1941,8 +1941,8 @@ public class LauncherModel extends BroadcastReceiver } } incrementPinnedShortcutCount(key, shouldPin); info = ShortcutInfo.fromDeepShortcutInfo(pinnedShortcut, context, launcherApps); info = ShortcutInfo.fromDeepShortcutInfo( pinnedShortcut, context); } else { // item type == ITEM_TYPE_SHORTCUT info = getShortcutInfo(c, context, titleIndex, cursorIconInfo); Loading Loading @@ -3317,7 +3317,7 @@ public class LauncherModel extends BroadcastReceiver List<ShortcutInfo> shortcutInfos = idsToWorkspaceShortcutInfos .get(fullDetails.getId()); for (ShortcutInfo shortcutInfo : shortcutInfos) { shortcutInfo.updateFromDeepShortcutInfo(fullDetails, context, mLauncherApps); shortcutInfo.updateFromDeepShortcutInfo(fullDetails, context); updatedShortcutInfos.add(shortcutInfo); } } Loading src/com/android/launcher3/ShortcutInfo.java +6 −6 Original line number Diff line number Diff line Loading @@ -282,18 +282,17 @@ public class ShortcutInfo extends ItemInfo { */ @TargetApi(Build.VERSION_CODES.N) public static ShortcutInfo fromDeepShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context, LauncherAppsCompat launcherApps) { Context context) { ShortcutInfo si = new ShortcutInfo(); si.user = shortcutInfo.getUserHandle(); si.itemType = LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; si.intent = shortcutInfo.makeIntent(context); si.flags = 0; si.updateFromDeepShortcutInfo(shortcutInfo, context, launcherApps); si.updateFromDeepShortcutInfo(shortcutInfo, context); return si; } public void updateFromDeepShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context, LauncherAppsCompat launcherApps) { public void updateFromDeepShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context) { title = shortcutInfo.getShortLabel(); CharSequence label = shortcutInfo.getLongLabel(); Loading @@ -304,8 +303,9 @@ public class ShortcutInfo extends ItemInfo { .getBadgedLabelForUser(label, user); LauncherAppState launcherAppState = LauncherAppState.getInstance(); Drawable unbadgedIcon = launcherApps.getShortcutIconDrawable(shortcutInfo, launcherAppState .getInvariantDeviceProfile().fillResIconDpi); Drawable unbadgedIcon = launcherAppState.getShortcutManager() .getShortcutIconDrawable(shortcutInfo, launcherAppState.getInvariantDeviceProfile().fillResIconDpi); Bitmap icon = unbadgedIcon == null ? null : Utilities.createBadgedIconBitmap(unbadgedIcon, user, context); setIcon(icon != null ? icon : launcherAppState.getIconCache().getDefaultIcon(user)); Loading src/com/android/launcher3/Utilities.java +8 −0 Original line number Diff line number Diff line Loading @@ -44,8 +44,10 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.PaintDrawable; import android.os.Build; import android.os.Build.VERSION; import android.os.Bundle; import android.os.PowerManager; import android.support.v4.os.BuildCompat; import android.text.Spannable; import android.text.SpannableString; import android.text.TextUtils; Loading Loading @@ -100,6 +102,12 @@ public final class Utilities { private static final int[] sLoc0 = new int[2]; private static final int[] sLoc1 = new int[2]; public static boolean isNycMR1OrAbove() { // TODO: Use the check from support lib return !"REL".equals(VERSION.CODENAME) && "NMR1".compareTo(VERSION.CODENAME) <= 0; } // TODO: use Build.VERSION_CODES when available public static final boolean ATLEAST_MARSHMALLOW = Build.VERSION.SDK_INT >= 23; Loading src/com/android/launcher3/compat/LauncherAppsCompat.java +1 −10 Original line number Diff line number Diff line Loading @@ -61,9 +61,7 @@ public abstract class LauncherAppsCompat { public static LauncherAppsCompat getInstance(Context context) { synchronized (sInstanceLock) { if (sInstance == null) { if (Utilities.isNycOrAbove()) { sInstance = new LauncherAppsCompatVNMR1(context.getApplicationContext()); } else if (Utilities.ATLEAST_LOLLIPOP) { if (Utilities.ATLEAST_LOLLIPOP) { sInstance = new LauncherAppsCompatVL(context.getApplicationContext()); } else { sInstance = new LauncherAppsCompatV16(context.getApplicationContext()); Loading @@ -86,11 +84,4 @@ public abstract class LauncherAppsCompat { public abstract boolean isActivityEnabledForProfile(ComponentName component, UserHandleCompat user); public abstract boolean isPackageSuspendedForProfile(String packageName, UserHandleCompat user); public abstract List<ShortcutInfoCompat> getShortcuts(LauncherApps.ShortcutQuery q, UserHandleCompat userHandle); public abstract void pinShortcuts(String packageName, List<String> pinnedIds, UserHandleCompat userHandle); public abstract void startShortcut(String packageName, String id, Rect sourceBounds, Bundle startActivityOptions, UserHandleCompat user); public abstract Drawable getShortcutIconDrawable(ShortcutInfoCompat shortcutInfo, int density); } Loading
src/com/android/launcher3/Launcher.java +2 −2 Original line number Diff line number Diff line Loading @@ -2801,7 +2801,7 @@ public class Launcher extends Activity if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { String id = ((ShortcutInfo) info).getDeepShortcutId(); String packageName = intent.getPackage(); LauncherAppsCompat.getInstance(this).startShortcut( LauncherAppState.getInstance().getShortcutManager().startShortcut( packageName, id, intent.getSourceBounds(), optsBundle, info.user); } else { // Could be launching some bookkeeping activity Loading
src/com/android/launcher3/LauncherModel.java +3 −3 Original line number Diff line number Diff line Loading @@ -1941,8 +1941,8 @@ public class LauncherModel extends BroadcastReceiver } } incrementPinnedShortcutCount(key, shouldPin); info = ShortcutInfo.fromDeepShortcutInfo(pinnedShortcut, context, launcherApps); info = ShortcutInfo.fromDeepShortcutInfo( pinnedShortcut, context); } else { // item type == ITEM_TYPE_SHORTCUT info = getShortcutInfo(c, context, titleIndex, cursorIconInfo); Loading Loading @@ -3317,7 +3317,7 @@ public class LauncherModel extends BroadcastReceiver List<ShortcutInfo> shortcutInfos = idsToWorkspaceShortcutInfos .get(fullDetails.getId()); for (ShortcutInfo shortcutInfo : shortcutInfos) { shortcutInfo.updateFromDeepShortcutInfo(fullDetails, context, mLauncherApps); shortcutInfo.updateFromDeepShortcutInfo(fullDetails, context); updatedShortcutInfos.add(shortcutInfo); } } Loading
src/com/android/launcher3/ShortcutInfo.java +6 −6 Original line number Diff line number Diff line Loading @@ -282,18 +282,17 @@ public class ShortcutInfo extends ItemInfo { */ @TargetApi(Build.VERSION_CODES.N) public static ShortcutInfo fromDeepShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context, LauncherAppsCompat launcherApps) { Context context) { ShortcutInfo si = new ShortcutInfo(); si.user = shortcutInfo.getUserHandle(); si.itemType = LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; si.intent = shortcutInfo.makeIntent(context); si.flags = 0; si.updateFromDeepShortcutInfo(shortcutInfo, context, launcherApps); si.updateFromDeepShortcutInfo(shortcutInfo, context); return si; } public void updateFromDeepShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context, LauncherAppsCompat launcherApps) { public void updateFromDeepShortcutInfo(ShortcutInfoCompat shortcutInfo, Context context) { title = shortcutInfo.getShortLabel(); CharSequence label = shortcutInfo.getLongLabel(); Loading @@ -304,8 +303,9 @@ public class ShortcutInfo extends ItemInfo { .getBadgedLabelForUser(label, user); LauncherAppState launcherAppState = LauncherAppState.getInstance(); Drawable unbadgedIcon = launcherApps.getShortcutIconDrawable(shortcutInfo, launcherAppState .getInvariantDeviceProfile().fillResIconDpi); Drawable unbadgedIcon = launcherAppState.getShortcutManager() .getShortcutIconDrawable(shortcutInfo, launcherAppState.getInvariantDeviceProfile().fillResIconDpi); Bitmap icon = unbadgedIcon == null ? null : Utilities.createBadgedIconBitmap(unbadgedIcon, user, context); setIcon(icon != null ? icon : launcherAppState.getIconCache().getDefaultIcon(user)); Loading
src/com/android/launcher3/Utilities.java +8 −0 Original line number Diff line number Diff line Loading @@ -44,8 +44,10 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.PaintDrawable; import android.os.Build; import android.os.Build.VERSION; import android.os.Bundle; import android.os.PowerManager; import android.support.v4.os.BuildCompat; import android.text.Spannable; import android.text.SpannableString; import android.text.TextUtils; Loading Loading @@ -100,6 +102,12 @@ public final class Utilities { private static final int[] sLoc0 = new int[2]; private static final int[] sLoc1 = new int[2]; public static boolean isNycMR1OrAbove() { // TODO: Use the check from support lib return !"REL".equals(VERSION.CODENAME) && "NMR1".compareTo(VERSION.CODENAME) <= 0; } // TODO: use Build.VERSION_CODES when available public static final boolean ATLEAST_MARSHMALLOW = Build.VERSION.SDK_INT >= 23; Loading
src/com/android/launcher3/compat/LauncherAppsCompat.java +1 −10 Original line number Diff line number Diff line Loading @@ -61,9 +61,7 @@ public abstract class LauncherAppsCompat { public static LauncherAppsCompat getInstance(Context context) { synchronized (sInstanceLock) { if (sInstance == null) { if (Utilities.isNycOrAbove()) { sInstance = new LauncherAppsCompatVNMR1(context.getApplicationContext()); } else if (Utilities.ATLEAST_LOLLIPOP) { if (Utilities.ATLEAST_LOLLIPOP) { sInstance = new LauncherAppsCompatVL(context.getApplicationContext()); } else { sInstance = new LauncherAppsCompatV16(context.getApplicationContext()); Loading @@ -86,11 +84,4 @@ public abstract class LauncherAppsCompat { public abstract boolean isActivityEnabledForProfile(ComponentName component, UserHandleCompat user); public abstract boolean isPackageSuspendedForProfile(String packageName, UserHandleCompat user); public abstract List<ShortcutInfoCompat> getShortcuts(LauncherApps.ShortcutQuery q, UserHandleCompat userHandle); public abstract void pinShortcuts(String packageName, List<String> pinnedIds, UserHandleCompat userHandle); public abstract void startShortcut(String packageName, String id, Rect sourceBounds, Bundle startActivityOptions, UserHandleCompat user); public abstract Drawable getShortcutIconDrawable(ShortcutInfoCompat shortcutInfo, int density); }