Commit 677c76b8 authored by Robbie McElrath's avatar Robbie McElrath Committed by Commit Bot

[AW] Add INFO logs about important seed fetching events

This adds logging on debug builds of android for the following events:
 * Requesting a new seed from the service
 * Scheduling a new download job within the service
 * Downloading a new seed
 * Copying a seed to an app's data directory
 * Loading a seed and its age

I believe this will be enough information to verify that the system is
behaving as expected and to narrow down where the problem is if things
aren't working.

Test: Manually verify the logs are being printed.
Bug: 1042895
Change-Id: I1f6ec28c2cdc970db419bcc9b73ee0375221f2b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2006109
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Reviewed-by: default avatarNate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733055}
parent 8588c8b6
......@@ -356,6 +356,7 @@ public class VariationsSeedLoader {
return;
}
VariationsUtils.debugLog("Requesting new seed from IVariationsSeedServer");
SeedServerConnection connection = new SeedServerConnection(newSeedFd, oldSeedDate);
connection.start();
}
......@@ -374,6 +375,8 @@ public class VariationsSeedLoader {
if (seed != null) {
AwVariationsSeedBridge.setSeed(seed);
AwVariationsSeedBridge.setLoadedSeedFresh(isLoadedSeedFresh());
long seedAge = TimeUnit.MILLISECONDS.toSeconds(new Date().getTime() - seed.date);
VariationsUtils.debugLog("Loaded seed with age " + seedAge + "s");
}
}
}
......@@ -10,6 +10,7 @@ import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import org.chromium.android_webview.proto.AwVariationsSeedOuterClass.AwVariationsSeed;
import org.chromium.base.BuildInfo;
import org.chromium.base.Log;
import org.chromium.base.PathUtils;
import org.chromium.components.variations.firstrun.VariationsSeedFetcher.SeedInfo;
......@@ -155,4 +156,11 @@ public class VariationsUtils {
closeSafely(out);
}
}
// Logs an INFO message if running in a debug build of Android.
public static void debugLog(String message) {
if (BuildInfo.isDebugAndroid()) {
Log.i(TAG, message);
}
}
}
......@@ -87,6 +87,7 @@ public class AwVariationsSeedFetcher extends JobService {
// Check if it's already scheduled.
if (getPendingJob(scheduler, JOB_ID) != null) {
VariationsUtils.debugLog("Seed download job already scheduled");
return;
}
......@@ -95,10 +96,12 @@ public class AwVariationsSeedFetcher extends JobService {
if (lastRequestTime != 0) {
long now = (new Date()).getTime();
if (now < lastRequestTime + MIN_JOB_PERIOD_MILLIS) {
VariationsUtils.debugLog("Throttling seed download job");
return;
}
}
VariationsUtils.debugLog("Scheduling seed download job");
ComponentName thisComponent = new ComponentName(
ContextUtils.getApplicationContext(), AwVariationsSeedFetcher.class);
JobInfo job = new JobInfo.Builder(JOB_ID, thisComponent)
......@@ -125,6 +128,7 @@ public class AwVariationsSeedFetcher extends JobService {
try {
VariationsUtils.updateStampTime();
VariationsUtils.debugLog("Downloading new seed");
VariationsSeedFetcher downloader =
sMockDownloader != null ? sMockDownloader : VariationsSeedFetcher.get();
String milestone = String.valueOf(VersionConstants.PRODUCT_MAJOR_VERSION);
......
......@@ -81,6 +81,7 @@ public class VariationsSeedHolder {
if (VariationsSeedHolder.this.mSeed == null) return;
if (mDestinationDate < VariationsSeedHolder.this.mSeed.date) {
VariationsUtils.debugLog("Writing new seed to app's data directory");
writeSeedWithoutClosing(VariationsSeedHolder.this.mSeed, mDestination);
}
} finally {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment