diff --git a/config/application-sonic-agent.yml b/config/application-sonic-agent.yml
index c09cfda1..c57f4399 100644
--- a/config/application-sonic-agent.yml
+++ b/config/application-sonic-agent.yml
@@ -40,16 +40,16 @@ modules:
# 如果不需要连接iOS设备,请将true改为false。开启的windows用户请确保本机已安装iTunes
enable: true
# 替换为你自己使用的wda的bundleId,如果没有.xctrunner后缀会自动补全,建议使用公司的开发者证书
- wda-bundle-id: com.facebook.WebDriverAgentRunner.xctrunner
+ wda-bundle-id: com.sonic.WebDriverAgentRunner.xctrunner
appium:
# 是否开启Appium功能
enable: true
webview:
# 是否开启在线webView调试功能
- enable: true
+ enable: false
# 谷歌调试端口,一般不需要修改(默认0使用随机端口,如果需要开启防火墙给外部使用,请设置固定端口如7778)
chrome-driver-debug-port: 0
# 替换为Agent机器上的chrome浏览器的driver路径,可以去http://npm.taobao.org/mirrors/chromedriver/下载
chrome-driver-path: "/Applications/Google Chrome.app/Contents/MacOS/chromedriver"
sgm:
- enable: true
\ No newline at end of file
+ enable: false
\ No newline at end of file
diff --git a/plugins/sonic-ios-bridge b/plugins/sonic-ios-bridge
index 5b14fd49..5cbece08 100644
Binary files a/plugins/sonic-ios-bridge and b/plugins/sonic-ios-bridge differ
diff --git a/pom.xml b/pom.xml
index de81e7d0..bc95707a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
sonic-agent
- 1.4.0-beta
+ 1.4.0-rc
jar
diff --git a/src/main/docker/docker-compose.yml b/src/main/docker/docker-compose.yml
index 0bdbe363..d3c03410 100644
--- a/src/main/docker/docker-compose.yml
+++ b/src/main/docker/docker-compose.yml
@@ -1,7 +1,7 @@
version: '3'
services:
sonic-agent:
- image: "registry.cn-hangzhou.aliyuncs.com/sonic-cloud/sonic-agent-linux:v1.4.0-beta"
+ image: "registry.cn-hangzhou.aliyuncs.com/sonic-cloud/sonic-agent-linux:v1.4.0-rc"
environment:
- ZOOKEEPER_HOST=192.168.1.1
- ZOOKEEPER_PORT=2181
diff --git a/src/main/docker/docker-compose2.yml b/src/main/docker/docker-compose2.yml
index 1d3f2da0..603ceb27 100644
--- a/src/main/docker/docker-compose2.yml
+++ b/src/main/docker/docker-compose2.yml
@@ -1,7 +1,7 @@
version: '3'
services:
sonic-agent:
- image: "sonicorg/sonic-agent-linux:v1.4.0-beta"
+ image: "sonicorg/sonic-agent-linux:v1.4.0-rc"
environment:
- ZOOKEEPER_HOST=192.168.1.1
- ZOOKEEPER_PORT=2181
diff --git a/src/main/java/org/cloud/sonic/agent/automation/IOSStepHandler.java b/src/main/java/org/cloud/sonic/agent/automation/IOSStepHandler.java
index 1f3bd545..1fd5ee33 100644
--- a/src/main/java/org/cloud/sonic/agent/automation/IOSStepHandler.java
+++ b/src/main/java/org/cloud/sonic/agent/automation/IOSStepHandler.java
@@ -108,10 +108,11 @@ public void startIOSDriver(String udId, int wdaPort) throws InterruptedException
desiredCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.IOS);
desiredCapabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.IOS_XCUI_TEST);
desiredCapabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 3600);
+ desiredCapabilities.setCapability(IOSMobileCapabilityType.COMMAND_TIMEOUTS, 3600);
desiredCapabilities.setCapability(MobileCapabilityType.NO_RESET, true);
desiredCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, SibTool.getName(udId));
desiredCapabilities.setCapability(MobileCapabilityType.UDID, udId);
- desiredCapabilities.setCapability("wdaConnectionTimeout", 10000);
+ desiredCapabilities.setCapability("wdaConnectionTimeout", 60000);
desiredCapabilities.setCapability(IOSMobileCapabilityType.WEB_DRIVER_AGENT_URL, "http://127.0.0.1:" + wdaPort);
desiredCapabilities.setCapability("useXctestrunFile", false);
desiredCapabilities.setCapability(IOSMobileCapabilityType.SHOW_IOS_LOG, false);
diff --git a/src/main/java/org/cloud/sonic/agent/bridge/ios/SibTool.java b/src/main/java/org/cloud/sonic/agent/bridge/ios/SibTool.java
index 10fc6362..bcfbd3cd 100644
--- a/src/main/java/org/cloud/sonic/agent/bridge/ios/SibTool.java
+++ b/src/main/java/org/cloud/sonic/agent/bridge/ios/SibTool.java
@@ -16,6 +16,7 @@
*/
package org.cloud.sonic.agent.bridge.ios;
+import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.cloud.sonic.agent.common.interfaces.DeviceStatus;
import org.cloud.sonic.agent.common.interfaces.PlatformType;
@@ -40,6 +41,7 @@
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
+import javax.websocket.Session;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -48,6 +50,8 @@
import java.util.ArrayList;
import java.util.List;
+import static org.cloud.sonic.agent.tools.BytesTool.sendText;
+
@ConditionalOnProperty(value = "modules.ios.enable", havingValue = "true")
@DependsOn({"iOSThreadPoolInit"})
@Component
@@ -147,6 +151,7 @@ public static void sendDisConnectStatus(JSONObject jsonObject) {
deviceStatus.put("status", DeviceStatus.DISCONNECTED);
deviceStatus.put("size", IOSInfoMap.getSizeMap().get(jsonObject.getString("serialNumber")));
deviceStatus.put("agentId", AgentZookeeperRegistry.currentAgent.getId());
+ deviceStatus.put("platform", PlatformType.IOS);
logger.info("iOS devices: " + jsonObject.getString("serialNumber") + " OFFLINE!");
SpringTool.getBean(AgentManagerTool.class).devicesStatus(deviceStatus);
IOSDeviceManagerMap.getMap().remove(jsonObject.getString("serialNumber"));
@@ -239,16 +244,94 @@ public static void install(String udId, String path) {
ProcessCommandTool.getProcessLocalCommand(String.format(commandLine, sib, udId, path));
}
- public static JSONObject getAppList(String udId) {
- String commandLine = "%s app list -u %s -j";
- String a = ProcessCommandTool.getProcessLocalCommandStr(String.format(commandLine, sib, udId));
- if (a.length() > 0) {
- return JSONObject.parseObject(a);
- } else {
- return new JSONObject();
+ public static void stopSysLog(String udId) {
+ String processName = String.format("process-%s-syslog", udId);
+ if (GlobalProcessMap.getMap().get(processName) != null) {
+ Process ps = GlobalProcessMap.getMap().get(processName);
+ ps.children().forEach(ProcessHandle::destroy);
+ ps.destroy();
}
}
+ public static void getSysLog(String udId, String filter, Session session) {
+ new Thread(() -> {
+ stopSysLog(udId);
+ String system = System.getProperty("os.name").toLowerCase();
+ Process ps = null;
+ String commandLine = "%s syslog -u %s";
+ if (filter != null && filter.length() > 0) {
+ commandLine += String.format(" -f %s", filter);
+ }
+ try {
+ if (system.contains("win")) {
+ ps = Runtime.getRuntime().exec(new String[]{"cmd", "/c", String.format(commandLine, sib, udId)});
+ } else if (system.contains("linux") || system.contains("mac")) {
+ ps = Runtime.getRuntime().exec(new String[]{"sh", "-c", String.format(commandLine, sib, udId)});
+ }
+ String processName = String.format("process-%s-syslog", udId);
+ GlobalProcessMap.getMap().put(processName, ps);
+ BufferedReader stdInput = new BufferedReader(new
+ InputStreamReader(ps.getInputStream()));
+ String s;
+ while (ps.isAlive()) {
+ if ((s = stdInput.readLine()) != null) {
+ logger.info(s);
+ try {
+ JSONObject appList = new JSONObject();
+ appList.put("msg", "logDetail");
+ appList.put("detail", s);
+ sendText(session, appList.toJSONString());
+ } catch (Exception e) {
+ logger.info(s);
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }).start();
+ }
+
+ public static void getAppList(String udId, Session session) {
+ Process appListProcess = null;
+ String commandLine = "%s app list -u %s -j -i";
+ String system = System.getProperty("os.name").toLowerCase();
+ try {
+ if (system.contains("win")) {
+ appListProcess = Runtime.getRuntime().exec(new String[]{"cmd", "/c", String.format(commandLine, sib, udId)});
+ } else if (system.contains("linux") || system.contains("mac")) {
+ appListProcess = Runtime.getRuntime().exec(new String[]{"sh", "-c", String.format(commandLine, sib, udId)});
+ }
+ BufferedReader stdInput = new BufferedReader(new
+ InputStreamReader(appListProcess.getInputStream()));
+ String s;
+ while (appListProcess.isAlive()) {
+ if ((s = stdInput.readLine()) != null) {
+ try {
+ JSONObject appList = new JSONObject();
+ appList.put("msg", "appListDetail");
+ appList.put("detail", JSON.parseObject(s));
+ sendText(session, appList.toJSONString());
+ } catch (Exception e) {
+ logger.info(s);
+ }
+ }
+ }
+ } catch (Exception e) {
+
+ }
+ }
+
+ public static void locationUnset(String udId) {
+ String commandLine = "%s location unset -u %s";
+ ProcessCommandTool.getProcessLocalCommand(String.format(commandLine, sib, udId));
+ }
+
+ public static void locationSet(String udId, String longitude, String latitude) {
+ String commandLine = "%s location set -u %s --long %s --lat %s";
+ ProcessCommandTool.getProcessLocalCommand(String.format(commandLine, sib, udId, longitude, latitude));
+ }
+
public static JSONObject getAllDevicesBattery() {
String commandLine = "%s battery -j";
String res = ProcessCommandTool.getProcessLocalCommandStr(commandLine.formatted(sib));
diff --git a/src/main/java/org/cloud/sonic/agent/tests/TaskManager.java b/src/main/java/org/cloud/sonic/agent/tests/TaskManager.java
index bb52d720..a6c931a4 100644
--- a/src/main/java/org/cloud/sonic/agent/tests/TaskManager.java
+++ b/src/main/java/org/cloud/sonic/agent/tests/TaskManager.java
@@ -251,9 +251,11 @@ public static void forceStopSuite(int platform, int resultId, int caseId, String
// 清理map
bootThreadsMap.remove(key);
Set removed = childThreadsMap.remove(key);
- for (Thread thread : removed) {
- if (thread instanceof RunStepThread) {
- ((RunStepThread) thread).setStopped(true);
+ if (!CollectionUtils.isEmpty(removed)) {
+ for (Thread thread : removed) {
+ if (thread instanceof RunStepThread) {
+ ((RunStepThread) thread).setStopped(true);
+ }
}
}
runningTestsMap.remove(resultId + "");
diff --git a/src/main/java/org/cloud/sonic/agent/websockets/TerminalWSServer.java b/src/main/java/org/cloud/sonic/agent/websockets/AndroidTerminalWSServer.java
similarity index 97%
rename from src/main/java/org/cloud/sonic/agent/websockets/TerminalWSServer.java
rename to src/main/java/org/cloud/sonic/agent/websockets/AndroidTerminalWSServer.java
index b9b71fd9..68e8ea49 100644
--- a/src/main/java/org/cloud/sonic/agent/websockets/TerminalWSServer.java
+++ b/src/main/java/org/cloud/sonic/agent/websockets/AndroidTerminalWSServer.java
@@ -47,10 +47,10 @@
* @date 2021/10/30 23:35
*/
@Component
-@ServerEndpoint(value = "/websockets/terminal/{key}/{udId}", configurator = MyEndpointConfigure.class)
-public class TerminalWSServer {
+@ServerEndpoint(value = "/websockets/android/terminal/{key}/{udId}/{token}", configurator = MyEndpointConfigure.class)
+public class AndroidTerminalWSServer {
- private final Logger logger = LoggerFactory.getLogger(TerminalWSServer.class);
+ private final Logger logger = LoggerFactory.getLogger(AndroidTerminalWSServer.class);
@Value("${sonic.agent.key}")
private String key;
private Map udIdMap = new ConcurrentHashMap<>();
@@ -60,8 +60,9 @@ public class TerminalWSServer {
private Map> logcatMap = new ConcurrentHashMap<>();
@OnOpen
- public void onOpen(Session session, @PathParam("key") String secretKey, @PathParam("udId") String udId) throws Exception {
- if (secretKey.length() == 0 || (!secretKey.equals(key))) {
+ public void onOpen(Session session, @PathParam("key") String secretKey,
+ @PathParam("udId") String udId, @PathParam("token") String token) throws Exception {
+ if (secretKey.length() == 0 || (!secretKey.equals(key)) || token.length() == 0) {
logger.info("拦截访问!");
return;
}
diff --git a/src/main/java/org/cloud/sonic/agent/websockets/AndroidWSServer.java b/src/main/java/org/cloud/sonic/agent/websockets/AndroidWSServer.java
index 4955f4d0..55002a2e 100644
--- a/src/main/java/org/cloud/sonic/agent/websockets/AndroidWSServer.java
+++ b/src/main/java/org/cloud/sonic/agent/websockets/AndroidWSServer.java
@@ -58,7 +58,7 @@
import java.util.concurrent.TimeUnit;
@Component
-@ServerEndpoint(value = "/websockets/android/{key}/{udId}/{token}", configurator = MyEndpointConfigure.class)
+@ServerEndpoint(value = "/websockets/android/{key}/{udId}/{token}/{isAutoInit}", configurator = MyEndpointConfigure.class)
public class AndroidWSServer implements IAndroidWSServer {
private final Logger logger = LoggerFactory.getLogger(AndroidWSServer.class);
@@ -80,8 +80,8 @@ public class AndroidWSServer implements IAndroidWSServer {
@OnOpen
public void onOpen(Session session, @PathParam("key") String secretKey,
- @PathParam("udId") String udId, @PathParam("token") String token) throws Exception {
- if (secretKey.length() == 0 || (!secretKey.equals(key)) || token.length() == 0) {
+ @PathParam("udId") String udId, @PathParam("token") String token, @PathParam("isAutoInit") Integer isAutoInit) throws Exception {
+ if (secretKey.length() == 0 || (!secretKey.equals(key)) || token.length() == 0 || isAutoInit == null) {
logger.info("拦截访问!");
return;
}
@@ -270,6 +270,10 @@ public boolean isCancelled() {
adbkit.put("isEnable", false);
BytesTool.sendText(session, adbkit.toJSONString());
}
+
+ if (isAutoInit == 1) {
+ openDriver(iDevice, session);
+ }
}
@OnClose
@@ -446,10 +450,10 @@ public void onMessage(String message, Session session) {
JSONObject result = new JSONObject();
result.put("msg", "pullResult");
String url = AndroidDeviceBridgeTool.pullFile(iDevice, msg.getString("path"));
- if(url!=null){
+ if (url != null) {
result.put("status", "success");
- result.put("url",url);
- }else {
+ result.put("url", url);
+ } else {
result.put("status", "fail");
}
BytesTool.sendText(session, result.toJSONString());
@@ -494,33 +498,7 @@ public void onMessage(String message, Session session) {
AndroidStepHandler androidStepHandler = HandlerMap.getAndroidMap().get(session.getId());
if (androidStepHandler == null || androidStepHandler.getAndroidDriver() == null) {
if (msg.getString("detail").equals("openDriver")) {
- if (isEnableAppium) {
- androidStepHandler = new AndroidStepHandler();
- androidStepHandler.setTestMode(0, 0, iDevice.getSerialNumber(), DeviceStatus.DEBUGGING, session.getId());
- JSONObject result = new JSONObject();
- AndroidStepHandler finalAndroidStepHandler1 = androidStepHandler;
- AndroidDeviceThreadPool.cachedThreadPool.execute(() -> {
- try {
- AndroidDeviceLocalStatus.startDebug(iDevice.getSerialNumber());
- finalAndroidStepHandler1.startAndroidDriver(iDevice.getSerialNumber());
- result.put("status", "success");
- result.put("detail", "初始化Driver完成!");
- HandlerMap.getAndroidMap().put(session.getId(), finalAndroidStepHandler1);
- JSONObject port = new JSONObject();
- port.put("port", AppiumServer.serviceMap.get(iDevice.getSerialNumber()).getUrl().getPort());
- port.put("msg", "appiumPort");
- BytesTool.sendText(session, port.toJSONString());
- } catch (Exception e) {
- logger.error(e.getMessage());
- result.put("status", "error");
- result.put("detail", "初始化Driver失败!部分功能不可用!请联系管理员");
- finalAndroidStepHandler1.closeAndroidDriver();
- } finally {
- result.put("msg", "openDriver");
- BytesTool.sendText(session, result.toJSONString());
- }
- });
- }
+ openDriver(iDevice, session);
}
break;
}
@@ -610,6 +588,36 @@ public void onMessage(String message, Session session) {
}
}
+ private void openDriver(IDevice iDevice, Session session) {
+ if (isEnableAppium) {
+ AndroidStepHandler androidStepHandler = new AndroidStepHandler();
+ androidStepHandler.setTestMode(0, 0, iDevice.getSerialNumber(), DeviceStatus.DEBUGGING, session.getId());
+ JSONObject result = new JSONObject();
+ AndroidStepHandler finalAndroidStepHandler1 = androidStepHandler;
+ AndroidDeviceThreadPool.cachedThreadPool.execute(() -> {
+ try {
+ AndroidDeviceLocalStatus.startDebug(iDevice.getSerialNumber());
+ finalAndroidStepHandler1.startAndroidDriver(iDevice.getSerialNumber());
+ result.put("status", "success");
+ result.put("detail", "初始化Driver完成!");
+ HandlerMap.getAndroidMap().put(session.getId(), finalAndroidStepHandler1);
+ JSONObject port = new JSONObject();
+ port.put("port", AppiumServer.serviceMap.get(iDevice.getSerialNumber()).getUrl().getPort());
+ port.put("msg", "appiumPort");
+ BytesTool.sendText(session, port.toJSONString());
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ result.put("status", "error");
+ result.put("detail", "初始化Driver失败!部分功能不可用!请联系管理员");
+ finalAndroidStepHandler1.closeAndroidDriver();
+ } finally {
+ result.put("msg", "openDriver");
+ BytesTool.sendText(session, result.toJSONString());
+ }
+ });
+ }
+ }
+
private void exit(Session session) {
AndroidDeviceLocalStatus.finish(session.getUserProperties().get("udId") + "");
IDevice iDevice = udIdMap.get(session);
diff --git a/src/main/java/org/cloud/sonic/agent/websockets/IOSTerminalWSServer.java b/src/main/java/org/cloud/sonic/agent/websockets/IOSTerminalWSServer.java
new file mode 100644
index 00000000..27533be6
--- /dev/null
+++ b/src/main/java/org/cloud/sonic/agent/websockets/IOSTerminalWSServer.java
@@ -0,0 +1,85 @@
+package org.cloud.sonic.agent.websockets;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import org.cloud.sonic.agent.bridge.ios.SibTool;
+import org.cloud.sonic.agent.common.maps.WebSocketSessionMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.websocket.*;
+import javax.websocket.server.PathParam;
+import javax.websocket.server.ServerEndpoint;
+import java.io.IOException;
+
+import static org.cloud.sonic.agent.tools.BytesTool.sendText;
+
+@Component
+@ServerEndpoint(value = "/websockets/ios/terminal/{key}/{udId}/{token}", configurator = MyEndpointConfigure.class)
+public class IOSTerminalWSServer implements IIOSWSServer {
+ private final Logger logger = LoggerFactory.getLogger(AndroidTerminalWSServer.class);
+ @Value("${sonic.agent.key}")
+ private String key;
+
+ @OnOpen
+ public void onOpen(Session session, @PathParam("key") String secretKey,
+ @PathParam("udId") String udId, @PathParam("token") String token) throws Exception {
+ if (secretKey.length() == 0 || (!secretKey.equals(key)) || token.length() == 0) {
+ logger.info("拦截访问!");
+ return;
+ }
+ WebSocketSessionMap.addSession(session);
+ if (!SibTool.getDeviceList().contains(udId)) {
+ logger.info("设备未连接,请检查!");
+ return;
+ }
+ saveUdIdMapAndSet(session, udId);
+ JSONObject ter = new JSONObject();
+ ter.put("msg", "terminal");
+ sendText(session, ter.toJSONString());
+ }
+
+ @OnMessage
+ public void onMessage(String message, Session session) throws InterruptedException {
+ JSONObject msg = JSON.parseObject(message);
+ logger.info(session.getId() + " 发送 " + msg);
+ String udId = udIdMap.get(session);
+ switch (msg.getString("type")) {
+ case "appList":
+ SibTool.getAppList(udId, session);
+ break;
+ case "syslog":
+ SibTool.getSysLog(udId, msg.getString("filter"), session);
+ break;
+ case "stopSyslog":
+ SibTool.stopSysLog(udId);
+ break;
+ }
+ }
+
+ @OnClose
+ public void onClose(Session session) {
+ exit(session);
+ }
+
+ @OnError
+ public void onError(Session session, Throwable error) {
+ logger.error(error.getMessage());
+ JSONObject errMsg = new JSONObject();
+ errMsg.put("msg", "error");
+ sendText(session, errMsg.toJSONString());
+ }
+
+ private void exit(Session session) {
+ WebSocketSessionMap.removeSession(session);
+ removeUdIdMapAndSet(session);
+ try {
+ session.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ logger.info(session.getId() + "退出");
+ }
+}
diff --git a/src/main/java/org/cloud/sonic/agent/websockets/IOSWSServer.java b/src/main/java/org/cloud/sonic/agent/websockets/IOSWSServer.java
index 74cdaf12..969a04e6 100644
--- a/src/main/java/org/cloud/sonic/agent/websockets/IOSWSServer.java
+++ b/src/main/java/org/cloud/sonic/agent/websockets/IOSWSServer.java
@@ -55,6 +55,8 @@
import java.time.Duration;
import java.util.concurrent.TimeUnit;
+import static org.cloud.sonic.agent.tools.BytesTool.sendText;
+
@Component
@ServerEndpoint(value = "/websockets/ios/{key}/{udId}/{token}", configurator = MyEndpointConfigure.class)
public class IOSWSServer implements IIOSWSServer {
@@ -63,7 +65,8 @@ public class IOSWSServer implements IIOSWSServer {
private String key;
@Value("${sonic.agent.port}")
private int port;
- @Autowired private AgentManagerTool agentManagerTool;
+ @Autowired
+ private AgentManagerTool agentManagerTool;
@OnOpen
public void onOpen(Session session, @PathParam("key") String secretKey,
@@ -112,7 +115,7 @@ public void onOpen(Session session, @PathParam("key") String secretKey,
JSONObject port = new JSONObject();
port.put("port", AppiumServer.serviceMap.get(udId).getUrl().getPort());
port.put("msg", "appiumPort");
- BytesTool.sendText(session, port.toJSONString());
+ sendText(session, port.toJSONString());
} catch (Exception e) {
logger.error(e.getMessage());
result.put("status", "error");
@@ -150,6 +153,13 @@ public void onMessage(String message, Session session) throws InterruptedExcepti
logger.info(session.getId() + " 发送 " + msg);
String udId = udIdMap.get(session);
switch (msg.getString("type")) {
+ case "location": {
+ if (msg.getString("detail").equals("set")) {
+ SibTool.locationSet(udId, msg.getString("long"), msg.getString("lat"));
+ } else {
+ SibTool.locationUnset(udId);
+ }
+ }
case "proxy": {
Socket portSocket = PortTool.getBindSocket();
Socket webPortSocket = PortTool.getBindSocket();
@@ -160,7 +170,7 @@ public void onMessage(String message, Session session) throws InterruptedExcepti
proxy.put("webPort", webPort);
proxy.put("port", pPort);
proxy.put("msg", "proxyResult");
- BytesTool.sendText(session, proxy.toJSONString());
+ sendText(session, proxy.toJSONString());
break;
}
case "installCert": {
@@ -171,13 +181,6 @@ public void onMessage(String message, Session session) throws InterruptedExcepti
iosStepHandler.getDriver().activateApp("com.apple.mobilesafari");
break;
}
- case "appList":
- JSONObject appList = SibTool.getAppList(udId);
- if (appList.get("appList") != null) {
- appList.put("msg", "appListDetail");
- sendText(session, appList.toJSONString());
- }
- break;
case "launch":
SibTool.launch(udId, msg.getString("pkg"));
break;
@@ -313,16 +316,6 @@ public void onMessage(String message, Session session) throws InterruptedExcepti
}
}
- private void sendText(Session session, String message) {
- synchronized (session) {
- try {
- session.getBasicRemote().sendText(message);
- } catch (IllegalStateException | IOException e) {
- logger.error("webSocket发送失败!连接已关闭!");
- }
- }
- }
-
private void exit(Session session) {
try {
HandlerMap.getIOSMap().get(session.getId()).closeIOSDriver();
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 690da407..03ede9fe 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -11,4 +11,4 @@ spring:
sonic:
saa: 2.0.0
sgm: 0.1.9
- sib: 1.0.6
\ No newline at end of file
+ sib: 1.0.8
\ No newline at end of file