Slightly improve isDoHEnabled()
DnsResolver doesn't need to check SDK level more than once.
Bug: 200763585
Test: built dnsresolver passed
Change-Id: I7e113a9b4d941dbe278fbeaa84953ac12a778de0
diff --git a/util.h b/util.h
index a5eb556..414b62f 100644
--- a/util.h
+++ b/util.h
@@ -62,7 +62,8 @@
inline bool isDoHEnabled() {
// STOPSHIP(b/200763585): clean up it before T shipping.
- if (android::modules::sdklevel::IsAtLeastT()) return 1;
+ static bool isAtLeastT = android::modules::sdklevel::IsAtLeastT();
+ if (isAtLeastT) return 1;
return android::net::Experiments::getInstance()->getFlag("doh", 0);
}