add quick launch
Browse files
hubble.py
CHANGED
|
@@ -387,3 +387,39 @@ def run_hubble_launch(raw_input_text, scratch_dir, log, progress, stop_event=Non
|
|
| 387 |
finally:
|
| 388 |
try: sess.close()
|
| 389 |
except: pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
finally:
|
| 388 |
try: sess.close()
|
| 389 |
except: pass
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
def run_hubble_quick(raw_input_text, scratch_dir, log, progress, stop_event=None):
|
| 393 |
+
"""快速模式: 只发 intent, 不暖机不轮询不验证."""
|
| 394 |
+
def check_stop():
|
| 395 |
+
if stop_event and stop_event.is_set():
|
| 396 |
+
raise HubbleError("用户已中断")
|
| 397 |
+
|
| 398 |
+
if scratch_dir:
|
| 399 |
+
try: os.makedirs(scratch_dir, exist_ok=True)
|
| 400 |
+
except: pass
|
| 401 |
+
|
| 402 |
+
sess = _init_session(raw_input_text, log, progress, check_stop)
|
| 403 |
+
try:
|
| 404 |
+
log("[快速] force-stop + am start intent")
|
| 405 |
+
progress(30)
|
| 406 |
+
sess.sh(f"am force-stop {DST_PKG}", check=False)
|
| 407 |
+
time.sleep(1)
|
| 408 |
+
intent = INTENT_TEMPLATE.format(dst=DST_PKG, url=CERT_URL)
|
| 409 |
+
sess.sh(f'am start "{intent}"', check=False)
|
| 410 |
+
log(" intent 已发送")
|
| 411 |
+
progress(60)
|
| 412 |
+
|
| 413 |
+
log("[快速] 等待 10s...")
|
| 414 |
+
for i in range(10):
|
| 415 |
+
check_stop()
|
| 416 |
+
time.sleep(1)
|
| 417 |
+
progress(60 + i * 3)
|
| 418 |
+
|
| 419 |
+
png = _screenshot(sess, scratch_dir, log)
|
| 420 |
+
log("\n=== 快速启动完成 ===")
|
| 421 |
+
progress(100)
|
| 422 |
+
return True, png, None
|
| 423 |
+
finally:
|
| 424 |
+
try: sess.close()
|
| 425 |
+
except: pass
|