Fix VTS ContextHubAidl#TestEnableTestMode

We need to process the nanoapp list response no matter if a callback
exists or not.

Bug: 262820493
Test: TODO
Change-Id: I5497c168e5fa1e34028f88c8f1e6b29cf5a228cb
diff --git a/host/hal_generic/aidl/generic_context_hub_aidl.cc b/host/hal_generic/aidl/generic_context_hub_aidl.cc
index 70cca83..dae0d6f 100644
--- a/host/hal_generic/aidl/generic_context_hub_aidl.cc
+++ b/host/hal_generic/aidl/generic_context_hub_aidl.cc
@@ -361,12 +361,7 @@
 
 void ContextHub::onNanoappListResponse(
     const ::chre::fbs::NanoappListResponseT &response) {
-  std::lock_guard<std::mutex> lock(mCallbackMutex);
-  if (mCallback == nullptr) {
-    return;
-  }
   std::vector<NanoappInfo> appInfoList;
-
   for (const std::unique_ptr<::chre::fbs::NanoappListEntryT> &nanoapp :
        response.nanoapps) {
     // TODO(b/245202050): determine if this is really required, and if so, have
@@ -408,7 +403,10 @@
     }
   }
 
-  mCallback->handleNanoappInfo(appInfoList);
+  std::lock_guard<std::mutex> lock(mCallbackMutex);
+  if (mCallback != nullptr) {
+    mCallback->handleNanoappInfo(appInfoList);
+  }
 }
 
 void ContextHub::onTransactionResult(uint32_t transactionId, bool success) {