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

Commit d55c6797 authored by Hsin-chen Chuang's avatar Hsin-chen Chuang
Browse files

floss: Add sysprop for RTL advertisement monitor quirk

This prop will be used by https://r.android.com/3016133

Bug: 294961421
Tag: #floss
Test: mmm packages/modules/Bluetooth
Test: manual Log the prop somewhere, adjust sysprop.conf and verify log
Flag: EXEMPT, Floss-only changes
Change-Id: I587728f4076a053bdd7479b6500b196840d8f793
parent 1c8c9402
Loading
Loading
Loading
Loading
+28 −0
Original line number Original line Diff line number Diff line
@@ -61,3 +61,31 @@ pub fn get_i32(prop: PropertyI32) -> i32 {
        )
        )
    }
    }
}
}

/// List of properties accessible to Rust. Add new ones here as they become
/// necessary.
pub enum PropertyBool {
    // bluetooth.core.le
    LeAdvMonRtlQuirk,
}

impl Into<(Vec<u8>, bool)> for PropertyBool {
    /// Convert the property into the property key name and a default value.
    fn into(self) -> (Vec<u8>, bool) {
        let (key, default_value) = match self {
            PropertyBool::LeAdvMonRtlQuirk => ("bluetooth.core.le.adv_mon_rtl_quirk", false),
        };

        (key.bytes().chain("\0".bytes()).collect::<Vec<u8>>(), default_value)
    }
}

/// Get the boolean value for a system property.
pub fn get_bool(prop: PropertyBool) -> bool {
    let (key, default_value) = prop.into();
    let key_cptr = LTCheckedPtr::from(&key);

    unsafe {
        bindings::osi_property_get_bool(key_cptr.cast_into::<std::os::raw::c_char>(), default_value)
    }
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -106,6 +106,7 @@ void SyspropsModule::parse_config(std::string file_path) {
      "bluetooth.core.le.inquiry_scan_window",
      "bluetooth.core.le.inquiry_scan_window",
      "bluetooth.core.le.adv_mon_scan_interval",
      "bluetooth.core.le.adv_mon_scan_interval",
      "bluetooth.core.le.adv_mon_scan_window",
      "bluetooth.core.le.adv_mon_scan_window",
      "bluetooth.core.le.adv_mon_rtl_quirk",
      "bluetooth.core.le.vendor_capabilities.enabled",
      "bluetooth.core.le.vendor_capabilities.enabled",
      // SCO
      // SCO
      "bluetooth.sco.disable_enhanced_connection",
      "bluetooth.sco.disable_enhanced_connection",