| 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 6a9f4c3bc4b9df7dfb9ce2b63dce12f80b479347..44fb86996238524872c4e2e7e081f23701d9d2ab 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
|
| @@ -40,6 +40,17 @@ public class PhysicalWeb {
|
| }
|
|
|
| /**
|
| + * Checks Physical Web prerequisites.
|
| + * @return whether we have the necessary permissions to begin Physical Web scanning.
|
| + */
|
| + public static boolean hasPrerequisites() {
|
| + LocationUtils locationUtils = LocationUtils.getInstance();
|
| + return featureIsEnabled()
|
| + && locationUtils.hasAndroidLocationPermission()
|
| + && locationUtils.isSystemLocationSettingEnabled();
|
| + }
|
| +
|
| + /**
|
| * Checks whether the Physical Web preference is switched to On.
|
| *
|
| * @return boolean {@code true} if the preference is On.
|
| @@ -63,12 +74,7 @@ public class PhysicalWeb {
|
| * At the moment, this only enables URL discovery over BLE.
|
| */
|
| public static void startPhysicalWeb() {
|
| - // Only subscribe to Nearby if we have the location permission.
|
| - LocationUtils locationUtils = LocationUtils.getInstance();
|
| - if (locationUtils.hasAndroidLocationPermission()
|
| - && locationUtils.isSystemLocationSettingEnabled()) {
|
| - new NearbyBackgroundSubscription(NearbySubscription.SUBSCRIBE).run();
|
| - }
|
| + new NearbyBackgroundSubscription(NearbySubscription.SUBSCRIBE).run();
|
| }
|
|
|
| /**
|
| @@ -117,7 +123,7 @@ public class PhysicalWeb {
|
| * Performs various Physical Web operations that should happen on startup.
|
| */
|
| public static void onChromeStart() {
|
| - if (!featureIsEnabled()) {
|
| + if (!hasPrerequisites()) {
|
| stopPhysicalWeb();
|
| return;
|
| }
|
|
|