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

Commit e6096e9f authored by Zhengping Jiang's avatar Zhengping Jiang
Browse files

floss: add return value for set_ll_privacy

Add return value to set_ll_privacy dbus call.
set_ll_privacy will return false if file permission is wrong.

Bug: 242100561
Tag: #floss
Test: manual run dbus command to enable/disable ll privacy
Test: mma -j32

Change-Id: I4cffeb639615d91c0def8285e8de3bfdbb58904b
parent 7ec562b9
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;