Fix for targeting 31+

Stephen Paul Weber created

com.cheogram.android: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.

Change summary

src/main/java/eu/siacs/conversations/services/NotificationService.java | 6 
1 file changed, 4 insertions(+), 2 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/services/NotificationService.java 🔗

@@ -1609,9 +1609,11 @@ public class NotificationService {
         intent.setAction(XmppConnectionService.ACTION_CLEAR_MISSED_CALL_NOTIFICATION);
         if (conversation != null) {
             intent.putExtra("uuid", conversation.getUuid());
-            return PendingIntent.getService(mXmppConnectionService, generateRequestCode(conversation, 21), intent, 0);
+            return PendingIntent.getService(mXmppConnectionService, generateRequestCode(conversation, 21), intent,
+                s() ? PendingIntent.FLAG_IMMUTABLE : 0);
         }
-        return PendingIntent.getService(mXmppConnectionService, 1, intent, 0);
+        return PendingIntent.getService(mXmppConnectionService, 1, intent,
+                s() ? PendingIntent.FLAG_IMMUTABLE : 0);
     }
 
     private PendingIntent createReplyIntent(