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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListener.java

Issue 2450353003: android: Histogram for the GSA account change broacast mechanism. (Closed)
Patch Set: Better description + typo. Created 4 years, 1 month 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListener.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListener.java b/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListener.java
index a9b8556df5c699d70d5e76ce68b53d85a0cb7af8..5cc600f35125f0a51609811e6c9b7bb8a1e26b9d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListener.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAAccountChangeListener.java
@@ -13,6 +13,7 @@ import android.os.Bundle;
import org.chromium.base.Callback;
import org.chromium.base.ContextUtils;
+import org.chromium.base.metrics.RecordHistogram;
/**
* Listens to te account change notifications from GSA.
@@ -42,9 +43,9 @@ public class GSAAccountChangeListener {
private int mUsersCount;
private GSAServiceClient mClient;
- /**
- * @return the instance of GSAAccountChangeListener.
- */
+ private boolean mAlreadyReportedHistogram;
+
+ /** @return the instance of GSAAccountChangeListener. */
public static GSAAccountChangeListener getInstance() {
if (sInstance == null) {
Context context = ContextUtils.getApplicationContext();
@@ -106,8 +107,17 @@ public class GSAAccountChangeListener {
Callback<Bundle> onMessageReceived = new Callback<Bundle>() {
@Override
public void onResult(Bundle result) {
- if (result.getBoolean(KEY_SSB_BROADCASTS_ACCOUNT_CHANGE_TO_CHROME)) {
- notifyGsaBroadcastsAccountChanges();
+ boolean supportsBroadcast =
+ result.getBoolean(KEY_SSB_BROADCASTS_ACCOUNT_CHANGE_TO_CHROME);
+ if (supportsBroadcast) notifyGsaBroadcastsAccountChanges();
+ // If GSA doesn't support the broadcast, we connect several times to the service per
+ // Chrome session (since there is a disconnect() call in
+ // ChromeActivity#onStopWithNative()). Only record the histogram once per startup to
+ // avoid skewing the results.
+ if (!mAlreadyReportedHistogram) {
+ RecordHistogram.recordBooleanHistogram(
+ "Search.GsaBroadcastsAccountChanges", supportsBroadcast);
+ mAlreadyReportedHistogram = true;
}
}
};
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698