From 46daf350a57550004162fba2563b67bef1276593 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 27 Sep 2021 07:50:23 +0200 Subject: [PATCH] Fixed mutable pending intents --- app/src/main/java/eu/faircode/email/Core.java | 2 +- .../main/java/eu/faircode/email/PendingIntentCompat.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 6f4697332b..51e2d8a741 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -4900,7 +4900,7 @@ class Core { .setAction("reply:" + message.id) .putExtra("group", group); PendingIntent piReply = PendingIntentCompat.getService( - context, ServiceUI.PI_REPLY_DIRECT, reply, PendingIntent.FLAG_UPDATE_CURRENT); + context, ServiceUI.PI_REPLY_DIRECT, reply, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE); NotificationCompat.Action.Builder actionReply = new NotificationCompat.Action.Builder( R.drawable.twotone_reply_24, context.getString(R.string.title_advanced_notify_action_reply_direct), diff --git a/app/src/main/java/eu/faircode/email/PendingIntentCompat.java b/app/src/main/java/eu/faircode/email/PendingIntentCompat.java index 49b268e493..fb3216dc9f 100644 --- a/app/src/main/java/eu/faircode/email/PendingIntentCompat.java +++ b/app/src/main/java/eu/faircode/email/PendingIntentCompat.java @@ -31,21 +31,21 @@ public class PendingIntentCompat { } public static PendingIntent getActivity(Context context, int requestCode, Intent intent, int flags) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || (flags & PendingIntent.FLAG_MUTABLE) != 0) return PendingIntent.getActivity(context, requestCode, intent, flags); else return PendingIntent.getActivity(context, requestCode, intent, flags | PendingIntent.FLAG_IMMUTABLE); } public static PendingIntent getService(Context context, int requestCode, @NonNull Intent intent, int flags) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || (flags & PendingIntent.FLAG_MUTABLE) != 0) return PendingIntent.getService(context, requestCode, intent, flags); else return PendingIntent.getService(context, requestCode, intent, flags | PendingIntent.FLAG_IMMUTABLE); } static PendingIntent getForegroundService(Context context, int requestCode, @NonNull Intent intent, int flags) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O || (flags & PendingIntent.FLAG_MUTABLE) != 0) return PendingIntent.getService(context, requestCode, intent, flags); else return PendingIntent.getForegroundService(context, requestCode, intent, flags | PendingIntent.FLAG_IMMUTABLE);