Fix NewLocalRef to use AddLocalReference.

Bug: 10026664
Change-Id: I06f8f75a92f73b3b58fa767c0d08d1b736f7d5b5
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 858ac34..6681d56 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -833,11 +833,7 @@
       return NULL;
     }
     ScopedObjectAccess soa(env);
-    IndirectReferenceTable& locals = soa.Env()->locals;
-
-    uint32_t cookie = soa.Env()->local_ref_cookie;
-    IndirectRef ref = locals.Add(cookie, soa.Decode<Object*>(obj));
-    return reinterpret_cast<jobject>(ref);
+    return soa.AddLocalReference<jobject>(soa.Decode<Object*>(obj));
   }
 
   static void DeleteLocalRef(JNIEnv* env, jobject obj) {