]> cvs.zerfleddert.de Git - ms2-fixes/commitdiff
there is no need for a service
authorMichael Gernoth <michael@gernoth.net>
Fri, 20 May 2011 19:01:42 +0000 (21:01 +0200)
committerMichael Gernoth <michael@gernoth.net>
Fri, 20 May 2011 19:01:42 +0000 (21:01 +0200)
.gitignore
MS2Debounce/AndroidManifest.xml
MS2Debounce/src/de/rmdir/ms2debounce/DebounceBootReceiver.java
MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java [new file with mode: 0644]
MS2Debounce/src/de/rmdir/ms2debounce/DebounceService.java [deleted file]
MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java

index aafe4df1f60296b6012ef28d90ed192b1d4bc77d..3e427b570a1b38b497003e043993f684dec4592e 100644 (file)
@@ -3,7 +3,7 @@
 .debounce.o.cmd
 .tmp_versions/
 Module.symvers
-debounce.ko
+./debounce.ko
 debounce.mod.c
 debounce.mod.o
 debounce.o
index 7f9b4727c7ad1c9169dc0bf22040c5b5456201fe..bc9081121346c1d9454cce6a83c451909ce0e49b 100644 (file)
@@ -11,7 +11,6 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-       <service android:name=".DebounceService"/>
        <receiver android:name=".DebounceBootReceiver">
                <intent-filter>
                        <action android:name="android.intent.action.BOOT_COMPLETED" />
index 2f97c2c955a42329463379397364d8a33d19396f..3ab003d12999029efdf7189cdd7a9633c60eac25 100644 (file)
@@ -8,8 +8,7 @@ public class DebounceBootReceiver extends BroadcastReceiver{
        @Override
        public void onReceive(Context context, Intent intent) {
                if("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
-                       Intent debouncesvc = new Intent(context, DebounceService.class);
-                       context.startService(debouncesvc);
+                       DebounceModuleHelper.loadModule();
                }
        }
 }
diff --git a/MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java b/MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java
new file mode 100644 (file)
index 0000000..f4569a5
--- /dev/null
@@ -0,0 +1,15 @@
+package de.rmdir.ms2debounce;
+
+public class DebounceModuleHelper
+{
+       static public void loadModule() {
+               try {
+                       Process insmod = Runtime.getRuntime().exec(new String[]{"su","-c","/system/bin/insmod /system/lib/modules/debounce.ko"});
+                       insmod.waitFor();
+               } catch (Exception e) {}
+       }
+
+       static public boolean isLoaded() {
+               return false;
+       }
+}
diff --git a/MS2Debounce/src/de/rmdir/ms2debounce/DebounceService.java b/MS2Debounce/src/de/rmdir/ms2debounce/DebounceService.java
deleted file mode 100644 (file)
index c4a8762..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-package de.rmdir.ms2debounce;
-
-import android.content.Intent;
-import android.app.IntentService;
-
-public class DebounceService extends IntentService {
-
-       // Create worker thread
-       public DebounceService() {
-               super("DebounceService");
-       }
-
-       @Override
-       protected void onHandleIntent(Intent intent) {
-       }
-
-       @Override
-       public void onCreate() {
-               try {
-                       Process insmod = Runtime.getRuntime().exec(new String[]{"su","-c","/system/bin/insmod /system/lib/modules/debounce.ko"});
-                       insmod.waitFor();
-               } catch (Exception e) {}
-               super.onCreate();
-       }
-}
index 99ca40dc16f3c74380e7c9f8a27a1b5b74ff87ef..85ec653a1b0960501cf27684fcd7a45d43680384 100644 (file)
@@ -12,8 +12,9 @@ public class MS2Debounce extends Activity
     {
         super.onCreate(savedInstanceState);
 
-       Intent debouncesvc = new Intent(this, DebounceService.class);
-       startService(debouncesvc);
+       if (!DebounceModuleHelper.isLoaded()) {
+               DebounceModuleHelper.loadModule();
+       }
 
         setContentView(R.layout.main);
     }
Impressum, Datenschutz