| 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
|
|
|