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

Commit 2d70b651 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Merge "Do not set random address when public address is in use"

am: 453f2dda

Change-Id: Ie1ed12ba0f06f77abb4248ca94ba062a61c9e13c
parents 60b51a2d 453f2dda
Loading
Loading
Loading
Loading
+36 −26
Original line number Diff line number Diff line
@@ -422,6 +422,12 @@ class BleAdvertisingManagerImpl

            c->self->adv_inst[c->inst_id].tx_power = tx_power;

            if (c->self->adv_inst[c->inst_id].own_address_type == BLE_ADDR_PUBLIC) {
              c->self->StartAdvertisingSetAfterAddressPart(std::move(c));
              return;
            }

            //own_address_type == BLE_ADDR_RANDOM
            const RawAddress& rpa = c->self->adv_inst[c->inst_id].own_address;
            c->self->GetHciInterface()->SetRandomAddress(c->inst_id, rpa, Bind(
              [](c_type c, uint8_t status) {
@@ -432,6 +438,14 @@ class BleAdvertisingManagerImpl
                  return;
                }

                c->self->StartAdvertisingSetAfterAddressPart(std::move(c));
          }, base::Passed(&c)));
        }, base::Passed(&c)));
    }, base::Passed(&c)));
    // clang-format on
  }

  void StartAdvertisingSetAfterAddressPart(c_type c) {
    c->self->SetData(c->inst_id, false, std::move(c->advertise_data), Bind(
      [](c_type c, uint8_t status) {
        if (status != 0) {
@@ -457,10 +471,6 @@ class BleAdvertisingManagerImpl
            }
        }, base::Passed(&c)));
    }, base::Passed(&c)));
            }, base::Passed(&c)));
        }, base::Passed(&c)));
    }, base::Passed(&c)));
    // clang-format on
  }

  void StartAdvertisingSetPeriodicPart(c_type c) {