Compare commits
	
		
			2 Commits 
		
	
	
		
			0e785a67a5
			...
			47b6c0d728
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								 | 
						47b6c0d728 | |
| 
							
							
								 | 
						8e8b116492 | 
| 
						 | 
					@ -138,15 +138,10 @@ public class AndroidAgentSession {
 | 
				
			||||||
     * 安静地关闭流
 | 
					     * 安静地关闭流
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public void closeSilence() {
 | 
					    public void closeSilence() {
 | 
				
			||||||
        try {
 | 
					        if (null != this.sendThread) {
 | 
				
			||||||
 | 
					            this.sendThread.interrupt();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        state = false;
 | 
					        state = false;
 | 
				
			||||||
            logger.debug("关闭设备【{}】的agentSession连接",serial);
 | 
					 | 
				
			||||||
            if (transport != null) {
 | 
					 | 
				
			||||||
                transport.close();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        } catch (IOException ignore) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private class CommandSendThread extends Thread {
 | 
					    private class CommandSendThread extends Thread {
 | 
				
			||||||
| 
						 | 
					@ -168,7 +163,14 @@ public class AndroidAgentSession {
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            closeSilence();
 | 
					            try {
 | 
				
			||||||
 | 
					                logger.debug("关闭设备【{}】的agentSession连接",serial);
 | 
				
			||||||
 | 
					                if (transport != null) {
 | 
				
			||||||
 | 
					                    transport.close();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            } catch (IOException ignore) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,7 @@ package net.northking.cctp.upperComputer.service;
 | 
				
			||||||
import cn.hutool.core.codec.Base64;
 | 
					import cn.hutool.core.codec.Base64;
 | 
				
			||||||
import cn.hutool.core.img.ImgUtil;
 | 
					import cn.hutool.core.img.ImgUtil;
 | 
				
			||||||
import com.alibaba.fastjson.JSON;
 | 
					import com.alibaba.fastjson.JSON;
 | 
				
			||||||
 | 
					import com.alibaba.fastjson.JSONObject;
 | 
				
			||||||
import io.appium.java_client.AppiumDriver;
 | 
					import io.appium.java_client.AppiumDriver;
 | 
				
			||||||
import io.appium.java_client.android.AndroidDriver;
 | 
					import io.appium.java_client.android.AndroidDriver;
 | 
				
			||||||
import io.appium.java_client.ios.IOSDriver;
 | 
					import io.appium.java_client.ios.IOSDriver;
 | 
				
			||||||
| 
						 | 
					@ -864,17 +865,20 @@ public class AndroidDebuggerServiceImpl extends AbstractDebuggerService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public String endRecord(DebuggerDeviceInfo info) {
 | 
					    public String endRecord(DebuggerDeviceInfo info) {
 | 
				
			||||||
        String result = null;
 | 
					        String videoUrl = null;
 | 
				
			||||||
        logger.info("收到设备【{}】在任务【{}】关闭录屏的请求............",info.getDeviceId(),info.getTaskId());
 | 
					        logger.info("收到设备【{}】在任务【{}】关闭录屏的请求............",info.getDeviceId(),info.getTaskId());
 | 
				
			||||||
        AndroidScreenResponseThread screenThread = AndroidDeviceManager.getInstance().getScreenThread(info.getDeviceId());
 | 
					        AndroidScreenResponseThread screenThread = AndroidDeviceManager.getInstance().getScreenThread(info.getDeviceId());
 | 
				
			||||||
        if (null != screenThread && screenThread.isAlive() && !screenThread.isInterrupted()) {
 | 
					        if (null != screenThread && screenThread.isAlive() && !screenThread.isInterrupted()) {
 | 
				
			||||||
            result = screenThread.stopRecord();
 | 
					            String result = screenThread.stopRecord();
 | 
				
			||||||
            return result;
 | 
					            JSONObject jsonObject = JSON.parseObject(result, JSONObject.class);
 | 
				
			||||||
 | 
					            videoUrl = jsonObject.getString("videoUrl");
 | 
				
			||||||
 | 
					            logger.info("设备【{}】在任务【{}】录屏关闭,得到的视频地址为:{}",info.getDeviceId(),info.getTaskId(),videoUrl);
 | 
				
			||||||
 | 
					            return videoUrl;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            logger.info("设备【{}】在任务【{}】录屏不存在............",info.getDeviceId(),info.getTaskId());
 | 
					            logger.info("设备【{}】在任务【{}】录屏不存在............",info.getDeviceId(),info.getTaskId());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        logger.info("设备【{}】在任务【{}】录屏保存的地址:{}............",info.getDeviceId(),info.getTaskId(),result);
 | 
					        logger.info("设备【{}】在任务【{}】录屏保存的地址:{}............",info.getDeviceId(),info.getTaskId(),videoUrl);
 | 
				
			||||||
        return result;
 | 
					        return videoUrl;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -248,17 +248,20 @@ public class IosDebuggerServiceImpl extends AbstractDebuggerService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public String endRecord(DebuggerDeviceInfo info) {
 | 
					    public String endRecord(DebuggerDeviceInfo info) {
 | 
				
			||||||
        String result = null;
 | 
					        String videoUrl = null;
 | 
				
			||||||
        logger.info("收到设备【{}】在任务【{}】关闭录屏的请求............",info.getDeviceId(),info.getTaskId());
 | 
					        logger.info("收到设备【{}】在任务【{}】关闭录屏的请求............",info.getDeviceId(),info.getTaskId());
 | 
				
			||||||
        IosScreenResponseThread screenThread = IOSDeviceManager.getInstance().getScreenThread(info.getDeviceId());
 | 
					        IosScreenResponseThread screenThread = IOSDeviceManager.getInstance().getScreenThread(info.getDeviceId());
 | 
				
			||||||
        if (null != screenThread && screenThread.isAlive() && !screenThread.isInterrupted()) {
 | 
					        if (null != screenThread && screenThread.isAlive() && !screenThread.isInterrupted()) {
 | 
				
			||||||
            result = screenThread.stopRecord();
 | 
					            String result = screenThread.stopRecord();
 | 
				
			||||||
            return result;
 | 
					            JSONObject jsonObject = JSON.parseObject(result, JSONObject.class);
 | 
				
			||||||
 | 
					            videoUrl = jsonObject.getString("videoUrl");
 | 
				
			||||||
 | 
					            logger.info("设备【{}】在任务【{}】录屏关闭,得到的视频地址为:{}",info.getDeviceId(),info.getTaskId(),videoUrl);
 | 
				
			||||||
 | 
					            return videoUrl;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            logger.info("设备【{}】在任务【{}】录屏不存在............",info.getDeviceId(),info.getTaskId());
 | 
					            logger.info("设备【{}】在任务【{}】录屏不存在............",info.getDeviceId(),info.getTaskId());
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        logger.info("设备【{}】在任务【{}】录屏保存的地址:{}............",info.getDeviceId(),info.getTaskId(),result);
 | 
					        logger.info("设备【{}】在任务【{}】录屏保存的地址:{}............",info.getDeviceId(),info.getTaskId(),videoUrl);
 | 
				
			||||||
        return result;
 | 
					        return videoUrl;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue