Skip to content

Commit c9dafe2

Browse files
author
朱辉\harry
committed
删除不需要的log输出
1 parent 61bccfc commit c9dafe2

4 files changed

Lines changed: 18 additions & 8 deletions

File tree

‎src/main/java/com/yeetor/androidcontrol/LocalClient.java‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ public LocalClient(Protocol protocol) {
3030

3131

3232
public void executeCommand(ChannelHandlerContext ctx, Command command) {
33-
if (command.getSchem() != Command.Schem.WAITTING && command.getSchem() != Command.Schem.TOUCH) {
34-
System.out.println(command.getContent());
35-
}
3633
switch (command.getSchem()) {
3734
case START:
3835
startCommand(ctx, command);

‎src/main/java/com/yeetor/androidcontrol/RemoteClient.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public void onConnected(WebSocket websocket, Map<String, List<String>> headers)
6262

6363
@Override
6464
public void onTextMessage(WebSocket websocket, String text) throws Exception {
65-
System.out.println(text);
6665
Command command = Command.ParseCommand(text);
6766
if (command != null) {
6867
switch (command.getSchem()) {

‎src/main/java/com/yeetor/androidcontrol/RemoteServer.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ public void onDisconnect(ChannelHandlerContext ctx) {
8282

8383
@Override
8484
public void onTextMessage(ChannelHandlerContext ctx, String text) {
85-
System.out.println(text);
8685
Command command = Command.ParseCommand(text);
8786
if (command != null) {
8887
switch (command.getSchem()) {
@@ -183,7 +182,6 @@ void forwardCommand(ChannelHandlerContext ctx, Command command) {
183182
ChannelHandlerContext sendTo = null;
184183

185184
if (ctx == protocol.getBroswerSocket()) {
186-
System.out.println("转发:" + command.getCommandString());
187185
sendTo = protocol.getClientSocket();
188186
} else {
189187
sendTo = protocol.getBroswerSocket();

‎src/main/java/com/yeetor/minicap/Minicap.java‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ public AdbForward createForward() {
162162
return forward;
163163
}
164164

165+
private void removeForward(AdbForward forward) {
166+
if (forward == null || !forward.isForward()) {
167+
return;
168+
}
169+
try {
170+
device.removeForward(forward.getPort(), forward.getLocalabstract(), IDevice.DeviceUnixSocketNamespace.ABSTRACT);
171+
} catch (Exception e) {
172+
e.printStackTrace();
173+
System.out.println("remove forward failed");
174+
}
175+
}
176+
165177
/**
166178
* 屏幕截图
167179
*
@@ -400,6 +412,7 @@ private void onStartup(boolean success) {
400412
private void onClose() {
401413
for (MinicapListener listener : listenerList) {
402414
listener.onClose(this);
415+
removeForward(forward);
403416
}
404417
}
405418

@@ -427,6 +440,7 @@ private class DataReader implements Runnable {
427440
this.inputStream = minicapSocket.getInputStream();
428441
} catch (IOException e) {
429442
e.printStackTrace();
443+
onClose();
430444
}
431445
}
432446

@@ -435,7 +449,8 @@ public void run() {
435449
try {
436450
readData();
437451
} catch (IOException e) {
438-
e.printStackTrace();
452+
System.out.println("lost connection: " + e.getMessage());
453+
onClose();
439454
}
440455
}
441456

@@ -473,7 +488,8 @@ public void run() {
473488
banner = new Banner();
474489
readData();
475490
} catch (InterruptedException e) {
476-
e.printStackTrace();
491+
System.out.println(e.getMessage());
492+
onClose();
477493
}
478494
}
479495
}

0 commit comments

Comments
 (0)