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

Commit 15a03831 authored by Jacky Cheung's avatar Jacky Cheung Committed by Andre Eisenbach
Browse files

Fix issue with BLE advertising not started when local privacy is not enabled

Bug: 37282500
Test: manual
Change-Id: I44657d0b3315bc241373c8cbaf6a2b6a6e49f31d
parent d545d848
Loading
Loading
Loading
Loading
+6 −14
Original line number Original line Diff line number Diff line
@@ -98,9 +98,7 @@ struct AdvertisingInstance {
  }
  }
};
};


#if (BLE_PRIVACY_SPT == TRUE)
void btm_ble_adv_raddr_timer_timeout(void* data);
void btm_ble_adv_raddr_timer_timeout(void* data);
#endif


void DoNothing(uint8_t) {}
void DoNothing(uint8_t) {}
void DoNothing2(uint8_t, uint8_t) {}
void DoNothing2(uint8_t, uint8_t) {}
@@ -261,7 +259,6 @@ class BleAdvertisingManagerImpl


      p_inst->in_use = true;
      p_inst->in_use = true;


#if (BLE_PRIVACY_SPT == TRUE)
      // set up periodic timer to update address.
      // set up periodic timer to update address.
      if (BTM_BleLocalPrivacyEnabled()) {
      if (BTM_BleLocalPrivacyEnabled()) {
        p_inst->own_address_type = BLE_ADDR_RANDOM;
        p_inst->own_address_type = BLE_ADDR_RANDOM;
@@ -279,14 +276,13 @@ class BleAdvertisingManagerImpl
              cb.Run(p_inst->inst_id, BTM_BLE_MULTI_ADV_SUCCESS);
              cb.Run(p_inst->inst_id, BTM_BLE_MULTI_ADV_SUCCESS);
            },
            },
            p_inst, cb));
            p_inst, cb));
      }
      } else {
#else
        p_inst->own_address_type = BLE_ADDR_PUBLIC;
        p_inst->own_address_type = BLE_ADDR_PUBLIC;
        memcpy(p_inst->own_address,
        memcpy(p_inst->own_address,
               controller_get_interface()->get_address()->address, BD_ADDR_LEN);
               controller_get_interface()->get_address()->address, BD_ADDR_LEN);


        cb.Run(p_inst->inst_id, BTM_BLE_MULTI_ADV_SUCCESS);
        cb.Run(p_inst->inst_id, BTM_BLE_MULTI_ADV_SUCCESS);
#endif
      }
      return;
      return;
    }
    }


@@ -800,12 +796,10 @@ class BleAdvertisingManagerImpl
      return;
      return;
    }
    }


#if (BLE_PRIVACY_SPT == TRUE)
    if (BTM_BleLocalPrivacyEnabled() &&
    if (BTM_BleLocalPrivacyEnabled() &&
        advertising_handle <= BTM_BLE_MULTI_ADV_MAX) {
        advertising_handle <= BTM_BLE_MULTI_ADV_MAX) {
      btm_acl_update_conn_addr(connection_handle, p_inst->own_address);
      btm_acl_update_conn_addr(connection_handle, p_inst->own_address);
    }
    }
#endif


    VLOG(1) << "reneabling advertising";
    VLOG(1) << "reneabling advertising";


@@ -833,12 +827,10 @@ class BleAdvertisingManagerImpl


BleAdvertisingManager* instance;
BleAdvertisingManager* instance;


#if (BLE_PRIVACY_SPT == TRUE)
void btm_ble_adv_raddr_timer_timeout(void* data) {
void btm_ble_adv_raddr_timer_timeout(void* data) {
  ((BleAdvertisingManagerImpl*)BleAdvertisingManager::Get())
  ((BleAdvertisingManagerImpl*)BleAdvertisingManager::Get())
      ->ConfigureRpa((AdvertisingInstance*)data, base::Bind(DoNothing));
      ->ConfigureRpa((AdvertisingInstance*)data, base::Bind(DoNothing));
}
}
#endif
}  // namespace
}  // namespace


void BleAdvertisingManager::Initialize(BleAdvertiserHciInterface* interface) {
void BleAdvertisingManager::Initialize(BleAdvertiserHciInterface* interface) {