Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4403)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java

Issue 2790213004: Don't try to update incessently when Shell APK version is out of date. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java
index 3aafbd3bec438d2d145808aba95ddb28c4857f52..b1ae7da7f0e3f120f5d4f21d6a14b6f08c0e5677 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java
@@ -74,6 +74,10 @@ public class WebappDataStorage {
// server if the previous update attempt failed.
public static final long RETRY_UPDATE_DURATION = TimeUnit.HOURS.toMillis(12L);
+ // Number of milliseconds to wait before re-questing an update for shell APK if the previous
+ // update attempt failed.
+ public static final long RETRY_SHELL_APK_UPDATE_DURATION = TimeUnit.DAYS.toMillis(2L);
+
// Unset/invalid constants for last used times and URLs. 0 is used as the null last used time as
// WebappRegistry assumes that this is always a valid timestamp.
static final long LAST_USED_UNSET = 0;
@@ -474,6 +478,13 @@ public class WebappDataStorage {
&& !didPreviousUpdateSucceed();
}
+ /** Returns whether we should request shell APK update. */
+ boolean shouldRequestShellApkUpdate() {
+ long sinceLastRequestDurationMs =
+ sClock.currentTimeMillis() - getLastWebApkUpdateRequestCompletionTime();
+ return sinceLastRequestDurationMs >= RETRY_SHELL_APK_UPDATE_DURATION;
+ }
+
protected WebappDataStorage(String webappId) {
mId = webappId;
mPreferences = ContextUtils.getApplicationContext().getSharedPreferences(

Powered by Google App Engine
This is Rietveld 408576698