@nativescript/android 8.8.0-alpha.11 → 8.8.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/framework/app/build.gradle +10 -4
- package/framework/app/libs/runtime-libs/nativescript-optimized-with-inspector.aar +0 -0
- package/framework/app/libs/runtime-libs/nativescript-optimized.aar +0 -0
- package/framework/app/libs/runtime-libs/nativescript-regular.aar +0 -0
- package/framework/app/src/main/assets/internal/ts_helpers.js +3 -1
- package/framework/build-tools/android-metadata-generator.jar +0 -0
- package/framework/build-tools/dts-generator.jar +0 -0
- package/framework/build-tools/jsparser/js_parser.js +1 -1
- package/framework/build-tools/static-binding-generator.jar +0 -0
- package/framework/settings.gradle +7 -0
- package/package.json +1 -1
- package/framework/app/src/debug/java/com/tns/ErrorReport.java +0 -512
- package/framework/app/src/debug/java/com/tns/ErrorReportActivity.java +0 -52
- package/framework/app/src/debug/java/com/tns/NativeScriptSyncService.java +0 -346
- package/framework/app/src/debug/java/com/tns/NativeScriptSyncServiceSocketImpl.java +0 -448
- package/framework/app/src/debug/res/layout/error_activity.xml +0 -62
- package/framework/app/src/debug/res/layout/exception_tab.xml +0 -71
- package/framework/app/src/debug/res/layout/logcat_tab.xml +0 -71
- package/framework/app/src/main/java/com/tns/AndroidJsV8Inspector.java +0 -361
- package/framework/app/src/main/java/com/tns/DefaultExtractPolicy.java +0 -151
- package/framework/app/src/main/java/com/tns/EqualityComparator.java +0 -7
- package/framework/app/src/main/java/com/tns/LogcatLogger.java +0 -45
- package/framework/app/src/main/java/com/tns/NativeScriptUncaughtExceptionHandler.java +0 -72
- package/framework/app/src/main/java/com/tns/RuntimeHelper.java +0 -343
- package/framework/app/src/main/java/com/tns/Util.java +0 -105
- package/framework/app/src/main/java/com/tns/internal/AppBuilderCallback.java +0 -21
- package/framework/app/src/main/java/com/tns/internal/Plugin.java +0 -5
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
package com.tns;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
import android.net.LocalServerSocket;
|
|
5
|
-
import android.net.LocalSocket;
|
|
6
|
-
|
|
7
|
-
import java.io.Closeable;
|
|
8
|
-
import java.io.File;
|
|
9
|
-
import java.io.FileOutputStream;
|
|
10
|
-
import java.io.IOException;
|
|
11
|
-
import java.security.DigestInputStream;
|
|
12
|
-
import java.security.MessageDigest;
|
|
13
|
-
import java.io.OutputStream;
|
|
14
|
-
import java.util.Arrays;
|
|
15
|
-
|
|
16
|
-
public class NativeScriptSyncServiceSocketImpl {
|
|
17
|
-
private static String DEVICE_APP_DIR;
|
|
18
|
-
|
|
19
|
-
private final Runtime runtime;
|
|
20
|
-
private static Logger logger;
|
|
21
|
-
private final Context context;
|
|
22
|
-
|
|
23
|
-
private LocalServerSocketThread localServerThread;
|
|
24
|
-
private Thread localServerJavaThread;
|
|
25
|
-
|
|
26
|
-
public NativeScriptSyncServiceSocketImpl(Runtime runtime, Logger logger, Context context) {
|
|
27
|
-
this.runtime = runtime;
|
|
28
|
-
NativeScriptSyncServiceSocketImpl.logger = logger;
|
|
29
|
-
this.context = context;
|
|
30
|
-
DEVICE_APP_DIR = this.context.getFilesDir().getAbsolutePath() + "/app";
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
private class LocalServerSocketThread implements Runnable {
|
|
34
|
-
|
|
35
|
-
private volatile boolean running;
|
|
36
|
-
private final String name;
|
|
37
|
-
|
|
38
|
-
private LiveSyncWorker livesyncWorker;
|
|
39
|
-
private LocalServerSocket deviceSystemSocket;
|
|
40
|
-
|
|
41
|
-
public LocalServerSocketThread(String name) {
|
|
42
|
-
this.name = name;
|
|
43
|
-
this.running = false;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public void stop() {
|
|
47
|
-
this.running = false;
|
|
48
|
-
try {
|
|
49
|
-
deviceSystemSocket.close();
|
|
50
|
-
} catch (IOException e) {
|
|
51
|
-
if (com.tns.Runtime.isDebuggable()) {
|
|
52
|
-
e.printStackTrace();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public void run() {
|
|
58
|
-
running = true;
|
|
59
|
-
try {
|
|
60
|
-
deviceSystemSocket = new LocalServerSocket(this.name);
|
|
61
|
-
while (running) {
|
|
62
|
-
LocalSocket systemSocket = deviceSystemSocket.accept();
|
|
63
|
-
livesyncWorker = new LiveSyncWorker(systemSocket);
|
|
64
|
-
Thread liveSyncThread = setUpLivesyncThread();
|
|
65
|
-
liveSyncThread.start();
|
|
66
|
-
}
|
|
67
|
-
} catch (IOException e) {
|
|
68
|
-
if (com.tns.Runtime.isDebuggable()) {
|
|
69
|
-
e.printStackTrace();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch (java.security.NoSuchAlgorithmException e) {
|
|
73
|
-
if (com.tns.Runtime.isDebuggable()) {
|
|
74
|
-
e.printStackTrace();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
private Thread setUpLivesyncThread() {
|
|
80
|
-
Thread livesyncThread = new Thread(livesyncWorker);
|
|
81
|
-
livesyncThread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
|
82
|
-
@Override
|
|
83
|
-
public void uncaughtException(Thread t, Throwable e) {
|
|
84
|
-
logger.write(String.format("%s(%s): %s", t.getName(), t.getId(), e.toString()));
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
livesyncThread.setName("Livesync Thread");
|
|
88
|
-
return livesyncThread;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
@Override
|
|
92
|
-
protected void finalize() throws Throwable {
|
|
93
|
-
deviceSystemSocket.close();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public void startServer() {
|
|
98
|
-
localServerThread = new LocalServerSocketThread(context.getPackageName() + "-livesync");
|
|
99
|
-
localServerJavaThread = new Thread(localServerThread);
|
|
100
|
-
localServerJavaThread.setName("Livesync Server Thread");
|
|
101
|
-
localServerJavaThread.start();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
private class LiveSyncWorker implements Runnable {
|
|
105
|
-
public static final int OPERATION_BYTE_SIZE = 1;
|
|
106
|
-
public static final int HASH_BYTE_SIZE = 16;
|
|
107
|
-
public static final int LENGTH_BYTE_SIZE = 1;
|
|
108
|
-
public static final int OPERATION_ID_BYTE_SIZE = 32;
|
|
109
|
-
public static final int DELETE_FILE_OPERATION = 7;
|
|
110
|
-
public static final int CREATE_FILE_OPERATION = 8;
|
|
111
|
-
public static final int DO_SYNC_OPERATION = 9;
|
|
112
|
-
public static final int ERROR_REPORT_CODE = 1;
|
|
113
|
-
public static final int OPERATION_END_NO_REFRESH_REPORT_CODE = 3;
|
|
114
|
-
public static final int OPERATION_END_REPORT_CODE = 2;
|
|
115
|
-
public static final int REPORT_CODE_SIZE = 1;
|
|
116
|
-
public static final int DO_REFRESH_LENGTH = 1;
|
|
117
|
-
public static final int DO_REFRESH_VALUE = 1;
|
|
118
|
-
public static final String FILE_NAME = "fileName";
|
|
119
|
-
public static final String FILE_NAME_LENGTH = FILE_NAME + "Length";
|
|
120
|
-
public static final String OPERATION = "operation";
|
|
121
|
-
public static final String FILE_CONTENT = "fileContent";
|
|
122
|
-
public static final String FILE_CONTENT_LENGTH = FILE_CONTENT + "Length";
|
|
123
|
-
public static final int DEFAULT_OPERATION = -1;
|
|
124
|
-
private static final String PROTOCOL_VERSION = "0.2.0";
|
|
125
|
-
private byte[] handshakeMessage;
|
|
126
|
-
private final DigestInputStream input;
|
|
127
|
-
private Closeable livesyncSocket;
|
|
128
|
-
private OutputStream output;
|
|
129
|
-
|
|
130
|
-
public LiveSyncWorker(LocalSocket systemSocket) throws IOException, java.security.NoSuchAlgorithmException {
|
|
131
|
-
this.livesyncSocket = systemSocket;
|
|
132
|
-
MessageDigest md = MessageDigest.getInstance("MD5");
|
|
133
|
-
input = new DigestInputStream(systemSocket.getInputStream(), md);
|
|
134
|
-
output = systemSocket.getOutputStream();
|
|
135
|
-
handshakeMessage = getHandshakeMessage();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
public void run() {
|
|
139
|
-
try {
|
|
140
|
-
output.write(handshakeMessage);
|
|
141
|
-
output.flush();
|
|
142
|
-
|
|
143
|
-
} catch (IOException e) {
|
|
144
|
-
logger.write(String.format("Error while LiveSyncing: Client socket might be closed!", e.toString()));
|
|
145
|
-
if (com.tns.Runtime.isDebuggable()) {
|
|
146
|
-
e.printStackTrace();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
try {
|
|
150
|
-
do {
|
|
151
|
-
int operation = getOperation();
|
|
152
|
-
|
|
153
|
-
if (operation == DELETE_FILE_OPERATION) {
|
|
154
|
-
|
|
155
|
-
String fileName = getFileName();
|
|
156
|
-
validateData();
|
|
157
|
-
deleteRecursive(new File(DEVICE_APP_DIR, fileName));
|
|
158
|
-
|
|
159
|
-
} else if (operation == CREATE_FILE_OPERATION) {
|
|
160
|
-
|
|
161
|
-
String fileName = getFileName();
|
|
162
|
-
int contentLength = getFileContentLength(fileName);
|
|
163
|
-
validateData();
|
|
164
|
-
byte[] content = getFileContent(fileName, contentLength);
|
|
165
|
-
validateData();
|
|
166
|
-
createOrOverrideFile(fileName, content);
|
|
167
|
-
|
|
168
|
-
} else if (operation == DO_SYNC_OPERATION) {
|
|
169
|
-
byte[] operationUid = readNextBytes(OPERATION_ID_BYTE_SIZE);
|
|
170
|
-
byte doRefresh = readNextBytes(DO_REFRESH_LENGTH)[0];
|
|
171
|
-
int doRefreshInt = (int)doRefresh;
|
|
172
|
-
int operationReportCode;
|
|
173
|
-
|
|
174
|
-
validateData();
|
|
175
|
-
if(runtime != null && doRefreshInt == DO_REFRESH_VALUE) {
|
|
176
|
-
runtime.runScript(new File(NativeScriptSyncServiceSocketImpl.this.context.getFilesDir(), "internal/livesync.js"), false);
|
|
177
|
-
operationReportCode = OPERATION_END_REPORT_CODE;
|
|
178
|
-
} else {
|
|
179
|
-
operationReportCode = OPERATION_END_NO_REFRESH_REPORT_CODE;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
output.write(getReportMessageBytes(operationReportCode, operationUid));
|
|
183
|
-
output.flush();
|
|
184
|
-
|
|
185
|
-
} else if (operation == DEFAULT_OPERATION) {
|
|
186
|
-
logger.write("LiveSync: input stream is empty!");
|
|
187
|
-
break;
|
|
188
|
-
} else {
|
|
189
|
-
throw new IllegalArgumentException(String.format("\nLiveSync: Operation not recognised. Received operation is %s.", operation));
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
} while (true);
|
|
193
|
-
} catch (Exception e) {
|
|
194
|
-
String message = String.format("Error while LiveSyncing: %s", e.toString());
|
|
195
|
-
this.closeWithError(message);
|
|
196
|
-
} catch (Throwable e) {
|
|
197
|
-
String message = String.format("%s(%s): Error while LiveSyncing.\nOriginal Exception: %s", Thread.currentThread().getName(), Thread.currentThread().getId(), e.toString());
|
|
198
|
-
this.closeWithError(message);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
private byte[] getErrorMessageBytes(String message) {
|
|
204
|
-
return this.getReportMessageBytes(ERROR_REPORT_CODE, message.getBytes());
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
private byte[] getReportMessageBytes(int reportType, byte[] messageBytes) {
|
|
208
|
-
byte[] reportBytes = new byte[]{(byte)reportType};
|
|
209
|
-
byte[] combined = new byte[messageBytes.length + REPORT_CODE_SIZE];
|
|
210
|
-
|
|
211
|
-
System.arraycopy(reportBytes,0,combined, 0, REPORT_CODE_SIZE);
|
|
212
|
-
System.arraycopy(messageBytes,0,combined, REPORT_CODE_SIZE, messageBytes.length);
|
|
213
|
-
|
|
214
|
-
return combined;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
private byte[] getHandshakeMessage() {
|
|
218
|
-
byte[] protocolVersionBytes = PROTOCOL_VERSION.getBytes();
|
|
219
|
-
byte[] versionLength = new byte[]{(byte)protocolVersionBytes.length};
|
|
220
|
-
byte[] packageNameBytes = context.getPackageName().getBytes();
|
|
221
|
-
byte[] combined = new byte[protocolVersionBytes.length + packageNameBytes.length + versionLength.length];
|
|
222
|
-
|
|
223
|
-
System.arraycopy(versionLength,0,combined, 0, versionLength.length);
|
|
224
|
-
System.arraycopy(protocolVersionBytes,0,combined, versionLength.length, protocolVersionBytes.length);
|
|
225
|
-
System.arraycopy(packageNameBytes,0,combined,protocolVersionBytes.length + versionLength.length,packageNameBytes.length);
|
|
226
|
-
|
|
227
|
-
return combined;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
private void validateData() throws IOException {
|
|
231
|
-
MessageDigest messageDigest = input.getMessageDigest();
|
|
232
|
-
byte[] digest = messageDigest.digest();
|
|
233
|
-
input.on(false);
|
|
234
|
-
byte[] inputMD5 = readNextBytes(HASH_BYTE_SIZE);
|
|
235
|
-
input.on(true);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if(!Arrays.equals(digest, inputMD5)){
|
|
239
|
-
throw new IllegalStateException(String.format("\nLiveSync: Validation of data failed.\nComputed hash: %s\nOriginal hash: %s ", Arrays.toString(digest), Arrays.toString(inputMD5)));
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/*
|
|
244
|
-
* Tries to read operation input stream
|
|
245
|
-
* If the stream is empty, method returns -1
|
|
246
|
-
* */
|
|
247
|
-
private int getOperation() {
|
|
248
|
-
Integer operation;
|
|
249
|
-
byte[] operationBuff = null;
|
|
250
|
-
try {
|
|
251
|
-
operationBuff = readNextBytes(OPERATION_BYTE_SIZE);
|
|
252
|
-
if (operationBuff == null) {
|
|
253
|
-
return DEFAULT_OPERATION;
|
|
254
|
-
}
|
|
255
|
-
operation = Integer.parseInt(new String(operationBuff));
|
|
256
|
-
|
|
257
|
-
} catch (Exception e) {
|
|
258
|
-
if(operationBuff == null){
|
|
259
|
-
operationBuff = new byte[]{};
|
|
260
|
-
}
|
|
261
|
-
throw new IllegalStateException(String.format("\nLiveSync: failed to parse %s. Bytes read: $s %s\nOriginal Exception: %s", OPERATION, Arrays.toString(operationBuff), e.toString()));
|
|
262
|
-
}
|
|
263
|
-
return operation;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
private String getFileName() {
|
|
267
|
-
byte[] fileNameBuffer;
|
|
268
|
-
int fileNameLength = -1;
|
|
269
|
-
|
|
270
|
-
try {
|
|
271
|
-
fileNameLength = getLength();
|
|
272
|
-
} catch (Exception e) {
|
|
273
|
-
throw new IllegalStateException(String.format("\nLiveSync: failed to parse %s. \nOriginal Exception: %s", FILE_NAME_LENGTH, e.toString()));
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
if(fileNameLength <= 0) {
|
|
277
|
-
throw new IllegalStateException(String.format("\nLiveSync: File name length must be positive number or zero. Provided length: %s.", fileNameLength));
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
try {
|
|
281
|
-
fileNameBuffer = readNextBytes(fileNameLength);
|
|
282
|
-
} catch (Exception e) {
|
|
283
|
-
throw new IllegalStateException(String.format("\nLiveSync: failed to parse %s.\nOriginal Exception: %s", FILE_NAME, e.toString()));
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (fileNameBuffer == null) {
|
|
287
|
-
throw new IllegalStateException(String.format("\nLiveSync: Missing %s bytes.", FILE_NAME));
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
String fileName = new String(fileNameBuffer);
|
|
291
|
-
if (fileName.trim().length() < fileNameLength) {
|
|
292
|
-
logger.write(String.format("WARNING: %s parsed length is less than %s. We read less information than you specified!", FILE_NAME, FILE_NAME_LENGTH));
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return fileName.trim();
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
private int getFileContentLength(String fileName) throws IllegalStateException {
|
|
299
|
-
int contentLength;
|
|
300
|
-
|
|
301
|
-
try {
|
|
302
|
-
contentLength = getLength();
|
|
303
|
-
} catch (Exception e) {
|
|
304
|
-
throw new IllegalStateException(String.format("\nLiveSync: failed to read %s for %s.\nOriginal Exception: %s", FILE_CONTENT_LENGTH, fileName, e.toString()));
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
if(contentLength < 0){
|
|
308
|
-
throw new IllegalStateException(String.format("\nLiveSync: Content length must be positive number or zero. Provided content length: %s.", contentLength));
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return contentLength;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
private byte[] getFileContent(String fileName, int contentLength) throws IllegalStateException {
|
|
315
|
-
byte[] contentBuff = null;
|
|
316
|
-
|
|
317
|
-
try {
|
|
318
|
-
if(contentLength > 0) {
|
|
319
|
-
contentBuff = readNextBytes(contentLength);
|
|
320
|
-
} else if(contentLength == 0){
|
|
321
|
-
contentBuff = new byte[]{};
|
|
322
|
-
}
|
|
323
|
-
} catch (Exception e) {
|
|
324
|
-
throw new IllegalStateException(String.format("\nLiveSync: failed to parse content of file: %s.\nOriginal Exception: %s", fileName, e.toString()));
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
if (contentLength != 0 && contentBuff == null) {
|
|
328
|
-
throw new IllegalStateException(String.format("\nLiveSync: Missing %s bytes for file: %s. Did you send %s bytes?", FILE_CONTENT, fileName, contentLength));
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return contentBuff;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
private int getLength() {
|
|
335
|
-
byte[] lengthBuffer;
|
|
336
|
-
int lengthInt;
|
|
337
|
-
|
|
338
|
-
try {
|
|
339
|
-
byte lengthSize = readNextBytes(LENGTH_BYTE_SIZE)[0];
|
|
340
|
-
//Cast signed byte to unsigned int
|
|
341
|
-
int lengthSizeInt = ((int) lengthSize) & 0xFF;
|
|
342
|
-
lengthBuffer = readNextBytes(lengthSizeInt);
|
|
343
|
-
|
|
344
|
-
if (lengthBuffer == null) {
|
|
345
|
-
throw new IllegalStateException(String.format("\nLiveSync: Missing size length bytes."));
|
|
346
|
-
}
|
|
347
|
-
} catch (Exception e) {
|
|
348
|
-
throw new IllegalStateException(String.format("\nLiveSync: Failed to read size length. \nOriginal Exception: %s", e.toString()));
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
try {
|
|
352
|
-
lengthInt = Integer.valueOf(new String(lengthBuffer));
|
|
353
|
-
} catch (Exception e) {
|
|
354
|
-
throw new IllegalStateException(String.format("\nLiveSync: Failed to parse size length. \nOriginal Exception: %s", e.toString()));
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
return lengthInt;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
private void createOrOverrideFile(String fileName, byte[] content) throws IOException {
|
|
361
|
-
File fileToCreate = prepareFile(fileName);
|
|
362
|
-
try {
|
|
363
|
-
|
|
364
|
-
fileToCreate.getParentFile().mkdirs();
|
|
365
|
-
FileOutputStream fos = new FileOutputStream(fileToCreate.getCanonicalPath());
|
|
366
|
-
if(runtime != null) {
|
|
367
|
-
runtime.lock();
|
|
368
|
-
}
|
|
369
|
-
fos.write(content);
|
|
370
|
-
fos.close();
|
|
371
|
-
|
|
372
|
-
} catch (Exception e) {
|
|
373
|
-
throw new IOException(String.format("\nLiveSync: failed to write file: %s\nOriginal Exception: %s", fileName, e.toString()));
|
|
374
|
-
} finally {
|
|
375
|
-
if(runtime != null) {
|
|
376
|
-
runtime.unlock();
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
void deleteRecursive(File fileOrDirectory) {
|
|
382
|
-
if (fileOrDirectory.isDirectory())
|
|
383
|
-
for (File child : fileOrDirectory.listFiles()) {
|
|
384
|
-
deleteRecursive(child);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
fileOrDirectory.delete();
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
private File prepareFile(String fileName) {
|
|
391
|
-
File fileToCreate = new File(DEVICE_APP_DIR, fileName);
|
|
392
|
-
if (fileToCreate.exists()) {
|
|
393
|
-
fileToCreate.delete();
|
|
394
|
-
}
|
|
395
|
-
return fileToCreate;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
/*
|
|
399
|
-
* Reads next bites from input stream. Bytes read depend on passed parameter.
|
|
400
|
-
* */
|
|
401
|
-
private byte[] readNextBytes(int size) throws IOException {
|
|
402
|
-
byte[] buffer = new byte[size];
|
|
403
|
-
int bytesRead = 0;
|
|
404
|
-
int bufferWriteOffset = bytesRead;
|
|
405
|
-
try {
|
|
406
|
-
do {
|
|
407
|
-
|
|
408
|
-
bytesRead = this.input.read(buffer, bufferWriteOffset, size);
|
|
409
|
-
if (bytesRead == -1) {
|
|
410
|
-
if (bufferWriteOffset == 0) {
|
|
411
|
-
return null;
|
|
412
|
-
}
|
|
413
|
-
break;
|
|
414
|
-
}
|
|
415
|
-
size -= bytesRead;
|
|
416
|
-
bufferWriteOffset += bytesRead;
|
|
417
|
-
} while (size > 0);
|
|
418
|
-
} catch (IOException e) {
|
|
419
|
-
String message = e.getMessage();
|
|
420
|
-
if (message != null && message.equals("Try again")) {
|
|
421
|
-
throw new IllegalStateException("Error while LiveSyncing: Read operation timed out.");
|
|
422
|
-
} else {
|
|
423
|
-
throw e;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
return buffer;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
private void closeWithError(String message) {
|
|
431
|
-
try {
|
|
432
|
-
output.write(getErrorMessageBytes(message));
|
|
433
|
-
output.flush();
|
|
434
|
-
logger.write(message);
|
|
435
|
-
this.livesyncSocket.close();
|
|
436
|
-
} catch (IOException e) {
|
|
437
|
-
if (com.tns.Runtime.isDebuggable()) {
|
|
438
|
-
e.printStackTrace();
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
@Override
|
|
444
|
-
protected void finalize() throws Throwable {
|
|
445
|
-
this.livesyncSocket.close();
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
-
xmlns:tools="http://schemas.android.com/tools"
|
|
4
|
-
android:layout_width="match_parent"
|
|
5
|
-
android:layout_height="match_parent"
|
|
6
|
-
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
7
|
-
android:background="@color/gray"
|
|
8
|
-
tools:context="com.tns.ErrorReportActivity"
|
|
9
|
-
android:theme="@style/Widget.AppCompat.Light.ActionBar">
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<TextView
|
|
13
|
-
android:id="@+id/errorException"
|
|
14
|
-
android:layout_width="match_parent"
|
|
15
|
-
android:layout_height="wrap_content"
|
|
16
|
-
android:text=""
|
|
17
|
-
android:background="@color/red"
|
|
18
|
-
android:textSize="16sp"
|
|
19
|
-
android:paddingLeft="16dp"
|
|
20
|
-
android:textIsSelectable="true"
|
|
21
|
-
android:maxHeight="200dp"
|
|
22
|
-
android:scrollbars="vertical"
|
|
23
|
-
android:textColor="@color/white"
|
|
24
|
-
android:paddingVertical="10dp"
|
|
25
|
-
android:paddingRight="16dp" />
|
|
26
|
-
|
|
27
|
-
<RelativeLayout
|
|
28
|
-
android:layout_below="@id/errorException"
|
|
29
|
-
android:layout_width="wrap_content"
|
|
30
|
-
android:layout_height="wrap_content">
|
|
31
|
-
|
|
32
|
-
<androidx.appcompat.widget.Toolbar
|
|
33
|
-
android:id="@+id/toolbar"
|
|
34
|
-
android:layout_width="match_parent"
|
|
35
|
-
android:layout_height="wrap_content"
|
|
36
|
-
android:minHeight="?attr/actionBarSize" />
|
|
37
|
-
|
|
38
|
-
<androidx.viewpager.widget.ViewPager
|
|
39
|
-
android:id="@+id/pager"
|
|
40
|
-
android:layout_width="match_parent"
|
|
41
|
-
android:layout_height="fill_parent"
|
|
42
|
-
android:layout_below="@+id/toolbar"
|
|
43
|
-
android:scrollbarAlwaysDrawVerticalTrack="false">
|
|
44
|
-
|
|
45
|
-
</androidx.viewpager.widget.ViewPager>
|
|
46
|
-
|
|
47
|
-
<com.google.android.material.tabs.TabLayout
|
|
48
|
-
android:id="@+id/tabLayout"
|
|
49
|
-
android:layout_width="match_parent"
|
|
50
|
-
android:layout_height="wrap_content"
|
|
51
|
-
android:background="@color/gray"
|
|
52
|
-
android:minHeight="?attr/actionBarSize"
|
|
53
|
-
app:tabIndicatorColor="@color/nativescript_blue"
|
|
54
|
-
android:layout_alignParentTop="true"
|
|
55
|
-
android:layout_alignParentStart="true"
|
|
56
|
-
android:scrollbarStyle="insideOverlay"
|
|
57
|
-
android:scrollbars="vertical"
|
|
58
|
-
tools:tabBackground="@color/gray_color"
|
|
59
|
-
android:scrollbarAlwaysDrawVerticalTrack="false" />
|
|
60
|
-
</RelativeLayout>
|
|
61
|
-
|
|
62
|
-
</RelativeLayout>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
-
xmlns:tools="http://schemas.android.com/tools"
|
|
4
|
-
android:layout_width="match_parent"
|
|
5
|
-
android:background="@color/gray"
|
|
6
|
-
android:layout_height="match_parent"
|
|
7
|
-
android:orientation="vertical">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<LinearLayout
|
|
11
|
-
android:id="@+id/linearLayout"
|
|
12
|
-
android:layout_width="match_parent"
|
|
13
|
-
android:layout_height="wrap_content"
|
|
14
|
-
android:layout_above="@+id/bottomButtonRow"
|
|
15
|
-
android:layout_alignParentStart="true"
|
|
16
|
-
android:layout_alignParentTop="true"
|
|
17
|
-
android:orientation="vertical"
|
|
18
|
-
android:weightSum="100">
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<TextView
|
|
22
|
-
android:id="@+id/errorStacktrace"
|
|
23
|
-
android:layout_width="match_parent"
|
|
24
|
-
android:layout_height="wrap_content"
|
|
25
|
-
android:text=""
|
|
26
|
-
android:scrollbars="vertical"
|
|
27
|
-
android:scrollbarStyle="outsideOverlay"
|
|
28
|
-
android:paddingLeft="16dp"
|
|
29
|
-
android:paddingRight="16dp"
|
|
30
|
-
android:scrollbarAlwaysDrawVerticalTrack="true" />
|
|
31
|
-
|
|
32
|
-
</LinearLayout>
|
|
33
|
-
|
|
34
|
-
<LinearLayout
|
|
35
|
-
android:id="@+id/bottomButtonRow"
|
|
36
|
-
android:layout_width="match_parent"
|
|
37
|
-
android:orientation="horizontal"
|
|
38
|
-
android:layout_alignParentBottom="true"
|
|
39
|
-
android:layout_centerHorizontal="true"
|
|
40
|
-
android:paddingBottom="10dp"
|
|
41
|
-
android:paddingLeft="16dp"
|
|
42
|
-
android:paddingRight="16dp"
|
|
43
|
-
android:paddingTop="10dp"
|
|
44
|
-
android:layout_height="wrap_content">
|
|
45
|
-
|
|
46
|
-
<Button
|
|
47
|
-
android:id="@+id/btnRestartApp"
|
|
48
|
-
android:text="Restart APP"
|
|
49
|
-
android:textAlignment="center"
|
|
50
|
-
android:textColor="@android:color/white"
|
|
51
|
-
android:background="@drawable/button_accented"
|
|
52
|
-
android:layout_width="0dp"
|
|
53
|
-
android:layout_height="wrap_content"
|
|
54
|
-
android:layout_weight="1"
|
|
55
|
-
android:layout_marginRight="10dp" />
|
|
56
|
-
|
|
57
|
-
<Button
|
|
58
|
-
android:id="@+id/btnCopyException"
|
|
59
|
-
android:textColor="@android:color/white"
|
|
60
|
-
android:text="Copy"
|
|
61
|
-
android:background="@drawable/button"
|
|
62
|
-
android:textAlignment="center"
|
|
63
|
-
android:layout_width="0dp"
|
|
64
|
-
android:layout_height="wrap_content"
|
|
65
|
-
android:layout_weight="1" />
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
</LinearLayout>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</RelativeLayout>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
-
xmlns:tools="http://schemas.android.com/tools"
|
|
4
|
-
android:layout_width="match_parent"
|
|
5
|
-
android:layout_height="match_parent"
|
|
6
|
-
android:background="@color/gray"
|
|
7
|
-
android:orientation="vertical">
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<LinearLayout
|
|
11
|
-
android:id="@+id/bottomButtonRow"
|
|
12
|
-
android:layout_width="match_parent"
|
|
13
|
-
android:orientation="horizontal"
|
|
14
|
-
android:layout_alignParentBottom="true"
|
|
15
|
-
android:layout_centerHorizontal="true"
|
|
16
|
-
android:paddingBottom="10dp"
|
|
17
|
-
android:paddingLeft="16dp"
|
|
18
|
-
android:paddingRight="16dp"
|
|
19
|
-
android:paddingTop="10dp"
|
|
20
|
-
android:layout_height="wrap_content">
|
|
21
|
-
|
|
22
|
-
<Button
|
|
23
|
-
android:id="@+id/btnCopyLogcat"
|
|
24
|
-
android:layout_height="wrap_content"
|
|
25
|
-
android:text="Copy to sdcard"
|
|
26
|
-
android:layout_width="match_parent"
|
|
27
|
-
android:background="@drawable/button"
|
|
28
|
-
android:textColor="@android:color/white"
|
|
29
|
-
android:textAlignment="center"
|
|
30
|
-
android:paddingLeft="20dp"
|
|
31
|
-
android:paddingRight="20dp"
|
|
32
|
-
android:layout_marginRight="10dp"
|
|
33
|
-
android:layout_marginLeft="10dp"
|
|
34
|
-
android:layout_alignParentBottom="true"
|
|
35
|
-
android:layout_centerHorizontal="true"
|
|
36
|
-
tools:layout_width="match_parent" />
|
|
37
|
-
|
|
38
|
-
</LinearLayout>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<LinearLayout
|
|
42
|
-
android:id="@+id/logcatLinearLayout"
|
|
43
|
-
android:layout_width="match_parent"
|
|
44
|
-
android:layout_height="wrap_content"
|
|
45
|
-
android:orientation="vertical"
|
|
46
|
-
android:weightSum="100"
|
|
47
|
-
android:layout_alignParentTop="true"
|
|
48
|
-
android:layout_alignParentStart="true"
|
|
49
|
-
android:layout_above="@+id/bottomButtonRow"
|
|
50
|
-
android:paddingBottom="10dp"
|
|
51
|
-
android:paddingTop="10dp"
|
|
52
|
-
android:paddingLeft="16dp"
|
|
53
|
-
android:paddingRight="16dp"
|
|
54
|
-
>
|
|
55
|
-
|
|
56
|
-
<TextView
|
|
57
|
-
android:id="@+id/logcatMsg"
|
|
58
|
-
android:layout_width="match_parent"
|
|
59
|
-
android:text=""
|
|
60
|
-
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
61
|
-
android:layout_height="wrap_content"
|
|
62
|
-
android:paddingLeft="2dp"
|
|
63
|
-
android:paddingRight="2dp"
|
|
64
|
-
android:scrollbars="vertical"
|
|
65
|
-
android:scrollbarStyle="outsideOverlay"
|
|
66
|
-
android:scrollbarAlwaysDrawVerticalTrack="true" />
|
|
67
|
-
|
|
68
|
-
</LinearLayout>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</RelativeLayout>
|