|
1 | 1 | package com.batch.android; |
2 | 2 |
|
| 3 | +import android.annotation.SuppressLint; |
3 | 4 | import android.app.PendingIntent; |
4 | 5 | import android.content.Context; |
5 | 6 | import android.content.Intent; |
@@ -71,12 +72,16 @@ public class BatchNotificationAction |
71 | 72 | * @return A list of {@link NotificationCompat.Action} instances matching the provided {@link BatchNotificationAction}, |
72 | 73 | * if they've been successfully converted |
73 | 74 | */ |
| 75 | + @SuppressLint("UnspecifiedImmutableFlag") |
74 | 76 | @NonNull |
75 | 77 | public static List<NotificationCompat.Action> getSupportActions(@NonNull Context context, |
76 | 78 | @NonNull List<BatchNotificationAction> batchActions, |
77 | 79 | @Nullable BatchPushPayload pushPayload, |
78 | 80 | @Nullable Integer notificationId) |
79 | 81 | { |
| 82 | + // UnspecifiedImmutableFlag is suppressed as the linter can't recognize our conditional |
| 83 | + // Android M immutability flag. |
| 84 | + |
80 | 85 | if (context == null) { |
81 | 86 | throw new IllegalArgumentException("Context cannot be null"); |
82 | 87 | } |
@@ -109,6 +114,8 @@ public static List<NotificationCompat.Action> getSupportActions(@NonNull Context |
109 | 114 |
|
110 | 115 | int actionIntentFlags = PendingIntent.FLAG_ONE_SHOT; |
111 | 116 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
| 117 | + // Remove @SuppressLint("UnspecifiedImmutableFlag") if you ever delete this line, |
| 118 | + // so that the linter can warn appropriately |
112 | 119 | actionIntentFlags = actionIntentFlags | PendingIntent.FLAG_IMMUTABLE; |
113 | 120 | } |
114 | 121 |
|
|
0 commit comments