Configurable sample rate for hidden API log events

To reduce log spam, we do not log all hidden API accesses. This CL allows
configuration of the sampling rate of the log events so it can be tweaked
later if necessary.

Test: m
Test: $ adb shell settings put global hidden_api_access_log_sampling_rate 100
Bug: 64382372
Bug: 77517571
Change-Id: Ibec5d3d93bac4308f96c8d3a7a36de6add967eae
diff --git a/libart/src/main/java/dalvik/system/VMRuntime.java b/libart/src/main/java/dalvik/system/VMRuntime.java
index 268208a..7ae2088 100644
--- a/libart/src/main/java/dalvik/system/VMRuntime.java
+++ b/libart/src/main/java/dalvik/system/VMRuntime.java
@@ -278,6 +278,14 @@
     public native void setHiddenApiExemptions(String[] signaturePrefixes);
 
     /**
+     * Sets the log sampling rate of hidden API accesses written to the event log.
+     *
+     * @param rate Proportion of hidden API accesses that will be logged; an integer between
+     *                0 and 0x10000 inclusive.
+     */
+    public native void setHiddenApiAccessLogSamplingRate(int rate);
+
+    /**
      * Returns an array allocated in an area of the Java heap where it will never be moved.
      * This is used to implement native allocations on the Java heap, such as DirectByteBuffers
      * and Bitmaps.