Reland "Add $(PRODUCT_OUT)/apex to the artifact path whitelist"

This reverts commit 4cf7cde9aa8aab116381737d5055cd5faeb24bff.

Bug: 120846816
Test: build/soong/build_test.bash -dist -products mainline_system_arm64
Test: lunch aosp_cf_x86_pasan-userdebug; m && SANITIZE_TARGET=address m

Change-Id: I6fbf23dcef450da17fafafa78def3816792d83c8
diff --git a/core/main.mk b/core/main.mk
index 712b2c5..67cd3ac 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1133,7 +1133,12 @@
   static_whitelist_patterns += %__auto_generated_rro.apk
   # Auto-included targets are not considered
   static_whitelist_patterns += $(call module-installed-files,$(call auto-included-modules))
-
+  # $(PRODUCT_OUT)/apex is where shared libraries in APEXes get installed.
+  # The path can be considered as a fake path, as the shared libraries
+  # are installed there just to have symbols files for them under
+  # $(PRODUCT_OUT)/symbols/apex for debugging purpose. The /apex directory
+  # is never compiled into a filesystem image.
+  static_whitelist_patterns += $(PRODUCT_OUT)/apex/%
   ifeq (true,$(BOARD_USES_SYSTEM_OTHER_ODEX))
     # Allow system_other odex space optimization.
     static_whitelist_patterns += \