<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:text="Hello World, MS2Debounce"
+ android:text="You will soon be able to set the debounce_delay here."
/>
</LinearLayout>
@Override
public void onReceive(Context context, Intent intent) {
if("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
- DebounceModuleHelper.loadModule();
+ DebounceModuleHelper module = new DebounceModuleHelper(context.getFilesDir());
+
+ module.loadModule();
}
}
}
package de.rmdir.ms2debounce;
+import java.io.File;
+
public class DebounceModuleHelper
{
- static public void loadModule() {
+ private File filesdir;
+
+ public DebounceModuleHelper(File appdir) {
+ filesdir = appdir;
+ }
+
+ public void loadModule() {
+ extractModule();
+
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() {
+ public boolean isLoaded() {
return false;
}
+
+ private void extractModule() {
+ File debounce_ko = new File(filesdir + "/debounce.ko");
+
+ if (debounce_ko.exists()) {
+ return;
+ }
+ }
}
public class MS2Debounce extends Activity
{
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
- if (!DebounceModuleHelper.isLoaded()) {
- DebounceModuleHelper.loadModule();
- }
+ DebounceModuleHelper module = new DebounceModuleHelper(getFilesDir());
+
+ if (!module.isLoaded()) {
+ module.loadModule();
+ }
- setContentView(R.layout.main);
- }
+ setContentView(R.layout.main);
+ }
}