Add doh experiment flag
Test: TH
Bug: 155855709
Change-Id: Ie2536938a4f01e24cffcbec9794990fc4d4e2d6c
diff --git a/Experiments.h b/Experiments.h
index 1678553..fcbe8bf 100644
--- a/Experiments.h
+++ b/Experiments.h
@@ -61,6 +61,7 @@
"dot_query_timeout_ms",
"dot_validation_latency_factor",
"dot_validation_latency_offset_ms",
+ "doh",
};
// This value is used in updateInternal as the default value if any flags can't be found.
static constexpr int kFlagIntDefault = INT_MIN;
diff --git a/util.h b/util.h
index bb4a598..0c37851 100644
--- a/util.h
+++ b/util.h
@@ -24,6 +24,8 @@
#include <android-base/properties.h>
+#include "Experiments.h"
+
socklen_t sockaddrSize(const sockaddr* sa);
socklen_t sockaddrSize(const sockaddr_storage& ss);
@@ -56,3 +58,7 @@
inline bool isUserDebugBuild() {
return (android::base::GetProperty("ro.build.type", "user") == "userdebug");
}
+
+inline bool isDoHEnabled() {
+ return android::net::Experiments::getInstance()->getFlag("doh", 0);
+}