Only request multiple tasks for HA notification intents (#3109)

Only request multiple tasks for notification intents for HA
This commit is contained in:
Joris Pelgröm 2022-11-29 04:13:51 +01:00 committed by GitHub
parent 71bf6a76f1
commit 11e8d5a8e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1673,6 +1673,7 @@ class MessagingManager @Inject constructor(
uri: String
): PendingIntent {
val needsPackage = uri.startsWith(APP_PREFIX) || uri.startsWith(INTENT_PREFIX)
val otherApp = needsPackage || UrlHandler.isAbsoluteUrl(uri) || uri.startsWith(DEEP_LINK_PREFIX)
val intent = when {
uri.isBlank() -> {
WebViewActivity.newInstance(context)
@ -1708,8 +1709,10 @@ class MessagingManager @Inject constructor(
intent.putExtra("fragment", NOTIFICATION_HISTORY)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
if (!otherApp) {
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK)
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
}
return PendingIntent.getActivity(
context,