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

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

Issue 2641973003: Implement server-suggested update check backoff (Closed)
Patch Set: 2 Created 3 years, 10 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 cc68e6613d0150ec72614748a25ad2855164633c..ca5bc6fe25b18da93ce0bce9eb743463f2f854e8 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
@@ -61,6 +61,9 @@ public class WebappDataStorage {
// The number of times that updating a WebAPK in the background has been requested.
static final String KEY_UPDATE_REQUESTED = "update_requested";
+ // Whether to check updates less frequently.
+ static final String KEY_INFREQUENT_UPDATES = "infrequent_updates";
+
// 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;
@@ -305,6 +308,7 @@ public class WebappDataStorage {
editor.remove(KEY_LAST_WEBAPK_UPDATE_REQUEST_COMPLETE_TIME);
editor.remove(KEY_DID_LAST_WEBAPK_UPDATE_REQUEST_SUCCEED);
editor.remove(KEY_UPDATE_REQUESTED);
+ editor.remove(KEY_INFREQUENT_UPDATES);
editor.apply();
}
@@ -390,7 +394,7 @@ public class WebappDataStorage {
}
/**
- * Updates the result of whether the last update request to WebAPK Server succeeded.
+ * Updates whether the last update request to WebAPK Server succeeded.
*/
void updateDidLastWebApkUpdateRequestSucceed(boolean success) {
mPreferences.edit()
@@ -426,6 +430,20 @@ public class WebappDataStorage {
return mPreferences.getInt(KEY_UPDATE_REQUESTED, 0);
}
+ /**
+ * Updates whether to check updates less frequently.
+ */
+ void updateInfrequentUpdates(boolean isInfrequentUpdates) {
pkotwicz 2017/02/14 00:15:12 I can't think of a good name for the setter. Perha
dominickn 2017/02/14 04:13:34 setRelaxedUpdates()?
Xi Han 2017/02/14 22:25:46 Done.
+ mPreferences.edit().putBoolean(KEY_INFREQUENT_UPDATES, isInfrequentUpdates).apply();
+ }
+
+ /**
+ * Returns whether to check updates less frequently.
+ */
+ boolean getInfrequentUpdates() {
dominickn 2017/02/14 04:13:34 shouldRelaxUpdates()?
Xi Han 2017/02/14 22:25:46 I would still prefer to name it getRelaxUpdates().
+ return mPreferences.getBoolean(KEY_INFREQUENT_UPDATES, false);
+ }
+
protected WebappDataStorage(String webappId) {
mId = webappId;
mPreferences = ContextUtils.getApplicationContext().getSharedPreferences(

Powered by Google App Engine
This is Rietveld 408576698