summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2012-03-22 05:54:33 -0700
committerMichael Jurka <mikejurka@google.com>2012-04-27 15:09:37 -0700
commit968795679be0a3f0118d5a6e2e1580808da5716d (patch)
treed52a9e8dbef1ca6126332aca088deb3ecff304c5
parent9cfcb39bffaffe2123cc6e6a39b4e32ee440fda5 (diff)
downloadandroid_packages_apps_Trebuchet-968795679be0a3f0118d5a6e2e1580808da5716d.tar.gz
android_packages_apps_Trebuchet-968795679be0a3f0118d5a6e2e1580808da5716d.tar.bz2
android_packages_apps_Trebuchet-968795679be0a3f0118d5a6e2e1580808da5716d.zip
Set FLAG_ACTIVITY_RESET_TASK_IF_NEEDED for all app shortcuts
Change-Id: I3a5cc205c24b1ec33f428e8d341a995e864f6a1d
-rw-r--r--src/com/android/launcher2/InstallShortcutReceiver.java4
-rw-r--r--src/com/android/launcher2/LauncherModel.java9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java
index eda82e098..66b3f5f67 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 37235e960..8f6ca4fd1 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) {