refactor(device): remove single-device state and test branches
This commit is contained in:
1 parent
cbe8f4f0c6
commit
33c4a0d112
12 files changed
+175
-88
No files matched your search
@@ -111,7 +111,7 @@ async def select_active_device(request: SelectDeviceRequest):
|
||||
if not serial:
|
||||
raise HTTPException(status_code=400, detail="Device serial cannot be empty.")
|
||||
|
||||
readiness_engine.set_active_device_serial(serial)
|
||||
readiness_engine.set_probe_target_serial(serial)
|
||||
# Return updated readiness
|
||||
report = await readiness_engine.run_all(force_refresh=True)
|
||||
return {
|
||||
@@ -192,7 +192,7 @@ async def connect_adb_server(payload: ConnectAdbServerRequest, request: Request)
|
||||
|
||||
response: dict[str, object] = {"connection_result": connection_result}
|
||||
if connection_result["success"]:
|
||||
readiness_engine.set_active_device_serial(None)
|
||||
readiness_engine.set_probe_target_serial(None)
|
||||
readiness_engine.invalidate_cache()
|
||||
response["report"] = await readiness_engine.run_all(force_refresh=True)
|
||||
return response
|
||||
@@ -214,7 +214,7 @@ async def use_local_adb_server(request: Request, persist: bool = True):
|
||||
"""Restore the standard local ADB server without touching a remote daemon."""
|
||||
_require_local_admin_request(request)
|
||||
connection_result = await adb_server_connection.use_local_server(persist=persist)
|
||||
readiness_engine.set_active_device_serial(None)
|
||||
readiness_engine.set_probe_target_serial(None)
|
||||
readiness_engine.invalidate_cache()
|
||||
updated_report = await readiness_engine.run_all(force_refresh=True)
|
||||
return {
|
||||
|
||||
@@ -140,7 +140,10 @@ async def run_task(request: RunRequest):
|
||||
# polling intervals cannot start through a stale Ready state. Use the
|
||||
# bounded submission probe: the full diagnostics path also scans packages,
|
||||
# emulator installations, Android version, and screen size.
|
||||
target_serial = request.device_serial or readiness_engine.get_active_device_serial()
|
||||
# With no explicit serial the probe itself resolves a live target (it
|
||||
# prefers the diagnostics target preference, then any unlocked ready
|
||||
# device); the verified serial is bound below.
|
||||
target_serial = request.device_serial
|
||||
device_probe = await readiness_engine.run_device_submission_probe(
|
||||
target_serial=target_serial
|
||||
)
|
||||
@@ -164,10 +167,6 @@ async def run_task(request: RunRequest):
|
||||
# invalid, enqueue_tasks rejects the submission with a clear error.
|
||||
if verified_serial and not request.device_serial:
|
||||
target_serial = verified_serial
|
||||
# The probe verified a live device either way: keep the global active
|
||||
# serial in sync even when the caller pinned the target explicitly.
|
||||
if verified_serial and readiness_engine.get_active_device_serial() != verified_serial:
|
||||
readiness_engine.set_active_device_serial(verified_serial)
|
||||
|
||||
return await task_queue_service.enqueue_tasks(
|
||||
incoming_goals,
|
||||
|
||||
Reference in new issue
Block a user