Merge "Make libnativehelper C++ library agnostic and remove libnativehelper_libc++."
diff --git a/Android.mk b/Android.mk
index 53642d9..c79ad48 100644
--- a/Android.mk
+++ b/Android.mk
@@ -38,28 +38,6 @@
 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 include $(BUILD_SHARED_LIBRARY)
 
-# Don't build for unbundled branches
-ifeq (,$(TARGET_BUILD_APPS))
-#
-# Build for the target (device) using libc++.
-#
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := \
-    $(local_src_files) \
-    JniInvocation.cpp
-LOCAL_SHARED_LIBRARIES := liblog
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE := libnativehelper_libc++
-LOCAL_CFLAGS := -Werror
-LOCAL_C_INCLUDES := libcore/include
-LOCAL_SHARED_LIBRARIES += libcutils libdl
-include external/libcxx/libcxx.mk
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-include $(BUILD_SHARED_LIBRARY)
-endif
-
-#
 # NDK-only build for the target (device).
 # - Relies only on NDK exposed functionality.
 # - This doesn't include JniInvocation.
diff --git a/include/nativehelper/toStringArray.h b/include/nativehelper/toStringArray.h
index 55fae2c..9dc7a16 100644
--- a/include/nativehelper/toStringArray.h
+++ b/include/nativehelper/toStringArray.h
@@ -45,7 +45,27 @@
     return result;
 }
 
-JNIEXPORT jobjectArray toStringArray(JNIEnv* env, const std::vector<std::string>& strings);
+struct VectorCounter {
+    const std::vector<std::string>& strings;
+    VectorCounter(const std::vector<std::string>& strings) : strings(strings) {}
+    size_t operator()() {
+        return strings.size();
+    }
+};
+struct VectorGetter {
+    const std::vector<std::string>& strings;
+    VectorGetter(const std::vector<std::string>& strings) : strings(strings) {}
+    const char* operator()(size_t i) {
+        return strings[i].c_str();
+    }
+};
+
+inline jobjectArray toStringArray(JNIEnv* env, const std::vector<std::string>& strings) {
+    VectorCounter counter(strings);
+    VectorGetter getter(strings);
+    return toStringArray<VectorCounter, VectorGetter>(env, &counter, &getter);
+}
+
 JNIEXPORT jobjectArray toStringArray(JNIEnv* env, const char* const* strings);
 
 #endif  // TO_STRING_ARRAY_H_included
diff --git a/toStringArray.cpp b/toStringArray.cpp
index 414d43c..f2fa53c 100644
--- a/toStringArray.cpp
+++ b/toStringArray.cpp
@@ -17,34 +17,10 @@
 #include "JniConstants.h"
 #include "toStringArray.h"
 
-#include <string>
-#include <vector>
-
 jobjectArray newStringArray(JNIEnv* env, size_t count) {
     return env->NewObjectArray(count, JniConstants::stringClass, NULL);
 }
 
-struct VectorCounter {
-    const std::vector<std::string>& strings;
-    VectorCounter(const std::vector<std::string>& strings) : strings(strings) {}
-    size_t operator()() {
-        return strings.size();
-    }
-};
-struct VectorGetter {
-    const std::vector<std::string>& strings;
-    VectorGetter(const std::vector<std::string>& strings) : strings(strings) {}
-    const char* operator()(size_t i) {
-        return strings[i].c_str();
-    }
-};
-
-jobjectArray toStringArray(JNIEnv* env, const std::vector<std::string>& strings) {
-    VectorCounter counter(strings);
-    VectorGetter getter(strings);
-    return toStringArray<VectorCounter, VectorGetter>(env, &counter, &getter);
-}
-
 struct ArrayCounter {
     const char* const* strings;
     ArrayCounter(const char* const* strings) : strings(strings) {}