mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 21:25:35 +03:00
replace Random with SecureRandom and ignore Spotbugs warnign about randomness (just creating Notification IDs)
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
4c77c6ad51
commit
8bf657ce27
2 changed files with 8 additions and 4 deletions
|
@ -69,11 +69,11 @@ import com.owncloud.android.utils.MimeTypeUtil;
|
|||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.AbstractList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
@ -81,6 +81,7 @@ import javax.inject.Inject;
|
|||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import dagger.android.AndroidInjection;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
public class FileDownloader extends Service
|
||||
implements OnDatatransferProgressListener, OnAccountsUpdateListener {
|
||||
|
@ -614,6 +615,7 @@ public class FileDownloader extends Service
|
|||
* @param downloadResult Result of the download operation.
|
||||
* @param download Finished download operation
|
||||
*/
|
||||
@SuppressFBWarnings("DMI")
|
||||
private void notifyDownloadResult(DownloadFileOperation download,
|
||||
RemoteOperationResult downloadResult) {
|
||||
if (mNotificationManager == null) {
|
||||
|
@ -653,7 +655,7 @@ public class FileDownloader extends Service
|
|||
download, getResources()));
|
||||
|
||||
if (mNotificationManager != null) {
|
||||
mNotificationManager.notify((new Random()).nextInt(), mNotificationBuilder.build());
|
||||
mNotificationManager.notify((new SecureRandom()).nextInt(), mNotificationBuilder.build());
|
||||
|
||||
// Remove success notification
|
||||
if (downloadResult.isSuccess()) {
|
||||
|
|
|
@ -80,11 +80,11 @@ import com.owncloud.android.utils.ErrorMessageAdapter;
|
|||
import com.owncloud.android.utils.theme.ThemeColorUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
@ -93,6 +93,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import dagger.android.AndroidInjection;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
/**
|
||||
* Service for uploading files. Invoke using context.startService(...).
|
||||
|
@ -745,6 +746,7 @@ public class FileUploader extends Service
|
|||
* @param uploadResult Result of the upload operation.
|
||||
* @param upload Finished upload operation
|
||||
*/
|
||||
@SuppressFBWarnings("DMI")
|
||||
private void notifyUploadResult(UploadFileOperation upload, RemoteOperationResult uploadResult) {
|
||||
Log_OC.d(TAG, "NotifyUploadResult with resultCode: " + uploadResult.getCode());
|
||||
// cancelled operation or success -> silent removal of progress notification
|
||||
|
@ -826,7 +828,7 @@ public class FileUploader extends Service
|
|||
|
||||
mNotificationBuilder.setContentText(content);
|
||||
if(!uploadResult.isSuccess()){
|
||||
mNotificationManager.notify((new Random()).nextInt(), mNotificationBuilder.build());
|
||||
mNotificationManager.notify((new SecureRandom()).nextInt(), mNotificationBuilder.build());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue