Add SafetyNet logging to JNI::NewStringUTF.

(cherry picked from commit 69fc841b8460943c2b2224f61585942cbc9f3f40)

Test: blueline-userdebug boots.
Bug: 172655291
Merged-In: I653db8be0c0a45302f0d1c54285c02d2d052a9f4
Change-Id: I9e9ed17377c9723d07169e7bcdbb8e36f995988e
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 60c7d3b..a9049b5 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -19,6 +19,7 @@
 #include <dlfcn.h>
 
 #include <cstdarg>
+#include <log/log.h>
 #include <memory>
 #include <utility>
 #include <vector>
@@ -1882,6 +1883,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));