Drop Core Platform API checks when JNI table updated

Bug: 136493688
Test: manual
Change-Id: I1168a794e0cebea1e8ef9a68092c2616a6503a17
diff --git a/runtime/jni/jni_env_ext.cc b/runtime/jni/jni_env_ext.cc
index 976f89b..411794c 100644
--- a/runtime/jni/jni_env_ext.cc
+++ b/runtime/jni/jni_env_ext.cc
@@ -24,6 +24,7 @@
 #include "base/mutex.h"
 #include "base/to_str.h"
 #include "check_jni.h"
+#include "hidden_api.h"
 #include "indirect_reference_table.h"
 #include "java_vm_ext.h"
 #include "jni_internal.h"
@@ -308,6 +309,9 @@
   Runtime* runtime = Runtime::Current();
   if (runtime != nullptr) {
     runtime->GetThreadList()->ForEach(ThreadResetFunctionTable, nullptr);
+    // Core Platform API checks rely on stack walking and classifying the caller. If a table
+    // override is installed do not try to guess what semantics should be.
+    runtime->SetCorePlatformApiEnforcementPolicy(hiddenapi::EnforcementPolicy::kDisabled);
   }
 }