Use mutable flag above Android 12

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-05-15 17:20:10 +02:00
parent da11f8997e
commit 0d5038182d
No known key found for this signature in database
GPG key ID: 4E577DC593B59BDF

View file

@ -28,9 +28,7 @@ public class WidgetUtil {
* @return {@param flags} | {@link PendingIntent#FLAG_MUTABLE} * @return {@param flags} | {@link PendingIntent#FLAG_MUTABLE}
*/ */
public static int pendingIntentFlagCompat(int flags) { public static int pendingIntentFlagCompat(int flags) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
return flags | PendingIntent.FLAG_IMMUTABLE;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
return flags | PendingIntent.FLAG_MUTABLE; return flags | PendingIntent.FLAG_MUTABLE;
} }
return flags; return flags;