Bug 1131935 - remove cached paired device once Bond state was changed to BT_STATUS_AUTH_FAILURE, r=shuang, a=2.0m+
authorWill Wang <wiwang@mozilla.com>
Tue, 31 Mar 2015 15:53:27 +0800
changeset 204760 e5ffcbd115cd
parent 204759 c1b2d56b1885
child 204761 51d8d4584b47
push id155
push userkli@mozilla.com
push date2015-03-31 07:54 +0000
treeherdermozilla-b2g32_v2_0m@e5ffcbd115cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshuang, 2
bugs1131935
milestone32.0
Bug 1131935 - remove cached paired device once Bond state was changed to BT_STATUS_AUTH_FAILURE, r=shuang, a=2.0m+
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
@@ -827,17 +827,24 @@ BondStateChangedCallback(bt_status_t aSt
       // Redirect to main thread to avoid racing problem
       NS_DispatchToMainThread(
         new BondStateChangedCallbackTask(remoteBdAddress, bonded));
       break;
     }
     case BT_STATUS_BUSY:
     case BT_STATUS_AUTH_FAILURE:
     case BT_STATUS_RMT_DEV_DOWN:
+    case BT_STATUS_FAIL:
     {
+      if (BT_STATUS_AUTH_FAILURE == aStatus) {
+        if (sAdapterBondedAddressArray.Contains(remoteBdAddress)) {
+          sAdapterBondedAddressArray.RemoveElement(remoteBdAddress);
+        }
+      }
+
       InfallibleTArray<BluetoothNamedValue> propertiesArray;
       BluetoothSignal signal(NS_LITERAL_STRING("Cancel"),
                              NS_LITERAL_STRING(KEY_LOCAL_AGENT),
                              BluetoothValue(propertiesArray));
       nsRefPtr<DistributeBluetoothSignalTask>
         t = new DistributeBluetoothSignalTask(signal);
       if (NS_FAILED(NS_DispatchToMainThread(t))) {
         BT_WARNING("Failed to dispatch to main thread!");