Only set UI warning on hidden API dark greylist

The framework might show a toast notification on access to greylisted
hidden APIs. Only show this warning on dark greylist so as to not spam
early testers.

Bug: 64382372
Test: make
Change-Id: I8b5f7b4938e0f238c513e37d7db06856b966802f
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 184e4e5..7ab9be5 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -544,6 +544,14 @@
     return dedupe_hidden_api_warnings_;
   }
 
+  void AlwaysSetHiddenApiWarningFlag() {
+    always_set_hidden_api_warning_flag_ = true;
+  }
+
+  bool ShouldAlwaysSetHiddenApiWarningFlag() const {
+    return always_set_hidden_api_warning_flag_;
+  }
+
   bool IsDexFileFallbackEnabled() const {
     return allow_dex_file_fallback_;
   }
@@ -992,6 +1000,11 @@
   // This is only used for testing.
   bool dedupe_hidden_api_warnings_;
 
+  // Hidden API can print warnings into the log and/or set a flag read by the
+  // framework to show a UI warning. If this flag is set, always set the flag
+  // when there is a warning. This is only used for testing.
+  bool always_set_hidden_api_warning_flag_;
+
   // Whether threads should dump their native stack on SIGQUIT.
   bool dump_native_stack_on_sig_quit_;