Link all internal libraries statically into hiddenapi(d).

Test: m hiddenapi{,d}
Test: readelf -d out/host/linux-x86/bin/dex2oat(d)
  Check that NEEDED only lists system libraries (libdl, libpthread,
  libm, librt, libgcc_s, libc).
Bug: 145934348
Change-Id: I9b1473e40b3f1f37133443407b1a5d2dd66432f8
diff --git a/tools/hiddenapi/Android.bp b/tools/hiddenapi/Android.bp
index 29486a7..89d1eb3 100644
--- a/tools/hiddenapi/Android.bp
+++ b/tools/hiddenapi/Android.bp
@@ -29,14 +29,19 @@
         },
     },
 
-    shared_libs: [
+    stl: "c++_static",
+    static_libs: [
         "libbase",
     ],
 }
 
 art_cc_binary {
     name: "hiddenapi",
-    defaults: ["hiddenapi-defaults"],
+    defaults: [
+        "hiddenapi-defaults",
+        "libartbase_static_defaults",
+        "libdexfile_static_defaults",
+    ],
     target: {
         host: {
             // Override the prefer32 added by art_cc_binary when
@@ -46,10 +51,6 @@
             compile_multilib: "64",
         },
     },
-    shared_libs: [
-        "libdexfile",
-        "libartbase",
-    ],
 }
 
 art_cc_binary {
@@ -57,10 +58,8 @@
     defaults: [
         "art_debug_defaults",
         "hiddenapi-defaults",
-    ],
-    shared_libs: [
-        "libdexfiled",
-        "libartbased",
+        "libartbased_static_defaults",
+        "libdexfiled_static_defaults",
     ],
 }