fuzz: support fuzzers with statically built parameters

Each HAL will have a corresponding static fuzzer. This will simplify use
of fuzzer for both local and continuous tests.

Suggested-by: [email protected] ag/9782114

Test: m [email protected] && \
adb sync data && \
adb shell \
"LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/fuzz/arm64/lib \
/data/fuzz/arm64/[email protected]/[email protected] \
--vts_spec_dir=/data/vts_specs/spec/light/2.0/ -- \
-max_len=65536 -max_total_time=1 > /dev/null"
device screen flickers
Change-Id: I23561f8e30e83df99303232bab93f73a4b6b8799
diff --git a/iface_fuzzer/ProtoFuzzerMain.cpp b/iface_fuzzer/ProtoFuzzerMain.cpp
index 58a7d9a..597eecb 100644
--- a/iface_fuzzer/ProtoFuzzerMain.cpp
+++ b/iface_fuzzer/ProtoFuzzerMain.cpp
@@ -50,6 +50,11 @@
 namespace vts {
 namespace fuzzer {
 
+#ifdef STATIC_TARGET_FQ_NAME
+// Returns parameters used for static fuzzer executables.
+extern ProtoFuzzerParams ExtractProtoFuzzerStaticParams(int argc, char **argv);
+#endif
+
 // 64-bit random number generator.
 static unique_ptr<Random> random;
 // Parameters that were passed in to fuzzer.
@@ -97,7 +102,12 @@
 }
 
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) {
+#ifdef STATIC_TARGET_FQ_NAME
+  params = ExtractProtoFuzzerStaticParams(*argc, *argv);
+#else
   params = ExtractProtoFuzzerParams(*argc, *argv);
+#endif
+
   cerr << params.DebugString() << endl;
 
   random = make_unique<Random>(params.seed_);