fix: restore automatic startup of local ADB server
This commit is contained in:
1 parent
f826bdf3b0
commit
49873e7f05
9 files changed
+211
-23
No files matched your search
@@ -92,6 +92,19 @@ class AdbEndpoint:
|
||||
def mode(self) -> str:
|
||||
return "local" if self.is_local_default else "remote"
|
||||
|
||||
@property
|
||||
def client_host(self) -> str:
|
||||
"""ADB only permits daemon auto-start for the literal host 'localhost'.
|
||||
|
||||
Keep forwarded/custom-port endpoints explicit, even on loopback, so a
|
||||
missing tunnel never starts a different local daemon at that address.
|
||||
"""
|
||||
return "localhost" if self.is_local_default else self.host
|
||||
|
||||
@property
|
||||
def client_socket(self) -> str:
|
||||
return f"tcp:localhost:{self.port}" if self.is_local_default else self.socket
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
return {
|
||||
**asdict(self),
|
||||
@@ -108,7 +121,7 @@ class AdbEndpoint:
|
||||
target = environment if environment is not None else os.environ
|
||||
target["ADB_HOST"] = self.host
|
||||
target["ADB_PORT"] = str(self.port)
|
||||
target["ADB_SERVER_SOCKET"] = self.socket
|
||||
target["ADB_SERVER_SOCKET"] = self.client_socket
|
||||
target[ADB_ENDPOINT_ID_ENV] = self.identity
|
||||
return target
|
||||
|
||||
@@ -145,7 +158,7 @@ class AdbSession:
|
||||
return [
|
||||
self.adb_path,
|
||||
"-H",
|
||||
self.endpoint.host,
|
||||
self.endpoint.client_host,
|
||||
"-P",
|
||||
str(self.endpoint.port),
|
||||
*arguments,
|
||||
|
||||
Reference in new issue
Block a user