Establish a global reference before saving a class into a global.

A local reference is obtained to the string class for the purpose of
using it later in another routine to create string object arrays.
However, the local reference is invalid by the time it is next used.
Making the string class reference a global reference eliminates the
problem.

Change-Id: I8a04642e0ed3060f2fff2cb63996559f004aacff
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 1bce332..fdb7fda 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -1806,7 +1806,9 @@
         = env->GetFieldID(assetManager, "mObject", "I");
     LOG_FATAL_IF(gAssetManagerOffsets.mObject == NULL, "Unable to find AssetManager.mObject");
 
-    g_stringClass = env->FindClass("java/lang/String");
+    jclass stringClass = env->FindClass("java/lang/String");
+    LOG_FATAL_IF(stringClass == NULL, "Unable to find class java/lang/String");
+    g_stringClass = (jclass)env->NewGlobalRef(stringClass);
 
     return AndroidRuntime::registerNativeMethods(env,
             "android/content/res/AssetManager", gAssetManagerMethods, NELEM(gAssetManagerMethods));