diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-05-19 16:03:28 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-05-21 13:34:07 -0700 |
commit | 5c97f51fd9443e461a360ff7852aa223c05d667f (patch) | |
tree | 1190bccb371f1c5e1792375270a657e6364c896c /src/com/android/launcher3/InstallShortcutReceiver.java | |
parent | 324d78358c88d30eac587f4e1d679f9b5bf8d2f3 (diff) | |
download | android_packages_apps_Trebuchet-5c97f51fd9443e461a360ff7852aa223c05d667f.tar.gz android_packages_apps_Trebuchet-5c97f51fd9443e461a360ff7852aa223c05d667f.tar.bz2 android_packages_apps_Trebuchet-5c97f51fd9443e461a360ff7852aa223c05d667f.zip |
Icons are not updated to TYPE_APPLICATION during restore
> Use low res only for app shortcuts
> Running icon migration after restore
> Running icon migration again for all users
> Deduping shortcuts added from widget tray
Bug: 20945600
Change-Id: I3bb47545fdd9832510069026fbae8966d2311cc1
Diffstat (limited to 'src/com/android/launcher3/InstallShortcutReceiver.java')
-rw-r--r-- | src/com/android/launcher3/InstallShortcutReceiver.java | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java index 115598f7b..448cc1dfd 100644 --- a/src/com/android/launcher3/InstallShortcutReceiver.java +++ b/src/com/android/launcher3/InstallShortcutReceiver.java @@ -156,6 +156,16 @@ public class InstallShortcutReceiver extends BroadcastReceiver { queuePendingShortcutInfo(info, context); } + public static ShortcutInfo fromShortcutIntent(Context context, Intent data) { + PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, context); + if (info.launchIntent == null || info.label == null) { + if (DBG) Log.e(TAG, "Invalid install shortcut intent"); + return null; + } + info = convertToLauncherActivityIfPossible(info); + return info.getShortcutInfo(); + } + static void queueInstallShortcut(LauncherActivityInfoCompat info, Context context) { queuePendingShortcutInfo(new PendingInstallShortcutInfo(info, context), context); } @@ -215,30 +225,6 @@ public class InstallShortcutReceiver extends BroadcastReceiver { } /** - * Returns true if the intent is a valid launch intent for a shortcut. - * This is used to identify shortcuts which are different from the ones exposed by the - * applications' manifest file. - * - * When DISABLE_ALL_APPS is true, shortcuts exposed via the app's manifest should never be - * duplicated or removed(unless the app is un-installed). - * - * @param launchIntent The intent that will be launched when the shortcut is clicked. - */ - static boolean isValidShortcutLaunchIntent(Intent launchIntent) { - if (launchIntent != null - && Intent.ACTION_MAIN.equals(launchIntent.getAction()) - && launchIntent.getComponent() != null - && launchIntent.getCategories() != null - && launchIntent.getCategories().size() == 1 - && launchIntent.hasCategory(Intent.CATEGORY_LAUNCHER) - && launchIntent.getExtras() == null - && TextUtils.isEmpty(launchIntent.getDataString())) { - return false; - } - return true; - } - - /** * Ensures that we have a valid, non-null name. If the provided name is null, we will return * the application name instead. */ @@ -428,7 +414,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { // Already an activity target return original; } - if (isValidShortcutLaunchIntent(original.launchIntent) + if (!Utilities.isLauncherAppTarget(original.launchIntent) || !original.user.equals(UserHandleCompat.myUserHandle())) { // We can only convert shortcuts which point to a main activity in the current user. return original; |