Define empty callback in Context Hub AIDL VTS

Current implementation results in registering a nullptr.

Bug: 194285834
Test: Run VTS
Change-Id: I68c75011a377013e2ee02ef0fc088d78af896e09
This commit is contained in:
Arthur Ishiguro
2021-10-29 16:01:35 +00:00
parent 4c46fb83b9
commit e6b540d3bd

View File

@@ -82,10 +82,28 @@ TEST_P(ContextHubAidl, TestGetHubs) {
}
}
class EmptyContextHubCallback : public android::hardware::contexthub::BnContextHubCallback {
public:
Status handleNanoappInfo(const std::vector<NanoappInfo>& /* appInfo */) override {
return Status::ok();
}
Status handleContextHubMessage(const ContextHubMessage& /* msg */,
const std::vector<String16>& /* msgContentPerms */) override {
return Status::ok();
}
Status handleContextHubAsyncEvent(AsyncEventType /* evt */) override { return Status::ok(); }
Status handleTransactionResult(int32_t /* transactionId */, bool /* success */) override {
return Status::ok();
}
};
TEST_P(ContextHubAidl, TestRegisterCallback) {
bool success;
ASSERT_TRUE(contextHub->registerCallback(getHubId(), new IContextHubCallbackDefault(), &success)
.isOk());
sp<EmptyContextHubCallback> cb = sp<EmptyContextHubCallback>::make();
ASSERT_TRUE(contextHub->registerCallback(getHubId(), cb, &success).isOk());
ASSERT_TRUE(success);
}
@@ -263,8 +281,8 @@ void ContextHubAidl::testSettingChanged(Setting setting) {
// In VTS, we only test that sending the values doesn't cause things to blow up - GTS tests
// verify the expected E2E behavior in CHRE
bool success;
ASSERT_TRUE(contextHub->registerCallback(getHubId(), new IContextHubCallbackDefault(), &success)
.isOk());
sp<EmptyContextHubCallback> cb = sp<EmptyContextHubCallback>::make();
ASSERT_TRUE(contextHub->registerCallback(getHubId(), cb, &success).isOk());
ASSERT_TRUE(success);
ASSERT_TRUE(contextHub->onSettingChanged(setting, true /* enabled */).isOk());