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

Commit 073cee40 authored by Sonny Sasaka's avatar Sonny Sasaka Committed by Automerger Merge Worker
Browse files

Merge changes I505d2fbc,I0a419221 am: 5934b13a

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1912493

Change-Id: I2b2df043eea00920cf1f478881e99d3056f2d4da
parents 99a0b08e 5934b13a
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
use log::{error, info};
use log::{error, info, warn};

use manager_service::iface_bluetooth_manager::{
    AdapterWithEnabled, IBluetoothManager, IBluetoothManagerCallback,
@@ -123,10 +123,9 @@ impl IBluetoothManager for BluetoothManager {
        let prev = self.manager_context.floss_enabled.swap(enabled, Ordering::Relaxed);
        config_util::write_floss_enabled(enabled);
        if prev != enabled && enabled {
            Command::new("initctl")
                .args(&["stop", BLUEZ_INIT_TARGET])
                .output()
                .expect("failed to stop bluetoothd");
            if let Err(e) = Command::new("initctl").args(&["stop", BLUEZ_INIT_TARGET]).output() {
                warn!("Failed to stop bluetoothd: {}", e);
            }
            // TODO: Implement multi-hci case
            let default_device = config_util::list_hci_devices()[0];
            if config_util::is_hci_n_enabled(default_device) {
@@ -136,10 +135,9 @@ impl IBluetoothManager for BluetoothManager {
            // TODO: Implement multi-hci case
            let default_device = config_util::list_hci_devices()[0];
            self.manager_context.proxy.stop_bluetooth(default_device);
            Command::new("initctl")
                .args(&["start", BLUEZ_INIT_TARGET])
                .output()
                .expect("failed to start bluetoothd");
            if let Err(e) = Command::new("initctl").args(&["start", BLUEZ_INIT_TARGET]).output() {
                warn!("Failed to start bluetoothd: {}", e);
            }
        }
    }

+8 −4
Original line number Diff line number Diff line
@@ -495,17 +495,21 @@ impl UpstartInvoker {

impl ProcessManager for UpstartInvoker {
    fn start(&mut self, hci_interface: String) {
        Command::new("initctl")
        if let Err(e) = Command::new("initctl")
            .args(&["start", "btadapterd", format!("HCI={}", hci_interface).as_str()])
            .output()
            .expect("failed to start bluetooth");
        {
            error!("Failed to start btadapterd: {}", e);
        }
    }

    fn stop(&mut self, hci_interface: String) {
        Command::new("initctl")
        if let Err(e) = Command::new("initctl")
            .args(&["stop", "btadapterd", format!("HCI={}", hci_interface).as_str()])
            .output()
            .expect("failed to stop bluetooth");
        {
            error!("Failed to stop btadapterd: {}", e);
        }
    }
}

+0 −1
Original line number Diff line number Diff line
@@ -474,7 +474,6 @@ static void reschedule_root_alarm(void) {
    if (!timer_set) {
      if (!wakelock_acquire()) {
        LOG_ERROR("%s unable to acquire wake lock", __func__);
        goto done;
      }
    }