Don't use apexd when TARGET_FLATTEN_APEX == true

When TARGET_FLATTEN_APEX is true, the build system creates an empty
directory /system/apex/com.android.runtime. At runtime, init bind mounts
the entire /system/apex to /apex and then specially bind mounts
the runtime APEX (/system/apex/com.android.runtime.{debug|release}) to
the empty directory. This allows the runtime APEX is accessible via the
canonical path /apex/com.android.runtime without apexd.

Bug: 132413565
Test: marlin is bootable
Merged-In: Ia25f83d2fbc2b1784fc83b0d5b39a31093d0dfdf
Change-Id: Ia25f83d2fbc2b1784fc83b0d5b39a31093d0dfdf
(cherry picked from commit 442f0f129ed856547ed8e324882bd63318d56f21)
diff --git a/Android.mk b/Android.mk
index 9879864..2a2a03c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -384,6 +384,13 @@
 # Note that installation of the symlink is triggered by the apex_manifest.json
 # file which is the file that is guaranteed to be created regardless of the
 # value of TARGET_FLATTEN_APEX.
+#
+# b/132413565: Also, when TARGET_FLATTEN_APEX, an empty directory
+# /system/apex/com.android.runtime is created. After the entire
+# /system/apex is mounted on /apex, the flattened runtime APEX
+# (either com.android.runtime.debug or *.release) is mounted on the empty
+# directory so that the APEX is accessible via the canonical path
+# /apex/com.android.runtime
 ifeq ($(TARGET_FLATTEN_APEX),true)
 runtime_apex_manifest_file := $(PRODUCT_OUT)/system/apex/$(TARGET_RUNTIME_APEX)/apex_manifest.json
 else
@@ -396,6 +403,9 @@
 $(runtime_apex_symlink_timestamp):
 	$(hide) mkdir -p $(dir $(PRIVATE_LINK_NAME))
 	$(hide) ln -sf $(TARGET_RUNTIME_APEX) $(PRIVATE_LINK_NAME)
+ifeq ($(TARGET_FLATTEN_APEX),true)
+	$(hide) mkdir -p $(TARGET_OUT)/apex/com.android.runtime
+endif
 	$(hide) touch $@
 
 runtime_apex_manifest_file :=