Log an event on hidden API accesses.

The new event consists of:
- The type of access (reflection, JNI, etc.)
- The action taken (warn or deny)
- The type of member accessed (field or method)
- Name of the class which defined the member accessed
- The name of the member
- The type signature of the member (type of field, or method signature)

The fully qualified member name is also not included to avoid the overhead
of building the string. It can be build from the information included.

Similarly, the package name, version, etc. are not included as they can
be inferred from the context when analyzing the event log.

The event is sampled, according to a sampling rate that can be set by a
configuration option, to reduce log spam.

Test: $ m
Test: $ adb shell settings put global hidden_api_access_log_sampling_rate 65536
Test: $ adb lolcat -b events | grep art_hidden_api_access

Sample output:
16796 16796 I art_hidden_api_access: [1,0,Ldalvik/system/VMRuntime;,getRuntime,()Ldalvik/system/VMRuntime;]
16796 16796 I art_hidden_api_access: [1,2,Ldalvik/system/VMRuntime;,setHiddenApiExemptions,([Ljava/lang/String;)V]
16796 16796 I art_hidden_api_access: [1,3,Landroid/app/Activity;,mDoReportFullyDrawn,Z]
(Timestamps have been elided)

Bug: 64382372
Bug: 77517571
Change-Id: I012b2c9fbffbd00ed3219918e7a736a4f7435ec8
6 files changed