Introduce a new callback function to get client's UUID
Bug: 247124878
Test: compilation and manual test
Change-Id: I96b386fc232c4f65615858cf9b65317ae5bdc499
diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml
index 0c6ae7b..29d6259 100644
--- a/compatibility_matrices/compatibility_matrix.9.xml
+++ b/compatibility_matrices/compatibility_matrix.9.xml
@@ -185,7 +185,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.contexthub</name>
- <version>2</version>
+ <version>3</version>
<interface>
<name>IContextHub</name>
<instance>default</instance>
diff --git a/contexthub/aidl/Android.bp b/contexthub/aidl/Android.bp
index a0315d0..cf10529 100644
--- a/contexthub/aidl/Android.bp
+++ b/contexthub/aidl/Android.bp
@@ -49,6 +49,6 @@
},
],
- frozen: true,
+ frozen: false,
}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
index 6163cfc..d0099ff 100644
--- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
@@ -39,5 +39,6 @@
void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt);
void handleTransactionResult(in int transactionId, in boolean success);
void handleNanSessionRequest(in android.hardware.contexthub.NanSessionRequest request);
+ byte[16] getUuid();
const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000;
}
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
index bfcb51e..41fb266 100644
--- a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
@@ -91,6 +91,14 @@
void handleNanSessionRequest(in NanSessionRequest request);
/**
+ * This callback is passed to the HAL implementation to allow the HAL to request a UUID that
+ * uniquely identifies an IContextHubCallback.
+ *
+ * @return a byte array representating the UUID
+ */
+ byte[16] getUuid();
+
+ /**
* Amount of time, in milliseconds, that a handleNanSessionRequest can be pending before the
* Contexthub service must respond.
*/
diff --git a/contexthub/aidl/default/Android.bp b/contexthub/aidl/default/Android.bp
index 6ee7407..74bac69 100644
--- a/contexthub/aidl/default/Android.bp
+++ b/contexthub/aidl/default/Android.bp
@@ -29,7 +29,7 @@
shared_libs: [
"libbase",
"libbinder_ndk",
- "android.hardware.contexthub-V2-ndk",
+ "android.hardware.contexthub-V3-ndk",
],
export_include_dirs: ["include"],
srcs: [
@@ -50,7 +50,7 @@
shared_libs: [
"libbase",
"libbinder_ndk",
- "android.hardware.contexthub-V2-ndk",
+ "android.hardware.contexthub-V3-ndk",
],
static_libs: [
"libcontexthubexampleimpl",
diff --git a/contexthub/aidl/default/contexthub-default.xml b/contexthub/aidl/default/contexthub-default.xml
index 930f672..2f8ddc8 100644
--- a/contexthub/aidl/default/contexthub-default.xml
+++ b/contexthub/aidl/default/contexthub-default.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.contexthub</name>
- <version>2</version>
+ <version>3</version>
<interface>
<name>IContextHub</name>
<instance>default</instance>
diff --git a/contexthub/aidl/vts/Android.bp b/contexthub/aidl/vts/Android.bp
index 1534b40..b166baf 100644
--- a/contexthub/aidl/vts/Android.bp
+++ b/contexthub/aidl/vts/Android.bp
@@ -32,7 +32,7 @@
"libbinder",
],
static_libs: [
- "android.hardware.contexthub-V2-cpp",
+ "android.hardware.contexthub-V3-cpp",
"VtsHalContexthubUtils",
],
test_suites: [
diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
index c1cc07c..e780857 100644
--- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
+++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
@@ -48,6 +48,10 @@
using ::android::hardware::contexthub::vts_utils::kNonExistentAppId;
using ::android::hardware::contexthub::vts_utils::waitForCallback;
+// 6612b522-b717-41c8-b48d-c0b1cc64e142
+const std::array<uint8_t, 16> kUuid = {0x66, 0x12, 0xb5, 0x22, 0xb7, 0x17, 0x41, 0xc8,
+ 0xb4, 0x8d, 0xc0, 0xb1, 0xcc, 0x64, 0xe1, 0x42};
+
class ContextHubAidl : public testing::TestWithParam<std::tuple<std::string, int32_t>> {
public:
virtual void SetUp() override {
@@ -126,6 +130,11 @@
Status handleNanSessionRequest(const NanSessionRequest& /* request */) override {
return Status::ok();
}
+
+ Status getUuid(std::array<uint8_t, 16>* out_uuid) override {
+ *out_uuid = kUuid;
+ return Status::ok();
+ }
};
TEST_P(ContextHubAidl, TestRegisterCallback) {
@@ -157,6 +166,11 @@
return Status::ok();
}
+ Status getUuid(std::array<uint8_t, 16>* out_uuid) override {
+ *out_uuid = kUuid;
+ return Status::ok();
+ }
+
std::promise<std::vector<NanoappInfo>> promise;
};
@@ -223,6 +237,11 @@
return Status::ok();
}
+ Status getUuid(std::array<uint8_t, 16>* out_uuid) override {
+ *out_uuid = kUuid;
+ return Status::ok();
+ }
+
uint32_t expectedTransactionId = 0;
std::promise<bool> promise;
};