From 5dba921320aa294538b4bed47e80ec4f17bb6ee9 Mon Sep 17 00:00:00 2001 From: Arthur Ishiguro Date: Tue, 1 Feb 2022 17:03:32 +0000 Subject: [PATCH] Remove use of ILLEGAL_ARGUMENT in hostEndpointDisconnected Since an invalid argument to hostEndpointDisconnected should be ignored by the HAL (and the Context Hub service), remove the EX_ILLEGAL_ARGUMENT requirement in the Context Hub AIDL HAL. Bug: 216798253 Test: Compile Change-Id: I83f08ccb998e6b494307de51f8709f3e0fbd2c99 --- contexthub/aidl/android/hardware/contexthub/IContextHub.aidl | 5 ++--- contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl index 2135041ed7..16666efd95 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl @@ -189,9 +189,8 @@ interface IContextHub { * called, the HAL is expected to clean up any resources attached to the messaging channel * associated with this host endpoint ID. * - * @param hostEndPointId The ID of the host that has disconnected. - * - * @throws EX_ILLEGAL_ARGUMENT if hostEndpointId is not associated with a connected host. + * @param hostEndPointId The ID of the host that has disconnected. Any invalid values for this + * parameter should be ignored (no-op). */ void onHostEndpointDisconnected(char hostEndpointId); diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index f0583be581..3c01c6bac2 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -338,8 +338,7 @@ TEST_P(ContextHubAidl, TestHostConnection) { TEST_P(ContextHubAidl, TestInvalidHostConnection) { constexpr char16_t kHostEndpointId = 1; - Status status = contextHub->onHostEndpointDisconnected(kHostEndpointId); - ASSERT_EQ(status.exceptionCode(), android::binder::Status::EX_ILLEGAL_ARGUMENT); + ASSERT_TRUE(contextHub->onHostEndpointDisconnected(kHostEndpointId).isOk()); } std::string PrintGeneratedTest(const testing::TestParamInfo& info) {