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;

        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to