Reputation: 310
I am developing a security module and i want to start an activity from Loadable Kernel Module (LKM) for authentication of user when he/she tries to access some secure content.
I have worked in Android and I have also worked on Linux desktop butt i don't know that how to start an activity from kernel space in Android?
Upvotes: 0
Views: 520
Reputation: 95
You can execute the 'am' executable(activity manager), found in /system/bin from your lkm.
adb shell am start -a android.intent.action.MAIN -n com.android.mms/.ui.ConversationList
The way to do it from inside the lkm is by using the kernel function 'call_usermodehelper'
example:
#include <linux/kmod.h>
char *argv[] = { "/system/bin/am", "start", "-a", "android.intent.action.MAIN",
"-n", "com.android.mms/.ui.ConversationList", NULL};
static char *envp[] = {
"HOME=/",
"PATH=/sbin:/system/sbin:/system/bin:/system/xbin", NULL };
call_usermodehelper (argv[0], argv, envp, 1);
Upvotes: 1