feat: 支持安装前后ADB命令与安装后启动应用

按工程保存前后置命令和自动启动选项,全程绑定选中设备,区分安装与后续动作失败。通过实际APK及目标设备解析Launcher入口,兼容activity-alias;增加模拟进程回归测试及0.8.0三套服务部署记录。
This commit is contained in:
tongtong committed 2026-11-27 16:26:03 +08:00
1 parent 6f9cc7e7ea
commit b46ebd1070
18 files changed
+472 -35

No files matched your search

@@ -437,13 +437,7 @@ class RemotePanel(private val project: Project) : JPanel(BorderLayout()), Dispos
}
settings.selectDevice(target.serial)
append("安装目标:$target")
val outputLog = Files.createTempFile("remotecompile-adb-", ".log")
try {
val process = ProcessBuilder(adb, "-s", target.serial, "install", "-r", output.toString())
.redirectErrorStream(true).redirectOutput(outputLog.toFile()).start()
if (!process.waitFor(120, TimeUnit.SECONDS)) { process.destroyForcibly(); error("adb 安装超时") }
append(Files.readString(outputLog)); check(process.exitValue() == 0) { "adb 安装失败" }
} finally { Files.deleteIfExists(outputLog) }
InstallActions.install(source, cfg, adb, target.serial, output, ::append)
}
private fun setBuildId(id: String) = ApplicationManager.getApplication().invokeLater { if (!disposed) buildIdField.text = id }
private fun showProgress(message: String, percent: Int = -1) = ApplicationManager.getApplication().invokeLater {
@@ -597,12 +591,7 @@ class RemotePanel(private val project: Project) : JPanel(BorderLayout()), Dispos
val target = AdbDevices.choose(AdbDevices.list(adb), explicit?.serial ?: cfg.device, explicit != null)
check(target != null) { "请选择在线且已授权的设备" }
append("安装构建 ${record.buildId} 到 $target")
val outputLog = Files.createTempFile("remote-install-", ".log")
try {
val process = ProcessBuilder(adb, "-s", target.serial, "install", "-r", output.toString()).redirectErrorStream(true).redirectOutput(outputLog.toFile()).start()
if (!process.waitFor(120, TimeUnit.SECONDS)) { process.destroyForcibly(); error("安装超时") }
append(Files.readString(outputLog)); check(process.exitValue() == 0) { "adb 安装失败" }
} finally { Files.deleteIfExists(outputLog) }
InstallActions.install(source, cfg, adb, target.serial, output, ::append)
} catch (e: Exception) { append("安装失败:${e.message ?: e.javaClass.simpleName}") }
finally { busy = false; ApplicationManager.getApplication().invokeLater { if (!disposed && !project.isDisposed) run.isEnabled = true } }
}