Update ContextHub v1.2 default HAL
Updates ContextHub v1.2 default HAL based on latest tweaks to the API.
Bug: 166846988
Test: compile
Change-Id: I4a723afab834153d5e59694e70fc9282a96e7954
diff --git a/contexthub/1.2/default/Contexthub.cpp b/contexthub/1.2/default/Contexthub.cpp
index db0c5bc..601eccd 100644
--- a/contexthub/1.2/default/Contexthub.cpp
+++ b/contexthub/1.2/default/Contexthub.cpp
@@ -23,10 +23,36 @@
namespace V1_2 {
namespace implementation {
+using ::android::hardware::hidl_string;
using ::android::hardware::contexthub::V1_0::Result;
using ::android::hardware::contexthub::V1_X::implementation::IContextHubCallbackWrapperV1_0;
using ::android::hardware::contexthub::V1_X::implementation::IContextHubCallbackWrapperV1_2;
+Return<void> Contexthub::getHubs_1_2(getHubs_1_2_cb _hidl_cb) {
+ ::android::hardware::contexthub::V1_0::ContextHub hub = {};
+ hub.name = "Mock Context Hub";
+ hub.vendor = "AOSP";
+ hub.toolchain = "n/a";
+ hub.platformVersion = 1;
+ hub.toolchainVersion = 1;
+ hub.hubId = kMockHubId;
+ hub.peakMips = 1;
+ hub.peakPowerDrawMw = 1;
+ hub.maxSupportedMsgLen = 4096;
+ hub.chrePlatformId = UINT64_C(0x476f6f6754000000);
+ hub.chreApiMajorVersion = 1;
+ hub.chreApiMinorVersion = 4;
+
+ // Report a single mock hub
+ std::vector<::android::hardware::contexthub::V1_0::ContextHub> hubs;
+ hubs.push_back(hub);
+
+ std::vector<hidl_string> hubPermissionList;
+
+ _hidl_cb(hubs, hubPermissionList);
+ return Void();
+}
+
Return<Result> Contexthub::registerCallback(uint32_t hubId,
const sp<V1_0::IContexthubCallback>& cb) {
if (hubId == kMockHubId) {
diff --git a/contexthub/1.2/default/Contexthub.h b/contexthub/1.2/default/Contexthub.h
index 8b89824..32b862d 100644
--- a/contexthub/1.2/default/Contexthub.h
+++ b/contexthub/1.2/default/Contexthub.h
@@ -35,6 +35,7 @@
using Result = ::android::hardware::contexthub::V1_0::Result;
using SettingValue = ::android::hardware::contexthub::V1_1::SettingValue;
using SettingV1_1 = ::android::hardware::contexthub::V1_1::Setting;
+ using getHubs_1_2_cb = ::android::hardware::contexthub::V1_2::IContexthub::getHubs_1_2_cb;
public:
// Methods from V1_0::IContexthub
@@ -47,6 +48,8 @@
Return<void> onSettingChanged(SettingV1_1 setting, SettingValue newValue) override;
// Methods from V1_2::IContexthub
+ Return<void> getHubs_1_2(getHubs_1_2_cb _hidl_cb) override;
+
Return<void> onSettingChanged_1_2(Setting setting, SettingValue newValue) override;
Return<Result> registerCallback_1_2(uint32_t hubId,