| Index: device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java
|
| diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java
|
| index 5ef691323b78b9b97b3d95102d4951adb5d92fab..ee60580c4d72dbfcd1a66c99d9a08d26c85c7469 100644
|
| --- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java
|
| +++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/ChromeBluetoothDevice.java
|
| @@ -126,26 +126,27 @@ final class ChromeBluetoothDevice {
|
| (newState == android.bluetooth.BluetoothProfile.STATE_CONNECTED)
|
| ? "Connected"
|
| : "Disconnected");
|
| - if (newState == android.bluetooth.BluetoothProfile.STATE_CONNECTED) {
|
| - RecordHistogram.recordSparseSlowlyHistogram(
|
| - "Bluetooth.Web.Android.onConnectionStateChange.Status.Connected", status);
|
| - mBluetoothGatt.discoverServices();
|
| - } else if (newState == android.bluetooth.BluetoothProfile.STATE_DISCONNECTED) {
|
| - RecordHistogram.recordSparseSlowlyHistogram(
|
| - "Bluetooth.Web.Android.onConnectionStateChange.Status.Disconnected",
|
| - status);
|
| - if (mBluetoothGatt != null) {
|
| - mBluetoothGatt.close();
|
| - mBluetoothGatt = null;
|
| - }
|
| - } else {
|
| - RecordHistogram.recordSparseSlowlyHistogram(
|
| - "Bluetooth.Web.Android.onConnectionStateChange.Status.InvalidState",
|
| - status);
|
| - }
|
| Wrappers.ThreadUtilsWrapper.getInstance().runOnUiThread(new Runnable() {
|
| @Override
|
| public void run() {
|
| + if (newState == android.bluetooth.BluetoothProfile.STATE_CONNECTED) {
|
| + RecordHistogram.recordSparseSlowlyHistogram(
|
| + "Bluetooth.Web.Android.onConnectionStateChange.Status.Connected",
|
| + status);
|
| + mBluetoothGatt.discoverServices();
|
| + } else if (newState == android.bluetooth.BluetoothProfile.STATE_DISCONNECTED) {
|
| + RecordHistogram.recordSparseSlowlyHistogram(
|
| + "Bluetooth.Web.Android.onConnectionStateChange.Status.Disconnected",
|
| + status);
|
| + if (mBluetoothGatt != null) {
|
| + mBluetoothGatt.close();
|
| + mBluetoothGatt = null;
|
| + }
|
| + } else {
|
| + RecordHistogram.recordSparseSlowlyHistogram(
|
| + "Bluetooth.Web.Android.onConnectionStateChange.Status.InvalidState",
|
| + status);
|
| + }
|
| if (mNativeBluetoothDeviceAndroid != 0) {
|
| nativeOnConnectionStateChange(mNativeBluetoothDeviceAndroid, status,
|
| newState == android.bluetooth.BluetoothProfile.STATE_CONNECTED);
|
|
|