Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6b540d3 authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Define empty callback in Context Hub AIDL VTS

Current implementation results in registering a nullptr.

Bug: 194285834
Test: Run VTS
Change-Id: I68c75011a377013e2ee02ef0fc088d78af896e09
parent 4c46fb83
Loading
Loading
Loading
Loading
+22 −4
Original line number Diff line number Diff line
@@ -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());