From fc02c1b446ee54561ac7351fb6ff0f8294785f0e Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 29 Aug 2016 15:17:48 -0700 Subject: Use promisedIntent instead of intent when deep shortcuts are restored. This ensures that the intent has the package corresponding to the shortcut publisher, rather than a market intent. It also ensures that the intent has the EXTRA_SHORTCUT_ID attached. Bug: 31123204 Change-Id: I05d56396b629880322e915f52bfc0605b921b0b1 --- src/com/android/launcher3/LauncherModel.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/com/android/launcher3/LauncherModel.java') diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 1607a4a40..b31a00064 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -931,7 +931,8 @@ public class LauncherModel extends BroadcastReceiver } if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { incrementPinnedShortcutCount( - ShortcutKey.fromItemInfo(item), true /* shouldPin */); + ShortcutKey.fromShortcutInfo((ShortcutInfo) item), + true /* shouldPin */); } break; case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET: @@ -1000,7 +1001,8 @@ public class LauncherModel extends BroadcastReceiver sBgWorkspaceItems.remove(item); break; case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT: - decrementPinnedShortcutCount(ShortcutKey.fromItemInfo(item)); + decrementPinnedShortcutCount(ShortcutKey.fromShortcutInfo( + (ShortcutInfo) item)); // Fall through. case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION: case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT: @@ -3389,7 +3391,8 @@ public class LauncherModel extends BroadcastReceiver for (ItemInfo itemInfo : sBgItemsIdMap) { if (itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) { ShortcutInfo si = (ShortcutInfo) itemInfo; - if (si.getIntent().getPackage().equals(mPackageName) && si.user.equals(mUser)) { + if (si.getPromisedIntent().getPackage().equals(mPackageName) + && si.user.equals(mUser)) { String shortcutId = si.getDeepShortcutId(); if (idsToShortcuts.containsKey(shortcutId)) { idsToWorkspaceShortcutInfos.addToList(shortcutId, si); @@ -3462,7 +3465,7 @@ public class LauncherModel extends BroadcastReceiver ShortcutInfo si = (ShortcutInfo) itemInfo; if (isUserUnlocked) { ShortcutInfoCompat shortcut = - pinnedShortcuts.get(ShortcutKey.fromItemInfo(si)); + pinnedShortcuts.get(ShortcutKey.fromShortcutInfo(si)); // We couldn't verify the shortcut during loader. If its no longer available // (probably due to clear data), delete the workspace item as well if (shortcut == null) { -- cgit v1.2.3