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
(cherry picked from commit fc02c1b446ee54561ac7351fb6ff0f8294785f0e)
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 886c5f0..81c95e7 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2954,7 +2954,8 @@
         try {
             if (Utilities.ATLEAST_MARSHMALLOW && item != null
                     && (item.itemType == Favorites.ITEM_TYPE_SHORTCUT
-                    || item.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT)) {
+                    || item.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT)
+                    && ((ShortcutInfo) item).promisedIntent == null) {
                 // Shortcuts need some special checks due to legacy reasons.
                 startShortcutIntentSafely(intent, optsBundle, item);
             } else if (user == null || user.equals(UserHandleCompat.myUserHandle())) {
@@ -4267,7 +4268,7 @@
 
             for (ShortcutInfo si : removed) {
                 if (si.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
-                    removedDeepShortcuts.add(ShortcutKey.fromItemInfo(si));
+                    removedDeepShortcuts.add(ShortcutKey.fromShortcutInfo(si));
                 } else {
                     removedComponents.add(si.getTargetComponent());
                 }