]>
Commit | Line | Data |
---|---|---|
1 | package de.rmdir.ms2debounce; | |
2 | ||
3 | import java.io.InputStream; | |
4 | import java.io.OutputStream; | |
5 | import java.io.File; | |
6 | ||
7 | import android.content.Context; | |
8 | ||
9 | public class DebounceModuleHelper | |
10 | { | |
11 | private Context ctx; | |
12 | ||
13 | public DebounceModuleHelper(Context context) { | |
14 | ctx = context; | |
15 | } | |
16 | ||
17 | public void loadModule() { | |
18 | extractModule(); | |
19 | ||
20 | try { | |
21 | Process insmod = Runtime.getRuntime().exec(new String[]{"su","-c","/system/bin/insmod /system/lib/modules/debounce.ko"}); | |
22 | insmod.waitFor(); | |
23 | } catch (Exception e) {} | |
24 | } | |
25 | ||
26 | public boolean isLoaded() { | |
27 | return false; | |
28 | } | |
29 | ||
30 | private synchronized void extractModule() { | |
31 | File debounce_ko = new File(ctx.getFilesDir() + "/debounce.ko"); | |
32 | ||
33 | if (debounce_ko.exists()) { | |
34 | return; | |
35 | } | |
36 | ||
37 | try { | |
38 | InputStream apk = ctx.getAssets().open("debounce.ko"); | |
39 | OutputStream mod = ctx.openFileOutput("debounce.ko", 0); | |
40 | ||
41 | apk.close(); | |
42 | mod.close(); | |
43 | } catch (Exception e) {} | |
44 | } | |
45 | } |