Add runtime option for no hidden API access checks

Add a new Runtime option -Xno-hidden-api-checks to disable
enforcing hidden API access restrictions.

Test: m test-art-host
Bug: 64382372
Change-Id: I8bd5b7ef307f21ba71d05a066a9d5dd2d7614543
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 6d2887c..022a1be 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -520,6 +520,14 @@
   bool IsVerificationEnabled() const;
   bool IsVerificationSoftFail() const;
 
+  void DisableHiddenApiChecks() {
+    do_hidden_api_checks_ = false;
+  }
+
+  bool AreHiddenApiChecksEnabled() const {
+    return do_hidden_api_checks_;
+  }
+
   bool IsDexFileFallbackEnabled() const {
     return allow_dex_file_fallback_;
   }
@@ -957,6 +965,9 @@
   // Whether the application should run in safe mode, that is, interpreter only.
   bool safe_mode_;
 
+  // Whether access checks on hidden API should be performed.
+  bool do_hidden_api_checks_;
+
   // Whether threads should dump their native stack on SIGQUIT.
   bool dump_native_stack_on_sig_quit_;