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

Commit 39c4fa71 authored by Sal Savage's avatar Sal Savage
Browse files

Don't use config object after std::move

Problem: Devices marked as restricted were not properly getting removed
after existing restricted move. This was because we were trying to call
the removal function on an object after calling std::move() on it. This
caused the function not to operate on the same effective object and the
devices weren't properly found and removed from the cache, nor was the
file updated.

Solution: Use the reference of the config now owned by pimpl_ so we act
on the proper set of objects.

Bug: 357640474
Flag: EXEMPT, simple bug fix
Test: m com.android.btservices
Change-Id: Iebfe73efa6eca7302cc7866196cfacb13185ad68
parent 811f3370
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -178,10 +178,10 @@ void StorageModule::Start() {

  // Cleanup temporary pairings if we have left guest mode
  if (!com::android::bluetooth::flags::guest_mode_bond() && !is_restricted_mode_) {
    config->RemoveSectionWithProperty("Restricted");
    pimpl_->cache_.RemoveSectionWithProperty("Restricted");
  }

  config->FixDeviceTypeInconsistencies();
  pimpl_->cache_.FixDeviceTypeInconsistencies();
  if (bluetooth::os::ParameterProvider::GetBtKeystoreInterface() != nullptr) {
    bluetooth::os::ParameterProvider::GetBtKeystoreInterface()
            ->ConvertEncryptOrDecryptKeyIfNeeded();
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ static const std::string kReadTestConfig =
        "[01:02:03:ab:cd:ea]\n"
        "Name = hello world\n"
        "LinkKey = fedcba0987654321fedcba0987654328\n"
        "DevType = 1\n"
        "\n";

TEST_F(StorageModuleTest, read_existing_config_test) {