Index: device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java |
diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java |
index a03283f36af0444a783e4ceee4c6f3631bad5368..64510c14514e1c0468626034734dfa3354ddcd68 100644 |
--- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java |
+++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java |
@@ -185,12 +185,15 @@ final class ChromeBluetoothAdapter extends BroadcastReceiver { |
// Implementation details: |
/** |
- * @return true if Chromium has permission to scan for Bluetooth devices. |
+ * @return true if Chromium has permission to scan for Bluetooth devices and location services |
+ * are on. |
*/ |
private boolean canScan() { |
Wrappers.ContextWrapper context = mAdapter.getContext(); |
+ boolean havePermission = context.hasAndroidLocationPermission(); |
+ boolean locationServicesOn = context.isSystemLocationSettingEnabled(); |
- return context.hasAndroidLocationPermission(); |
+ return havePermission && locationServicesOn; |
} |
private void registerBroadcastReceiver() { |