Fixed mutable pending intents

pull/206/head
M66B 3 years ago
parent 32d4a7df03
commit 46daf350a5

@ -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),

@ -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);

Loading…
Cancel
Save