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

Commit f60aeb44 authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

Bluetooth: Disable low power managerment on Hal->close()

This ensures the vendor library can release any wakelocks held and
perform any additional cleanup steps as necessary.

Change-Id: Ibfeac161109162ac375eef9c20f147f0506de602
Fixes: 35097918
Test: manual; disable Bluetooth, monitor wakelocks
parent 0f7a0678
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ bool VendorInterface::Open(InitializeCompleteCallback initialize_complete_cb,
                                         [this](int fd) { OnDataReady(fd); });

  // Initially, the power management is off.
  lpm_wake_deasserted = false;
  lpm_wake_deasserted = true;

  // Start configuring the firmware
  firmware_startup_timer_ = new FirmwareStartupTimer();
@@ -290,6 +290,9 @@ void VendorInterface::Close() {
  fd_watcher_.StopWatchingFileDescriptor();

  if (lib_interface_ != nullptr) {
    bt_vendor_lpm_mode_t mode = BT_VND_LPM_DISABLE;
    lib_interface_->op(BT_VND_OP_LPM_SET_MODE, &mode);

    lib_interface_->op(BT_VND_OP_USERIAL_CLOSE, nullptr);
    uart_fd_ = INVALID_FD;
    int power_state = BT_VND_PWR_OFF;
@@ -352,9 +355,6 @@ void VendorInterface::OnFirmwareConfigured(uint8_t result) {
  ALOGD("%s Calling StartLowPowerWatchdog()", __func__);
  fd_watcher_.ConfigureTimeout(std::chrono::milliseconds(lpm_timeout_ms),
                               [this]() { OnTimeout(); });

  bt_vendor_lpm_wake_state_t wakeState = BT_VND_LPM_WAKE_ASSERT;
  lib_interface_->op(BT_VND_OP_LPM_WAKE_SET_STATE, &wakeState);
}

void VendorInterface::OnTimeout() {