From 76aedd72f043352dd8cae1ad6ea49fca354b4253 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Mon, 30 Aug 2021 09:37:12 -0400 Subject: [PATCH] Add new task to intents that leave Settings Test: manual Fixes: 197702721 Fixes: 197704633 Fixes: 197704125 Fixes: 197704456 Change-Id: Iffeca2d152bd083edafe69a7121d011e284eeb69 --- .../zen/ZenModePrioritySendersPreferenceController.java | 9 ++++++--- .../zen/ZenRuleStarredContactsPreferenceController.java | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/notification/zen/ZenModePrioritySendersPreferenceController.java b/src/com/android/settings/notification/zen/ZenModePrioritySendersPreferenceController.java index 482865c40ab..d89163d0c1b 100644 --- a/src/com/android/settings/notification/zen/ZenModePrioritySendersPreferenceController.java +++ b/src/com/android/settings/notification/zen/ZenModePrioritySendersPreferenceController.java @@ -54,10 +54,13 @@ public class ZenModePrioritySendersPreferenceController @VisibleForTesting static final String KEY_NONE = "senders_none"; private static final Intent ALL_CONTACTS_INTENT = - new Intent(Contacts.Intents.UI.LIST_DEFAULT); + new Intent(Contacts.Intents.UI.LIST_DEFAULT) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); private static final Intent STARRED_CONTACTS_INTENT = - new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION); - private static final Intent FALLBACK_INTENT = new Intent(Intent.ACTION_MAIN); + new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + private static final Intent FALLBACK_INTENT = new Intent(Intent.ACTION_MAIN) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); private final PackageManager mPackageManager; private final boolean mIsMessages; // if this is false, then this preference is for calls diff --git a/src/com/android/settings/notification/zen/ZenRuleStarredContactsPreferenceController.java b/src/com/android/settings/notification/zen/ZenRuleStarredContactsPreferenceController.java index a6de68c2546..3ac66337eb4 100644 --- a/src/com/android/settings/notification/zen/ZenRuleStarredContactsPreferenceController.java +++ b/src/com/android/settings/notification/zen/ZenRuleStarredContactsPreferenceController.java @@ -43,10 +43,12 @@ public class ZenRuleStarredContactsPreferenceController extends mPriorityCategory = priorityCategory; mPackageManager = mContext.getPackageManager(); - mStarredContactsIntent = new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION); + mStarredContactsIntent = new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); mFallbackIntent = new Intent(Intent.ACTION_MAIN); mFallbackIntent.addCategory(Intent.CATEGORY_APP_CONTACTS); + mFallbackIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); } @Override