Skip to content

Commit

Permalink
improve usage of random, ignore findbugs since notification Ids are f…
Browse files Browse the repository at this point in the history
…ine to be predictable

Signed-off-by: Andy Scherzinger <[email protected]>
  • Loading branch information
AndyScherzinger committed Jan 16, 2019
1 parent 8c44b94 commit bbeacbf
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit bbeacbf

Please sign in to comment.