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

Commit 059643b5 authored by Sonny Sasaka's avatar Sonny Sasaka
Browse files

floss: Ignore Start and Stop if the state is already the same

Bug: 202065157
Tag: #floss
Test: Manual

Change-Id: I32752ce85631a557c5332e49706f62a4eba74016
parent 3154232a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -71,6 +71,12 @@ impl IBluetoothManager for BluetoothManager {
        if !config_util::modify_hci_n_enabled(hci_interface, true) {
            error!("Config is not successfully modified");
        }

        // Ignore the request if adapter is already enabled.
        if self.cached_devices.get(&hci_interface).unwrap_or(false) {
            return;
        }

        self.manager_context.proxy.start_bluetooth(hci_interface);
    }

@@ -79,6 +85,12 @@ impl IBluetoothManager for BluetoothManager {
        if !config_util::modify_hci_n_enabled(hci_interface, false) {
            error!("Config is not successfully modified");
        }

        // Ignore the request if adapter is already disabled.
        if !self.cached_devices.get(&hci_interface).unwrap_or(false) {
            return;
        }

        self.manager_context.proxy.stop_bluetooth(hci_interface);
    }