Revert "Support socket activation of adb server"
This reverts commit 4456b5fc15c233afe3e8aedf5b87aaeed1d9e0f9.
Reason for revert: Device boot failure BUG: 144355953
Change-Id: I539400fa2422bd4d6e396634c629a928cd2ac398
diff --git a/adb/socket_spec.cpp b/adb/socket_spec.cpp
index e5129e6..98468b5 100644
--- a/adb/socket_spec.cpp
+++ b/adb/socket_spec.cpp
@@ -16,7 +16,6 @@
#include "socket_spec.h"
-#include <limits>
#include <string>
#include <string_view>
#include <unordered_map>
@@ -29,12 +28,10 @@
#include <cutils/sockets.h>
#include "adb.h"
-#include "adb_utils.h"
#include "sysdeps.h"
using namespace std::string_literals;
-using android::base::ConsumePrefix;
using android::base::StringPrintf;
#if defined(__linux__)
@@ -134,7 +131,7 @@
return true;
}
}
- return spec.starts_with("tcp:") || spec.starts_with("acceptfd:");
+ return spec.starts_with("tcp:");
}
bool is_local_socket_spec(std::string_view spec) {
@@ -238,9 +235,6 @@
*error = "vsock is only supported on linux";
return false;
#endif // ADB_LINUX
- } else if (address.starts_with("acceptfd:")) {
- *error = "cannot connect to acceptfd";
- return false;
}
for (const auto& it : kLocalSocketTypes) {
@@ -338,46 +332,6 @@
*error = "vsock is only supported on linux";
return -1;
#endif // ADB_LINUX
- } else if (ConsumePrefix(&spec, "acceptfd:")) {
-#if ADB_WINDOWS
- *error = "socket activation not supported under Windows";
- return -1;
-#else
- // We inherited the socket from some kind of launcher. It's already bound and
- // listening. Return a copy of the FD instead of the FD itself so we implement the
- // normal "listen" contract and can succeed more than once.
- unsigned int fd_u;
- if (!ParseUint(&fd_u, spec) || fd_u > std::numeric_limits<int>::max()) {
- *error = "invalid fd";
- return -1;
- }
- int fd = static_cast<int>(fd_u);
- int flags = get_fd_flags(fd);
- if (flags < 0) {
- *error = android::base::StringPrintf("could not get flags of inherited fd %d: '%s'", fd,
- strerror(errno));
- return -1;
- }
- if (flags & O_CLOEXEC) {
- *error = android::base::StringPrintf("fd %d was not inherited from parent", fd);
- return -1;
- }
-
- int dummy_sock_type;
- socklen_t dummy_sock_type_size = sizeof(dummy_sock_type);
- if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &dummy_sock_type, &dummy_sock_type_size)) {
- *error = android::base::StringPrintf("fd %d does not refer to a socket", fd);
- return -1;
- }
-
- int new_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
- if (new_fd < 0) {
- *error = android::base::StringPrintf("could not dup inherited fd %d: '%s'", fd,
- strerror(errno));
- return -1;
- }
- return new_fd;
-#endif
}
for (const auto& it : kLocalSocketTypes) {