Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4b3f874 authored by Gabriele M's avatar Gabriele M
Browse files

Append random ID to temporary json file names

Multiple update list downloads can happen simultaneously. Use
unique file names for the temporary jsons to avoid conflicts.

Change-Id: I751c9838394e1f5aebbe359f61532947b429f39b
parent d450bca3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class UpdatesActivity extends UpdatesListActivity {

@@ -317,7 +318,7 @@ public class UpdatesActivity extends UpdatesListActivity {

    private void downloadUpdatesList(final boolean manualRefresh) {
        final File jsonFile = Utils.getCachedUpdateList(this);
        final File jsonFileTmp = new File(jsonFile.getAbsolutePath() + ".tmp");
        final File jsonFileTmp = new File(jsonFile.getAbsolutePath() + UUID.randomUUID());
        String url = Utils.getServerURL(this);
        Log.d(TAG, "Checking " + url);

+2 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.UUID;

public class UpdatesCheckReceiver extends BroadcastReceiver {

@@ -70,7 +71,7 @@ public class UpdatesCheckReceiver extends BroadcastReceiver {
        }

        final File json = Utils.getCachedUpdateList(context);
        final File jsonNew = new File(json.getAbsolutePath() + ".tmp");
        final File jsonNew = new File(json.getAbsolutePath() + UUID.randomUUID());
        String url = Utils.getServerURL(context);
        DownloadClient.DownloadCallback callback = new DownloadClient.DownloadCallback() {
            @Override