Loosen check:jni around GetStatic[...]Field

-Xcheck:jni was requiring that the jclass being passed to
GetStatic[...]Field was the exact same class as the jfieldID's
declaring class. This was stricter than is really needed and causes
some issues when dealing with fields where the declaring class cannot
be easily determined.

Bug: 70532839
Test: ./test.py --host -j50
Change-Id: I0987de09af956ed9a8dde37c50606604fdd94b87
diff --git a/runtime/check_jni.cc b/runtime/check_jni.cc
index 0b9bf22..90f478f 100644
--- a/runtime/check_jni.cc
+++ b/runtime/check_jni.cc
@@ -373,7 +373,7 @@
     if (f == nullptr) {
       return false;
     }
-    if (c != f->GetDeclaringClass()) {
+    if (!f->GetDeclaringClass()->IsAssignableFrom(c)) {
       AbortF("static jfieldID %p not valid for class %s", fid,
              mirror::Class::PrettyClass(c).c_str());
       return false;
@@ -710,7 +710,7 @@
         return false;
       }
       ObjPtr<mirror::Class> c = o->AsClass();
-      if (c != field->GetDeclaringClass()) {
+      if (!field->GetDeclaringClass()->IsAssignableFrom(c)) {
         AbortF("attempt to access static field %s with an incompatible class argument of %s: %p",
                field->PrettyField().c_str(), mirror::Class::PrettyDescriptor(c).c_str(), fid);
         return false;