Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/android/AdblockPlus.java

Issue 5153282527854592: Issue 98 - Use the libadblockplus update mechanism (Closed)
Patch Set: Only append the revision to the version for devbuilds Created Sept. 26, 2014, 2:54 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/org/adblockplus/android/AdblockPlus.java
===================================================================
--- a/src/org/adblockplus/android/AdblockPlus.java
+++ b/src/org/adblockplus/android/AdblockPlus.java
@@ -23,20 +23,15 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.util.Calendar;
import java.util.List;
-import java.util.TimeZone;
import java.util.regex.Pattern;
-import org.adblockplus.android.updater.AlarmReceiver;
import org.adblockplus.libadblockplus.FilterEngine.ContentType;
import org.apache.commons.lang.StringUtils;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
-import android.app.AlarmManager;
import android.app.Application;
-import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -63,10 +58,6 @@
private static final Pattern RE_HTML = Pattern.compile("\\.html?$", Pattern.CASE_INSENSITIVE);
/**
- * Update notification id.
- */
- public static final int UPDATE_NOTIFICATION_ID = R.string.app_name + 1;
- /**
* Broadcasted when filtering is enabled or disabled.
*/
public static final String BROADCAST_FILTERING_CHANGE = "org.adblockplus.android.filtering.status";
@@ -424,41 +415,6 @@
abpEngine.checkForUpdates();
}
- /**
- * Sets Alarm to call updater after specified number of minutes or after one
- * day if
- * minutes are set to 0.
- *
- * @param minutes
- * number of minutes to wait
- */
- public void scheduleUpdater(final int minutes)
- {
- final Calendar updateTime = Calendar.getInstance();
-
- if (minutes == 0)
- {
- // Start update checks at 10:00 GMT...
- updateTime.setTimeZone(TimeZone.getTimeZone("GMT"));
- updateTime.set(Calendar.HOUR_OF_DAY, 10);
- updateTime.set(Calendar.MINUTE, 0);
- // ...next day
- updateTime.add(Calendar.HOUR_OF_DAY, 24);
- // Spread out the “mass downloading” for 6 hours
- updateTime.add(Calendar.MINUTE, (int) (Math.random() * 60 * 6));
- }
- else
- {
- updateTime.add(Calendar.MINUTE, minutes);
- }
-
- final Intent updater = new Intent(this, AlarmReceiver.class);
- final PendingIntent recurringUpdate = PendingIntent.getBroadcast(this, 0, updater, PendingIntent.FLAG_CANCEL_CURRENT);
- // Set non-waking alarm
- final AlarmManager alarms = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
- alarms.set(AlarmManager.RTC, updateTime.getTimeInMillis(), recurringUpdate);
- }
-
@Override
public void onCreate()
{
@@ -499,8 +455,5 @@
// Set crash handler
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(this));
-
- // Initiate update check
- scheduleUpdater(0);
}
}
« no previous file with comments | « src/org/adblockplus/android/ABPEngine.java ('k') | src/org/adblockplus/android/AndroidUpdateAvailableCallback.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld