Make dex2oat(d) and hiddenapi 64-bit only on host.

Following https://r.android.com/1239726 we no longer need multilib host
dex2oat.

Also clean up a prefer32 device override that isn't applicable for the
host-only hiddenapi binary.

Test: m (with and without HOST_PREFER_32_BIT=true)
Test: art/build/apex/runtests.sh (with and without HOST_PREFER_32_BIT=true)
Test: lunch sdk-eng && art/tools/buildbot-build.sh --host && \
  art/test/run-test --host --optimizing 641-checker-arraycopy
  (with and without HOST_PREFER_32_BIT=true)
Bug: 148372405
Bug: 149749169
Change-Id: I46256ad7e8778e8d0f24b40d5acde482c4b66971
diff --git a/build/apex/Android.bp b/build/apex/Android.bp
index 03704c3..4d96d6d 100644
--- a/build/apex/Android.bp
+++ b/build/apex/Android.bp
@@ -11,24 +11,10 @@
 // - Base requirements (binaries for which a 32-bit version is preferred on device, but for which
 //   only the "first" (likely 64-bit) version is required on host).
 art_runtime_base_binaries_prefer32_on_device_first_on_host = [
+    "dex2oat",
     "dexoptanalyzer",
     "profman",
 ]
-// - Base requirements (binaries for which a 32-bit version is preferred on device, but for which
-//   "both" versions (32- and 64-bit, if possible) are required on host).
-art_runtime_base_binaries_prefer32_on_device_both_on_host = [
-    "dex2oat",
-]
-
-art_runtime_base_binaries_prefer32_on_device =
-    art_runtime_base_binaries_prefer32_on_device_first_on_host +
-    art_runtime_base_binaries_prefer32_on_device_both_on_host
-
-art_runtime_base_binaries_both_on_host =
-  art_runtime_base_binaries_prefer32_on_device_both_on_host
-
-art_runtime_base_binaries_first_on_host =
-  art_runtime_base_binaries_prefer32_on_device_first_on_host
 
 // - Base requirements (libraries).
 //
@@ -80,24 +66,10 @@
 // - Debug variants (binaries for which a 32-bit version is preferred on device, but for which
 //   only the "first" (likely 64-bit) version is required on host).
 art_runtime_debug_binaries_prefer32_on_device_first_on_host = [
+    "dex2oatd",
     "dexoptanalyzerd",
     "profmand",
 ]
-// - Debug variants (binaries for which a 32-bit version is preferred on device, but for which
-//   "both" versions (32- and 64-bit, if possible) are required on host).
-art_runtime_debug_binaries_prefer32_on_device_both_on_host = [
-    "dex2oatd",
-]
-
-art_runtime_debug_binaries_prefer32_on_device =
-    art_runtime_debug_binaries_prefer32_on_device_first_on_host +
-    art_runtime_debug_binaries_prefer32_on_device_both_on_host
-
-art_runtime_debug_binaries_both_on_host =
-    art_runtime_debug_binaries_prefer32_on_device_both_on_host
-
-art_runtime_debug_binaries_first_on_host =
-    art_runtime_debug_binaries_prefer32_on_device_first_on_host
 
 // - Debug variants (libraries).
 art_runtime_debug_native_shared_libs = [
@@ -239,7 +211,7 @@
             binaries: art_runtime_base_binaries_both,
         },
         prefer32: {
-            binaries: art_runtime_base_binaries_prefer32_on_device
+            binaries: art_runtime_base_binaries_prefer32_on_device_first_on_host,
         },
         first: {
             binaries: art_tools_common_binaries +
@@ -266,7 +238,7 @@
             binaries: art_tools_debug_binaries_both,
         },
         prefer32: {
-            binaries: art_runtime_debug_binaries_prefer32_on_device,
+            binaries: art_runtime_debug_binaries_prefer32_on_device_first_on_host,
         },
         first: {
             binaries: art_tools_debug_binaries +
@@ -352,14 +324,11 @@
     multilib: {
         both: {
             binaries: art_runtime_base_binaries_both +
-                art_runtime_base_binaries_both_on_host +
-                art_runtime_debug_binaries_both_on_host +
                 art_tools_debug_binaries_both,
         },
         first: {
-            binaries:
-                art_runtime_base_binaries_first_on_host +
-                art_runtime_debug_binaries_first_on_host +
+            binaries: art_runtime_base_binaries_prefer32_on_device_first_on_host +
+                art_runtime_debug_binaries_prefer32_on_device_first_on_host +
                 art_tools_common_binaries +
                 art_tools_debug_binaries + // Host APEX is always debug.
                 art_tools_host_only_binaries,
diff --git a/build/apex/art_apex_test.py b/build/apex/art_apex_test.py
index bc0de41..0e63afd 100755
--- a/build/apex/art_apex_test.py
+++ b/build/apex/art_apex_test.py
@@ -614,8 +614,7 @@
   def run(self):
     # Check binaries for ART.
     self._checker.check_executable('hprof-conv')
-    self._checker.check_symlinked_multilib_executable('dex2oat')
-    self._checker.check_symlinked_multilib_executable('dex2oatd')
+    self._checker.check_executable('dex2oatd')
 
     # Check exported native libraries for Managed Core Library.
     self._checker.check_native_library('libandroidicu-host')
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index e5e5b95..4a72faa 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -275,20 +275,10 @@
             // HOST_PREFER_32_BIT is in use. Necessary because the logic in
             // Soong for setting ctx.Config().BuildOSTarget (used in
             // dexpreopt.RegisterToolDeps) doesn't take host prefer32 into
-            // account. Note that this override cannot be in cc_default because
+            // account. Note that this override cannot be in cc_defaults because
             // it'd get overridden by the load hook even when it uses
             // PrependProperties.
-            compile_multilib: "both",
-            symlink_preferred_arch: true,
-        },
-        linux_glibc_x86: {
-            suffix: "32",
-        },
-        linux_glibc_x86_64: {
-            suffix: "64",
-        },
-        linux_bionic_x86_64: {
-            suffix: "64",
+            compile_multilib: "64",
         },
     },
     apex_available: [
@@ -336,20 +326,10 @@
             // HOST_PREFER_32_BIT is in use. Necessary because the logic in
             // Soong for setting ctx.Config().BuildOSTarget (used in
             // dexpreopt.RegisterToolDeps) doesn't take host prefer32 into
-            // account. Note that this override cannot be in cc_default because
+            // account. Note that this override cannot be in cc_defaults because
             // it'd get overridden by the load hook even when it uses
             // PrependProperties.
-            compile_multilib: "both",
-            symlink_preferred_arch: true,
-        },
-        linux_glibc_x86: {
-            suffix: "32",
-        },
-        linux_glibc_x86_64: {
-            suffix: "64",
-        },
-        linux_bionic_x86_64: {
-            suffix: "64",
+            compile_multilib: "64",
         },
     },
     apex_available: [
diff --git a/tools/hiddenapi/Android.bp b/tools/hiddenapi/Android.bp
index e77e4c7..9ddaf7d 100644
--- a/tools/hiddenapi/Android.bp
+++ b/tools/hiddenapi/Android.bp
@@ -24,9 +24,6 @@
     ],
 
     target: {
-        android: {
-            compile_multilib: "prefer32",
-        },
         darwin: {
             enabled: true,
         },
@@ -40,6 +37,15 @@
 art_cc_binary {
     name: "hiddenapi",
     defaults: ["hiddenapi-defaults"],
+    target: {
+        host: {
+            // Override the prefer32 added by art_cc_binary when
+            // HOST_PREFER_32_BIT is in use. Note that this override cannot be
+            // in cc_defaults because it'd get overridden by the load hook even
+            // when it uses PrependProperties.
+            compile_multilib: "64",
+        },
+    },
     shared_libs: [
         "libdexfile",
         "libartbase",