Exclude setting code maps from APEX

some APEX modules are running into null-deref when calling
AIBinder_Class_setTransactionCodeToFunctionNameMap (artd).
Don't call the API from APEX modules.

Test: m CtsNdkBinderTestCases && atest -c CtsNdkBinderTestCases
Bug: 370091328
Change-Id: Id2a47f29fedb6b045d58fc034bda5d8f2cab0f51
diff --git a/libs/binder/ndk/include_cpp/android/binder_interface_utils.h b/libs/binder/ndk/include_cpp/android/binder_interface_utils.h
index 8296356..acb6970 100644
--- a/libs/binder/ndk/include_cpp/android/binder_interface_utils.h
+++ b/libs/binder/ndk/include_cpp/android/binder_interface_utils.h
@@ -298,7 +298,8 @@
 #endif
 
 // TODO(b/368559337): fix versioning on product partition
-#if !defined(__ANDROID_PRODUCT__) && \
+// TODO(b/370091328): APEX modules call this function even it is unavailable.
+#if !defined(__ANDROID_APEX__) && !defined(__ANDROID_PRODUCT__) && \
         (defined(__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__) || __ANDROID_API__ >= 36)
     if API_LEVEL_AT_LEAST (36, 202504) {
         if (codeToFunction != nullptr) {
@@ -309,7 +310,8 @@
 #else
     (void)codeToFunction;
     (void)functionCount;
-#endif  // defined(__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__) || __ANDROID_API__ >= 36
+#endif  // !defined(__ANDROID_APEX__) && !defined(__ANDROID_PRODUCT__) && \
+//     (defined(__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__) || __ANDROID_API__ >= 36)
     return clazz;
 }