[Safer intents] Notifications

To avoid implicit intents, make intents launch explicitly.

Test: build
Bug: 323061508
Change-Id: I68624ca7c913c473490f371409ae35acbb4f6fb2
This commit is contained in:
Jason Chiu
2024-03-25 15:12:09 +08:00
parent 37f992aecc
commit 8bc1a141b5
11 changed files with 25 additions and 7 deletions

View File

@@ -25,6 +25,7 @@ import android.service.notification.ZenPolicy;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
public class ZenRuleStarredContactsPreferenceController extends
@@ -43,10 +44,13 @@ public class ZenRuleStarredContactsPreferenceController extends
mPriorityCategory = priorityCategory;
mPackageManager = mContext.getPackageManager();
String contactsPackage = context.getString(R.string.config_contacts_package_name);
mStarredContactsIntent = new Intent(Contacts.Intents.UI.LIST_STARRED_ACTION)
.setPackage(contactsPackage)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
mFallbackIntent = new Intent(Intent.ACTION_MAIN);
mFallbackIntent = new Intent(Intent.ACTION_MAIN);
mFallbackIntent.setPackage(contactsPackage);
mFallbackIntent.addCategory(Intent.CATEGORY_APP_CONTACTS);
mFallbackIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
}