Libraryless. Click here for Pure Java version (817L/6K/20K).
1 | !752 |
2 | |
3 | import android.os.*; |
4 | import android.widget.*; |
5 | import android.app.*; |
6 | |
7 | static S snippetToRun = "#1004078", snippetArg = "alarm"; |
8 | |
9 | static Class x30; |
10 | |
11 | public static void main(final Service service) { |
12 | androidContext = service; |
13 | |
14 | androidLifecycle("#1004186 toasting"); |
15 | |
16 | pcall { |
17 | androidToast("JavaX starting awareness."); |
18 | } |
19 | |
20 | new Thread() { |
21 | public void run() { |
22 | try { |
23 | androidLifecycle("#1004186 threading"); |
24 | String[] a = { snippetToRun, snippetArg }; |
25 | callx30(a); |
26 | } catch e { |
27 | androidLifecycle(e); |
28 | } |
29 | } |
30 | }.start(); |
31 | |
32 | } |
33 | |
34 | static void callx30(S[] args) { |
35 | getx30(); |
36 | androidLifecycle("#1004186 calling x30 " + join(" ", args)); |
37 | pcall { |
38 | callMain(x30, args); |
39 | androidLifecycle("x30 done"); |
40 | } |
41 | } |
42 | |
43 | static synchronized void getx30() { |
44 | if (x30 == null) { |
45 | O dataStore = null; |
46 | pcall { |
47 | dataStore = Class.forName("de.tinybrain.javax_allperms.DataStore"); |
48 | } |
49 | if (dataStore != null) |
50 | x30 = (Class) call(dataStore, "get", "x30"); |
51 | if (x30 == null) { |
52 | androidLifecycle("#1004186 loading x30"); |
53 | x30 = loadx30("#1004182"); |
54 | callOpt(dataStore, "put", "x30", x30); |
55 | } |
56 | } |
57 | } |
58 | |
59 | static Class<?> loadx30(String programID) ctex { |
60 | S url = "http://tinybrain.de:8080/dexcompile.php?id=" + parseSnippetID(programID); |
61 | byte[] dexData = loadBinaryPage(url); |
62 | if (!isDex(dexData)) |
63 | throw new RuntimeException("Dex generation error"); |
64 | |
65 | androidLifecycle("Dex loaded: " + dexData.length + "b"); |
66 | |
67 | File dexDir = makeAndroidTempDir(); |
68 | File dexFile = new File(dexDir, System.currentTimeMillis() + ".dex"); |
69 | File dexOutputDir = makeAndroidTempDir(); |
70 | |
71 | try { |
72 | saveBinaryFile(dexFile.getPath(), dexData); |
73 | } catch (Throwable e) { |
74 | System.out.println("Whoa!"); |
75 | throw new RuntimeException(e); |
76 | } |
77 | |
78 | System.out.println("Getting parent class loader."); |
79 | ClassLoader parentClassLoader = |
80 | main.class.getClassLoader().getParent(); |
81 | |
82 | //System.out.println("Making DexClassLoader."); |
83 | //DexClassLoader classLoader = new DexClassLoader(dexFile.getAbsolutePath(), dexOutputDir.getAbsolutePath(), null, |
84 | // parentClassLoader); |
85 | Class dcl = Class.forName("dalvik.system.DexClassLoader"); |
86 | Object classLoader = dcl.getConstructors()[0].newInstance(dexFile.getAbsolutePath(), dexOutputDir.getAbsolutePath(), null, |
87 | parentClassLoader); |
88 | |
89 | androidLifecycle("Loading main class."); |
90 | Class<?> theClass = (Class<?>) call(classLoader, "loadClass", "x30"); |
91 | |
92 | androidLifecycle("Main class loaded."); |
93 | try { |
94 | set(theClass, "androidContext", androidContext); |
95 | } catch (Throwable e) {} |
96 | |
97 | setVars(theClass, programID); |
98 | hotwire_copyOver(theClass); |
99 | return theClass; |
100 | } |
101 | |
102 | static void setVars(Class<?> theClass, String programID) { |
103 | try { |
104 | set(theClass, "programID", programID); |
105 | } catch (Throwable e) {} |
106 | |
107 | try { |
108 | set(theClass, "__javax", x30); |
109 | } catch (Throwable e) {} |
110 | } |
Began life as a copy of #1002655
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004186 |
Snippet name: | Android Boot Program (try to start awareness) |
Eternal ID of this version: | #1004186/1 |
Text MD5: | eaa08f7130ffc91cae58c94d18a4805b |
Transpilation MD5: | b0c418a4b926bcda2d2840fae65ec88e |
Author: | stefan |
Category: | |
Type: | JavaX source code (Android) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-20 21:14:21 |
Source code size: | 3140 bytes / 110 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 513 / 893 |
Referenced in: | [show references] |