As of 1.5 applications can no longer use su.

On Mon, May 11, 2009 at 9:59 PM, toto <[email protected]> wrote:

>
> hi
> I work on rooted unlocked G1, latest JS firmware ADP1.5
> I wrote some application that perform some root actions in the /system
> of course, when messing up /system requires to remount that partition
> but that's not my issue.
>
> the code is fairly simple (attached at bottom of this message).
> however when running a command as root (for example executeAsRoot("su
> ls -l /system")) I get exit code 255 (i.e. -1 or failure)
> when running that command as non-root - it runs ok with exit code 0.
> The strange thing that this happens only in the real G1 . On the
> emulator, root commands work just fine.
> if i open a terminal on the G1 and perform su - I get the
> "allow"/"deny" screen but after that I am able to perform actions as
> root.
> How can I debug the reason for the application process failure ?
>
>
> private int executeAsRoot(String command) {
>                Process process = null;
>                int exitVal = -1;
>                try {
>                        process = Runtime.getRuntime().exec(command);
>                        process.waitFor();
>                        exitVal = process.exitValue();
>                        m_logsView.append("\nexecuted:"+command +"
> ->"+((exitVal==1)?
> "success" : exitVal));
>                        Log.i("executeAsRoot","Exit value is:"+exitVal);
>                } catch (IOException e) {
>                        m_logsView.append("\nexecuted:"+command +"
> ->"+e.getLocalizedMessage
> ());
>                        Log.e("executeAsRoot",e.getLocalizedMessage(), e);
>                } catch (InterruptedException e) {
>                        m_logsView.append("\nexecuted:"+command +"
> ->"+e.getLocalizedMessage
> ());
>                        Log.e("executeAsRoot",e.getLocalizedMessage(), e);
>                } finally {
>                        if (process != null) {
>                                process.destroy();
>                        }
>                }
>                return exitVal;
>
>        }
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to