On Monday, March 12, 2012 9:37:36 AM UTC-4, Ali wrote:
>
> Process p = Runtime.getRuntime().exec("su");
> p = Runtime.getRuntime().exec("sync");
> p = Runtime.getRuntime().exec("echo 3 >
> /proc/sys/vm/drop_caches");
>
Regardless if these commands would or would not work with sufficient
permission, your most obvious problem is a fundamental misunderstanding of
the "su" command sometimes available on custom roms, and on unix-like
systems in general.
This command does not (and fundamentally could not) change the userid of
the process requesting its execution. It can only result in a new process
running as a different userid. If you want to do something as root, you
have to get the process (typically a shell) created by su to do the thing
you want to do. Typically people do that either by specifying the command
as an argument to su (which in many cases is not supported) or more
portably by piping further commands into the stdin of the su process.
A quick web search will show that the details of how to do this have been
covered numerous times in all of the usual help forums.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en