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

Commit 56d325e5 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio/vc/csis: Fix handling BTA_GATTC_ENC_CMPL_CB_EVT

Seems that BTA_GATTC_ENC_CMPL_CB_EVT is missing status of the
encryption, and it is called either on success or failure.

Note: Encryption is mandatory for Le Audio operations and profile shall
be disconnected if encryption is not enabled.

Bug: 233548307
Test: atest BluetoothInstrumentationTests

Change-Id: I8d8579cd1ae9d87275aa9e10e009f1296c2cb8cc
parent 1ae2b697
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -1558,9 +1558,15 @@ class CsisClientImpl : public CsisClient {
        OnGattNotification(p_data->notify);
        break;

      case BTA_GATTC_ENC_CMPL_CB_EVT:
        OnLeEncryptionComplete(p_data->enc_cmpl.remote_bda, BTM_SUCCESS);
        break;
      case BTA_GATTC_ENC_CMPL_CB_EVT: {
        uint8_t encryption_status;
        if (BTM_IsEncrypted(p_data->enc_cmpl.remote_bda, BT_TRANSPORT_LE)) {
          encryption_status = BTM_SUCCESS;
        } else {
          encryption_status = BTM_FAILED_ON_SECURITY;
        }
        OnLeEncryptionComplete(p_data->enc_cmpl.remote_bda, encryption_status);
      } break;

      case BTA_GATTC_SRVC_CHG_EVT:
        OnGattServiceChangeEvent(p_data->remote_bda);
+10 −3
Original line number Diff line number Diff line
@@ -3577,9 +3577,16 @@ void le_audio_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data) {
                                p_data->open.transport, p_data->open.mtu);
      break;

    case BTA_GATTC_ENC_CMPL_CB_EVT:
      instance->OnEncryptionComplete(p_data->enc_cmpl.remote_bda, BTM_SUCCESS);
      break;
    case BTA_GATTC_ENC_CMPL_CB_EVT: {
      uint8_t encryption_status;
      if (BTM_IsEncrypted(p_data->enc_cmpl.remote_bda, BT_TRANSPORT_LE)) {
        encryption_status = BTM_SUCCESS;
      } else {
        encryption_status = BTM_FAILED_ON_SECURITY;
      }
      instance->OnEncryptionComplete(p_data->enc_cmpl.remote_bda,
                                     encryption_status);
    } break;

    case BTA_GATTC_CLOSE_EVT:
      instance->OnGattDisconnected(
+10 −3
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include "gd/common/strings.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "stack/btm/btm_sec.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"

@@ -1014,9 +1015,15 @@ class VolumeControlImpl : public VolumeControl {
        OnNotificationEvent(n.conn_id, n.handle, n.len, n.value);
      } break;

      case BTA_GATTC_ENC_CMPL_CB_EVT:
        OnEncryptionComplete(p_data->enc_cmpl.remote_bda, BTM_SUCCESS);
        break;
      case BTA_GATTC_ENC_CMPL_CB_EVT: {
        uint8_t encryption_status;
        if (!BTM_IsEncrypted(p_data->enc_cmpl.remote_bda, BT_TRANSPORT_LE)) {
          encryption_status = BTM_SUCCESS;
        } else {
          encryption_status = BTM_FAILED_ON_SECURITY;
        }
        OnEncryptionComplete(p_data->enc_cmpl.remote_bda, encryption_status);
      } break;

      case BTA_GATTC_SRVC_CHG_EVT:
        OnServiceChangeEvent(p_data->remote_bda);