]> git.zerfleddert.de Git - ms2-fixes/commitdiff
start unpacking file, this is just a stub for now
authorMichael Gernoth <michael@gernoth.net>
Fri, 20 May 2011 19:43:11 +0000 (21:43 +0200)
committerMichael Gernoth <michael@gernoth.net>
Fri, 20 May 2011 19:43:11 +0000 (21:43 +0200)
MS2Debounce/src/de/rmdir/ms2debounce/DebounceBootReceiver.java
MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java
MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java

index de10592968112629aea666270927ea7c83f32074..2a15ea4271a8a0a53be2447b0fc604e9eaec49a8 100644 (file)
@@ -8,7 +8,7 @@ public class DebounceBootReceiver extends BroadcastReceiver{
        @Override
        public void onReceive(Context context, Intent intent) {
                if("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
        @Override
        public void onReceive(Context context, Intent intent) {
                if("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
-                       DebounceModuleHelper module = new DebounceModuleHelper(context.getFilesDir());
+                       DebounceModuleHelper module = new DebounceModuleHelper(context);
 
                        module.loadModule();
                }
 
                        module.loadModule();
                }
index fe9ffa80d06a972c7a5548ec4bbb81a48ce1c96f..2f9804cda64cdd463a55a1259dc21a7d106140f9 100644 (file)
@@ -1,13 +1,17 @@
 package de.rmdir.ms2debounce;
 
 package de.rmdir.ms2debounce;
 
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.io.File;
 
 import java.io.File;
 
+import android.content.Context;
+
 public class DebounceModuleHelper
 {
 public class DebounceModuleHelper
 {
-       private File filesdir;
+       private Context ctx;
 
 
-       public DebounceModuleHelper(File appdir) {
-               filesdir = appdir;
+       public DebounceModuleHelper(Context context) {
+               ctx = context;
        }
 
        public void loadModule() {
        }
 
        public void loadModule() {
@@ -23,11 +27,19 @@ public class DebounceModuleHelper
                return false;
        }
 
                return false;
        }
 
-       private void extractModule() {
-               File debounce_ko = new File(filesdir + "/debounce.ko");
+       private synchronized void extractModule() {
+               File debounce_ko = new File(ctx.getFilesDir() + "/debounce.ko");
 
                if (debounce_ko.exists()) {
                        return;
                }
 
                if (debounce_ko.exists()) {
                        return;
                }
+
+               try {
+                       InputStream apk = ctx.getAssets().open("debounce.ko");
+                       OutputStream mod = ctx.openFileOutput("debounce.ko", 0);
+
+                       apk.close();
+                       mod.close();
+               } catch (Exception e) {}
        }
 }
        }
 }
index 3f7814edd339c3ccd264cc80c01d2e71db4f31d9..00eaa61ef7001d5e737c57e0e3f5794c41040f17 100644 (file)
@@ -11,7 +11,7 @@ public class MS2Debounce extends Activity
        {
                super.onCreate(savedInstanceState);
 
        {
                super.onCreate(savedInstanceState);
 
-               DebounceModuleHelper module = new DebounceModuleHelper(getFilesDir());
+               DebounceModuleHelper module = new DebounceModuleHelper(this);
 
                if (!module.isLoaded()) {
                        module.loadModule();
 
                if (!module.isLoaded()) {
                        module.loadModule();
Impressum, Datenschutz