Replace instances of new Date().getTime() with System.currentTimeMillis()
This commit is contained in:
parent
88a86a14c3
commit
0b2c2e4692
2 changed files with 2 additions and 2 deletions
|
@ -95,7 +95,7 @@ public class AttachmentTempFileProvider extends FileProvider {
|
||||||
public static boolean deleteOldTemporaryFiles(Context context) {
|
public static boolean deleteOldTemporaryFiles(Context context) {
|
||||||
File tempDirectory = getTempFileDirectory(context);
|
File tempDirectory = getTempFileDirectory(context);
|
||||||
boolean allFilesDeleted = true;
|
boolean allFilesDeleted = true;
|
||||||
long deletionThreshold = new Date().getTime() - FILE_DELETE_THRESHOLD_MILLISECONDS;
|
long deletionThreshold = System.currentTimeMillis() - FILE_DELETE_THRESHOLD_MILLISECONDS;
|
||||||
for (File tempFile : tempDirectory.listFiles()) {
|
for (File tempFile : tempDirectory.listFiles()) {
|
||||||
long lastModified = tempFile.lastModified();
|
long lastModified = tempFile.lastModified();
|
||||||
if (lastModified < deletionThreshold) {
|
if (lastModified < deletionThreshold) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class DecryptedFileProvider extends FileProvider {
|
||||||
public static boolean deleteOldTemporaryFiles(Context context) {
|
public static boolean deleteOldTemporaryFiles(Context context) {
|
||||||
File tempDirectory = getDecryptedTempDirectory(context);
|
File tempDirectory = getDecryptedTempDirectory(context);
|
||||||
boolean allFilesDeleted = true;
|
boolean allFilesDeleted = true;
|
||||||
long deletionThreshold = new Date().getTime() - FILE_DELETE_THRESHOLD_MILLISECONDS;
|
long deletionThreshold = System.currentTimeMillis() - FILE_DELETE_THRESHOLD_MILLISECONDS;
|
||||||
for (File tempFile : tempDirectory.listFiles()) {
|
for (File tempFile : tempDirectory.listFiles()) {
|
||||||
long lastModified = tempFile.lastModified();
|
long lastModified = tempFile.lastModified();
|
||||||
if (lastModified < deletionThreshold) {
|
if (lastModified < deletionThreshold) {
|
||||||
|
|
Loading…
Reference in a new issue