From 75befd1738357b9e33fd31c0f1ca2ad80917efb0 Mon Sep 17 00:00:00 2001 From: Gabriele M Date: Mon, 17 Jul 2017 00:30:14 +0200 Subject: [PATCH] Always cleanup the download directory This shouldn't really be necessary since the cleanup is needed after the application data has been wiped, which by default has the automatic updates check enabled. --- src/org/lineageos/updater/UpdatesCheckReceiver.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/lineageos/updater/UpdatesCheckReceiver.java b/src/org/lineageos/updater/UpdatesCheckReceiver.java index e3fbfff..3d21aaf 100644 --- a/src/org/lineageos/updater/UpdatesCheckReceiver.java +++ b/src/org/lineageos/updater/UpdatesCheckReceiver.java @@ -44,6 +44,10 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { + if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { + Utils.cleanupDownloadsDir(context); + } + final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); if (!preferences.getBoolean(Constants.PREF_AUTO_UPDATES_CHECK, true)) { @@ -53,8 +57,6 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { // Set a repeating alarm on boot to check for new updates once per day scheduleRepeatingUpdatesCheck(context); - - Utils.cleanupDownloadsDir(context); } long lastCheck = preferences.getLong(Constants.PREF_LAST_UPDATE_CHECK, -1);