diff options
author | Michael Jurka <mikejurka@google.com> | 2012-04-27 15:14:24 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-27 15:14:24 -0700 |
commit | 727f0e1292dccc1916c7e3d54ff70385ae329108 (patch) | |
tree | 83705ad98f9fb6f863f83ba4e1cd740a9f7e6646 | |
parent | d2a9194b6119051962edab14cc26d12706867c72 (diff) | |
parent | 968795679be0a3f0118d5a6e2e1580808da5716d (diff) | |
download | packages_apps_trebuchet-727f0e1292dccc1916c7e3d54ff70385ae329108.zip packages_apps_trebuchet-727f0e1292dccc1916c7e3d54ff70385ae329108.tar.gz packages_apps_trebuchet-727f0e1292dccc1916c7e3d54ff70385ae329108.tar.bz2 |
Merge "Set FLAG_ACTIVITY_RESET_TASK_IF_NEEDED for all app shortcuts" into jb-dev
-rw-r--r-- | src/com/android/launcher2/InstallShortcutReceiver.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java index eda82e0..66b3f5f 100644 --- a/src/com/android/launcher2/InstallShortcutReceiver.java +++ b/src/com/android/launcher2/InstallShortcutReceiver.java @@ -113,6 +113,10 @@ public class InstallShortcutReceiver extends BroadcastReceiver { if (intent != null) { if (intent.getAction() == null) { intent.setAction(Intent.ACTION_VIEW); + } else if (intent.getAction().equals(Intent.ACTION_MAIN) && + intent.getCategories().contains(Intent.CATEGORY_LAUNCHER)) { + intent.addFlags( + Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); } // By default, we allow for duplicate entries (located in diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 37235e9..8f6ca4f 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -1070,6 +1070,15 @@ public class LauncherModel extends BroadcastReceiver { info = getShortcutInfo(c, context, iconTypeIndex, iconPackageIndex, iconResourceIndex, iconIndex, titleIndex); + + // App shortcuts that used to be automatically added to Launcher + // didn't always have the correct intent flags set, so do that here + if (intent.getAction().equals(Intent.ACTION_MAIN) && + intent.getCategories().contains(Intent.CATEGORY_LAUNCHER)) { + intent.addFlags( + Intent.FLAG_ACTIVITY_NEW_TASK | + Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); + } } if (info != null) { |