Fix recently introduced automatic repo scan bug

This commit is contained in:
Ciaran Gultnieks 2012-09-25 22:20:30 +01:00
parent 222001f14d
commit 8415cc2e0a

View File

@ -88,15 +88,19 @@ public class UpdateService extends IntentService {
// See if it's time to actually do anything yet... // See if it's time to actually do anything yet...
if (receiver == null) { if (receiver == null) {
long lastUpdate = prefs.getLong("lastUpdateCheck", long lastUpdate = prefs.getLong("lastUpdateCheck", 0);
System.currentTimeMillis());
String sint = prefs.getString("updateInterval", "0"); String sint = prefs.getString("updateInterval", "0");
int interval = Integer.parseInt(sint); int interval = Integer.parseInt(sint);
if (interval == 0) if (interval == 0) {
Log.d("FDroid", "Skipping update - disabled");
return; return;
if (lastUpdate + (interval * 60 * 60) > System }
.currentTimeMillis()) long elapsed = System.currentTimeMillis() - lastUpdate;
if (elapsed < interval * 60 * 60) {
Log.d("FDroid", "Skipping update - done " + elapsed
+ "ms ago, interval is " + interval + " hours");
return; return;
}
} }
boolean notify = prefs.getBoolean("updateNotify", false); boolean notify = prefs.getBoolean("updateNotify", false);