ART: Move to libbase StringPrintf
Remove ART's StringPrintf implementation. Fix up clients. Add
missing includes where necessary.
Test: m test-art-host
Change-Id: I564038d5868595ac3bb88d641af1000cea940e5a
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 1a77072..cd0e55f 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -18,9 +18,10 @@
#include <sstream>
+#include "android-base/stringprintf.h"
+
#include "base/logging.h"
#include "base/stl_util.h"
-#include "base/stringprintf.h"
#include "class_linker.h"
#include "common_throws.h"
#include "compiler_filter.h"
@@ -43,6 +44,8 @@
namespace art {
+using android::base::StringPrintf;
+
static bool ConvertJavaArrayToDexFiles(
JNIEnv* env,
jobject arrayObject,
diff --git a/runtime/native/dalvik_system_InMemoryDexClassLoader_DexData.cc b/runtime/native/dalvik_system_InMemoryDexClassLoader_DexData.cc
index db245aa..981be68 100644
--- a/runtime/native/dalvik_system_InMemoryDexClassLoader_DexData.cc
+++ b/runtime/native/dalvik_system_InMemoryDexClassLoader_DexData.cc
@@ -16,6 +16,8 @@
#include "dalvik_system_InMemoryDexClassLoader_DexData.h"
+#include "android-base/stringprintf.h"
+
#include "class_linker.h"
#include "common_throws.h"
#include "dex_file.h"
@@ -29,6 +31,8 @@
namespace art {
+using android::base::StringPrintf;
+
static std::unique_ptr<MemMap> AllocateDexMemoryMap(JNIEnv* env, jint start, jint end) {
if (end <= start) {
ScopedObjectAccess soa(env);
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index 3058df4..1af8619 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -27,6 +27,8 @@
#include "toStringArray.h"
#pragma GCC diagnostic pop
+#include "android-base/stringprintf.h"
+
#include "art_method-inl.h"
#include "arch/instruction_set.h"
#include "base/enums.h"
@@ -54,6 +56,8 @@
namespace art {
+using android::base::StringPrintf;
+
static jfloat VMRuntime_getTargetHeapUtilization(JNIEnv*, jobject) {
return Runtime::Current()->GetHeap()->GetTargetHeapUtilization();
}
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index a78909b..10fc90b 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -18,6 +18,8 @@
#include <stdlib.h>
+#include "android-base/stringprintf.h"
+
#include "arch/instruction_set.h"
#include "debugger.h"
#include "java_vm_ext.h"
@@ -37,6 +39,8 @@
namespace art {
+using android::base::StringPrintf;
+
static void EnableDebugger() {
#if defined(__linux__)
// To let a non-privileged gdbserver attach to this
diff --git a/runtime/native/java_lang_reflect_Executable.cc b/runtime/native/java_lang_reflect_Executable.cc
index 73b81a7..ee59c4a 100644
--- a/runtime/native/java_lang_reflect_Executable.cc
+++ b/runtime/native/java_lang_reflect_Executable.cc
@@ -16,6 +16,8 @@
#include "java_lang_reflect_Executable.h"
+#include "android-base/stringprintf.h"
+
#include "art_method-inl.h"
#include "dex_file_annotations.h"
#include "handle.h"
@@ -30,6 +32,8 @@
namespace art {
+using android::base::StringPrintf;
+
static jobjectArray Executable_getDeclaredAnnotationsNative(JNIEnv* env, jobject javaMethod) {
ScopedFastNativeObjectAccess soa(env);
ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod);
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 6206948..374eeb5 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -16,6 +16,8 @@
#include "java_lang_reflect_Field.h"
+#include "android-base/stringprintf.h"
+
#include "class_linker.h"
#include "class_linker-inl.h"
#include "common_throws.h"
@@ -30,6 +32,8 @@
namespace art {
+using android::base::StringPrintf;
+
template<bool kIsSet>
ALWAYS_INLINE inline static bool VerifyFieldAccess(Thread* self,
ObjPtr<mirror::Field> field,
diff --git a/runtime/native/java_lang_reflect_Parameter.cc b/runtime/native/java_lang_reflect_Parameter.cc
index 16164d2..0bb9e38 100644
--- a/runtime/native/java_lang_reflect_Parameter.cc
+++ b/runtime/native/java_lang_reflect_Parameter.cc
@@ -16,6 +16,8 @@
#include "java_lang_reflect_Parameter.h"
+#include "android-base/stringprintf.h"
+
#include "art_method-inl.h"
#include "common_throws.h"
#include "dex_file-inl.h"
@@ -26,6 +28,8 @@
namespace art {
+using android::base::StringPrintf;
+
static jobject Parameter_getAnnotationNative(JNIEnv* env,
jclass,
jobject javaMethod,