@@ -41,6 +41,14 @@ public class Main {
41
41
public static void main (String [] args ) throws ClassNotFoundException , NoSuchMethodException , InvocationTargetException , IllegalAccessException , IOException {
42
42
43
43
System .out .println ("start!" );
44
+
45
+ Thread .setDefaultUncaughtExceptionHandler (new Thread .UncaughtExceptionHandler () {
46
+ @ Override
47
+ public void uncaughtException (Thread t , Throwable e ) {
48
+ System .out .println (e .getMessage ());
49
+ }
50
+ });
51
+
44
52
LocalServerSocket serverSocket = new LocalServerSocket ("puppet-ver1" );
45
53
46
54
init ();
@@ -51,6 +59,7 @@ public static void main(String[] args) throws ClassNotFoundException, NoSuchMeth
51
59
LocalSocket socket = serverSocket .accept ();
52
60
acceptConnect (socket );
53
61
} catch (Exception e ) {
62
+ System .out .println (e .getMessage ());
54
63
serverSocket = new LocalServerSocket ("puppet-ver1" );
55
64
}
56
65
@@ -93,8 +102,8 @@ public void run() {
93
102
outputStream .write (byteArrayOutputStream .toByteArray ());
94
103
outputStream .flush ();
95
104
}
96
- } catch (Exception e ) {
97
- e . printStackTrace ( );
105
+ } catch (Throwable e ) {
106
+ System . out . println ( e . getMessage () );
98
107
}
99
108
}
100
109
}.start ();
@@ -126,7 +135,7 @@ public void run() {
126
135
return ;
127
136
}
128
137
} catch (Exception e ) {
129
- e . printStackTrace ( );
138
+ System . out . println ( e . getMessage () );
130
139
return ;
131
140
}
132
141
try {
@@ -146,13 +155,13 @@ public void run() {
146
155
scale = Float .parseFloat (line .substring (DEGREE .length ())) / 100 ;
147
156
}
148
157
} catch (Exception e ) {
149
- e . printStackTrace ( );
158
+ System . out . println ( e . getMessage () );
150
159
}
151
160
152
161
153
162
}
154
- } catch (Exception e ) {
155
- e . printStackTrace ( );
163
+ } catch (Throwable e ) {
164
+ System . out . println ( e . getMessage () );
156
165
}
157
166
158
167
}
@@ -165,7 +174,7 @@ private static void handlerUp(String line) {
165
174
try {
166
175
touchUp (point .x , point .y );
167
176
} catch (Exception e ) {
168
- e . printStackTrace ( );
177
+ System . out . println ( e . getMessage () );
169
178
}
170
179
}
171
180
}
@@ -176,7 +185,7 @@ private static void hanlerMove(String line) {
176
185
try {
177
186
touchMove (point .x , point .y );
178
187
} catch (Exception e ) {
179
- e . printStackTrace ( );
188
+ System . out . println ( e . getMessage () );
180
189
}
181
190
}
182
191
}
@@ -187,7 +196,7 @@ private static void hanlerDown(String line) {
187
196
try {
188
197
touchDown (point .x , point .y );
189
198
} catch (Exception e ) {
190
- e . printStackTrace ( );
199
+ System . out . println ( e . getMessage () );
191
200
}
192
201
}
193
202
}
@@ -203,7 +212,7 @@ private static Point getXY(String nums) {
203
212
point .y *= scaleY ;
204
213
return point ;
205
214
} catch (Exception e ) {
206
- e . printStackTrace ( );
215
+ System . out . println ( e . getMessage () );
207
216
}
208
217
return null ;
209
218
}
@@ -232,19 +241,19 @@ public static Bitmap screenshot() throws Exception {
232
241
}
233
242
b = (Bitmap ) Class .forName (surfaceClassName ).getDeclaredMethod ("screenshot" , new Class []{Integer .TYPE , Integer .TYPE }).invoke (null , new Object []{Integer .valueOf (size .x ), Integer .valueOf (size .y )});
234
243
235
- int rotation = wm .getRotation ();
236
-
237
- if (rotation == 0 ) {
238
- return b ;
239
- }
244
+ // int rotation = wm.getRotation();
245
+ //
246
+ // if (rotation == 0) {
247
+ // return b;
248
+ // }
240
249
Matrix m = new Matrix ();
241
- if (rotation == 1 ) {
242
- m .postRotate (-90.0f );
243
- } else if (rotation == 2 ) {
244
- m .postRotate (-180.0f );
245
- } else if (rotation == 3 ) {
246
- m .postRotate (-270.0f );
247
- }
250
+ // if (rotation == 1) {
251
+ // m.postRotate(-90.0f);
252
+ // } else if (rotation == 2) {
253
+ // m.postRotate(-180.0f);
254
+ // } else if (rotation == 3) {
255
+ // m.postRotate(-270.0f);
256
+ // }
248
257
return Bitmap .createBitmap (b , 0 , 0 , size .x , size .y , m , false );
249
258
250
259
}
0 commit comments