Add SafetyNet logging to JNI::NewStringUTF.

(cherry picked from commit ed4b3e0958d3de6a92d82abb9f81e49e84d5c673)

Test: blueline-userdebug boots.
Bug: 172655291
Merged-In: I653db8be0c0a45302f0d1c54285c02d2d052a9f4
Change-Id: I653db8be0c0a45302f0d1c54285c02d2d052a9f4
diff --git a/runtime/jni/jni_internal.cc b/runtime/jni/jni_internal.cc
index 0344a77..e3b95b9 100644
--- a/runtime/jni/jni_internal.cc
+++ b/runtime/jni/jni_internal.cc
@@ -17,6 +17,7 @@
 #include "jni_internal.h"
 
 #include <cstdarg>
+#include <log/log.h>
 #include <memory>
 #include <mutex>
 #include <utility>
@@ -2075,6 +2076,7 @@
         /*bad=*/ []() { return true; });  // Abort processing and return 0 for bad characters.
     if (UNLIKELY(utf8_length != 0u && utf16_length == 0u)) {
       // VisitModifiedUtf8Chars() aborted for a bad character.
+      android_errorWriteLog(0x534e4554, "172655291");  // Report to SafetyNet.
       // Report the error to logcat but avoid too much spam.
       static const uint64_t kMinDelay = UINT64_C(10000000000);  // 10s
       static std::atomic<uint64_t> prev_bad_input_time(UINT64_C(0));