Deprecate flattened apexes

Flattened apexes are deprecated. mege_dexopt does not need to care about
flattened apexes.

Bug: 278826656
Test: m otapackage
Change-Id: I527eed64c5f1a7466e2c48d73360f47f6cfa0911
diff --git a/tools/releasetools/merge/merge_dexopt.py b/tools/releasetools/merge/merge_dexopt.py
index 1dd591b..c21103c 100644
--- a/tools/releasetools/merge/merge_dexopt.py
+++ b/tools/releasetools/merge/merge_dexopt.py
@@ -72,7 +72,6 @@
   #         <contents of vendor dexpreopt_config.zip>
   #     system -> output/SYSTEM
   #     vendor -> output/VENDOR
-  #     apex -> output/SYSTEM/apex (only for flattened APEX builds)
   #     apex/ (extracted updatable APEX)
   #         <apex 1>/
   #             ...
@@ -114,19 +113,11 @@
       os.path.join(output_target_files_dir, 'VENDOR'),
       os.path.join(temp_dir, 'vendor'))
 
-  # The directory structure for flatteded APEXes is:
-  #
-  # SYSTEM
-  #     apex
-  #         <APEX name, e.g., com.android.wifi>
-  #             apex_manifest.pb
-  #             apex_pubkey
-  #             etc/
-  #             javalib/
-  #             lib/
-  #             lib64/
-  #             priv-app/
-  #
+  # Extract APEX.
+  logging.info('extracting APEX')
+  apex_extract_root_dir = os.path.join(temp_dir, 'apex')
+  os.makedirs(apex_extract_root_dir)
+
   # The directory structure for updatable APEXes is:
   #
   # SYSTEM
@@ -136,46 +127,33 @@
   #         com.android.art.apex
   #         ...
   apex_root = os.path.join(output_target_files_dir, 'SYSTEM', 'apex')
+  for apex in (glob.glob(os.path.join(apex_root, '*.apex')) +
+                glob.glob(os.path.join(apex_root, '*.capex'))):
+    logging.info('  apex: %s', apex)
+    # deapexer is in the same directory as the merge_target_files binary extracted
+    # from otatools.zip.
+    apex_json_info = subprocess.check_output(['deapexer', 'info', apex])
+    logging.info('    info: %s', apex_json_info)
+    apex_info = json.loads(apex_json_info)
+    apex_name = apex_info['name']
+    logging.info('    name: %s', apex_name)
 
-  # Check for flattended versus updatable APEX.
-  if OPTIONS.framework_misc_info.get('target_flatten_apex') == 'false':
-    # Extract APEX.
-    logging.info('extracting APEX')
+    apex_extract_dir = os.path.join(apex_extract_root_dir, apex_name)
+    os.makedirs(apex_extract_dir)
 
-    apex_extract_root_dir = os.path.join(temp_dir, 'apex')
-    os.makedirs(apex_extract_root_dir)
-
-    for apex in (glob.glob(os.path.join(apex_root, '*.apex')) +
-                 glob.glob(os.path.join(apex_root, '*.capex'))):
-      logging.info('  apex: %s', apex)
-      # deapexer is in the same directory as the merge_target_files binary extracted
-      # from otatools.zip.
-      apex_json_info = subprocess.check_output(['deapexer', 'info', apex])
-      logging.info('    info: %s', apex_json_info)
-      apex_info = json.loads(apex_json_info)
-      apex_name = apex_info['name']
-      logging.info('    name: %s', apex_name)
-
-      apex_extract_dir = os.path.join(apex_extract_root_dir, apex_name)
-      os.makedirs(apex_extract_dir)
-
-      # deapexer uses debugfs_static, which is part of otatools.zip.
-      command = [
-          'deapexer',
-          '--debugfs_path',
-          'debugfs_static',
-          '--fsckerofs_path',
-          'fsck.erofs',
-          'extract',
-          apex,
-          apex_extract_dir,
-      ]
-      logging.info('    running %s', command)
-      subprocess.check_call(command)
-  else:
-    # Flattened APEXes don't need to be extracted since they have the necessary
-    # directory structure.
-    os.symlink(os.path.join(apex_root), os.path.join(temp_dir, 'apex'))
+    # deapexer uses debugfs_static/fsck.erofs from otatools.zip.
+    command = [
+        'deapexer',
+        '--debugfs_path',
+        'debugfs_static',
+        '--fsckerofs_path',
+        'fsck.erofs',
+        'extract',
+        apex,
+        apex_extract_dir,
+    ]
+    logging.info('    running %s', command)
+    subprocess.check_call(command)
 
   # Modify system config to point to the tools that have been extracted.
   # Absolute or .. paths are not allowed  by the dexpreopt_gen tool in