mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 10:44:41 +00:00
Introduce a new callback function to get client's UUID
Bug: 247124878 Test: compilation and manual test Change-Id: I96b386fc232c4f65615858cf9b65317ae5bdc499
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -49,6 +49,6 @@ aidl_interface {
|
||||
},
|
||||
|
||||
],
|
||||
frozen: true,
|
||||
frozen: false,
|
||||
|
||||
}
|
||||
|
||||
@@ -39,5 +39,6 @@ interface IContextHubCallback {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -90,6 +90,14 @@ interface IContextHubCallback {
|
||||
*/
|
||||
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.
|
||||
|
||||
@@ -29,7 +29,7 @@ cc_library_static {
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"android.hardware.contexthub-V2-ndk",
|
||||
"android.hardware.contexthub-V3-ndk",
|
||||
],
|
||||
export_include_dirs: ["include"],
|
||||
srcs: [
|
||||
@@ -50,7 +50,7 @@ cc_binary {
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"android.hardware.contexthub-V2-ndk",
|
||||
"android.hardware.contexthub-V3-ndk",
|
||||
],
|
||||
static_libs: [
|
||||
"libcontexthubexampleimpl",
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -32,7 +32,7 @@ cc_test {
|
||||
"libbinder",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.contexthub-V2-cpp",
|
||||
"android.hardware.contexthub-V3-cpp",
|
||||
"VtsHalContexthubUtils",
|
||||
],
|
||||
test_suites: [
|
||||
|
||||
@@ -48,6 +48,10 @@ using ::android::hardware::contexthub::Setting;
|
||||
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 @@ class EmptyContextHubCallback : public android::hardware::contexthub::BnContextH
|
||||
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 @@ class QueryAppsCallback : public android::hardware::contexthub::BnContextHubCall
|
||||
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 @@ class TransactionResultCallback : public android::hardware::contexthub::BnContex
|
||||
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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user