- ADB client (connect, tap, swipe, screencap, app control) - Vision module (in-memory screenshot + OpenCV template matching) - Action loader (auto-discovers .py files in actions/) - Engine (screenshot → detect → act loop with YAML playbook) - 12 built-in actions: tap, click, wait, swipe, find, find_and_click, wait_until, click_seq, keyevent, app, log - Example custom action template - Debug screenshot tool for template creation - Detailed plan.md with 20 actions across 9 phases - Sample playbook with 10 steps
25 lines
783 B
Python
25 lines
783 B
Python
"""Action: app — launch or force-stop an app."""
|
|
import time
|
|
|
|
|
|
class Action:
|
|
name = "app"
|
|
|
|
def run(self, ctx, params):
|
|
action = params.get("action", "launch")
|
|
package = params.get("package", "com.kingsgroup.sos")
|
|
|
|
if action == "launch":
|
|
ctx["adb"].launch_app(package)
|
|
ctx["log"].info("Launched %s", package)
|
|
time.sleep(params.get("wait", 5))
|
|
elif action == "stop":
|
|
ctx["adb"].force_stop(package)
|
|
ctx["log"].info("Stopped %s", package)
|
|
elif action == "restart":
|
|
ctx["adb"].force_stop(package)
|
|
time.sleep(2)
|
|
ctx["adb"].launch_app(package)
|
|
ctx["log"].info("Restarted %s", package)
|
|
time.sleep(params.get("wait", 10))
|