Merge "[uwb-core] Add support support for custom vendor message type"
diff --git a/src/Android.bp b/src/Android.bp
index 737caad..5fc7630 100755
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -50,6 +50,7 @@
},
},
auto_gen_config: true,
+ min_sdk_version: "33",
}
rust_library {
@@ -110,6 +111,16 @@
],
}
+// Builds uwb_core library with "mock-utils" enabled.
+// This enables mock methods to be used for testing external crates.
+rust_library {
+ name: "libuwb_core_with_mock",
+ defaults: ["libuwb_core_defaults"],
+ crate_name: "uwb_core",
+ features: ["mock-utils"],
+ host_supported: true,
+}
+
rust_test {
name: "libuwb_core_tests",
defaults: ["libuwb_core_defaults"],
@@ -151,6 +162,7 @@
},
},
auto_gen_config: true,
+ min_sdk_version: "33",
}
rust_binary {
@@ -236,8 +248,8 @@
},
}
-rust_library {
- name: "libuci_hal_android",
+rust_defaults {
+ name: "libuci_hal_android_defaults",
crate_name: "uci_hal_android",
lints: "android",
clippy_lints: "android",
@@ -251,7 +263,6 @@
"liblog_rust",
"libthiserror",
"libtokio",
- "libuwb_core",
"libuwb_uci_packets",
],
target: {
@@ -274,6 +285,25 @@
],
}
+rust_library {
+ name: "libuci_hal_android",
+ defaults: ["libuci_hal_android_defaults"],
+ rustlibs: [
+ "libuwb_core",
+ ],
+}
+
+// uci_hal_android built with uwb_core_with_mock.
+// Used to replace uci_hal_android in place where mock version of uwb_core is
+// used.
+rust_library {
+ name: "libuci_hal_android_with_mock",
+ defaults: ["libuci_hal_android_defaults"],
+ rustlibs: [
+ "libuwb_core_with_mock",
+ ],
+}
+
// Generate the artifacts zip for uwb_core library and its dependencies.
genrule {
name: "uwb_core_artifacts",
diff --git a/src/rust/uwb_core/src/uci/mock_uci_manager.rs b/src/rust/uwb_core/src/uci/mock_uci_manager.rs
index e3ed7ed..249b563 100644
--- a/src/rust/uwb_core/src/uci/mock_uci_manager.rs
+++ b/src/rust/uwb_core/src/uci/mock_uci_manager.rs
@@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//! This module offers a mocked version of UciManager for testing.
+//!
+//! The mocked version of UciManager mimics the behavior of the UCI manager and
+//! stacks below it, such that tests can be run on a target without the UWB
+//! hardware.
use std::collections::VecDeque;
use std::sync::{Arc, Mutex};
use std::time::Duration;