From 311b2f7cfd2870e65b8416f3a11b7670c05878e4 Mon Sep 17 00:00:00 2001 From: Gabriele M Date: Tue, 4 Jul 2017 19:05:04 +0200 Subject: [PATCH] Replace DB entries on conflict In this way we could add previously unknown info such as the size. --- src/org/lineageos/updater/controller/UpdaterController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/lineageos/updater/controller/UpdaterController.java b/src/org/lineageos/updater/controller/UpdaterController.java index 0e036512..8b3ec0fd 100644 --- a/src/org/lineageos/updater/controller/UpdaterController.java +++ b/src/org/lineageos/updater/controller/UpdaterController.java @@ -138,7 +138,9 @@ public class UpdaterController implements UpdaterControllerInt { if (contentLenght != null) { try { long size = Long.parseLong(contentLenght); - update.setFileSize(size); + if (size > 0) { + update.setFileSize(size); + } } catch (NumberFormatException e) { Log.e(TAG, "Could not get content-length"); } @@ -149,7 +151,7 @@ public class UpdaterController implements UpdaterControllerInt { @Override public void run() { mUpdatesDbHelper.addUpdateWithOnConflict(update, - SQLiteDatabase.CONFLICT_IGNORE); + SQLiteDatabase.CONFLICT_REPLACE); } }).start(); notifyUpdateChange(downloadId);