USB string descriptors are not UTF8, so it is not safe to treat them as such.
Add AndroidRuntime::NewStringLatin1() to convert non-UTF8 strings to Java strings.
Bug: 17427781
Change-Id: I7df1d4e94a7beebc8b1a74c0c0a163b794025ae8
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h
index 51e47e6..a882870 100644
--- a/include/android_runtime/AndroidRuntime.h
+++ b/include/android_runtime/AndroidRuntime.h
@@ -114,6 +114,9 @@
/** return a new string corresponding to 'className' with all '.'s replaced by '/'s. */
static char* toSlashClassName(const char* className);
+ /** Create a Java string from an ASCII or Latin-1 string */
+ static jstring NewStringLatin1(JNIEnv* env, const char* bytes);
+
private:
static int startReg(JNIEnv* env);
void addOption(const char* optionString, void* extra_info = NULL);