Add support for new APIs in default/vts code

Bug: 229888878
Test: presubmits
Change-Id: Ifc1ce761cc211d165b2f2f9315beffbb47f8fb85
diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp
index ac1dc46..615ac5c 100644
--- a/contexthub/aidl/default/ContextHub.cpp
+++ b/contexthub/aidl/default/ContextHub.cpp
@@ -87,6 +87,10 @@
     return ndk::ScopedAStatus::ok();
 }
 
+ScopedAStatus ContextHub::onNanSessionStateChanged(bool /*sin_state*/) {
+    return ndk::ScopedAStatus::ok();
+}
+
 ScopedAStatus ContextHub::registerCallback(int32_t in_contextHubId,
                                            const std::shared_ptr<IContextHubCallback>& in_cb) {
     if (in_contextHubId == kMockHubId) {
diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
index 4aeb948..b3998b9 100644
--- a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
+++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
@@ -47,6 +47,7 @@
     ::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override;
 
     ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override;
+    ::ndk::ScopedAStatus onNanSessionStateChanged(bool in_state) override;
 
   private:
     static constexpr uint32_t kMockHubId = 0;
diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
index 8104f27..4731648 100644
--- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
+++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
@@ -100,6 +100,8 @@
     Status handleTransactionResult(int32_t /* transactionId */, bool /* success */) override {
         return Status::ok();
     }
+
+    Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); }
 };
 
 TEST_P(ContextHubAidl, TestRegisterCallback) {
@@ -131,6 +133,8 @@
         return Status::ok();
     }
 
+    Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); }
+
     std::promise<std::vector<NanoappInfo>> promise;
 };
 
@@ -194,6 +198,8 @@
         return Status::ok();
     }
 
+    Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); }
+
     uint32_t expectedTransactionId = 0;
     std::promise<bool> promise;
 };
@@ -354,6 +360,11 @@
     ASSERT_TRUE(contextHub->onHostEndpointDisconnected(kHostEndpointId).isOk());
 }
 
+TEST_P(ContextHubAidl, TestNanSessionStateChange) {
+    ASSERT_TRUE(contextHub->onNanSessionStateChanged(true /*state*/).isOk());
+    ASSERT_TRUE(contextHub->onNanSessionStateChanged(false /*state*/).isOk());
+}
+
 std::string PrintGeneratedTest(const testing::TestParamInfo<ContextHubAidl::ParamType>& info) {
     return std::string("CONTEXT_HUB_ID_") + std::to_string(std::get<1>(info.param));
 }