From b6830197450d5a2befaf0dc4f7e73850f4c55846 Mon Sep 17 00:00:00 2001 From: Nicolas Prevot Date: Fri, 26 Jun 2015 13:45:12 -0700 Subject: [PATCH] Add flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED in LauncherAppsService. Without this fix: When starting an activity that was an activity-alias, in the work profile: If this activity was already running, it caused the activity to be created a second time instead of restarting the first one. BUG:21411331 Change-Id: Ieb323885c589caed2675765cd5eed8c311535b92 --- .../core/java/com/android/server/pm/LauncherAppsService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/pm/LauncherAppsService.java b/services/core/java/com/android/server/pm/LauncherAppsService.java index d787919b01ab3..458282827dbe4 100644 --- a/services/core/java/com/android/server/pm/LauncherAppsService.java +++ b/services/core/java/com/android/server/pm/LauncherAppsService.java @@ -271,7 +271,8 @@ public class LauncherAppsService extends SystemService { Intent launchIntent = new Intent(Intent.ACTION_MAIN); launchIntent.addCategory(Intent.CATEGORY_LAUNCHER); launchIntent.setSourceBounds(sourceBounds); - launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); launchIntent.setPackage(component.getPackageName()); long ident = Binder.clearCallingIdentity(); @@ -470,4 +471,4 @@ public class LauncherAppsService extends SystemService { } } } -} \ No newline at end of file +}