From: Michael Gernoth Date: Fri, 20 May 2011 19:01:42 +0000 (+0200) Subject: there is no need for a service X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/ms2-fixes/commitdiff_plain/0ae502f627e216e71b179a37079c9d43c7feeed3?ds=sidebyside;hp=-c there is no need for a service --- 0ae502f627e216e71b179a37079c9d43c7feeed3 diff --git a/.gitignore b/.gitignore index aafe4df..3e427b5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ .debounce.o.cmd .tmp_versions/ Module.symvers -debounce.ko +./debounce.ko debounce.mod.c debounce.mod.o debounce.o diff --git a/MS2Debounce/AndroidManifest.xml b/MS2Debounce/AndroidManifest.xml index 7f9b472..bc90811 100644 --- a/MS2Debounce/AndroidManifest.xml +++ b/MS2Debounce/AndroidManifest.xml @@ -11,7 +11,6 @@ - diff --git a/MS2Debounce/src/de/rmdir/ms2debounce/DebounceBootReceiver.java b/MS2Debounce/src/de/rmdir/ms2debounce/DebounceBootReceiver.java index 2f97c2c..3ab003d 100644 --- a/MS2Debounce/src/de/rmdir/ms2debounce/DebounceBootReceiver.java +++ b/MS2Debounce/src/de/rmdir/ms2debounce/DebounceBootReceiver.java @@ -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 index 0000000..f4569a5 --- /dev/null +++ b/MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java @@ -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 index c4a8762..0000000 --- a/MS2Debounce/src/de/rmdir/ms2debounce/DebounceService.java +++ /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(); - } -} diff --git a/MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java b/MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java index 99ca40d..85ec653 100644 --- a/MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java +++ b/MS2Debounce/src/de/rmdir/ms2debounce/MS2Debounce.java @@ -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); }