jiawen
jiawen

Reputation: 1208

How to start an app from kernel

I am working on Android platform, and I wonder if it is possible to start an Android app from the kernel source code. For example, at certain point along the linux kernel resume path, I want to start a specific app, say my custom lock screen app. Is that possible?

Edit:

the call_usermodehelper does not work with the "am" utility. I have code like this in a kernel module:

int result = 0;
char *argv[] = { "/system/bin/am", "start", "-n", "com.twitter.android/com.twitter.applib.HomeTabActivity", NULL};
char *argv[] = {"/system/bin/ls", NULL};
static char *envp[] = {"HOME=/", "PATH=/sbin:/system/sbin:/system/bin:/system/xbin", NULL };

result = call_usermodehelper(argv[0], argv, envp, 1);

but when I insmod, the nothing happens, and result = -8 anyone can help?

Upvotes: 0

Views: 1293

Answers (1)

John
John

Reputation: 3520

I can't speak for certain about Android, but in vanilla Linux, there's a bunch of API's in kmod.h which can do what you want. See this article for details.

Upvotes: 1

Related Questions