Add resolv_has_nameserver() to replace getHasDns()

getHasDns() returns the value assigned from networkCreateVpn(). It causes
issues when DNS configuration is changed without triggering VPN reconnection.
For example, first established vpn has no DNS server, then switch to the one
with DNS server, the system continues to use the DNS servers from the default
network in addition to the ones assigned from the VPN server, resulting in a
DNS leak. In the reverse case it causes DNS resolution fails. New API
resolv_has_nameserver() get DNS information from the DNS resolver directly.

Bug: 116539103
Test: verify patch via unmerged CTS test case aosp/658122 (with
little modification)

Change-Id: Ie01814435f4361c258c4ba96a47eb917f5441274
diff --git a/resolv/include/netd_resolv/resolv.h b/resolv/include/netd_resolv/resolv.h
index 134725a..9454a3b 100644
--- a/resolv/include/netd_resolv/resolv.h
+++ b/resolv/include/netd_resolv/resolv.h
@@ -110,6 +110,8 @@
                                                            const addrinfo*,
                                                            const android_net_context*, addrinfo**);
 
+LIBNETD_RESOLV_PUBLIC bool resolv_has_nameservers(unsigned netid);
+
 // Query dns with raw msg
 // TODO: Add a way to control query parameter, like flags, or maybe res_options or even res_state.
 LIBNETD_RESOLV_PUBLIC int resolv_res_nsend(const android_net_context* netContext, const u_char* msg,