| 33 | } |
| 34 | |
| 35 | bool AndrowsExtras::parse(const json::value& config) |
| 36 | { |
| 37 | bool enable = config.get("extras", "androws", "enable", false); |
| 38 | if (!enable) { |
| 39 | LogInfo << "extras.androws.enable is false, ignore"; |
| 40 | return false; |
| 41 | } |
| 42 | |
| 43 | app_package_ = config.get("extras", "androws", "app_package", std::string { }); |
| 44 | LogInfo << VAR(app_package_); |
| 45 | |
| 46 | // ADB shell command generator: {ADB} -s {ADB_SERIAL} shell {ANDROWS_SHELL_CMD} |
| 47 | static const json::array kAdbShellArgv = { |
| 48 | "{ADB}", "-s", "{ADB_SERIAL}", "shell", "{ANDROWS_SHELL_CMD}", |
| 49 | }; |
| 50 | |
| 51 | // Screencap using logical display ID directly |
| 52 | static const json::array kScreencapEncodeArgv = { |
| 53 | "{ADB}", "-s", "{ADB_SERIAL}", "exec-out", "screencap -d {ANDROWS_DISPLAY_ID} -p", |
| 54 | }; |
| 55 | |
| 56 | bool ok = parse_command("AndrowsShell", config, kAdbShellArgv, adb_shell_argv_) |
| 57 | && parse_command("ScreencapEncode", config, kScreencapEncodeArgv, screencap_encode_argv_); |
| 58 | |
| 59 | if (ok && !agent_path_.empty()) { |
| 60 | ok = parse_minitouch_config(config); |
| 61 | } |
| 62 | |
| 63 | return ok; |
| 64 | } |
| 65 | |
| 66 | bool AndrowsExtras::init() |
| 67 | { |