diff --git a/src/main/java/com/owncloud/android/jobs/MediaFoldersDetectionJob.java b/src/main/java/com/owncloud/android/jobs/MediaFoldersDetectionJob.java index 2431bd16c504..099ebdd6f463 100644 --- a/src/main/java/com/owncloud/android/jobs/MediaFoldersDetectionJob.java +++ b/src/main/java/com/owncloud/android/jobs/MediaFoldersDetectionJob.java @@ -56,6 +56,7 @@ import androidx.annotation.NonNull; import androidx.core.app.NotificationCompat; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; public class MediaFoldersDetectionJob extends Job { public static final String TAG = "MediaFoldersDetectionJob"; @@ -69,6 +70,12 @@ public class MediaFoldersDetectionJob extends Job { private static final String DISABLE_DETECTION_CLICK = "DISABLE_DETECTION_CLICK"; + @SuppressFBWarnings( + value = "PREDICTABLE_RANDOM", + justification = "Only used for notification id, so predictability is no issue here." + ) + private Random randomId = new Random(); + @NonNull @Override protected Result onRunJob(@NonNull Params params) { @@ -150,7 +157,7 @@ protected Result onRunJob(@NonNull Params params) { } private void sendNotification(String contentTitle, String subtitle, Account account, String path, int type) { - int notificationId = new Random().nextInt(); + int notificationId = randomId.nextInt(); Context context = getContext(); Intent intent = new Intent(getContext(), SyncedFoldersActivity.class);