Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9e818f4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ia4a2ff77,I970806e3,I47daa338 into nyc-dev

* changes:
  adb: increase the FD table size on Win32.
  adb: bump the server version to 36.
  adb: add reconnect command.
parents e4f870a0 d1e2300a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1134,6 +1134,13 @@ int handle_host_request(const char* service, TransportType type,
        /* we don't even need to send a reply */
        return 0;
    }

    if (!strcmp(service, "reconnect")) {
        if (s->transport != nullptr) {
            kick_transport(s->transport);
        }
        return SendOkay(reply_fd, "done");
    }
#endif // ADB_HOST

    int ret = handle_forward_request(service, type, serial, reply_fd);
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ constexpr size_t MAX_PAYLOAD = MAX_PAYLOAD_V2;
std::string adb_version();

// Increment this when we want to force users to start a new adb server.
#define ADB_SERVER_VERSION 35
#define ADB_SERVER_VERSION 36

class atransport;
struct usb_handle;
+7 −4
Original line number Diff line number Diff line
@@ -158,7 +158,8 @@ int _adb_connect(const std::string& service, std::string* error) {
        }
    }

    if (memcmp(&service[0],"host",4) != 0 && switch_socket_transport(fd, error)) {
    if ((memcmp(&service[0],"host",4) != 0 || service == "host:reconnect") &&
        switch_socket_transport(fd, error)) {
        return -1;
    }

@@ -168,10 +169,12 @@ int _adb_connect(const std::string& service, std::string* error) {
        return -1;
    }

    if (service != "reconnect") {
        if (!adb_status(fd, error)) {
            adb_close(fd);
            return -1;
        }
    }

    D("_adb_connect: return fd %d", fd);
    return fd;
+11 −0
Original line number Diff line number Diff line
@@ -242,6 +242,9 @@ static void help() {
        "  - If it is \"system\", \"vendor\", \"oem\" or \"data\", only the corresponding partition\n"
        "    is updated.\n"
        "\n"
        "internal debugging:\n"
        "  adb reconnect                  Kick current connection from host side and make it reconnect.\n"
        "  adb reconnect device           Kick current connection from device side and make it reconnect.\n"
        "environment variables:\n"
        "  ADB_TRACE                    - Print debug information. A comma separated list of the following values\n"
        "                                 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp\n"
@@ -1934,6 +1937,14 @@ int adb_commandline(int argc, const char **argv) {
            }
        }
        return 0;
    } else if (!strcmp(argv[0], "reconnect")) {
        if (argc == 1) {
            return adb_query_command("host:reconnect");
        } else if (argc == 2 && !strcmp(argv[1], "device")) {
            std::string err;
            adb_connect("reconnect", &err);
            return 0;
        }
    }

    usage();
+9 −0
Original line number Diff line number Diff line
@@ -184,6 +184,13 @@ void reboot_service(int fd, void* arg)
    adb_close(fd);
}

static void reconnect_service(int fd, void* arg) {
    WriteFdExactly(fd, "done");
    adb_close(fd);
    atransport* t = static_cast<atransport*>(arg);
    kick_transport(t);
}

int reverse_service(const char* command) {
    int s[2];
    if (adb_socketpair(s)) {
@@ -345,6 +352,8 @@ int service_to_fd(const char* name, const atransport* transport) {
        ret = create_service_thread(set_verity_enabled_state_service, (void*)0);
    } else if(!strncmp(name, "enable-verity:", 15)) {
        ret = create_service_thread(set_verity_enabled_state_service, (void*)1);
    } else if (!strcmp(name, "reconnect")) {
        ret = create_service_thread(reconnect_service, const_cast<atransport*>(transport));
#endif
    }
    if (ret >= 0) {
Loading