@nativescript/android 8.8.0-alpha.10 → 8.8.0-alpha.12
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 +15 -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/debug/res/values/colors.xml +0 -7
- 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,343 +0,0 @@
|
|
|
1
|
-
package com.tns;
|
|
2
|
-
|
|
3
|
-
import android.app.Application;
|
|
4
|
-
import android.content.BroadcastReceiver;
|
|
5
|
-
import android.content.Context;
|
|
6
|
-
import android.content.Intent;
|
|
7
|
-
import android.content.IntentFilter;
|
|
8
|
-
import android.content.SharedPreferences;
|
|
9
|
-
import android.content.pm.PackageManager.NameNotFoundException;
|
|
10
|
-
import android.os.Build;
|
|
11
|
-
import android.preference.PreferenceManager;
|
|
12
|
-
import android.util.Log;
|
|
13
|
-
|
|
14
|
-
import java.io.File;
|
|
15
|
-
import java.io.IOException;
|
|
16
|
-
import java.lang.reflect.Constructor;
|
|
17
|
-
import java.lang.reflect.Field;
|
|
18
|
-
import java.lang.reflect.InvocationTargetException;
|
|
19
|
-
import java.lang.reflect.Method;
|
|
20
|
-
import java.util.TimeZone;
|
|
21
|
-
|
|
22
|
-
public final class RuntimeHelper {
|
|
23
|
-
private RuntimeHelper() {
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
private static AndroidJsV8Inspector v8Inspector;
|
|
27
|
-
|
|
28
|
-
// hasErrorIntent tells you if there was an event (with an uncaught
|
|
29
|
-
// exception) raised from ErrorReport
|
|
30
|
-
private static boolean hasErrorIntent(Context context) {
|
|
31
|
-
boolean hasErrorIntent = false;
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
// empty file just to check if there was a raised uncaught error by
|
|
35
|
-
// ErrorReport
|
|
36
|
-
if (Util.isDebuggableApp(context)) {
|
|
37
|
-
String fileName;
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
Class<?> ErrReport = Class.forName("com.tns.ErrorReport");
|
|
41
|
-
Field field = ErrReport.getDeclaredField("ERROR_FILE_NAME");
|
|
42
|
-
fileName = (String) field.get(null);
|
|
43
|
-
} catch (Exception e) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
File errFile = new File(context.getFilesDir(), fileName);
|
|
48
|
-
|
|
49
|
-
if (errFile.exists()) {
|
|
50
|
-
errFile.delete();
|
|
51
|
-
hasErrorIntent = true;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
} catch (Exception e) {
|
|
55
|
-
Log.d(logTag, e.getMessage());
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return hasErrorIntent;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public static Runtime initRuntime(Context context) {
|
|
62
|
-
if (Runtime.isInitialized()) {
|
|
63
|
-
return Runtime.getCurrentRuntime();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
ManualInstrumentation.Frame frame = ManualInstrumentation.start("RuntimeHelper.initRuntime");
|
|
67
|
-
try {
|
|
68
|
-
ManualInstrumentation.Frame loadLibraryFrame = ManualInstrumentation.start("loadLibrary NativeScript");
|
|
69
|
-
try {
|
|
70
|
-
System.loadLibrary("NativeScript");
|
|
71
|
-
} finally {
|
|
72
|
-
loadLibraryFrame.close();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Logger logger = new LogcatLogger(context);
|
|
76
|
-
|
|
77
|
-
Runtime.nativeLibraryLoaded = true;
|
|
78
|
-
Runtime runtime = null;
|
|
79
|
-
boolean showErrorIntent = hasErrorIntent(context);
|
|
80
|
-
if (!showErrorIntent) {
|
|
81
|
-
NativeScriptUncaughtExceptionHandler exHandler = new NativeScriptUncaughtExceptionHandler(logger, context);
|
|
82
|
-
|
|
83
|
-
Thread.setDefaultUncaughtExceptionHandler(exHandler);
|
|
84
|
-
|
|
85
|
-
DefaultExtractPolicy extractPolicy = new DefaultExtractPolicy(logger);
|
|
86
|
-
boolean skipAssetExtraction = Util.runPlugin(logger, context);
|
|
87
|
-
|
|
88
|
-
String appName = context.getPackageName();
|
|
89
|
-
File rootDir = new File(context.getApplicationInfo().dataDir);
|
|
90
|
-
File appDir = context.getFilesDir();
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
appDir = appDir.getCanonicalFile();
|
|
94
|
-
} catch (IOException e1) {
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (!skipAssetExtraction) {
|
|
98
|
-
ManualInstrumentation.Frame extractionFrame = ManualInstrumentation.start("Extracting assets");
|
|
99
|
-
try {
|
|
100
|
-
if (logger.isEnabled()) {
|
|
101
|
-
logger.write("Extracting assets...");
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
AssetExtractor aE = new AssetExtractor(null, logger);
|
|
105
|
-
|
|
106
|
-
String outputDir = context.getFilesDir().getPath() + File.separator;
|
|
107
|
-
|
|
108
|
-
// will force deletion of previously extracted files in app/files directories
|
|
109
|
-
// see https://github.com/NativeScript/NativeScript/issues/4137 for reference
|
|
110
|
-
boolean removePreviouslyInstalledAssets = true;
|
|
111
|
-
aE.extractAssets(context, "app", outputDir, extractPolicy, removePreviouslyInstalledAssets);
|
|
112
|
-
aE.extractAssets(context, "internal", outputDir, extractPolicy, removePreviouslyInstalledAssets);
|
|
113
|
-
aE.extractAssets(context, "metadata", outputDir, extractPolicy, false);
|
|
114
|
-
|
|
115
|
-
extractPolicy.setAssetsThumb(context);
|
|
116
|
-
} finally {
|
|
117
|
-
extractionFrame.close();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
AppConfig appConfig = new AppConfig(appDir);
|
|
122
|
-
ManualInstrumentation.setMode(appConfig.getProfilingMode());
|
|
123
|
-
|
|
124
|
-
ClassLoader classLoader = context.getClassLoader();
|
|
125
|
-
File dexDir = new File(rootDir, "code_cache/secondary-dexes");
|
|
126
|
-
String dexThumb = null;
|
|
127
|
-
try {
|
|
128
|
-
dexThumb = Util.getDexThumb(context);
|
|
129
|
-
} catch (NameNotFoundException e) {
|
|
130
|
-
if (logger.isEnabled()) {
|
|
131
|
-
logger.write("Error while getting current proxy thumb");
|
|
132
|
-
}
|
|
133
|
-
if (Util.isDebuggableApp(context)) {
|
|
134
|
-
e.printStackTrace();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
String nativeLibDir = null;
|
|
139
|
-
try {
|
|
140
|
-
nativeLibDir = context.getPackageManager().getApplicationInfo(appName, 0).nativeLibraryDir;
|
|
141
|
-
} catch (NameNotFoundException e) {
|
|
142
|
-
if (Util.isDebuggableApp(context)) {
|
|
143
|
-
e.printStackTrace();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
boolean isDebuggable = Util.isDebuggableApp(context);
|
|
148
|
-
StaticConfiguration config = new StaticConfiguration(logger, appName, nativeLibDir, rootDir,
|
|
149
|
-
appDir, classLoader, dexDir, dexThumb, appConfig, isDebuggable);
|
|
150
|
-
|
|
151
|
-
runtime = Runtime.initializeRuntimeWithConfiguration(config);
|
|
152
|
-
if (isDebuggable) {
|
|
153
|
-
try {
|
|
154
|
-
v8Inspector = new AndroidJsV8Inspector(context.getFilesDir().getAbsolutePath(), context.getPackageName());
|
|
155
|
-
v8Inspector.start();
|
|
156
|
-
|
|
157
|
-
// the following snippet is used as means to notify the VSCode extension
|
|
158
|
-
// debugger that the debugger agent has started
|
|
159
|
-
File debuggerStartedFile = new File("/data/local/tmp", context.getPackageName() + "-debugger-started");
|
|
160
|
-
if (debuggerStartedFile.exists() && !debuggerStartedFile.isDirectory() && debuggerStartedFile.length() == 0) {
|
|
161
|
-
java.io.FileWriter fileWriter = new java.io.FileWriter(debuggerStartedFile);
|
|
162
|
-
fileWriter.write("started");
|
|
163
|
-
fileWriter.close();
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// check if --debug-brk flag has been set. If positive:
|
|
167
|
-
// write to the file to invalidate the flag
|
|
168
|
-
// inform the v8Inspector to pause the main thread
|
|
169
|
-
File debugBreakFile = new File("/data/local/tmp", context.getPackageName() + "-debugbreak");
|
|
170
|
-
boolean shouldBreak = false;
|
|
171
|
-
if (debugBreakFile.exists() && !debugBreakFile.isDirectory() && debugBreakFile.length() == 0) {
|
|
172
|
-
java.io.FileWriter fileWriter = new java.io.FileWriter(debugBreakFile);
|
|
173
|
-
fileWriter.write("started");
|
|
174
|
-
fileWriter.close();
|
|
175
|
-
|
|
176
|
-
shouldBreak = true;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
v8Inspector.waitForDebugger(shouldBreak);
|
|
180
|
-
} catch (IOException e) {
|
|
181
|
-
if (Util.isDebuggableApp(context)) {
|
|
182
|
-
e.printStackTrace();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// if app is in debuggable mode run livesync service
|
|
187
|
-
// runtime needs to be initialized before the NativeScriptSyncService is enabled because it uses runtime.runScript(...)
|
|
188
|
-
initLiveSync(runtime, logger, context);
|
|
189
|
-
|
|
190
|
-
waitForLiveSync(context);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
runtime.runScript(new File(appDir, "internal/ts_helpers.js"));
|
|
194
|
-
|
|
195
|
-
File javaClassesModule = new File(appDir, "app/tns-java-classes.js");
|
|
196
|
-
if (javaClassesModule.exists()) {
|
|
197
|
-
runtime.runModule(javaClassesModule);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
try {
|
|
201
|
-
// put this call in a try/catch block because with the latest changes in the modules it is not granted that NativeScriptApplication is extended through JavaScript.
|
|
202
|
-
JavaScriptImplementation jsImpl = context.getClass().getAnnotation(JavaScriptImplementation.class);
|
|
203
|
-
if (jsImpl != null && !(context instanceof android.app.Service)) {
|
|
204
|
-
Runtime.initInstance(context);
|
|
205
|
-
}
|
|
206
|
-
} catch (Exception e) {
|
|
207
|
-
if (logger.isEnabled()) {
|
|
208
|
-
logger.write("Cannot initialize application instance.");
|
|
209
|
-
}
|
|
210
|
-
if (Util.isDebuggableApp(context)) {
|
|
211
|
-
e.printStackTrace();
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (appConfig.handleTimeZoneChanges()) {
|
|
216
|
-
// If the user sets this flag, we will register a broadcast receiver
|
|
217
|
-
// that will listen for the TIMEZONE_CHANGED event and update V8's cache
|
|
218
|
-
// so that subsequent calls to "new Date()" return the new timezone
|
|
219
|
-
registerTimezoneChangedListener(context, runtime);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return runtime;
|
|
223
|
-
} finally {
|
|
224
|
-
frame.close();
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
private static void waitForLiveSync(Context context) {
|
|
229
|
-
boolean needToWait = false;
|
|
230
|
-
|
|
231
|
-
// CLI will create this file when initial sync is needed and then will remove it after syncing the fails and restarting the app
|
|
232
|
-
File liveSyncFile = new File("/data/local/tmp/" + context.getPackageName() + "-livesync-in-progress");
|
|
233
|
-
if (liveSyncFile.exists()) {
|
|
234
|
-
needToWait = true;
|
|
235
|
-
Long lastModified = liveSyncFile.lastModified();
|
|
236
|
-
// we check for lastModified == 0 as this might happen if we cannot get the actual modified date
|
|
237
|
-
if (lastModified > 0) {
|
|
238
|
-
Long fileCreatedBeforeMillis = System.currentTimeMillis() - lastModified;
|
|
239
|
-
// if last modified date is more than a minute before the current time discard the file as most probably this is a leftover
|
|
240
|
-
if (fileCreatedBeforeMillis > 60000) {
|
|
241
|
-
needToWait = false;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (needToWait) {
|
|
247
|
-
try {
|
|
248
|
-
// wait for the livesync to complete and it should restart the app after deleting the livesync-in-progress file
|
|
249
|
-
Thread.sleep(30000);
|
|
250
|
-
} catch (Exception ex) {
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
private static void registerTimezoneChangedListener(Context context, final Runtime runtime) {
|
|
256
|
-
IntentFilter timezoneFilter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED);
|
|
257
|
-
|
|
258
|
-
BroadcastReceiver timezoneReceiver = new BroadcastReceiver() {
|
|
259
|
-
@Override
|
|
260
|
-
public void onReceive(Context context, Intent intent) {
|
|
261
|
-
String action = intent.getAction();
|
|
262
|
-
if (action == null || !action.equals(Intent.ACTION_TIMEZONE_CHANGED)) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
267
|
-
|
|
268
|
-
String oldTimezone = prefs.getString(PREF_TIMEZONE, null);
|
|
269
|
-
String newTimezone = TimeZone.getDefault().getID();
|
|
270
|
-
if (newTimezone == null) {
|
|
271
|
-
newTimezone = "";
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
if (oldTimezone == null) {
|
|
275
|
-
oldTimezone = "";
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
if (!oldTimezone.equals(newTimezone)) {
|
|
279
|
-
prefs.edit().putString(PREF_TIMEZONE, newTimezone).commit();
|
|
280
|
-
// Notify V8 for the timezone change
|
|
281
|
-
runtime.ResetDateTimeConfigurationCache();
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
context.registerReceiver(timezoneReceiver, timezoneFilter);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
public static void initLiveSync(Application app) {
|
|
290
|
-
Runtime currentRuntime = Runtime.getCurrentRuntime();
|
|
291
|
-
if (!currentRuntime.getIsLiveSyncStarted()) {
|
|
292
|
-
initLiveSync(currentRuntime, currentRuntime.getLogger(), app);
|
|
293
|
-
currentRuntime.setIsLiveSyncStarted(true);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
public static void initLiveSync(Runtime runtime, Logger logger, Context context) {
|
|
299
|
-
boolean isDebuggable = Util.isDebuggableApp(context);
|
|
300
|
-
|
|
301
|
-
if (!isDebuggable) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// if app is in debuggable mode run livesync service
|
|
306
|
-
// runtime needs to be initialized before the NativeScriptSyncService is enabled because it uses runtime.runScript(...)
|
|
307
|
-
try {
|
|
308
|
-
@SuppressWarnings("unchecked")
|
|
309
|
-
Class<?> NativeScriptSyncService = Class.forName("com.tns.NativeScriptSyncServiceSocketImpl");
|
|
310
|
-
|
|
311
|
-
@SuppressWarnings("unchecked")
|
|
312
|
-
Constructor<?> cons = NativeScriptSyncService.getConstructor(new Class<?>[]{Runtime.class, Logger.class, Context.class});
|
|
313
|
-
Object syncService = cons.newInstance(runtime, logger, context);
|
|
314
|
-
|
|
315
|
-
@SuppressWarnings("unchecked")
|
|
316
|
-
Method startServerMethod = NativeScriptSyncService.getMethod("startServer");
|
|
317
|
-
startServerMethod.invoke(syncService);
|
|
318
|
-
} catch (ClassNotFoundException e) {
|
|
319
|
-
if (Util.isDebuggableApp(context)) {
|
|
320
|
-
e.printStackTrace();
|
|
321
|
-
}
|
|
322
|
-
} catch (NoSuchMethodException e) {
|
|
323
|
-
if (Util.isDebuggableApp(context)) {
|
|
324
|
-
e.printStackTrace();
|
|
325
|
-
}
|
|
326
|
-
} catch (IllegalAccessException e) {
|
|
327
|
-
if (Util.isDebuggableApp(context)) {
|
|
328
|
-
e.printStackTrace();
|
|
329
|
-
}
|
|
330
|
-
} catch (InvocationTargetException e) {
|
|
331
|
-
if (Util.isDebuggableApp(context)) {
|
|
332
|
-
e.printStackTrace();
|
|
333
|
-
}
|
|
334
|
-
} catch (InstantiationException e) {
|
|
335
|
-
if (Util.isDebuggableApp(context)) {
|
|
336
|
-
e.printStackTrace();
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
private static final String logTag = "MyApp";
|
|
342
|
-
private static final String PREF_TIMEZONE = "_android_runtime_pref_timezone_";
|
|
343
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
package com.tns;
|
|
2
|
-
|
|
3
|
-
import java.io.*;
|
|
4
|
-
|
|
5
|
-
import com.tns.internal.Plugin;
|
|
6
|
-
|
|
7
|
-
import android.content.Context;
|
|
8
|
-
import android.content.pm.ApplicationInfo;
|
|
9
|
-
import android.content.pm.PackageInfo;
|
|
10
|
-
import android.content.pm.PackageManager;
|
|
11
|
-
import android.content.pm.PackageManager.NameNotFoundException;
|
|
12
|
-
import android.os.Bundle;
|
|
13
|
-
import android.util.Log;
|
|
14
|
-
|
|
15
|
-
import androidx.core.content.pm.PackageInfoCompat;
|
|
16
|
-
|
|
17
|
-
public final class Util {
|
|
18
|
-
private Util() {
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public static String getDexThumb(Context context) throws NameNotFoundException {
|
|
22
|
-
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
|
23
|
-
long code = PackageInfoCompat.getLongVersionCode(packageInfo);
|
|
24
|
-
long updateTime = packageInfo.lastUpdateTime;
|
|
25
|
-
return updateTime + "-" + code;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public static boolean isDebuggableApp(Context context) {
|
|
29
|
-
int flags;
|
|
30
|
-
try {
|
|
31
|
-
flags = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).applicationInfo.flags;
|
|
32
|
-
} catch (NameNotFoundException e) {
|
|
33
|
-
flags = 0;
|
|
34
|
-
if (Util.isDebuggableApp(context)) {
|
|
35
|
-
e.printStackTrace();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
boolean isDebuggableApp = ((flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0);
|
|
40
|
-
return isDebuggableApp;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
static boolean runPlugin(Logger logger, Context context) {
|
|
44
|
-
boolean success = false;
|
|
45
|
-
String pluginClassName = "org.nativescript.livesync.LiveSyncPlugin";
|
|
46
|
-
try {
|
|
47
|
-
ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
|
|
48
|
-
Bundle metadataBundle = ai.metaData;
|
|
49
|
-
if (metadataBundle != null) {
|
|
50
|
-
pluginClassName = metadataBundle.getString("com.tns.internal.Plugin");
|
|
51
|
-
}
|
|
52
|
-
} catch (Exception e) {
|
|
53
|
-
if (Util.isDebuggableApp(context) && logger.isEnabled()) {
|
|
54
|
-
e.printStackTrace();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
try {
|
|
59
|
-
Class<?> liveSyncPluginClass = Class.forName(pluginClassName);
|
|
60
|
-
Plugin p = (Plugin) liveSyncPluginClass.newInstance();
|
|
61
|
-
success = p.execute(context);
|
|
62
|
-
} catch (Exception e) {
|
|
63
|
-
if (Util.isDebuggableApp(context) && logger.isEnabled()) {
|
|
64
|
-
e.printStackTrace();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return success;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public static String readSystemProperty(String name) {
|
|
71
|
-
InputStreamReader in = null;
|
|
72
|
-
BufferedReader reader = null;
|
|
73
|
-
try {
|
|
74
|
-
Process proc = java.lang.Runtime.getRuntime().exec(new String[] { "/system/bin/getprop", name });
|
|
75
|
-
in = new InputStreamReader(proc.getInputStream());
|
|
76
|
-
reader = new BufferedReader(in);
|
|
77
|
-
return reader.readLine();
|
|
78
|
-
} catch (IOException e) {
|
|
79
|
-
return null;
|
|
80
|
-
} finally {
|
|
81
|
-
silentClose(in);
|
|
82
|
-
silentClose(reader);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
private static void silentClose(Closeable closeable) {
|
|
87
|
-
if (closeable == null) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
closeable.close();
|
|
92
|
-
} catch (IOException ignored) {
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public static Boolean isPositive(String value) {
|
|
97
|
-
if (value == null) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return (value.equals("true") || value.equals("TRUE") ||
|
|
102
|
-
value.equals("yes") || value.equals("YES") ||
|
|
103
|
-
value.equals("enabled") || value.equals("ENABLED"));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
package com.tns.internal;
|
|
2
|
-
|
|
3
|
-
import com.tns.ExtractPolicy;
|
|
4
|
-
|
|
5
|
-
public interface AppBuilderCallback {
|
|
6
|
-
void onConfigurationChanged(android.content.Context context, android.content.res.Configuration newConfig);
|
|
7
|
-
|
|
8
|
-
void onCreate(android.content.Context context);
|
|
9
|
-
|
|
10
|
-
void onLowMemory(android.content.Context context);
|
|
11
|
-
|
|
12
|
-
void onTerminate(android.content.Context context);
|
|
13
|
-
|
|
14
|
-
void onTrimMemory(android.content.Context context, int level);
|
|
15
|
-
|
|
16
|
-
Thread.UncaughtExceptionHandler getDefaultUncaughtExceptionHandler();
|
|
17
|
-
|
|
18
|
-
ExtractPolicy getExtractPolicy();
|
|
19
|
-
|
|
20
|
-
boolean shouldEnableDebugging(android.content.Context context);
|
|
21
|
-
}
|