diff --git a/app/src/main/java/com/nextcloud/client/jobs/FilesUploadWorker.kt b/app/src/main/java/com/nextcloud/client/jobs/FilesUploadWorker.kt index e174eb9d05..5f7a4c0fcb 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/FilesUploadWorker.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/FilesUploadWorker.kt @@ -207,7 +207,7 @@ class FilesUploadWorker( context, SecureRandom().nextInt(), notificationActionIntent, - PendingIntent.FLAG_MUTABLE + PendingIntent.FLAG_IMMUTABLE ) notificationBuilder diff --git a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java index 28a64c5d97..5188965e81 100644 --- a/app/src/main/java/com/owncloud/android/files/services/FileUploader.java +++ b/app/src/main/java/com/owncloud/android/files/services/FileUploader.java @@ -207,6 +207,8 @@ public class FileUploader extends Service private Account mCurrentAccount; private FileDataStorageManager mStorageManager; + private SecureRandom secureRandomGenerator = new SecureRandom(); + @Inject UserAccountManager accountManager; @Inject UploadsStorageManager mUploadsStorageManager; @Inject ConnectivityService connectivityService; @@ -237,6 +239,7 @@ public class FileUploader extends Service /** * Service initialization */ + @SuppressFBWarnings("ST") @Override public void onCreate() { super.onCreate(); @@ -284,6 +287,7 @@ public class FileUploader extends Service /** * Service clean up */ + @SuppressFBWarnings("ST") @Override public void onDestroy() { Log_OC.v(TAG, "Destroying service"); @@ -713,7 +717,7 @@ public class FileUploader extends Service notificationActionIntent.putExtra(EXTRA_REMOTE_PATH,upload.getRemotePath()); notificationActionIntent.setAction(ACTION_CANCEL_BROADCAST); - PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(),new SecureRandom().nextInt(),notificationActionIntent, PendingIntent.FLAG_MUTABLE); + PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(),secureRandomGenerator.nextInt(),notificationActionIntent, PendingIntent.FLAG_IMMUTABLE); mLastPercent = 0; mNotificationBuilder = NotificationUtils.newNotificationBuilder(this, viewThemeUtils); mNotificationBuilder @@ -869,7 +873,7 @@ public class FileUploader extends Service mNotificationBuilder.setContentText(content); if (!uploadResult.isSuccess()) { - mNotificationManager.notify((new SecureRandom()).nextInt(), mNotificationBuilder.build()); + mNotificationManager.notify(secureRandomGenerator.nextInt(), mNotificationBuilder.build()); } } }