summaryrefslogtreecommitdiff
path: root/system/rust
AgeCommit message (Collapse)Author
2025-02-19system/rust: Add some debug code to try and track down crash Chris Suter
This has no functional change; it just contains logs that might help us diagnose the issue. Bug: 356462170 Test: m com.android.btservices Flag: EXEMPT refactor only Change-Id: Iad9cdb0d61bc815a7a2bc97c24fae7cbe18d48e7
2025-02-13Merge "system/rust: Set imports_granularity rustfmt option to Module" into main Chris Suter
2025-02-12Add missing tests to MTS Thomas Girardier
Bug: 393400512 Change-Id: I7fb9ecbaf1510fc5f1b8eb184554db10a1ebc5b5 Test: None Flag: TEST_ONLY
2025-02-12system/rust: Set imports_granularity rustfmt option to Module Chris Suter
This matches the Fuchsia style. See https://fxbug.dev/340943530 for rationale. I've also reformatted all Rust files under system/rust with this style as there seemed to be some inconsistencies. Fix: 396241824 Test: m com.android.btservices Flag: EXEMPT refactor only Change-Id: I74425bfbe98a402fa5f9fd5f1746a00b9767a321
2025-02-11Merge changes I6d31aa81,Ib8fce44b into main Henri Chataing
* changes: Delete unused modules neighbor::Scan, neighbor::NameDb Delete libbt_common
2025-02-11Delete libbt_common Henri Chataing
This rust library only exports the method `init_logging`, which is used solely by the bluetooth_core crate. `init_logging` is inlined to system/rust/src/utils.rs Bug: 331817295 Test: m libbluetooth_core_rs Flag: EXEMPT, dead code removal Change-Id: Ib8fce44be854f095a3a95324df102ef060717084
2025-02-11Soong: Make all tests available on device Henri Chataing
Convert host only tests to device tests with host_supported to ensure that they are eligible for mts presubmit Make net_test_bta_gatt, net_test_bta_security available as host tests as well. Bug: 393400512 Test: TreeHugger Flag: EXEMPT, config change Change-Id: Ia832d7d6f812c1d404b7b372fa5804b9db7f185b
2025-02-10system/rust: Wait forever for Rust module to initialize Chris Suter
Not waiting leads to a high chance of a later crash; it's better to wait forever. Fix: 385666726 Test: m com.android.btservices Flag: EXEMPT bugfix Change-Id: I07dd7fde11b1949606a69478cc5eca70f88ff8c9
2025-02-10system/rust: Restructure and add logs for FFI Marie Janssen
Restructure the GlobalModuleRegistry: - Rename to RustModuleRunner - Clarify states - Internalize the static global - Add a number of logs when error states occur This is reland of https://r.android.com/3318393 except that starting and stopping the module multiple times is now supported. Tested with `atest net_test_bluetooth` to verify the cause of revert has been fixed. Fix: 356462170 Test: m com.android.btservices Flag: EXEMPT refactor only Change-Id: I2aece397937e075a494b0b6e200492bb5664f46c
2025-01-30Merge "Revert "system/rust: Restructure and add logs for FFI"" into main Treehugger Robot
2025-01-30Revert "system/rust: Restructure and add logs for FFI" Omair Kamil
This reverts commit b182e3dd6daaa2c2f5076e18128e07c6b8c3c6a9. Reason for revert: b/393481018 Change-Id: I26d3fe5ffc9cd7854e2e3b8e7b9226b976978bbb
2025-01-30Merge "system/rust: Restructure and add logs for FFI" into main Omair Kamil
2025-01-15Code changes for Rust 1.83.0 Chris Wailes
Test: m rust Bug: 384401387 Change-Id: I647a63976830e5071cb4dac8c0480a00ecf4d973
2025-01-09Modify apex_available to Bluetooth apex William Escande
Bluetooth apex name has changed from com.android.btservices to com.android.bt. We now need to update the reference in the code. for i in `fd Android.bp` do perl -i -0pe "s/(apex_available: \[[^\]]*\")com.android.btservices(\"[^\]]*])/\1com.android.bt\2/g" $i # to replace btservices by bt perl -i -0pe "s/apex_available: \[\n *\"com.android.bt\",\n *\],/apex_available: [\"com.android.bt\"],/g" $i # to reduce the 3 lines into 1 when bt is the only apex available done Bug: 383863941 Flag: Exempt build infra Test: m . Change-Id: Ib9a8e1f5d4b31edbfd66273b09e45329a0122508
2024-12-17Remove the rust_binary bt_topshim_facade Henri Chataing
Bug: 384782957 Test: TreeHugger Flag: EXEMPT, build change Change-Id: I0cf32fa7e9b2b6ecb3cf5736e85703784b1ec57f
2024-11-25gd/dumpsys: Remove flatbuffer abtraction for dumpsys output Henri Chataing
Bug: 331817295 Test: m com.android.btservices Flag: EXEMPT, no logical change Change-Id: I0300fcef76f90bc21d642eebba13f3ec4638b2d5
2024-11-20system: Migrate from {fmt} to std::format Henri Chataing
Bug: 305066880 Test: m com.android.btservices Flag: EXEMPT, log change Change-Id: If1dbab99250a4f62626206fc9f73d27e71ebab56
2024-11-12Remove 'system/types' from include_dirs Henri Chataing
Bug: 331817295 Test: m com.android.btservices Flag: EXEMPT, build change Change-Id: I259a974e5d0bf389d69876889118de0d5eed9b5e
2024-10-31system/rust: Restructure and add logs for FFI Marie Janssen
Restructure the GlobalModuleRegistry: - Rename to RustModuleRunner - Clarify states - Internalize the static global - Add a number of logs when error states occur Logs should be output before panic to make crashes identifiable. Bug: 356462170 Test: m com.android.btservices Flag: EXEMPT refactor only Change-Id: Iecd62aa2b6e743b2726f2cf87808e6718d98fedf
2024-10-17Remove os/log.h Henri Chataing
The logging macros within have long been removed, this is just cleanup work to inline the included headers where necessary Bug: 331817295 Test: m com.android.btservices Flag: EXEMPT, no logical change Change-Id: I2147ce4bdcea977b92318b2cb96e7020a8958161
2024-10-09use_unified_connection_manager removal Jakub Pawlowski
Unused, out of date Test: mma -j32 Bug: 290846969 Bug: 349469413 Bug: 372202918 Flag: EXEMPT, just delting unused code under flag Change-Id: Ie01c56f81d81affeed5c7285bcf8d712b6af59b0
2024-10-02Remove the init_flags module Henri Chataing
All existing init flags have been migrated to feature flags or removed and the rust module can now be deleted. Bug: 331817295 Test: m com.android.btservices Flag: EXEMPT, dead code removal Change-Id: I38be97fad7f9bd42f432d74e5b8090a08dc4502a
2024-09-25Enforce -Wmissing-prototypes Henri Chataing
This lint check will raise an error if a function is implemented without a corresponding prototype declaration included in scope. The main use case will be to ensure mock functions do not become out of sync causing the original function to be linked instead. Because of the large amount of errors, this change suppresses errors in all locations, to be cleaned up gradually. Bug: 369381361 Test: m com.android.btservices Flag: EXEMPT, lint fixes Change-Id: I888b5e284e237d8a6e2864bdde55c0a7fc0c348d
2024-09-20Remove unused <base/*.h> includes from hardware headers Henri Chataing
Bug: 331817295 Test: m com.android.btservices Flag: EXEMPT, no logical change Change-Id: Ia465d52ae9c4889db5529cb2fec9085befd8104f
2024-09-12Define tCONN_ID for GATT Connection ID Kyunglyul Hyun
Introduce tCONN_ID as a type for GATT connection IDs used internally by the native stack. Althogh this change itself doesn't do anything, this is a preparatory step for expanding tGATT_IF to uint16_t and tCONN_ID to uint32_t. Rust stack cleanup will follow in a subsequent CL. Flag: EXEMPT, mechanical refactor Bug: 273561907 Test: atest BluetoothInstrumentationTests Change-Id: I307fbb0815f3f3c31c80e75c12c4223237099adc
2024-09-05Update Android for Rust 1.81.0 Chris Wailes
Test: m rust Bug: 364333811 Change-Id: I0431582199a8039ce226d6376bdc0ee65a53fa1d
2024-09-03Convert the unified_connection_manager flag Myles Watson
Initflags are deprecated, use a trunkstable flag. Bug: 349469413 Test: mma -j32 Change-Id: I4e5917098167261289f9f64f6827b7b28f97df81
2024-08-05Merge "system/rust/gatt: Switch to the default PDL rust generator" into main Treehugger Robot
2024-08-02Merge "Prevent NPE in bt_gatt_callback" into main Kyunglyul Hyun
2024-07-30Adjust Safety annotation but also just silence lint warning Stephen Hines
This external function declaration isn't able to be handled nicely by clippy in this case, so we suppress the lint. I also added a formatting fix to make it look more like other Safety sections. ``` error: unsafe function's docs miss `# Safety` section --> packages/modules/Bluetooth/system/rust/src/connection/ffi.rs:62:9 | 62 | / unsafe fn unchecked_register_rust_callbacks( 63 | | self: Pin<&mut Self>, 64 | | callbacks: Box<LeAclManagerCallbackShim>, 65 | | ); | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_safety_doc = note: `-D clippy::missing-safety-doc` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::missing_safety_doc)]` error: aborting due to 1 previous error ``` Bug: http://b/346588808 Test: ./toolchain/android_rust/tools/test_compiler.py --prebuilt-path dist/rust-linux.tar.xz --target aosp_cf_x86_64_phone --image --reuse-prebuilt Bug: 346588808 Test: m aosp_cf_x86_64_phone Change-Id: I015915f20cd97172bbc66913412da5f139a909de
2024-07-30Prevent NPE in bt_gatt_callback Kyunglyul Hyun
A thread setting bt_gatt_callbacks and a thread using it may be different, potentially causing an NPE if bt_gatt_callbacks is accessed after being cleaned up. Use a local variable to ensure safe access in threaded environments. Bug: 353974484 Flag: EXEMPT, strict null check. Test: atest BluetoothInstrumentaionTests Change-Id: I2bd8dd62d0fab0e58db1c1b690406341fc251bf8
2024-07-16system/rust/gatt: Switch to the default PDL rust generator Henri Chataing
The generator rust_no_alloc is no longer maintained and the default rust generator is now the preferred rust generator. Bug: 331817295 Test: m com.android.btservices Test: atest --host libbluetooth_core_rs_test Flag: EXEMPT, mechanical refactor Change-Id: I18da339ffb2537229fb870594edd344b6a924241
2024-07-07Format: apply clang rules William Escande
Restore SpacesBeforeTrailingComments to 2 to match current style Then run clang-format -i **/**.{c,h,cc,cpp,hpp} Then fix a bunch of typo (reported by gerrit) Then fix unnecessary multiline string Then fix whitespace for disabled clang format (reported by cpplint) This is no-op Bug: 311772251 Test: mmm packages/modules/Bluetooth Flag: Exempt Format only Change-Id: If135447803a40a2a07d4630ba2195e08ef8d250c
2024-06-28Merge "Remove unnecessary rust_ffi entries" into main Ivan Lozano
2024-06-27InitFlags: Remove always_use_private_gatt Myles Watson
Bug: 255880936 Fixes: 290842873 Test: mma -j32 Flag: EXEMPT, no logical change Change-Id: Ia1d6f2ea775087680f5d34472e32d44f574854d4
2024-06-14system/rust: Update GATT packet definition to use 8[] for ATT values Henri Chataing
Bug: 331817295 Test: m com.android.btservices Test: atest --host libbluetooth_core_rs_test Flag: EXEMPT, mechanical refactor Change-Id: Ia8b5fbf470df7ed3d20fced5339beb136e3aa9ba
2024-06-12system/rust: Update GATT datastore interfaces to use raw values Henri Chataing
The code almost never makes use of the structured type and mostly relies on AttAttributeDataChild::RawData. Removing this type will help convert the pdl rust backend later as the generated type AttAttributeDataChild will no longer exist under this form. Bug: 331817295 Test: m com.android.btservices Test: atest --host libbluetooth_core_rs_test Flag: EXEMPT, mechanical refactor Change-Id: I429341ed0ccc4a8cdaba7cc86d1249f16f11a28e
2024-06-12Merge "system/rust: Apply cargo fmt" into main Treehugger Robot
2024-06-11Merge "Remove usage of base::Owned in GattServerCallbacks::OnServerWrite" ↵ David Duarte
into main
2024-06-11system/rust: Apply cargo fmt Henri Chataing
Bug: 331817295 Test: m com.android.btservices Flag: EXEMPT, formatting Change-Id: Ibda132cef7bc849eea175bb9b978c6b58e311afc
2024-06-11Merge "system/rust: Update Cargo.toml" into main Treehugger Robot
2024-06-11Remove usage of base::Owned in GattServerCallbacks::OnServerWrite David Duarte
Test: mmm packages/modules/Bluetooth Bug: 345074109 Flag: EXEMPT, mechanical refactor Change-Id: Ief3f4c1ddd614f697ec8d5bb0b6eabc2adfde5e1
2024-06-11system/rust: Update Cargo.toml Henri Chataing
- remove unused dependency grpcio - bump pdl-compiler to 0.3.0 - bump pdl-runtime to 0.3.0 - bump bitflags to 2.5.0 Bug: 331817295 Test: m com.android.btservices Test: cd system/rust && cargo build Flag: EXEMPT, build change Change-Id: I8adeae054f00350c917e353bce00414ab6f138a9
2024-06-07Remove unnecessary rust_ffi entries Ivan Lozano
The build system no longer allows defining rust_ffi_rlibs in static_libs for rust modules. libbt_shim_ffi isn't needed as libbt_shim is already included in rustlibs. libbluetooth_core_rs is not needed as libbluetooth_core_rs_facade is included in rustlibs. Bug: 254469782 Test: m rust Test: mma Change-Id: I513b0446216c5417906b886d1ac8d7b8896cc235
2024-06-05Remove FROM_HERE from do_in_jni_thread invocations David Duarte
In production FROM_HERE only convey the filename and the pc and only log the pc in case of internal libchrome failures. It's mainly useful in debugging by enabling ENABLE_LOCATION_SOURCE and logging the base::Location object ourselves. The same information can be retrieved using c++'s [source_location](https://en.cppreference.com/w/cpp/utility/source_location) without needing to modify every caller. The benefit outweight the cost of needing to provide that (correctly) in every call site. Bug: 345074109 Test: mmm packages/modules/Bluetooth Flag: EXEMPT mechanical refactor Change-Id: I5ba252baa6c885f3c34bffec058517bf39539bbe
2024-04-19Remove rust_event_loop flag David Duarte
Bug: 290846388 Fix: 290846388 Test: m com.android.btservices Flag: EXEMPT, removing legacy flag Change-Id: I434d863d73cf5e78cb7f919598d5c6412a48eb5a
2024-04-04Gatt Rust: Convince rustc that OwnedHandle is used Myles Watson
OwnedHandle is dropped when a connection is dropped with a Pending transaction. Removing this will change the behavior. warning: field `0` is never read --> src/gatt/server/att_server_bearer.rs:37:13 | 37 | Pending(OwnedHandle<()>), | ------- ^^^^^^^^^^^^^^^ | | | field in this variant | = note: `#[warn(dead_code)]` on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 37 | Pending(()), | Bug: 330185853 Test: atest libbluetooth_core_rs_test Flag: EXEMPT, build-only change Change-Id: I00d61e2a1f91667931edf0beaea7961c5e00296b
2024-03-23Remove gd rust David Duarte
This code is unused and there is no plan to ship it. Bug: 279512287 Test: mmm packages/modules/Bluetooth Flag: Exempt, dead code removal Change-Id: Ic6085fe40ee3ecc376a15050cb8f6e88bb561804
2024-03-21system: Migrate to libbluetooth_log Henri Chataing
Test: m com.android.btservices Bug: 305066880 Flag: EXEMPT, mechanical refactor Change-Id: Ia6632bc2c6ab18d93fd9d5d21bb863eb8a3150ff
2024-02-21Disable LTO for libbluetooth_core_rs_bridge Pirama Arumuga Nainar
Bug: 326115797 Bug: 286537287 We don't support cross-language LTO yet. Disable LTO for libbluetooth_core_rs_bridge since it is read by rustc (which uses incompatible LLVM IR reader) when rustc creates libbluetooth_core_rs.a. Test: m libbluetooth_core_rs with ToT clang Change-Id: Ice3152e4265aeba2ff1f11fe4e6f18460c4e7e90