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

Commit ba989019 authored by Zhengping Jiang's avatar Zhengping Jiang Committed by Automerger Merge Worker
Browse files

Merge changes I4cffeb63,Idbf2b071 into main am: f4dc7933

parents b84befc2 f4dc7933
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ struct BluetoothExperimentalDBus {}
)]
impl IBluetoothExperimental for BluetoothExperimentalDBus {
    #[dbus_method("SetLLPrivacy")]
    fn set_ll_privacy(&mut self, enabled: bool) {
    fn set_ll_privacy(&mut self, enabled: bool) -> bool {
        dbus_generated!()
    }

+5 −3
Original line number Diff line number Diff line
@@ -180,23 +180,25 @@ impl IBluetoothManager for BluetoothManager {

/// Implementation of IBluetoothExperimental
impl IBluetoothExperimental for BluetoothManager {
    fn set_ll_privacy(&mut self, enabled: bool) {
    fn set_ll_privacy(&mut self, enabled: bool) -> bool {
        let current_status = match config_util::read_floss_ll_privacy_enabled() {
            Ok(true) => true,
            _ => false,
        };

        if current_status == enabled {
            return;
            return true;
        }

        info!("Set floss ll privacy to {}", enabled);
        if let Err(e) = config_util::write_floss_ll_privacy_enabled(enabled) {
            error!("Failed to write ll privacy status: {}", e);
            return;
            return false;
        }

        self.restart_available_adapters();

        return true;
    }

    fn set_devcoredump(&mut self, enabled: bool) -> bool {
+1 −1
Original line number Diff line number Diff line
/// Bluetooth experimental feature API
pub trait IBluetoothExperimental {
    /// Set LL privacy status
    fn set_ll_privacy(&mut self, enabled: bool);
    fn set_ll_privacy(&mut self, enabled: bool) -> bool;

    /// Set devcoredump status
    fn set_devcoredump(&mut self, enabled: bool) -> bool;
+11 −8
Original line number Diff line number Diff line
@@ -1262,8 +1262,9 @@ impl StateMachineInternal {
            .next()
    }

    /// Set the desired default adapter. Returns true if the default adapter was changed as result
    /// (meaning the newly desired adapter is either present or enabled).
    /// Set the desired default adapter. Returns a NewDefaultAdapter action if the default
    /// adapter was changed as a result (meaning the newly desired adapter is either present or
    /// enabled).
    pub fn set_desired_default_adapter(&mut self, adapter: VirtualHciIndex) -> AdapterChangeAction {
        self.desired_adapter = adapter;

@@ -1280,7 +1281,7 @@ impl StateMachineInternal {
        return AdapterChangeAction::DoNothing;
    }

    /// Returns true if we are starting bluetooth process.
    /// Returns an action to reset timer if we are starting bluetooth process.
    pub fn action_start_bluetooth(&mut self, hci: VirtualHciIndex) -> CommandTimeoutAction {
        let state = self.get_process_state(hci);
        let present = self.get_state(hci, move |a: &AdapterState| Some(a.present)).unwrap_or(false);
@@ -1303,7 +1304,7 @@ impl StateMachineInternal {
        }
    }

    /// Returns true if we are stopping bluetooth process.
    /// Returns an action to reset or cancel timer if we are stopping bluetooth process.
    pub fn action_stop_bluetooth(&mut self, hci: VirtualHciIndex) -> CommandTimeoutAction {
        if !self.is_known(hci) {
            warn!("Attempting to stop unknown hci{}", hci.to_i32());
@@ -1329,7 +1330,7 @@ impl StateMachineInternal {
        }
    }

    /// Returns true if we are restarting bluetooth process
    /// Returns an action to reset timer if we are restarting bluetooth process
    pub fn action_restart_bluetooth(&mut self, hci: VirtualHciIndex) -> CommandTimeoutAction {
        if !self.is_known(hci) {
            warn!("Attempting to restart unknown hci{}", hci);
@@ -1355,7 +1356,8 @@ impl StateMachineInternal {
        }
    }

    /// Handles a bluetooth started event. Always returns true even with unknown interfaces.
    /// Handles a bluetooth started event. Always return the acction to cancel timer even with
    /// unknown interfaces.
    pub fn action_on_bluetooth_started(
        &mut self,
        pid: i32,
@@ -1375,8 +1377,9 @@ impl StateMachineInternal {
        CommandTimeoutAction::CancelTimer
    }

    /// Returns true if the event is expected.
    /// If unexpected, Bluetooth probably crashed, returning false and starting the timer for restart timeout.
    /// Returns an action to cancel timer if the event is expected.
    /// If unexpected, Bluetooth probably crashed, returns an action to reset the timer to restart
    /// timeout.
    pub fn action_on_bluetooth_stopped(&mut self, hci: VirtualHciIndex) -> CommandTimeoutAction {
        let state = self.get_process_state(hci);
        let (present, config_enabled) = self