Remove DNS event reporting level

Reporting level was used only by microbenchmarks, but CI go/apct-net
doesn't show a significant timing difference between test runs with and
without reporting enabled.

Test: atest resolv_integration_test
Test: m netd_benchmark && adb sync data && adb shell /data/benchmarktest64/netd_benchmark/netd_benchmark
Change-Id: I0db0522e1cf229649c2516973d8942549ccd5476
diff --git a/tests/benchmarks/connect_benchmark.cpp b/tests/benchmarks/connect_benchmark.cpp
index 2e157b8..0374320 100644
--- a/tests/benchmarks/connect_benchmark.cpp
+++ b/tests/benchmarks/connect_benchmark.cpp
@@ -20,28 +20,7 @@
  * See README.md for general notes.
  *
  * This set of benchmarks measures the throughput of connect() calls on a single thread for IPv4 and
- * IPv6 under the following scenarios:
- *
- *  - FWmark disabled (::ANDROID_NO_USE_FWMARK_CLIENT).
- *
- *      The control case for other high load benchmarks. Essentially just testing performance of
- *      the kernel connect call. In real world use fwmark should stay on in order for traffic to
- *      be routed properly.
- *
- *  - FWmark enabled only for metrics (::ANDROID_FWMARK_METRICS_ONLY).
- *
- *      The default mode up to and including 7.1. Every time connect() is called on an AF_INET or
- *      AF_INET6 socket, netdclient sends a synchronous message to fwmarkserver to get the socket
- *      marked. Only the fields that are useful for marking or for metrics are sent in this mode;
- *      other fields are set to null for the RPC and ignored.
- *
- *  - FWmark enabled for all events.
- *
- *      The default mode starting from 7.1.2. As well as the normal connect() reporting, extra
- *      fields are filled in to log the IP and port of the connection.
- *
- *      A second synchronous message is sent to fwmarkserver after the connection completes, to
- *      record latency. This message is forwarded to the system server over a oneway binder call.
+ * IPv6.
  *
  * Realtime timed tests
  * ====================
@@ -232,118 +211,35 @@
     }
 }
 
-static void run_at_reporting_level(decltype(ipv4_loopback) benchmarkFunction,
-                                   ::benchmark::State& state, const int reportingLevel,
-                                   const bool waitBetweenRuns) {
-    // Our master thread (thread_index == 0) will control setup and teardown for other threads.
-    const bool isMaster = (state.thread_index == 0);
-
-    // Previous values of env variables used by fwmarkclient (only read/written by master thread)
-    const std::string savedSettings[] = {
-        FwmarkClient::ANDROID_NO_USE_FWMARK_CLIENT,
-        FwmarkClient::ANDROID_FWMARK_METRICS_ONLY
-    };
-    std::map<std::string, std::string> prevSettings;
-
-    // SETUP
-    if (isMaster) {
-        for (const auto& setting : savedSettings) {
-            const char* prevEnvStr = getenv(setting.c_str());
-            if (prevEnvStr != nullptr) {
-                prevSettings[setting.c_str()] = prevEnvStr;
-            }
-        }
-        switch (reportingLevel) {
-            case INetdEventListener::REPORTING_LEVEL_NONE:
-                setenv(FwmarkClient::ANDROID_NO_USE_FWMARK_CLIENT, "", 1);
-                break;
-            case INetdEventListener::REPORTING_LEVEL_METRICS:
-                unsetenv(FwmarkClient::ANDROID_NO_USE_FWMARK_CLIENT);
-                setenv(FwmarkClient::ANDROID_FWMARK_METRICS_ONLY, "", 1);
-                break;
-            case INetdEventListener::REPORTING_LEVEL_FULL:
-                unsetenv(FwmarkClient::ANDROID_NO_USE_FWMARK_CLIENT);
-                unsetenv(FwmarkClient::ANDROID_FWMARK_METRICS_ONLY);
-                break;
-        }
-    }
-
-    // TEST
+static void run(decltype(ipv4_loopback) benchmarkFunction, ::benchmark::State& state,
+                const bool waitBetweenRuns) {
     benchmarkFunction(state, waitBetweenRuns);
-
-    // TEARDOWN
-    if (isMaster) {
-        for (const auto& setting : savedSettings) {
-            if (prevSettings.count(setting)) {
-                setenv(setting.c_str(), prevSettings[setting].c_str(), 1);
-            } else {
-                unsetenv(setting.c_str());
-            }
-        }
-    }
 }
 
 constexpr int MIN_THREADS = 1;
 constexpr int MAX_THREADS = 1;
 constexpr double MIN_TIME = 0.5 /* seconds */;
 
-static void ipv4_metrics_reporting_no_fwmark(::benchmark::State& state) {
-    run_at_reporting_level(ipv4_loopback, state, INetdEventListener::REPORTING_LEVEL_NONE, true);
+// IPv4 benchmarks under no load
+static void ipv4_no_load(::benchmark::State& state) {
+    run(ipv4_loopback, state, true);
 }
-BENCHMARK(ipv4_metrics_reporting_no_fwmark)->MinTime(MIN_TIME)->UseManualTime();
-
-// IPv4 metrics under low load
-static void ipv4_metrics_reporting_no_load(::benchmark::State& state) {
-    run_at_reporting_level(ipv4_loopback, state, INetdEventListener::REPORTING_LEVEL_METRICS, true);
-}
-BENCHMARK(ipv4_metrics_reporting_no_load)->MinTime(MIN_TIME)->UseManualTime();
-
-static void ipv4_full_reporting_no_load(::benchmark::State& state) {
-    run_at_reporting_level(ipv4_loopback, state, INetdEventListener::REPORTING_LEVEL_FULL, true);
-}
-BENCHMARK(ipv4_full_reporting_no_load)->MinTime(MIN_TIME)->UseManualTime();
+BENCHMARK(ipv4_no_load)->MinTime(MIN_TIME)->UseManualTime();
 
 // IPv4 benchmarks under high load
-static void ipv4_metrics_reporting_high_load(::benchmark::State& state) {
-    run_at_reporting_level(ipv4_loopback, state, INetdEventListener::REPORTING_LEVEL_METRICS,
-            false);
+static void ipv4_high_load(::benchmark::State& state) {
+    run(ipv4_loopback, state, false);
 }
-BENCHMARK(ipv4_metrics_reporting_high_load)
-    ->ThreadRange(MIN_THREADS, MAX_THREADS)->MinTime(MIN_TIME)->UseRealTime();
-
-static void ipv4_full_reporting_high_load(::benchmark::State& state) {
-    run_at_reporting_level(ipv4_loopback, state, INetdEventListener::REPORTING_LEVEL_FULL, false);
-}
-BENCHMARK(ipv4_full_reporting_high_load)
-    ->ThreadRange(MIN_THREADS, MAX_THREADS)->MinTime(MIN_TIME)->UseRealTime();
+BENCHMARK(ipv4_high_load)->ThreadRange(MIN_THREADS, MAX_THREADS)->MinTime(MIN_TIME)->UseRealTime();
 
 // IPv6 raw connect() without using fwmark
-static void ipv6_metrics_reporting_no_fwmark(::benchmark::State& state) {
-    run_at_reporting_level(ipv6_loopback, state, INetdEventListener::REPORTING_LEVEL_NONE, true);
+static void ipv6_no_load(::benchmark::State& state) {
+    run(ipv6_loopback, state, true);
 }
-BENCHMARK(ipv6_metrics_reporting_no_fwmark)->MinTime(MIN_TIME)->UseManualTime();
-
-// IPv6 metrics under low load
-static void ipv6_metrics_reporting_no_load(::benchmark::State& state) {
-    run_at_reporting_level(ipv6_loopback, state, INetdEventListener::REPORTING_LEVEL_METRICS, true);
-}
-BENCHMARK(ipv6_metrics_reporting_no_load)->MinTime(MIN_TIME)->UseManualTime();
-
-static void ipv6_full_reporting_no_load(::benchmark::State& state) {
-    run_at_reporting_level(ipv6_loopback, state, INetdEventListener::REPORTING_LEVEL_FULL, true);
-}
-BENCHMARK(ipv6_full_reporting_no_load)->MinTime(MIN_TIME)->UseManualTime();
+BENCHMARK(ipv6_no_load)->MinTime(MIN_TIME)->UseManualTime();
 
 // IPv6 benchmarks under high load
-static void ipv6_metrics_reporting_high_load(::benchmark::State& state) {
-    run_at_reporting_level(ipv6_loopback, state, INetdEventListener::REPORTING_LEVEL_METRICS,
-            false);
+static void ipv6_high_load(::benchmark::State& state) {
+    run(ipv6_loopback, state, false);
 }
-BENCHMARK(ipv6_metrics_reporting_high_load)
-    ->ThreadRange(MIN_THREADS, MAX_THREADS)->MinTime(MIN_TIME)->UseRealTime();
-
-static void ipv6_full_reporting_high_load(::benchmark::State& state) {
-    run_at_reporting_level(ipv6_loopback, state, INetdEventListener::REPORTING_LEVEL_FULL, false);
-}
-BENCHMARK(ipv6_full_reporting_high_load)
-    ->ThreadRange(MIN_THREADS, MAX_THREADS)->MinTime(MIN_TIME)->UseRealTime();
+BENCHMARK(ipv6_high_load)->ThreadRange(MIN_THREADS, MAX_THREADS)->MinTime(MIN_TIME)->UseRealTime();