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

Unified Diff: device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothAdapter.java

Issue 2102813002: If location services are turned off, have the BT chooser prompt the user to turn them on. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-fix-testing
Patch Set: Address tedchoc's comments Created 4 years, 6 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: 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 8659685aed718444c70c662810ac26420241f570..7367e2f62d534c635393432c18e145551bb9a519 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
@@ -205,12 +205,17 @@ 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() {
Context context = mAdapter.getContext();
- return LocationUtils.getInstance().hasAndroidLocationPermission(context);
+ boolean havePermission = LocationUtils.getInstance().hasAndroidLocationPermission(context);
+ boolean locationServicesOn =
+ LocationUtils.getInstance().isSystemLocationSettingEnabled(context);
+
+ return havePermission && locationServicesOn;
}
private void registerBroadcastReceiver() {

Powered by Google App Engine
This is Rietveld 408576698