Re-submit "Make mainline device use apex"

The build system default was changed to not support apex, but
we want the mainline device to enable it.

Test: make mainline_system
Merged-In: I9f29e8354acffb1856dfd8a173b80a3f9324630c
Change-Id: I9f29e8354acffb1856dfd8a173b80a3f9324630c
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 9a3d97e..4e06d80 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -676,6 +676,8 @@
 # Change file layout of system_other
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system_other)
 
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/apex)
+
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
 # ************************************************
diff --git a/target/board/mainline_arm64/BoardConfig.mk b/target/board/mainline_arm64/BoardConfig.mk
index 70505f4..ea2b3c5 100644
--- a/target/board/mainline_arm64/BoardConfig.mk
+++ b/target/board/mainline_arm64/BoardConfig.mk
@@ -34,3 +34,8 @@
 
 BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
 BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
+
+# Mainline devices support apex
+# TODO: move this to BoardConfigMainlineCommon. Currently, GSI wants flattened
+#       apexes, but emulator wants .apex files, preventing this.
+TARGET_FLATTEN_APEX := false