Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e62e68a3 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Android (Google) Code Review
Browse files

Merge "Bluetooth: Add handling TERMINATED_POWER_OFF error code" into tm-qpr-dev

parents 0ee3c328 4eccfaa7
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -4645,6 +4645,8 @@ public class AdapterService extends Service {
                return BluetoothStatusCodes.ERROR_DISCONNECT_REASON_BAD_PARAMETERS;
                return BluetoothStatusCodes.ERROR_DISCONNECT_REASON_BAD_PARAMETERS;
            case /*HCI_ERR_PEER_USER*/ 0x13:
            case /*HCI_ERR_PEER_USER*/ 0x13:
                return BluetoothStatusCodes.ERROR_DISCONNECT_REASON_REMOTE_REQUEST;
                return BluetoothStatusCodes.ERROR_DISCONNECT_REASON_REMOTE_REQUEST;
            case /*HCI_ERR_REMOTE_POWER_OFF*/ 0x15:
                return BluetoothStatusCodes.ERROR_DISCONNECT_REASON_REMOTE_REQUEST;
            case /*HCI_ERR_CONN_CAUSE_LOCAL_HOST*/ 0x16:
            case /*HCI_ERR_CONN_CAUSE_LOCAL_HOST*/ 0x16:
                return BluetoothStatusCodes.ERROR_DISCONNECT_REASON_LOCAL_REQUEST;
                return BluetoothStatusCodes.ERROR_DISCONNECT_REASON_LOCAL_REQUEST;
            case /*HCI_ERR_UNSUPPORTED_REM_FEATURE*/ 0x1A:
            case /*HCI_ERR_UNSUPPORTED_REM_FEATURE*/ 0x1A:
+1 −1
Original line number Original line Diff line number Diff line
@@ -3750,7 +3750,7 @@ tBTM_STATUS btm_sec_disconnect(uint16_t handle, tHCI_STATUS reason,
void btm_sec_disconnected(uint16_t handle, tHCI_REASON reason,
void btm_sec_disconnected(uint16_t handle, tHCI_REASON reason,
                          std::string comment) {
                          std::string comment) {
  if ((reason != HCI_ERR_CONN_CAUSE_LOCAL_HOST) &&
  if ((reason != HCI_ERR_CONN_CAUSE_LOCAL_HOST) &&
      (reason != HCI_ERR_PEER_USER)) {
      (reason != HCI_ERR_PEER_USER) && (reason != HCI_ERR_REMOTE_POWER_OFF)) {
    LOG_WARN("Got uncommon disconnection reason:%s handle:0x%04x comment:%s",
    LOG_WARN("Got uncommon disconnection reason:%s handle:0x%04x comment:%s",
             hci_error_code_text(reason).c_str(), handle, comment.c_str());
             hci_error_code_text(reason).c_str(), handle, comment.c_str());
  }
  }
+3 −0
Original line number Original line Diff line number Diff line
@@ -213,6 +213,8 @@ typedef enum : uint16_t {


  GATT_CONN_FAILED_ESTABLISHMENT = HCI_ERR_CONN_FAILED_ESTABLISHMENT,
  GATT_CONN_FAILED_ESTABLISHMENT = HCI_ERR_CONN_FAILED_ESTABLISHMENT,


  GATT_CONN_TERMINATED_POWER_OFF = HCI_ERR_REMOTE_POWER_OFF,

  BTA_GATT_CONN_NONE = 0x0101, /* 0x0101 no connection to cancel  */
  BTA_GATT_CONN_NONE = 0x0101, /* 0x0101 no connection to cancel  */


} tGATT_DISCONN_REASON;
} tGATT_DISCONN_REASON;
@@ -232,6 +234,7 @@ inline std::string gatt_disconnection_reason_text(
    CASE_RETURN_TEXT(GATT_CONN_LMP_TIMEOUT);
    CASE_RETURN_TEXT(GATT_CONN_LMP_TIMEOUT);
    CASE_RETURN_TEXT(GATT_CONN_FAILED_ESTABLISHMENT);
    CASE_RETURN_TEXT(GATT_CONN_FAILED_ESTABLISHMENT);
    CASE_RETURN_TEXT(BTA_GATT_CONN_NONE);
    CASE_RETURN_TEXT(BTA_GATT_CONN_NONE);
    CASE_RETURN_TEXT(GATT_CONN_TERMINATED_POWER_OFF);
    default:
    default:
      return base::StringPrintf("UNKNOWN[%hu]", reason);
      return base::StringPrintf("UNKNOWN[%hu]", reason);
  }
  }
+1 −0
Original line number Original line Diff line number Diff line
@@ -44,6 +44,7 @@ typedef enum : uint8_t {
  HCI_ERR_HOST_TIMEOUT = 0x10,  // stack/btm/btm_ble_gap,
  HCI_ERR_HOST_TIMEOUT = 0x10,  // stack/btm/btm_ble_gap,
  HCI_ERR_ILLEGAL_PARAMETER_FMT = 0x12,
  HCI_ERR_ILLEGAL_PARAMETER_FMT = 0x12,
  HCI_ERR_PEER_USER = 0x13,
  HCI_ERR_PEER_USER = 0x13,
  HCI_ERR_REMOTE_POWER_OFF = 0x15,
  HCI_ERR_CONN_CAUSE_LOCAL_HOST = 0x16,
  HCI_ERR_CONN_CAUSE_LOCAL_HOST = 0x16,
  HCI_ERR_REPEATED_ATTEMPTS = 0x17,
  HCI_ERR_REPEATED_ATTEMPTS = 0x17,
  HCI_ERR_PAIRING_NOT_ALLOWED = 0x18,
  HCI_ERR_PAIRING_NOT_ALLOWED = 0x18,