Merge "Set FLAG_ACTIVITY_RESET_TASK_IF_NEEDED for all app shortcuts" into jb-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
727f0e1292
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user