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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java

Issue 1814213004: Record UMA for Physical Web state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Included utils.java in gn build Created 4 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/physicalweb/PhysicalWeb.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
index 0ae107c5951519fa916c3040c093cdb50a91cfb2..ac46a854e24e73f6a5f740c5122726fc25b74f68 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
@@ -55,17 +55,6 @@ public class PhysicalWeb {
}
/**
- * Evaluate whether the Physical Web should be enabled when the application starts.
- *
- * @param context An instance of android.content.Context
- * @return true if the Physical Web should be started at launch
- */
- public static boolean shouldStartOnLaunch(Context context) {
- return featureIsEnabled()
- && (isPhysicalWebPreferenceEnabled(context) || isOnboarding(context));
- }
-
- /**
* Start the Physical Web feature.
* At the moment, this only enables URL discovery over BLE.
* @param application An instance of {@link ChromeApplication}, used to get the
@@ -89,15 +78,6 @@ public class PhysicalWeb {
}
/**
- * Upload the collected UMA stats.
- * This method should be called only when the native library is loaded.
- * @param context A valid instance of Context.
- */
- public static void uploadDeferredMetrics(final Context context) {
- PhysicalWebUma.uploadDeferredMetrics(context);
- }
-
- /**
* Increments a value tracking how many times we've shown the Physical Web
* opt-in notification.
*
@@ -123,6 +103,23 @@ public class PhysicalWeb {
return sharedPreferences.getInt(PREF_PHYSICAL_WEB_NOTIFY_COUNT, 0);
}
+ /**
+ * Perform various Physical Web operations that should happen on startup.
+ * @param application An instance of {@link ChromeApplication}.
+ */
+ public static void onChromeStart(ChromeApplication application) {
+ // The PhysicalWebUma calls in this method should be called only when the native library is
+ // loaded. This is always the case on chrome startup.
+ PhysicalWebUma.onChromeStart(application);
+ if (featureIsEnabled()
+ && (isPhysicalWebPreferenceEnabled(application) || isOnboarding(application))) {
+ startPhysicalWeb(application);
+ PhysicalWebUma.uploadDeferredMetrics(application);
+ } else {
+ stopPhysicalWeb(application);
+ }
+ }
+
private static void clearUrlsAsync(final Context context) {
Runnable task = new Runnable() {
@Override

Powered by Google App Engine
This is Rietveld 408576698