Seperate header target for DnsResolver from libnetd_client_header
0. Move NETID_USE_LOCAL_NAMESERVERS definition to DnsResolver
1. Create libnetdbinder_utils shared to DnsResolver
2. Use dnsproxyd_protocol_headers for NETID_USE_LOCAL_NAMESERVERS
Bug: 151895202
Test: build
Change-Id: I5315f5214bc7cd399e878b96a06f486dc8e4b874
diff --git a/Android.bp b/Android.bp
index 8942ff6..01a8e77 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,6 +1,11 @@
cc_library_headers {
name: "libnetd_client_headers",
export_include_dirs: ["include"],
+}
+
+cc_library_headers {
+ name: "libnetdbinder_utils_headers",
+ export_include_dirs: ["include/binder_utils"],
apex_available: [
"//apex_available:platform",
"com.android.resolv",
diff --git a/client/Android.bp b/client/Android.bp
index e3f00bb..53afc97 100644
--- a/client/Android.bp
+++ b/client/Android.bp
@@ -19,6 +19,7 @@
"NetdClient.cpp",
],
header_libs: [
+ "dnsproxyd_protocol_headers", // NETID_USE_LOCAL_NAMESERVERS
"libnetd_client_headers",
"libbase_headers", // for unique_fd.h
"libnetd_resolv_headers",
diff --git a/client/NetdClient.cpp b/client/NetdClient.cpp
index 0ac1e68..74a441a 100644
--- a/client/NetdClient.cpp
+++ b/client/NetdClient.cpp
@@ -30,6 +30,7 @@
#include <string>
#include <vector>
+#include <DnsProxydProtocol.h> // NETID_USE_LOCAL_NAMESERVERS
#include <android-base/parseint.h>
#include <android-base/unique_fd.h>
diff --git a/include/NetdClient.h b/include/NetdClient.h
index 0cfc187..89f0a41 100644
--- a/include/NetdClient.h
+++ b/include/NetdClient.h
@@ -21,8 +21,6 @@
#include <sys/cdefs.h>
#include <sys/types.h>
-#define NETID_USE_LOCAL_NAMESERVERS 0x80000000
-
__BEGIN_DECLS
// All functions below that return an int return 0 on success or a negative errno value on failure.
diff --git a/include/BinderUtil.h b/include/binder_utils/BinderUtil.h
similarity index 100%
rename from include/BinderUtil.h
rename to include/binder_utils/BinderUtil.h
diff --git a/include/NetdPermissions.h b/include/binder_utils/NetdPermissions.h
similarity index 100%
rename from include/NetdPermissions.h
rename to include/binder_utils/NetdPermissions.h
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index b6c0d4e..a367a8c 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -35,12 +35,10 @@
#include <utils/Errors.h>
#include <utils/String16.h>
-#include "BinderUtil.h"
#include "Controllers.h"
#include "Fwmark.h"
#include "InterfaceController.h"
#include "NetdNativeService.h"
-#include "NetdPermissions.h"
#include "OemNetdListener.h"
#include "Permission.h"
#include "Process.h"
@@ -48,6 +46,8 @@
#include "SockDiag.h"
#include "UidRanges.h"
#include "android/net/BnNetd.h"
+#include "binder_utils/BinderUtil.h"
+#include "binder_utils/NetdPermissions.h"
#include "netid_client.h" // NETID_UNSET
using android::base::StringPrintf;