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
diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc
index f228982..7f14e68 100644
--- a/bluetooth/1.0/default/vendor_interface.cc
+++ b/bluetooth/1.0/default/vendor_interface.cc
@@ -277,7 +277,7 @@
[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 @@
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 @@
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() {