Using tokio to complete the rust DoH query implementation

This CL is the complement based on aosp/1531539 by using tokio.
Some implementations are took from aosp/1550834.
This CL would only focus on rust part of DoH.

Using tokio to re-write the event loop and I/O handling.

Test: atest
Bug: 155855709
Change-Id: I5bcc701178358bc442bd8c2af5df03399d7a8137
Ignore-AOSP-First: This CL is merged into aosp but wrongly skipped in internal git.
So put it back.
diff --git a/Android.bp b/Android.bp
index caedfd1..4dfd142 100644
--- a/Android.bp
+++ b/Android.bp
@@ -308,3 +308,57 @@
         "PrivateDnsConfigurationTest.cpp",
     ],
 }
+
+rust_ffi_static {
+    name: "libdoh_ffi",
+    enabled: support_rust_toolchain,
+    crate_name: "doh",
+    srcs: ["doh.rs"],
+    edition: "2018",
+
+    rlibs: [
+        "libandroid_logger",
+        "libanyhow",
+        "liblazy_static",
+        "liblibc",
+        "liblog_rust",
+        "libquiche",
+        "libring",
+        "libtokio",
+        "liburl",
+    ],
+    prefer_rlib: true,
+
+    shared_libs: [
+        "libcrypto",
+        "libssl",
+    ],
+
+    apex_available: [
+        "//apex_available:platform",  // Needed by doh_ffi_test
+        "com.android.resolv"
+    ],
+    min_sdk_version: "29",
+}
+
+cc_test {
+    name: "doh_ffi_test",
+    enabled: support_rust_toolchain,
+    test_suites: [
+        "general-tests",
+    ],
+    defaults: ["netd_defaults"],
+    srcs: ["doh_ffi_test.cpp"],
+    static_libs: [
+        "libdoh_ffi",
+        "libgmock",
+        "liblog",
+        "libring-core",
+    ],
+    // These are not carried over from libdoh_ffi.
+    shared_libs: [
+        "libcrypto",
+        "libssl",
+    ],
+    min_sdk_version: "29",
+}