Move logic to disable flattening in unbundled app mode from Soong to
make.

Avoids TARGET_FLATTEN_APEX lying about it, so we can trust it in
scripts, e.g. in art/build/apex/runtests.sh.

Test: banchan com.android.art; art/build/apex/runtests.sh
Bug: 179900989
Change-Id: I5d3226047e51a51ee76de2cbfad050e200568655
diff --git a/core/board_config.mk b/core/board_config.mk
index 9061342..0936234 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -764,8 +764,8 @@
 endif
 
 ###########################################
-# APEXes are by default flattened, i.e. non-updatable.
-# It can be unflattened (and updatable) by inheriting from
+# APEXes are by default flattened, i.e. non-updatable, if not building unbundled
+# apps. It can be unflattened (and updatable) by inheriting from
 # updatable_apex.mk
 #
 # APEX flattening can also be forcibly enabled (resp. disabled) by
@@ -774,7 +774,7 @@
 ifdef OVERRIDE_TARGET_FLATTEN_APEX
   TARGET_FLATTEN_APEX := $(OVERRIDE_TARGET_FLATTEN_APEX)
 else
-  ifeq (,$(TARGET_FLATTEN_APEX))
+  ifeq (,$(TARGET_BUILD_APPS)$(TARGET_FLATTEN_APEX))
     TARGET_FLATTEN_APEX := true
   endif
 endif