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

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

Issue 1610053005: bluetooth: android: Fix a couple of crashes when adapter is turned on/off. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 0774ea2401b20049095213c710fc17c5970db0a5..51cb5c5c7cbc8390c940946c59631466271b854d 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
@@ -200,6 +200,9 @@ final class ChromeBluetoothAdapter {
} catch (IllegalArgumentException e) {
Log.e(TAG, "Cannot start scan: " + e);
return false;
+ } catch (IllegalStateException e) {
scheib 2016/01/21 05:33:51 Add a test: - In Fakes.java have FakeBluetoothLeSc
+ Log.e(TAG, "Adapter is off. Cannot start scan: " + e);
+ return false;
}
return true;
}
@@ -218,6 +221,10 @@ final class ChromeBluetoothAdapter {
Log.e(TAG, "Cannot stop scan: " + e);
mScanCallback = null;
return false;
+ } catch (IllegalStateException e) {
+ Log.e(TAG, "Adapter is off. Cannot stop scan: " + e);
+ mScanCallback = null;
+ return false;
}
mScanCallback = null;
return true;

Powered by Google App Engine
This is Rietveld 408576698