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 63b25af5af7f11f0b7109d85a1040b695166f459..d089d1e6016f637dd1ffded8e64e765f5e886ba7 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 |
@@ -20,7 +20,9 @@ import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager |
public class PhysicalWeb { |
public static final int OPTIN_NOTIFY_MAX_TRIES = 1; |
private static final String PREF_PHYSICAL_WEB_NOTIFY_COUNT = "physical_web_notify_count"; |
+ private static final String PREF_IGNORE_OTHER_CLIENTS = "physical_web_ignore_other_clients"; |
private static final String FEATURE_NAME = "PhysicalWeb"; |
+ private static final String IGNORE_OTHER_CLIENTS_FEATURE_NAME = "PhysicalWebIgnoreOtherClients"; |
private static final int MIN_ANDROID_VERSION = 18; |
/** |
@@ -78,6 +80,15 @@ public class PhysicalWeb { |
} |
/** |
+ * Returns true if we should fire notifications regardless of the existence of other Physical |
+ * Web clients. |
+ * This method is for use when the native library is not available. |
+ */ |
+ public static boolean shouldIgnoreOtherClients() { |
+ return ContextUtils.getAppSharedPreferences().getBoolean(PREF_IGNORE_OTHER_CLIENTS, false); |
+ } |
+ |
+ /** |
* Increments a value tracking how many times we've shown the Physical Web |
* opt-in notification. |
* |
@@ -112,6 +123,11 @@ public class PhysicalWeb { |
// loaded. This is always the case on chrome startup. |
if (featureIsEnabled() |
&& (isPhysicalWebPreferenceEnabled(application) || isOnboarding(application))) { |
+ boolean ignoreOtherClients = |
+ ChromeFeatureList.isEnabled(IGNORE_OTHER_CLIENTS_FEATURE_NAME); |
+ ContextUtils.getAppSharedPreferences().edit() |
+ .putBoolean(PREF_IGNORE_OTHER_CLIENTS, ignoreOtherClients) |
+ .apply(); |
startPhysicalWeb(application); |
PhysicalWebUma.uploadDeferredMetrics(application); |
} else { |