4

Do you know how to run an app in Android with root permission? I used the following snippet but the root permission is only granted to generated process, not the app itself.

process = Runtime.getRuntime().exec("su")
tuan
  • 433
  • 8
  • 17

1 Answers1

8

You can't really, at least not without some kind of horrible hack.

You cannot make an existing process root, it must be that way from its creation.

Android applications run inside a Dalvik machine in a process that's forked off of a process called Zygote which maps a lot of system libraries into memory, so it's children inherit shared copies. You'd have to somehow modify zygote to tell it to leave the newly forked child root, instead of downgrading it to an application user.

Chris Stratton
  • 39,254
  • 6
  • 81
  • 117
  • Thanks Chris for a very clear explanation. I found another workaround for my issue but your explanation sheds a light on my understanding of Android framework. – tuan May 01 '11 at 06:01
  • 1
    And what solution did you find out? – while true Dec 28 '12 at 15:49