Merge changes from topic "update_contexthub" into sc-dev
* changes:
Update contexthub VTS based on latest spec
Modify default contexthub impl based on latest spec
Rework V1.2 ContextHub HAL spec
diff --git a/contexthub/1.2/IContexthub.hal b/contexthub/1.2/IContexthub.hal
index 4bb9361..04a8cb2 100644
--- a/contexthub/1.2/IContexthub.hal
+++ b/contexthub/1.2/IContexthub.hal
@@ -51,18 +51,6 @@
registerCallback_1_2(uint32_t hubId, IContexthubCallback cb) generates (Result result);
/**
- * Send a message to a hub
- *
- * @param hubId identifier for hub to send message to
- * @param msg message to be sent
- *
- * @return result OK if successful, error code otherwise
- * BAD_VALUE if parameters are not valid
- * TRANSACTION_FAILED if message send failed
- */
- sendMessageToHub_1_2(uint32_t hubId, ContextHubMsg msg) generates (Result result);
-
- /**
* Notification sent by the framework to indicate that the user
* has changed a setting.
*
diff --git a/contexthub/1.2/default/Contexthub.cpp b/contexthub/1.2/default/Contexthub.cpp
index 601eccd..57145fc 100644
--- a/contexthub/1.2/default/Contexthub.cpp
+++ b/contexthub/1.2/default/Contexthub.cpp
@@ -80,12 +80,6 @@
return Result::BAD_PARAMS;
}
-// We don't expose any nanoapps, therefore all nanoapp-related API calls return with BAD_PARAMS
-Return<Result> Contexthub::sendMessageToHub_1_2(uint32_t /* hubId */,
- const ContextHubMsg& /* msg */) {
- return Result::BAD_PARAMS;
-}
-
Return<void> Contexthub::onSettingChanged(SettingV1_1 /*setting*/, SettingValue /*newValue*/) {
return Void();
}
diff --git a/contexthub/1.2/default/Contexthub.h b/contexthub/1.2/default/Contexthub.h
index 32b862d..305544d 100644
--- a/contexthub/1.2/default/Contexthub.h
+++ b/contexthub/1.2/default/Contexthub.h
@@ -55,8 +55,6 @@
Return<Result> registerCallback_1_2(uint32_t hubId,
const sp<V1_2::IContexthubCallback>& cb) override;
- Return<Result> sendMessageToHub_1_2(uint32_t hubId, const ContextHubMsg& msg) override;
-
private:
sp<IContextHubCallbackWrapperBase> mCallback;
};
diff --git a/contexthub/1.2/types.hal b/contexthub/1.2/types.hal
index 5a11efe..5033ce8 100644
--- a/contexthub/1.2/types.hal
+++ b/contexthub/1.2/types.hal
@@ -45,11 +45,8 @@
@1.0::ContextHubMsg msg_1_0;
/**
- * The list of Android permissions that the sender of this message has at
- * the time the message was sent.
- *
- * The HAL MUST drop messages to nanoapps if this list of permissions is not
- * a superset of those of the receiving nanoapp(s).
+ * The list of Android permissions held by the sending nanoapp at the time
+ * the message was sent.
*
* The framework MUST drop messages to host apps that don't have a superset
* of the permissions that the sending nanoapp is using.
diff --git a/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp b/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp
index c50d43c..3510c23 100644
--- a/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp
+++ b/contexthub/1.2/vts/functional/VtsHalContexthubV1_2TargetTest.cpp
@@ -195,39 +195,8 @@
std::promise<TransactionResult> promise;
};
-// Parameterized fixture that sets the callback to TxnResultCallback
-class ContexthubTxnTest : public ContexthubHidlTest {
- public:
- virtual void SetUp() override {
- ContexthubHidlTest::SetUp();
- ASSERT_OK(registerCallback_1_2(cb));
- }
-
- sp<TxnResultCallback> cb = new TxnResultCallback();
-};
-
-TEST_P(ContexthubTxnTest, TestSendMessageToNonExistentNanoApp) {
- ContextHubMsg msg;
- msg.msg_1_0.appName = kNonExistentAppId;
- msg.msg_1_0.msgType = 1;
- msg.msg_1_0.msg.resize(4);
- std::fill(msg.msg_1_0.msg.begin(), msg.msg_1_0.msg.end(), 0);
-
- ALOGD("Sending message to non-existent nanoapp");
- Result result = hubApi->sendMessageToHub_1_2(getHubId(), msg);
- if (result != Result::OK && result != Result::BAD_PARAMS &&
- result != Result::TRANSACTION_FAILED) {
- FAIL() << "Got result " << asBaseType(result) << ", expected OK, BAD_PARAMS"
- << ", or TRANSACTION_FAILED";
- }
-}
-
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ContexthubHidlTest);
INSTANTIATE_TEST_SUITE_P(HubIdSpecificTests, ContexthubHidlTest, testing::ValuesIn(kTestParameters),
android::hardware::PrintInstanceTupleNameToString<>);
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ContexthubTxnTest);
-INSTANTIATE_TEST_SUITE_P(HubIdSpecificTests, ContexthubTxnTest, testing::ValuesIn(kTestParameters),
- android::hardware::PrintInstanceTupleNameToString<>);
-
} // anonymous namespace