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

Commit f2d50e15 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "eatt: Accept incoming Eatt connection request for uknown devices"

parents a194e0b5 cf102edb
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -118,10 +118,14 @@ struct eatt_impl {
     */
    eatt_device* eatt_dev = this->find_device_by_address(bda);
    if (!eatt_dev) {
      LOG(ERROR) << __func__ << " unknown device: " << bda;
      L2CA_ConnectCreditBasedRsp(bda, identifier, lcids,
                                 L2CAP_CONN_NO_RESOURCES, NULL);
      return;
      /* If there is no device it means, Android did not read yet Server
       * supported features, but according to Core 5.3, Vol 3,  Part G, 6.2.1,
       * for LE case it is not necessary to read it before establish connection.
       * Therefore assume, device supports EATT since we got request to create
       * EATT channels. Just create device here. */
      LOG(INFO) << __func__ << " Adding device: " << bda
                << " on incoming EATT creation request";
      eatt_dev = add_eatt_device(bda);
    }

    uint16_t max_mps = controller_get_interface()->get_acl_data_size_ble();
+5 −3
Original line number Diff line number Diff line
@@ -185,13 +185,15 @@ TEST_F(EattTest, ConnectSucceed) {
TEST_F(EattTest, IncomingEattConnectionByUnknownDevice) {
  std::vector<uint16_t> incoming_cids{71, 72, 73, 74, 75};

  EXPECT_CALL(l2cap_interface_,
              ConnectCreditBasedRsp(test_address, 1, incoming_cids,
                                    L2CAP_CONN_NO_RESOURCES, _))
  EXPECT_CALL(
      l2cap_interface_,
      ConnectCreditBasedRsp(test_address, 1, incoming_cids, L2CAP_CONN_OK, _))
      .WillOnce(Return(true));

  l2cap_app_info_.pL2CA_CreditBasedConnectInd_Cb(
      test_address, incoming_cids, BT_PSM_EATT, EATT_MIN_MTU_MPS, 1);

  DisconnectEattDevice(incoming_cids);
}

TEST_F(EattTest, IncomingEattConnectionByKnownDevice) {