support delay config

This commit is contained in:
liuyongbin
2025-12-15 11:56:48 +08:00
parent 61c1522174
commit 430c13d22d
5 changed files with 233 additions and 21 deletions

View File

@@ -6,6 +6,8 @@ from dataclasses import dataclass
from enum import Enum
from typing import Optional
from phone_agent.config.timing import TIMING_CONFIG
class ConnectionType(Enum):
"""Type of ADB connection."""
@@ -244,7 +246,7 @@ class ADBConnection:
output = result.stdout + result.stderr
if "restarting" in output.lower() or result.returncode == 0:
time.sleep(2) # Wait for ADB to restart
time.sleep(TIMING_CONFIG.connection.adb_restart_delay)
return True, f"TCP/IP mode enabled on port {port}"
else:
return False, output.strip()
@@ -312,7 +314,7 @@ class ADBConnection:
[self.adb_path, "kill-server"], capture_output=True, timeout=5
)
time.sleep(1)
time.sleep(TIMING_CONFIG.connection.server_restart_delay)
# Start server
subprocess.run(