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

Commit 4699ac6e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "eatt: Accept incoming Eatt connection request for uknown devices" into tm-d1-dev

parents 9156d28a 80acdea7
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -118,10 +118,14 @@ struct eatt_impl {
     */
     */
    eatt_device* eatt_dev = this->find_device_by_address(bda);
    eatt_device* eatt_dev = this->find_device_by_address(bda);
    if (!eatt_dev) {
    if (!eatt_dev) {
      LOG(ERROR) << __func__ << " unknown device: " << bda;
      /* If there is no device it means, Android did not read yet Server
      L2CA_ConnectCreditBasedRsp(bda, identifier, lcids,
       * supported features, but according to Core 5.3, Vol 3,  Part G, 6.2.1,
                                 L2CAP_CONN_NO_RESOURCES, NULL);
       * for LE case it is not necessary to read it before establish connection.
      return;
       * 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();
    uint16_t max_mps = controller_get_interface()->get_acl_data_size_ble();
+5 −3
Original line number Original line Diff line number Diff line
@@ -185,13 +185,15 @@ TEST_F(EattTest, ConnectSucceed) {
TEST_F(EattTest, IncomingEattConnectionByUnknownDevice) {
TEST_F(EattTest, IncomingEattConnectionByUnknownDevice) {
  std::vector<uint16_t> incoming_cids{71, 72, 73, 74, 75};
  std::vector<uint16_t> incoming_cids{71, 72, 73, 74, 75};


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


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

  DisconnectEattDevice(incoming_cids);
}
}


TEST_F(EattTest, IncomingEattConnectionByKnownDevice) {
TEST_F(EattTest, IncomingEattConnectionByKnownDevice) {