Index: components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedService.java |
diff --git a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedService.java b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedService.java |
index c752d884b1fb67c05c0648f2f4bd1d2de2d90f26..daf433d20a828665c5cfc9610b39d451ad29065f 100644 |
--- a/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedService.java |
+++ b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedService.java |
@@ -27,16 +27,29 @@ public class VariationsSeedService extends IntentService { |
private static final int READ_TIMEOUT = 10000; // time in ms |
private static final int REQUEST_TIMEOUT = 15000; // time in ms |
+ // Static variable that indicates a status of the variations seed fetch. If one request is in |
+ // progress, we do not start another fetch. |
+ private static boolean sFetchInProgress = false; |
+ |
public VariationsSeedService() { |
super(TAG); |
} |
@Override |
public void onHandleIntent(Intent intent) { |
+ // Check if any variations seed fetch is in progress, or the seed has been already fetched, |
+ // or seed has been successfully stored on the C++ side. |
+ if (sFetchInProgress || VariationsSeedBridge.hasJavaPref(getApplicationContext()) |
+ || VariationsSeedBridge.hasNativePref(getApplicationContext())) { |
+ return; |
+ } |
+ sFetchInProgress = true; |
try { |
downloadContent(new URL(VARIATIONS_SERVER_URL)); |
} catch (MalformedURLException e) { |
Log.w(TAG, "Variations server URL is malformed.", e); |
+ } finally { |
+ sFetchInProgress = false; |
} |
} |