Snap for 10360508 from 36a22ac0495571b5faa7258dfa074c7f3c6ef1d7 to udc-release

Change-Id: Ie537f6c63bde88ef54d72a8d4daa0979a1608de6
diff --git a/host/hal_generic/common/hal_client_manager.cc b/host/hal_generic/common/hal_client_manager.cc
index 1660ff5..f6945eb 100644
--- a/host/hal_generic/common/hal_client_manager.cc
+++ b/host/hal_generic/common/hal_client_manager.cc
@@ -159,7 +159,8 @@
 
   for (const auto &[procName, id] : mProcessNamesToClientIds) {
     if (id == clientId && procName == kSystemServerName) {
-      mIsFirstClient = false;
+      LOGE("System server is disconnected");
+      mIsFirstClient = true;
     }
   }
 
diff --git a/host/hal_generic/common/multi_client_context_hub_base.cc b/host/hal_generic/common/multi_client_context_hub_base.cc
index 543eb47..950c09f 100644
--- a/host/hal_generic/common/multi_client_context_hub_base.cc
+++ b/host/hal_generic/common/multi_client_context_hub_base.cc
@@ -41,6 +41,7 @@
 enum class HalErrorCode : int32_t {
   OPERATION_FAILED = -1,
   INVALID_RESULT = -2,
+  INVALID_ARGUMENT = -3,
 };
 
 bool isValidContextHubId(uint32_t hubId) {
@@ -333,14 +334,14 @@
       break;
     default:
       LOGE("Unsupported host endpoint type %" PRIu32, info.type);
-      return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+      return fromServiceError(HalErrorCode::INVALID_ARGUMENT);
   }
 
   uint16_t endpointId = info.hostEndpointId;
   if (!mHalClientManager->registerEndpointId(info.hostEndpointId) ||
       !mHalClientManager->mutateEndpointIdFromHostIfNeeded(
           AIBinder_getCallingPid(), endpointId)) {
-    return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+    return fromServiceError(HalErrorCode::INVALID_ARGUMENT);
   }
   flatbuffers::FlatBufferBuilder builder(64);
   HostProtocolHost::encodeHostEndpointConnected(