commit 790acb8a5354745204ae5f0fdcbc3eb7d5dca4f6 Author: Nathan Freitas nathan@freitas.net Date: Sat Feb 11 22:41:25 2012 -0500
updated way for checking for ROOT --- .../android/settings/SettingsPreferences.java | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/src/org/torproject/android/settings/SettingsPreferences.java b/src/org/torproject/android/settings/SettingsPreferences.java index 1545df6..35c4314 100644 --- a/src/org/torproject/android/settings/SettingsPreferences.java +++ b/src/org/torproject/android/settings/SettingsPreferences.java @@ -118,7 +118,21 @@ public class SettingsPreferences
if (prefRequestRoot.isChecked()) { - boolean canRoot = TorServiceUtils.isRootPossible(); + //boolean canRoot = TorServiceUtils.isRootPossible(); + boolean canRoot; + + try + { + StringBuilder res = new StringBuilder(); + String[] cmd = {"ls /data/data"}; //only root can do this! + int code = TorServiceUtils.doShellCommand(cmd, res, true, true); + canRoot = code > -1; + } + catch (Exception e) + { + //probably not root + canRoot = false; + } getPreferenceScreen().getPreference(TRANSPROXY_GROUP_IDX).setEnabled(canRoot); prefRequestRoot.setChecked(canRoot);
tor-commits@lists.torproject.org