fix:上位机

1.修改ios的结束应用的逻辑
master
李杰应 2024-08-05 18:23:20 +08:00
parent e87632e127
commit 1608e29d27
1 changed files with 33 additions and 19 deletions

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.appium.java_client.AppiumDriver; import io.appium.java_client.AppiumDriver;
import net.northking.cctp.upperComputer.config.MobileProperty; import net.northking.cctp.upperComputer.config.MobileProperty;
import net.northking.cctp.upperComputer.deviceManager.common.PyMobileDevice;
import net.northking.cctp.upperComputer.deviceManager.screen.IosScreenResponseThread; import net.northking.cctp.upperComputer.deviceManager.screen.IosScreenResponseThread;
import net.northking.cctp.upperComputer.entity.Attachment; import net.northking.cctp.upperComputer.entity.Attachment;
import net.northking.cctp.upperComputer.entity.DebuggerDeviceInfo; import net.northking.cctp.upperComputer.entity.DebuggerDeviceInfo;
@ -18,6 +19,7 @@ import net.northking.cctp.upperComputer.service.thread.IOSDeviceInfoByPackageThr
import net.northking.cctp.upperComputer.deviceManager.IOSDeviceManager; import net.northking.cctp.upperComputer.deviceManager.IOSDeviceManager;
import net.northking.cctp.upperComputer.utils.HttpUtils; import net.northking.cctp.upperComputer.utils.HttpUtils;
import net.northking.cctp.upperComputer.utils.ScreenShotUtils; import net.northking.cctp.upperComputer.utils.ScreenShotUtils;
import net.northking.cctp.upperComputer.utils.ios.MacIosHandleHelper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -319,6 +321,17 @@ public class IosDebuggerServiceImpl extends AbstractDebuggerService {
@Override @Override
public boolean terminateApp(String deviceId, String appPackage) { public boolean terminateApp(String deviceId, String appPackage) {
boolean flag = deviceHandleHelper instanceof MacIosHandleHelper;
if (flag) {
PyMobileDevice.SpecificAppleDeviceInfo specificAppleDeviceInfo = IOSDeviceManager.getInstance().getSpecificAppleDeviceInfo(deviceId);
boolean killFlag = PyMobileDevice.getInstance().pkill(specificAppleDeviceInfo, appPackage);
if (killFlag) {
logger.info("设备{},执行关闭应用 {} 命令成功", deviceId, appPackage);
} else {
logger.info("设备{},执行关闭应用 {} 命令失败", deviceId, appPackage);
}
return killFlag;
} else {
String[] cmd = {"tidevice", "-u", deviceId, "kill", appPackage}; String[] cmd = {"tidevice", "-u", deviceId, "kill", appPackage};
ProcessBuilder builder = new ProcessBuilder(Arrays.asList(cmd)).redirectErrorStream(true); ProcessBuilder builder = new ProcessBuilder(Arrays.asList(cmd)).redirectErrorStream(true);
Process process = null; Process process = null;
@ -343,6 +356,7 @@ public class IosDebuggerServiceImpl extends AbstractDebuggerService {
return false; return false;
} }
} }
}
@Override @Override
public boolean recordDevicePer(DebuggerDeviceInfo info) { public boolean recordDevicePer(DebuggerDeviceInfo info) {