Add Experiments to handle experiment flags logic
update experiment flags everytime when a resolver network is created or
destroyed.
Bug: 135717624
Bug: 151698212
Test: atest
Merged-In: I5375e78831c5994af74b9ecaca991f18db03eca6
Change-Id: I6288c1d47085cdb70ab5e6e19f183c289af56815
(cherry picked from commit fe85ad8052e0faaac88b0a14a9e78b2463507dd7)
diff --git a/res_send.cpp b/res_send.cpp
index beb7f13..910026a 100644
--- a/res_send.cpp
+++ b/res_send.cpp
@@ -102,6 +102,7 @@
#include <netdutils/Stopwatch.h>
#include "DnsTlsDispatcher.h"
#include "DnsTlsTransport.h"
+#include "Experiments.h"
#include "PrivateDnsConfiguration.h"
#include "netd_resolv/resolv.h"
#include "private/android_filesystem_config.h"
@@ -925,7 +926,8 @@
static Result<std::vector<int>> udpRetryingPollWrapper(res_state statp, int ns,
const timespec* finish) {
- const bool keepListeningUdp = getExperimentFlagInt("keep_listening_udp", 0);
+ const bool keepListeningUdp =
+ android::net::Experiments::getInstance()->getFlag("keep_listening_udp", 0);
if (keepListeningUdp) return udpRetryingPoll(statp, finish);
if (int n = retrying_poll(statp->nssocks[ns], POLLIN, finish); n <= 0) {