简体   繁体   中英

Starting an Android Activity from a LKM/kernel-space

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?

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM