uwb: Add vts tests for UWB HAL

No target to run the tests yet. So, just starting the VTS test suite for
UWB with some simple tests.

Also, modified the reference HAL implementation to emulate the startuo
flow.

Bug: 191175259
Test: atest VtsHalUwbTargetTest (using reference HAL on cuttlefish)
Change-Id: I2f01a3fec3324e85123d1d17e1b03dd284aee7b1
diff --git a/uwb/aidl/default/uwb_chip.cpp b/uwb/aidl/default/uwb_chip.cpp
index 727bcf1..fe64fa7 100644
--- a/uwb/aidl/default/uwb_chip.cpp
+++ b/uwb/aidl/default/uwb_chip.cpp
@@ -16,13 +16,17 @@
 
 #include "uwb.h"
 
+namespace {
+constexpr static int kVendorUciVersion = 1;
+}
+
 namespace android {
 namespace hardware {
 namespace uwb {
 namespace impl {
 using namespace ::aidl::android::hardware::uwb;
 
-UwbChip::UwbChip(const std::string& name) : name_(name) {}
+UwbChip::UwbChip(const std::string& name) : name_(name), mClientCallback(nullptr) {}
 UwbChip::~UwbChip() {}
 
 ::ndk::ScopedAStatus UwbChip::getName(std::string* name) {
@@ -30,25 +34,30 @@
     return ndk::ScopedAStatus::ok();
 }
 
-::ndk::ScopedAStatus UwbChip::open(
-        const std::shared_ptr<IUwbClientCallback>& /* clientCallback */) {
-    return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+::ndk::ScopedAStatus UwbChip::open(const std::shared_ptr<IUwbClientCallback>& clientCallback) {
+    mClientCallback = clientCallback;
+    mClientCallback->onHalEvent(UwbEvent::OPEN_CPLT, UwbStatus::OK);
+    return ndk::ScopedAStatus::ok();
 }
 
 ::ndk::ScopedAStatus UwbChip::close() {
-    return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+    mClientCallback->onHalEvent(UwbEvent::CLOSE_CPLT, UwbStatus::OK);
+    mClientCallback = nullptr;
+    return ndk::ScopedAStatus::ok();
 }
 
 ::ndk::ScopedAStatus UwbChip::coreInit() {
-    return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+    return ndk::ScopedAStatus::ok();
 }
 
-::ndk::ScopedAStatus UwbChip::getSupportedVendorUciVersion(int32_t* /* version */) {
-    return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+::ndk::ScopedAStatus UwbChip::getSupportedVendorUciVersion(int32_t* version) {
+    *version = kVendorUciVersion;
+    return ndk::ScopedAStatus::ok();
 }
 
 ::ndk::ScopedAStatus UwbChip::sendUciMessage(const std::vector<uint8_t>& /* data */,
                                              int32_t* /* bytes_written */) {
+    // TODO(b/195992658): Need emulator support for UCI stack.
     return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
 }
 }  // namespace impl
diff --git a/uwb/aidl/default/uwb_chip.h b/uwb/aidl/default/uwb_chip.h
index 5d3f55c..ef1d5b6 100644
--- a/uwb/aidl/default/uwb_chip.h
+++ b/uwb/aidl/default/uwb_chip.h
@@ -43,6 +43,7 @@
 
   private:
     std::string name_;
+    std::shared_ptr<IUwbClientCallback> mClientCallback;
 };
 }  // namespace impl
 }  // namespace uwb