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

Commit 22ed7f76 authored by Henri Chataing's avatar Henri Chataing Committed by Automerger Merge Worker
Browse files

hearing_aid: Explicitly request encryption when creating audio channel am: 80ae7b56

parents 5196d04f 80ae7b56
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -1100,7 +1100,17 @@ class HearingAidImpl : public HearingAid {
                             : BTM_SEC_SERVICE_HEARING_AID_RIGHT;
    uint16_t gap_handle = GAP_ConnOpen(
        "", service_id, false, &hearingDevice->address, psm, 514 /* MPS */,
        &cfg_info, nullptr, BTM_SEC_NONE /* TODO: request security ? */,
        &cfg_info, nullptr,
        /// b/309483354:
        /// Encryption needs to be explicitly requested at channel
        /// establishment even though validation is performed in this module
        /// because of re-connection logic present in the L2CAP module.
        /// The L2CAP will automatically reconnect the LE-ACL link on
        /// disconnection when there is a pending channel request,
        /// which invalidates all encryption checks performed here.
        com::android::bluetooth::flags::asha_asrc()
            ? BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT
            : BTM_SEC_NONE,
        HearingAidImpl::GapCallbackStatic, BT_TRANSPORT_LE);

    if (gap_handle == GAP_INVALID_HANDLE) {