Initial netd binder interface.
In this change:
1. AIDL files for a new, android.net.INetd service, and
corresponding implementation using generated code. For now the
interface is just a prototype: it only has one trivial method.
2. Permission checking code to check for CONNECTIVITY_INTERNAL.
3. Add a Big Netd Lock and provide a wrapper that makes it easy
to ensure that it is taken by every CommandListener command.
Bug: 27239233
Change-Id: I448d0ac233edd0e351a7fe7f13901fb6871683a2
diff --git a/server/NetdConstants.h b/server/NetdConstants.h
index 296661d..5c3fde0 100644
--- a/server/NetdConstants.h
+++ b/server/NetdConstants.h
@@ -21,6 +21,8 @@
#include <list>
#include <stdarg.h>
+#include "utils/RWLock.h"
+
const int PROTECT_MARK = 0x1;
extern const char * const IPTABLES_PATH;
@@ -49,4 +51,18 @@
const uid_t INVALID_UID = static_cast<uid_t>(-1);
-#endif
+namespace android {
+namespace net {
+
+/**
+ * This lock exists to make NetdNativeService RPCs (which come in on multiple Binder threads)
+ * coexist with the commands in CommandListener.cpp. These are presumed not thread-safe because
+ * CommandListener has only one user (NetworkManagementService), which is connected through a
+ * FrameworkListener that passes in commands one at a time.
+ */
+extern android::RWLock gBigNetdLock;
+
+} // namespace net
+} // namespace android
+
+#endif // _NETD_CONSTANTS_H