Chromium Code Reviews| Index: device/bluetooth/bluetooth_device_android.cc |
| diff --git a/device/bluetooth/bluetooth_device_android.cc b/device/bluetooth/bluetooth_device_android.cc |
| index 22c1a0ef99d648820243336368e4de20ec1a4b63..033ed6ca10c48552efb96df241dac9acd7fdc2b2 100644 |
| --- a/device/bluetooth/bluetooth_device_android.cc |
| +++ b/device/bluetooth/bluetooth_device_android.cc |
| @@ -216,9 +216,26 @@ void BluetoothDeviceAndroid::OnConnectionStateChange( |
| // We assume that if there are any pending connection callbacks there |
| // was a failed connection attempt. |
| RecordConnectionFailureResult(status); |
| - // TODO(ortuno): Return an error code based on |status| |
| - // http://crbug.com/578191 |
| - DidFailToConnectGatt(ERROR_FAILED); |
| + |
| + // The following errors are based on errors seen in the wild. |
|
scheib
2017/03/07 06:20:22
I'm wondering if this patch has too many changes a
ortuno
2017/03/08 01:46:10
I think it does. Removed changes to android.
|
| + // They are cross referenced to Android errors, BT Spec errors, |
| + // and Bluedroid error where relevant. |
| + // - Android errors: |
| + // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html |
| + // - BT Spec 5.0 [Vol 2, Part D] 2 Error Code Descriptions |
| + // - Bluedroid: stack/include/gatt_api.h |
| + switch (status) { |
| + case 0x00000000: // Bluedroid: GATT_SUCCESS |
| + case 0x00000085: // Bluedroid: GATT_ERROR |
| + DidFailToConnectGatt(ERROR_FAILED); |
| + return; |
| + case 0x00000087: // Bluedroid GATT_PENDING |
| + DidFailToConnectGatt(ERROR_INPROGRESS); |
| + return; |
| + default: |
| + DidFailToConnectGatt(ERROR_UNKNOWN); |
| + return; |
| + } |
| } else { |
| // Otherwise an existing connection was terminated. |
| RecordConnectionTerminatedResult(status); |