Synthesize DNS64 prefix in netd

Synthesize DNS64 prefix with IPv4 dns query result in the following
conditions:
1. If specify address family to IPv6 and no IPv6 addresses result is
   obtained, then if IPv4 addresses result could be obtained
2. If address family is unspecified and query results are all IPv4
   addresses

Test: built, flashed, booted
      system/netd/tests/runtests.sh passes
Bug: 78545619

Change-Id: Ia7c5963c054772f8c95b95849282e9d9d5761515
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index 7c6e4a1..3331438 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -1500,5 +1500,18 @@
     return binder::Status::ok();
 }
 
+binder::Status NetdNativeService::getPrefix64(int netId, std::string* _aidl_return) {
+    ENFORCE_PERMISSION(NETWORK_STACK);
+
+    netdutils::IPPrefix prefix{};
+    int err = gCtls->resolverCtrl.getPrefix64(netId, &prefix);
+    if (err != 0) {
+        return binder::Status::fromServiceSpecificError(
+                -err, String8::format("ResolverController error: %s", strerror(-err)));
+    }
+    *_aidl_return = prefix.toString();
+    return binder::Status::ok();
+}
+
 }  // namespace net
 }  // namespace android