Loading res/values/overlay.xml +43 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,49 @@ <!-- The system directory --> <string name="system_dir" translatable="false">/system</string> <!-- The su binary --> <string name="su_binary" translatable="false">/system/xbin/su</string> <!-- The shell commands used by this application. All of this commands should exist to allow the use of a shell console (and access to root). If any of this commands are not present in the system, then app will start in non-rooted mode and with a java console. --> <string name="shell_required_commands" translatable="false"> /system/bin/cat, /system/bin/chmod, /system/bin/chown, /system/bin/dd, /system/bin/df, /system/bin/gzip, /system/bin/id, /system/bin/kill, /system/bin/ln, /system/bin/ls, /system/bin/mkdir, /system/bin/mount, /system/bin/mv, /system/bin/ps, /system/bin/rm, /system/bin/sh, /system/xbin/awk, /system/xbin/bunzip2, /system/xbin/bzip2, /system/xbin/cp, /system/xbin/cut, /system/xbin/dirname, /system/xbin/echo, /system/xbin/find, /system/xbin/grep, /system/xbin/groups, /system/xbin/gunzip, /system/xbin/pwd, /system/xbin/readlink, /system/xbin/su, /system/xbin/tar, /system/xbin/uncompress, /system/xbin/unlzma, /system/xbin/unxz, /system/xbin/unzip, /system/xbin/xargs </string> <!-- The mounts file --> <string name="mounts_file" translatable="false">/proc/mounts</string> Loading res/xml/command_list.xml +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ <command commandId="mountpointinfo" commandPath="/system/bin/cat" commandArgs="/proc/mounts" /> <!-- List/Find/Info --> <command commandId="ls" commandPath="cd" commandArgs="%1$s && /system/bin/ls -al %1$s | { /system/xbin/grep -v -e '^l' || true; } && echo '>SIMLINKS>' && /system/bin/ls -al %1$s | { /system/xbin/grep -e '^l' || true; } && echo '>SIMLINKS_DATA>' && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f && /system/bin/ls -F %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f | awk '{print "\\""$0"\\""}' | { /system/xbin/xargs -r /system/bin/ls -ald || echo; }" /> <command commandId="ls" commandPath="cd" commandArgs="%1$s && /system/bin/ls -al %1$s | { /system/xbin/grep -v -e '^l' || true; } && /system/xbin/echo '>SIMLINKS>' && /system/bin/ls -al %1$s | { /system/xbin/grep -e '^l' || true; } && /system/xbin/echo '>SIMLINKS_DATA>' && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | /system/xbin/awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f && /system/bin/ls -F %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | /system/xbin/awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f | /system/xbin/awk '{print "\\""$0"\\""}' | { /system/xbin/xargs -r /system/bin/ls -ald || /system/xbin/echo; }" /> <command commandId="fileinfo" commandPath="/system/bin/ls" commandArgs="-ald %1$s" /> <command commandId="find" commandPath="/system/xbin/find" commandArgs="%1$s \\( -name %2$s -o -name %3$s -o -name %4$s -o -name %5$s -o -name %6$s \\) -exec /system/xbin/echo {} \\; -exec /system/bin/ls -ald {} \\;" /> <command commandId="quickfoldersearch" commandPath="/system/bin/ls" commandArgs="-aFd %1$s.* %1$s* | /system/xbin/grep -e '^d' -e '^ld' | /system/xbin/awk '{print $2}'" /> Loading src/com/cyanogenmod/filemanager/FileManagerApplication.java +38 −3 Original line number Diff line number Diff line Loading @@ -203,9 +203,7 @@ public final class FileManagerApplication extends Application { sIsDebuggable = (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)); // Check if the device is rooted sIsDeviceRooted = new File(getString(R.string.su_binary)).exists() && getSystemProperty("ro.cm.version") != null; //$NON-NLS-1$ sIsDeviceRooted = areShellCommandsPresent(); // Register the notify broadcast receiver IntentFilter filter = new IntentFilter(); Loading Loading @@ -419,4 +417,41 @@ public final class FileManagerApplication extends Application { } } /** * Method that check if all shell commands are present in the device * * @return boolean Check if the device has all of the shell commands */ private boolean areShellCommandsPresent() { try { String shellCommands = getString(R.string.shell_required_commands); String[] commands = shellCommands.split(","); //$NON-NLS-1$ int cc = commands.length; if (cc == 0) { //??? Log.w(TAG, "No shell commands."); //$NON-NLS-1$ return false; } for (int i = 0; i < cc; i++) { String c = commands[i].trim(); if (c.length() == 0) continue; File cmd = new File(c); if (!cmd.exists() || !cmd.isFile()) { Log.w(TAG, String.format( "Command %s not found. Exists: %s; IsFile: %s.", //$NON-NLS-1$ c, String.valueOf(cmd.exists()), String.valueOf(cmd.isFile()))); return false; } } // All commands are present return true; } catch (Exception e) { Log.e(TAG, "Failed to read shell commands.", e); //$NON-NLS-1$ } return false; } } Loading
res/values/overlay.xml +43 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,49 @@ <!-- The system directory --> <string name="system_dir" translatable="false">/system</string> <!-- The su binary --> <string name="su_binary" translatable="false">/system/xbin/su</string> <!-- The shell commands used by this application. All of this commands should exist to allow the use of a shell console (and access to root). If any of this commands are not present in the system, then app will start in non-rooted mode and with a java console. --> <string name="shell_required_commands" translatable="false"> /system/bin/cat, /system/bin/chmod, /system/bin/chown, /system/bin/dd, /system/bin/df, /system/bin/gzip, /system/bin/id, /system/bin/kill, /system/bin/ln, /system/bin/ls, /system/bin/mkdir, /system/bin/mount, /system/bin/mv, /system/bin/ps, /system/bin/rm, /system/bin/sh, /system/xbin/awk, /system/xbin/bunzip2, /system/xbin/bzip2, /system/xbin/cp, /system/xbin/cut, /system/xbin/dirname, /system/xbin/echo, /system/xbin/find, /system/xbin/grep, /system/xbin/groups, /system/xbin/gunzip, /system/xbin/pwd, /system/xbin/readlink, /system/xbin/su, /system/xbin/tar, /system/xbin/uncompress, /system/xbin/unlzma, /system/xbin/unxz, /system/xbin/unzip, /system/xbin/xargs </string> <!-- The mounts file --> <string name="mounts_file" translatable="false">/proc/mounts</string> Loading
res/xml/command_list.xml +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ <command commandId="mountpointinfo" commandPath="/system/bin/cat" commandArgs="/proc/mounts" /> <!-- List/Find/Info --> <command commandId="ls" commandPath="cd" commandArgs="%1$s && /system/bin/ls -al %1$s | { /system/xbin/grep -v -e '^l' || true; } && echo '>SIMLINKS>' && /system/bin/ls -al %1$s | { /system/xbin/grep -e '^l' || true; } && echo '>SIMLINKS_DATA>' && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f && /system/bin/ls -F %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f | awk '{print "\\""$0"\\""}' | { /system/xbin/xargs -r /system/bin/ls -ald || echo; }" /> <command commandId="ls" commandPath="cd" commandArgs="%1$s && /system/bin/ls -al %1$s | { /system/xbin/grep -v -e '^l' || true; } && /system/xbin/echo '>SIMLINKS>' && /system/bin/ls -al %1$s | { /system/xbin/grep -e '^l' || true; } && /system/xbin/echo '>SIMLINKS_DATA>' && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | /system/xbin/awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f && /system/bin/ls -F %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | /system/xbin/awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f | /system/xbin/awk '{print "\\""$0"\\""}' | { /system/xbin/xargs -r /system/bin/ls -ald || /system/xbin/echo; }" /> <command commandId="fileinfo" commandPath="/system/bin/ls" commandArgs="-ald %1$s" /> <command commandId="find" commandPath="/system/xbin/find" commandArgs="%1$s \\( -name %2$s -o -name %3$s -o -name %4$s -o -name %5$s -o -name %6$s \\) -exec /system/xbin/echo {} \\; -exec /system/bin/ls -ald {} \\;" /> <command commandId="quickfoldersearch" commandPath="/system/bin/ls" commandArgs="-aFd %1$s.* %1$s* | /system/xbin/grep -e '^d' -e '^ld' | /system/xbin/awk '{print $2}'" /> Loading
src/com/cyanogenmod/filemanager/FileManagerApplication.java +38 −3 Original line number Diff line number Diff line Loading @@ -203,9 +203,7 @@ public final class FileManagerApplication extends Application { sIsDebuggable = (0 != (getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)); // Check if the device is rooted sIsDeviceRooted = new File(getString(R.string.su_binary)).exists() && getSystemProperty("ro.cm.version") != null; //$NON-NLS-1$ sIsDeviceRooted = areShellCommandsPresent(); // Register the notify broadcast receiver IntentFilter filter = new IntentFilter(); Loading Loading @@ -419,4 +417,41 @@ public final class FileManagerApplication extends Application { } } /** * Method that check if all shell commands are present in the device * * @return boolean Check if the device has all of the shell commands */ private boolean areShellCommandsPresent() { try { String shellCommands = getString(R.string.shell_required_commands); String[] commands = shellCommands.split(","); //$NON-NLS-1$ int cc = commands.length; if (cc == 0) { //??? Log.w(TAG, "No shell commands."); //$NON-NLS-1$ return false; } for (int i = 0; i < cc; i++) { String c = commands[i].trim(); if (c.length() == 0) continue; File cmd = new File(c); if (!cmd.exists() || !cmd.isFile()) { Log.w(TAG, String.format( "Command %s not found. Exists: %s; IsFile: %s.", //$NON-NLS-1$ c, String.valueOf(cmd.exists()), String.valueOf(cmd.isFile()))); return false; } } // All commands are present return true; } catch (Exception e) { Log.e(TAG, "Failed to read shell commands.", e); //$NON-NLS-1$ } return false; } }