Question

I know there is a permission check (pid/uid) when calling InputManager.

the UID of monkey process is not equal with the UID of current activity. but why monkey process could inject event into the current window of activity?

Was it helpful?

Solution

this is because "adb shell" user have the permission. Check /etc/permissions/platform.xml:

<assign-permission name="android.permission.INJECT_EVENTS" uid="shell" />

OTHER TIPS

monkey process start by adb shell, adbd process folk the monkey process. monkey process belong to root user group.

adb shell monkey --port 12345

USER PID PPID VSIZE RSS WCHAN PC NAME

root 1 0 676 520 c0159a9c 00010378 S /init

root 19691 1 4716 452 ffffffff 00018498 S /sbin/adbd

root 5972 19691 440824 19700 ffffffff 40077dc8 S com.android.commands.monkey

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top