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

Commit 4eccfaa7 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

Bluetooth: Add handling TERMINATED_POWER_OFF error code

Bug: 263359541
Test: atest BluetoothInstrumentationTests
Tag: #feature
Merged-In: Iada10c6965b39522718b8c317c8358a3345961ad
Change-Id: Iada10c6965b39522718b8c317c8358a3345961ad
(cherry picked from commit a7b92fab)
parent edf576ff
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4656,6 +4656,8 @@ public class AdapterService extends Service {
                return BluetoothStatusCodes.ERROR_DISCONNECT_REASON_BAD_PARAMETERS;
            case /*HCI_ERR_PEER_USER*/ 0x13:
                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:
                return BluetoothStatusCodes.ERROR_DISCONNECT_REASON_LOCAL_REQUEST;
            case /*HCI_ERR_UNSUPPORTED_REM_FEATURE*/ 0x1A:
+1 −1
Original line number 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,
                          std::string comment) {
  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",
             hci_error_code_text(reason).c_str(), handle, comment.c_str());
  }
+3 −0
Original line number Diff line number Diff line
@@ -213,6 +213,8 @@ typedef enum : uint16_t {

  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  */

} 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_FAILED_ESTABLISHMENT);
    CASE_RETURN_TEXT(BTA_GATT_CONN_NONE);
    CASE_RETURN_TEXT(GATT_CONN_TERMINATED_POWER_OFF);
    default:
      return base::StringPrintf("UNKNOWN[%hu]", reason);
  }
+1 −0
Original line number 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_ILLEGAL_PARAMETER_FMT = 0x12,
  HCI_ERR_PEER_USER = 0x13,
  HCI_ERR_REMOTE_POWER_OFF = 0x15,
  HCI_ERR_CONN_CAUSE_LOCAL_HOST = 0x16,
  HCI_ERR_REPEATED_ATTEMPTS = 0x17,
  HCI_ERR_PAIRING_NOT_ALLOWED = 0x18,