Add visibility attributes in runtime/native

Don't add visibility attributes in dalvik_system_VMRuntime.{h,cc} for
now, because it breaks some apps.

Bug: 260881207
Test: launch app from b/319255249
Test: presubmit
Test: abtd app_compat_drm
Test: abtd app_compat_top_100
Test: abtd app_compat_banking
Change-Id: I538c4f82a753c71fb9d008762d09ada5e1273427
diff --git a/runtime/native/dalvik_system_BaseDexClassLoader.cc b/runtime/native/dalvik_system_BaseDexClassLoader.cc
index a4f702c..f9a1aba 100644
--- a/runtime/native/dalvik_system_BaseDexClassLoader.cc
+++ b/runtime/native/dalvik_system_BaseDexClassLoader.cc
@@ -25,7 +25,7 @@
 #include "nativehelper/jni_macros.h"
 #include "thread-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static bool append_string(Thread* self,
                           Handle<mirror::ObjectArray<mirror::String>> array,
diff --git a/runtime/native/dalvik_system_BaseDexClassLoader.h b/runtime/native/dalvik_system_BaseDexClassLoader.h
index 4ec03ef..5a18b18 100644
--- a/runtime/native/dalvik_system_BaseDexClassLoader.h
+++ b/runtime/native/dalvik_system_BaseDexClassLoader.h
@@ -20,7 +20,9 @@
 #include <jni.h>
 #include <unistd.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_dalvik_system_BaseDexClassLoader(JNIEnv* env);
 
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index f602f73..f1c5d54 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -62,7 +62,7 @@
 #include <sys/system_properties.h>
 #endif  // ART_TARGET_ANDROID
 
-namespace art {
+namespace art HIDDEN {
 
 // Should be the same as dalvik.system.DexFile.ENFORCE_READ_ONLY_JAVA_DCL
 static constexpr uint64_t kEnforceReadOnlyJavaDcl = 218865702;
diff --git a/runtime/native/dalvik_system_DexFile.h b/runtime/native/dalvik_system_DexFile.h
index 77d219d..c22b83d 100644
--- a/runtime/native/dalvik_system_DexFile.h
+++ b/runtime/native/dalvik_system_DexFile.h
@@ -20,7 +20,9 @@
 #include <jni.h>
 #include <unistd.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 constexpr size_t kOatFileIndex = 0;
 constexpr size_t kDexFileIndexStart = 1;
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
index cf2b25d..137b04f 100644
--- a/runtime/native/dalvik_system_VMDebug.cc
+++ b/runtime/native/dalvik_system_VMDebug.cc
@@ -51,7 +51,7 @@
 #include "thread-inl.h"
 #include "trace.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobjectArray VMDebug_getVmFeatureList(JNIEnv* env, jclass) {
   ScopedObjectAccess soa(Thread::ForEnv(env));
diff --git a/runtime/native/dalvik_system_VMDebug.h b/runtime/native/dalvik_system_VMDebug.h
index b7eb8a8..6d53fbe 100644
--- a/runtime/native/dalvik_system_VMDebug.h
+++ b/runtime/native/dalvik_system_VMDebug.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_dalvik_system_VMDebug(JNIEnv* env);
 
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index f1561a2..e774f07 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -66,6 +66,8 @@
 #include "thread-inl.h"
 #include "thread_list.h"
 
+// TODO(260881207): should be HIDDEN, but some apps fail to launch
+// (e.g. b/319255249)
 namespace art {
 
 using android::base::StringPrintf;
diff --git a/runtime/native/dalvik_system_VMRuntime.h b/runtime/native/dalvik_system_VMRuntime.h
index 795caa5..d66c107 100644
--- a/runtime/native/dalvik_system_VMRuntime.h
+++ b/runtime/native/dalvik_system_VMRuntime.h
@@ -19,6 +19,10 @@
 
 #include <jni.h>
 
+#include "base/macros.h"
+
+// TODO(260881207): should be HIDDEN, but some apps fail to launch
+// (e.g. b/319255249)
 namespace art {
 
 void register_dalvik_system_VMRuntime(JNIEnv* env);
diff --git a/runtime/native/dalvik_system_VMStack.cc b/runtime/native/dalvik_system_VMStack.cc
index 596b2eb..599bdb9 100644
--- a/runtime/native/dalvik_system_VMStack.cc
+++ b/runtime/native/dalvik_system_VMStack.cc
@@ -32,7 +32,7 @@
 #include "scoped_thread_state_change-inl.h"
 #include "thread_list.h"
 
-namespace art {
+namespace art HIDDEN {
 
 template <typename T,
           typename ResultT =
diff --git a/runtime/native/dalvik_system_VMStack.h b/runtime/native/dalvik_system_VMStack.h
index 5638f99..c7a62ad 100644
--- a/runtime/native/dalvik_system_VMStack.h
+++ b/runtime/native/dalvik_system_VMStack.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_dalvik_system_VMStack(JNIEnv* env);
 
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index dd44e2e..cc47032 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -47,7 +47,7 @@
 
 #include <sys/resource.h>
 
-namespace art {
+namespace art HIDDEN {
 
 // Set to true to always determine the non-debuggable classes even if we would not allow a debugger
 // to actually attach.
diff --git a/runtime/native/dalvik_system_ZygoteHooks.h b/runtime/native/dalvik_system_ZygoteHooks.h
index ca0658d..fbd14c0 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.h
+++ b/runtime/native/dalvik_system_ZygoteHooks.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_dalvik_system_ZygoteHooks(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index 2abc493..1dc74e0 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -56,7 +56,7 @@
 #include "scoped_thread_state_change-inl.h"
 #include "well_known_classes-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static std::function<hiddenapi::AccessContext()> GetHiddenapiAccessContextFunction(Thread* self) {
   return [=]() REQUIRES_SHARED(Locks::mutator_lock_) {
diff --git a/runtime/native/java_lang_Class.h b/runtime/native/java_lang_Class.h
index 8f769c3..aaa9b66 100644
--- a/runtime/native/java_lang_Class.h
+++ b/runtime/native/java_lang_Class.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_Class(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_Object.cc b/runtime/native/java_lang_Object.cc
index 8fc10d1..5649b2c 100644
--- a/runtime/native/java_lang_Object.cc
+++ b/runtime/native/java_lang_Object.cc
@@ -24,7 +24,7 @@
 #include "native_util.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobject Object_internalClone(JNIEnv* env, jobject java_this) {
   ScopedFastNativeObjectAccess soa(env);
diff --git a/runtime/native/java_lang_Object.h b/runtime/native/java_lang_Object.h
index c860571..1ea2c05 100644
--- a/runtime/native/java_lang_Object.h
+++ b/runtime/native/java_lang_Object.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_Object(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_StackStreamFactory.cc b/runtime/native/java_lang_StackStreamFactory.cc
index f876c10..24d9030 100644
--- a/runtime/native/java_lang_StackStreamFactory.cc
+++ b/runtime/native/java_lang_StackStreamFactory.cc
@@ -23,7 +23,7 @@
 #include "scoped_fast_native_object_access-inl.h"
 #include "thread.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobject StackStreamFactory_nativeGetStackAnchor(JNIEnv* env, jclass) {
   ScopedFastNativeObjectAccess soa(env);
diff --git a/runtime/native/java_lang_StackStreamFactory.h b/runtime/native/java_lang_StackStreamFactory.h
index 2216871..31b3c95 100644
--- a/runtime/native/java_lang_StackStreamFactory.h
+++ b/runtime/native/java_lang_StackStreamFactory.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_StackStreamFactory(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc
index f70a188..1ba0028 100644
--- a/runtime/native/java_lang_String.cc
+++ b/runtime/native/java_lang_String.cc
@@ -31,7 +31,7 @@
 #include "scoped_thread_state_change-inl.h"
 #include "verify_object.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jchar String_charAt(JNIEnv* env, jobject java_this, jint index) {
   ScopedFastNativeObjectAccess soa(env);
diff --git a/runtime/native/java_lang_String.h b/runtime/native/java_lang_String.h
index 357eb3d..a78fdce 100644
--- a/runtime/native/java_lang_String.h
+++ b/runtime/native/java_lang_String.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_String(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_StringFactory.cc b/runtime/native/java_lang_StringFactory.cc
index 2fbebc0..e6c03db 100644
--- a/runtime/native/java_lang_StringFactory.cc
+++ b/runtime/native/java_lang_StringFactory.cc
@@ -28,7 +28,7 @@
 #include "scoped_fast_native_object_access-inl.h"
 #include "scoped_thread_state_change-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jstring StringFactory_newStringFromBytes(JNIEnv* env, jclass, jbyteArray java_data,
                                                 jint high, jint offset, jint byte_count) {
diff --git a/runtime/native/java_lang_StringFactory.h b/runtime/native/java_lang_StringFactory.h
index c476ad3..cdc19df 100644
--- a/runtime/native/java_lang_StringFactory.h
+++ b/runtime/native/java_lang_StringFactory.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_StringFactory(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc
index 63cbd2c..203d98d 100644
--- a/runtime/native/java_lang_System.cc
+++ b/runtime/native/java_lang_System.cc
@@ -29,7 +29,7 @@
 #include "native_util.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 /*
  * We make guarantees about the atomicity of accesses to primitive variables.  These guarantees
diff --git a/runtime/native/java_lang_System.h b/runtime/native/java_lang_System.h
index e371fa5..a529727 100644
--- a/runtime/native/java_lang_System.h
+++ b/runtime/native/java_lang_System.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_System(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
index fd67a0a..65e3009 100644
--- a/runtime/native/java_lang_Thread.cc
+++ b/runtime/native/java_lang_Thread.cc
@@ -29,7 +29,7 @@
 #include "thread_list.h"
 #include "verify_object.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobject Thread_currentThread(JNIEnv* env, jclass) {
   ScopedFastNativeObjectAccess soa(env);
diff --git a/runtime/native/java_lang_Thread.h b/runtime/native/java_lang_Thread.h
index 7700ce2..ef880a9 100644
--- a/runtime/native/java_lang_Thread.h
+++ b/runtime/native/java_lang_Thread.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_Thread(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_Throwable.cc b/runtime/native/java_lang_Throwable.cc
index b89e287..091ad03 100644
--- a/runtime/native/java_lang_Throwable.cc
+++ b/runtime/native/java_lang_Throwable.cc
@@ -23,7 +23,7 @@
 #include "scoped_fast_native_object_access-inl.h"
 #include "thread.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobject Throwable_nativeFillInStackTrace(JNIEnv* env, jclass) {
   ScopedFastNativeObjectAccess soa(env);
diff --git a/runtime/native/java_lang_Throwable.h b/runtime/native/java_lang_Throwable.h
index f9aea84..6758e48 100644
--- a/runtime/native/java_lang_Throwable.h
+++ b/runtime/native/java_lang_Throwable.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_Throwable(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index 4dad46f..ba1fde0 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -38,7 +38,7 @@
 #include "thread-inl.h"
 #include "well_known_classes-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 // A class so we can be friends with ClassLinker and access internal methods.
 class VMClassLoader {
diff --git a/runtime/native/java_lang_VMClassLoader.h b/runtime/native/java_lang_VMClassLoader.h
index bf8d94f..adf0c0a 100644
--- a/runtime/native/java_lang_VMClassLoader.h
+++ b/runtime/native/java_lang_VMClassLoader.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_VMClassLoader(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_invoke_MethodHandle.cc b/runtime/native/java_lang_invoke_MethodHandle.cc
index 5309a28..819656f 100644
--- a/runtime/native/java_lang_invoke_MethodHandle.cc
+++ b/runtime/native/java_lang_invoke_MethodHandle.cc
@@ -27,7 +27,7 @@
 #include "native_util.h"
 #include "scoped_thread_state_change-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static void MethodHandle_invokeExactWithFrame(JNIEnv* env, jobject thiz, jobject arguments) {
   ScopedObjectAccess soa(env);
diff --git a/runtime/native/java_lang_invoke_MethodHandle.h b/runtime/native/java_lang_invoke_MethodHandle.h
index 1f38ac7..f46f324 100644
--- a/runtime/native/java_lang_invoke_MethodHandle.h
+++ b/runtime/native/java_lang_invoke_MethodHandle.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_invoke_MethodHandle(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_invoke_MethodHandleImpl.cc b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
index 00ce01f..ccd3370 100644
--- a/runtime/native/java_lang_invoke_MethodHandleImpl.cc
+++ b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
@@ -28,7 +28,7 @@
 #include "runtime.h"
 #include "scoped_thread_state_change-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobject MethodHandleImpl_getMemberInternal(JNIEnv* env, jobject thiz) {
   ScopedObjectAccess soa(env);
diff --git a/runtime/native/java_lang_invoke_MethodHandleImpl.h b/runtime/native/java_lang_invoke_MethodHandleImpl.h
index 0e50371..49d4c2c 100644
--- a/runtime/native/java_lang_invoke_MethodHandleImpl.h
+++ b/runtime/native/java_lang_invoke_MethodHandleImpl.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_invoke_MethodHandleImpl(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_ref_FinalizerReference.cc b/runtime/native/java_lang_ref_FinalizerReference.cc
index 535b243..52f6f73 100644
--- a/runtime/native/java_lang_ref_FinalizerReference.cc
+++ b/runtime/native/java_lang_ref_FinalizerReference.cc
@@ -26,7 +26,7 @@
 #include "native_util.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jboolean FinalizerReference_makeCircularListIfUnenqueued(JNIEnv* env, jobject javaThis) {
   ScopedFastNativeObjectAccess soa(env);
diff --git a/runtime/native/java_lang_ref_FinalizerReference.h b/runtime/native/java_lang_ref_FinalizerReference.h
index 848a7ad..13d1a12 100644
--- a/runtime/native/java_lang_ref_FinalizerReference.h
+++ b/runtime/native/java_lang_ref_FinalizerReference.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_ref_FinalizerReference(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_ref_Reference.cc b/runtime/native/java_lang_ref_Reference.cc
index bd7235e..4c411c8 100644
--- a/runtime/native/java_lang_ref_Reference.cc
+++ b/runtime/native/java_lang_ref_Reference.cc
@@ -26,7 +26,7 @@
 #include "native_util.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobject Reference_getReferent(JNIEnv* env, jobject javaThis) {
   ScopedFastNativeObjectAccess soa(env);
diff --git a/runtime/native/java_lang_ref_Reference.h b/runtime/native/java_lang_ref_Reference.h
index 0cbf116..cc75069 100644
--- a/runtime/native/java_lang_ref_Reference.h
+++ b/runtime/native/java_lang_ref_Reference.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_ref_Reference(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_reflect_Array.cc b/runtime/native/java_lang_reflect_Array.cc
index ff94593..9ac6e61 100644
--- a/runtime/native/java_lang_reflect_Array.cc
+++ b/runtime/native/java_lang_reflect_Array.cc
@@ -29,7 +29,7 @@
 #include "native_util.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobject Array_createMultiArray(
     JNIEnv* env, jclass, jclass javaElementClass, jintArray javaDimArray) {
diff --git a/runtime/native/java_lang_reflect_Array.h b/runtime/native/java_lang_reflect_Array.h
index 805bf79..35b87b7 100644
--- a/runtime/native/java_lang_reflect_Array.h
+++ b/runtime/native/java_lang_reflect_Array.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_reflect_Array(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
index 98afddc..f9278ab 100644
--- a/runtime/native/java_lang_reflect_Constructor.cc
+++ b/runtime/native/java_lang_reflect_Constructor.cc
@@ -34,7 +34,7 @@
 #include "reflection.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobjectArray Constructor_getExceptionTypes(JNIEnv* env, jobject javaMethod) {
   ScopedFastNativeObjectAccess soa(env);
diff --git a/runtime/native/java_lang_reflect_Constructor.h b/runtime/native/java_lang_reflect_Constructor.h
index 7baae97..9c36ef4 100644
--- a/runtime/native/java_lang_reflect_Constructor.h
+++ b/runtime/native/java_lang_reflect_Constructor.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_reflect_Constructor(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_reflect_Executable.cc b/runtime/native/java_lang_reflect_Executable.cc
index 87c9f6c..3f3b648 100644
--- a/runtime/native/java_lang_reflect_Executable.cc
+++ b/runtime/native/java_lang_reflect_Executable.cc
@@ -35,7 +35,7 @@
 #include "scoped_fast_native_object_access-inl.h"
 #include "well_known_classes.h"
 
-namespace art {
+namespace art HIDDEN {
 
 using android::base::StringPrintf;
 
diff --git a/runtime/native/java_lang_reflect_Executable.h b/runtime/native/java_lang_reflect_Executable.h
index 0cfed62..05b0a23 100644
--- a/runtime/native/java_lang_reflect_Executable.h
+++ b/runtime/native/java_lang_reflect_Executable.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_reflect_Executable(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index f2603d4..622b514 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -37,7 +37,7 @@
 #include "scoped_fast_native_object_access-inl.h"
 #include "well_known_classes.h"
 
-namespace art {
+namespace art HIDDEN {
 
 using android::base::StringPrintf;
 
diff --git a/runtime/native/java_lang_reflect_Field.h b/runtime/native/java_lang_reflect_Field.h
index 1739711..b5368b9 100644
--- a/runtime/native/java_lang_reflect_Field.h
+++ b/runtime/native/java_lang_reflect_Field.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_reflect_Field(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc
index 5f02ad0..8cbc070 100644
--- a/runtime/native/java_lang_reflect_Method.cc
+++ b/runtime/native/java_lang_reflect_Method.cc
@@ -32,7 +32,7 @@
 #include "reflection.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jobject Method_getDefaultValue(JNIEnv* env, jobject javaMethod) {
   ScopedFastNativeObjectAccess soa(env);
diff --git a/runtime/native/java_lang_reflect_Method.h b/runtime/native/java_lang_reflect_Method.h
index 3a93cd0..4b48ced 100644
--- a/runtime/native/java_lang_reflect_Method.h
+++ b/runtime/native/java_lang_reflect_Method.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_reflect_Method(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_reflect_Parameter.cc b/runtime/native/java_lang_reflect_Parameter.cc
index 263a567..fe9e4e3 100644
--- a/runtime/native/java_lang_reflect_Parameter.cc
+++ b/runtime/native/java_lang_reflect_Parameter.cc
@@ -28,7 +28,7 @@
 #include "native_util.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 using android::base::StringPrintf;
 
diff --git a/runtime/native/java_lang_reflect_Parameter.h b/runtime/native/java_lang_reflect_Parameter.h
index f6322b1..97873fb 100644
--- a/runtime/native/java_lang_reflect_Parameter.h
+++ b/runtime/native/java_lang_reflect_Parameter.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_reflect_Parameter(JNIEnv* env);
 
diff --git a/runtime/native/java_lang_reflect_Proxy.cc b/runtime/native/java_lang_reflect_Proxy.cc
index f723ed2..a89f827 100644
--- a/runtime/native/java_lang_reflect_Proxy.cc
+++ b/runtime/native/java_lang_reflect_Proxy.cc
@@ -27,7 +27,7 @@
 #include "scoped_fast_native_object_access-inl.h"
 #include "verify_object.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jclass Proxy_generateProxy(JNIEnv* env, jclass, jstring name, jobjectArray interfaces,
                                   jobject loader, jobjectArray methods, jobjectArray throws) {
diff --git a/runtime/native/java_lang_reflect_Proxy.h b/runtime/native/java_lang_reflect_Proxy.h
index e25f0f7..e6b3f24 100644
--- a/runtime/native/java_lang_reflect_Proxy.h
+++ b/runtime/native/java_lang_reflect_Proxy.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_lang_reflect_Proxy(JNIEnv* env);
 
diff --git a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
index fa288ed..3f4c609 100644
--- a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
+++ b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
@@ -24,7 +24,7 @@
 #include "jni/jni_internal.h"
 #include "native_util.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jboolean AtomicLong_VMSupportsCS8(JNIEnv*, jclass) {
   return QuasiAtomic::LongAtomicsUseMutexes(kRuntimeISA) ? JNI_FALSE : JNI_TRUE;
diff --git a/runtime/native/java_util_concurrent_atomic_AtomicLong.h b/runtime/native/java_util_concurrent_atomic_AtomicLong.h
index 990dc86..de442ed 100644
--- a/runtime/native/java_util_concurrent_atomic_AtomicLong.h
+++ b/runtime/native/java_util_concurrent_atomic_AtomicLong.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_java_util_concurrent_atomic_AtomicLong(JNIEnv* env);
 
diff --git a/runtime/native/jdk_internal_misc_Unsafe.cc b/runtime/native/jdk_internal_misc_Unsafe.cc
index 9b2021d..10c6b2d 100644
--- a/runtime/native/jdk_internal_misc_Unsafe.cc
+++ b/runtime/native/jdk_internal_misc_Unsafe.cc
@@ -36,7 +36,7 @@
 #include "scoped_fast_native_object_access-inl.h"
 #include "well_known_classes-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 namespace {
   // Checks a JNI argument `size` fits inside a size_t and throws a RuntimeException if not (see
diff --git a/runtime/native/jdk_internal_misc_Unsafe.h b/runtime/native/jdk_internal_misc_Unsafe.h
index 779cd5f..61b377b 100644
--- a/runtime/native/jdk_internal_misc_Unsafe.h
+++ b/runtime/native/jdk_internal_misc_Unsafe.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_jdk_internal_misc_Unsafe(JNIEnv* env);
 
diff --git a/runtime/native/libcore_io_Memory.cc b/runtime/native/libcore_io_Memory.cc
index 5e38280..66a16ed 100644
--- a/runtime/native/libcore_io_Memory.cc
+++ b/runtime/native/libcore_io_Memory.cc
@@ -25,7 +25,7 @@
 #include "nativehelper/scoped_primitive_array.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 // Use packed structures for access to unaligned data on targets with alignment restrictions.
 // The compiler will generate appropriate code to access these structures without
diff --git a/runtime/native/libcore_io_Memory.h b/runtime/native/libcore_io_Memory.h
index 8c8a2ec..bf60986 100644
--- a/runtime/native/libcore_io_Memory.h
+++ b/runtime/native/libcore_io_Memory.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_libcore_io_Memory(JNIEnv* env);
 
diff --git a/runtime/native/libcore_util_CharsetUtils.cc b/runtime/native/libcore_util_CharsetUtils.cc
index 46f8993..b497f10 100644
--- a/runtime/native/libcore_util_CharsetUtils.cc
+++ b/runtime/native/libcore_util_CharsetUtils.cc
@@ -28,7 +28,7 @@
 #include "nativehelper/jni_macros.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static void CharsetUtils_asciiBytesToChars(JNIEnv* env, jclass, jbyteArray javaBytes, jint offset,
                                            jint length, jcharArray javaChars) {
diff --git a/runtime/native/libcore_util_CharsetUtils.h b/runtime/native/libcore_util_CharsetUtils.h
index 3518bdb..eaafcab 100644
--- a/runtime/native/libcore_util_CharsetUtils.h
+++ b/runtime/native/libcore_util_CharsetUtils.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_libcore_util_CharsetUtils(JNIEnv* env);
 
diff --git a/runtime/native/native_util.h b/runtime/native/native_util.h
index 784dba3..f399359 100644
--- a/runtime/native/native_util.h
+++ b/runtime/native/native_util.h
@@ -23,7 +23,7 @@
 #include "base/macros.h"
 #include "nativehelper/scoped_local_ref.h"
 
-namespace art {
+namespace art HIDDEN {
 
 ALWAYS_INLINE inline void RegisterNativeMethodsInternal(JNIEnv* env,
                                                         const char* jni_class_name,
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
index 419aed8..b2e94f9 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
@@ -26,7 +26,7 @@
 #include "nativehelper/scoped_primitive_array.h"
 #include "scoped_fast_native_object_access-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static void DdmServer_nativeSendChunk(JNIEnv* env, jclass, jint type,
                                       jbyteArray javaData, jint offset, jint length) {
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.h b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.h
index 9a4645c..fc5cfc9 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.h
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_org_apache_harmony_dalvik_ddmc_DdmServer(JNIEnv* env);
 
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
index f20cd28..6da4529 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
@@ -31,7 +31,7 @@
 #include "scoped_fast_native_object_access-inl.h"
 #include "thread_list.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static void DdmVmInternal_setRecentAllocationsTrackingEnabled(JNIEnv*, jclass, jboolean enable) {
   Dbg::SetAllocTrackingEnabled(enable);
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.h b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.h
index 736e4c8..5484f36 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.h
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_org_apache_harmony_dalvik_ddmc_DdmVmInternal(JNIEnv* env);
 
diff --git a/runtime/native/scoped_fast_native_object_access-inl.h b/runtime/native/scoped_fast_native_object_access-inl.h
index 0b8ad11..cd1a0b2 100644
--- a/runtime/native/scoped_fast_native_object_access-inl.h
+++ b/runtime/native/scoped_fast_native_object_access-inl.h
@@ -22,7 +22,7 @@
 #include "art_method.h"
 #include "scoped_thread_state_change-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 inline ScopedFastNativeObjectAccess::ScopedFastNativeObjectAccess(JNIEnv* env)
     : ScopedObjectAccessAlreadyRunnable(env) {
diff --git a/runtime/native/scoped_fast_native_object_access.h b/runtime/native/scoped_fast_native_object_access.h
index 6a9365d..a3b01d7 100644
--- a/runtime/native/scoped_fast_native_object_access.h
+++ b/runtime/native/scoped_fast_native_object_access.h
@@ -19,9 +19,10 @@
 
 #include <jni.h>
 
+#include "base/macros.h"
 #include "scoped_thread_state_change.h"
 
-namespace art {
+namespace art HIDDEN {
 
 // Variant of ScopedObjectAccess that does no runnable transitions. Should only be used by "fast"
 // JNI methods.
diff --git a/runtime/native/string_array_utils.h b/runtime/native/string_array_utils.h
index 41d5093..f1fbe54 100644
--- a/runtime/native/string_array_utils.h
+++ b/runtime/native/string_array_utils.h
@@ -17,13 +17,14 @@
 #ifndef ART_RUNTIME_NATIVE_STRING_ARRAY_UTILS_H_
 #define ART_RUNTIME_NATIVE_STRING_ARRAY_UTILS_H_
 
+#include "base/macros.h"
 #include "base/locks.h"
 #include "class_root-inl.h"
 #include "handle_scope-inl.h"
 #include "mirror/object_array-alloc-inl.h"
 #include "mirror/string.h"
 
-namespace art {
+namespace art HIDDEN {
 
 namespace detail {
 
diff --git a/runtime/native/sun_misc_Unsafe.cc b/runtime/native/sun_misc_Unsafe.cc
index f1e47ee..573b5a9 100644
--- a/runtime/native/sun_misc_Unsafe.cc
+++ b/runtime/native/sun_misc_Unsafe.cc
@@ -36,7 +36,7 @@
 #include "scoped_fast_native_object_access-inl.h"
 #include "well_known_classes-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 static jboolean Unsafe_compareAndSwapInt(JNIEnv* env, jobject, jobject javaObj, jlong offset,
                                          jint expectedValue, jint newValue) {
diff --git a/runtime/native/sun_misc_Unsafe.h b/runtime/native/sun_misc_Unsafe.h
index 93194f4..fe120b5 100644
--- a/runtime/native/sun_misc_Unsafe.h
+++ b/runtime/native/sun_misc_Unsafe.h
@@ -19,7 +19,9 @@
 
 #include <jni.h>
 
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
 
 void register_sun_misc_Unsafe(JNIEnv* env);