aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGianmarco Reverberi <gianmarco.reverberi@gmail.com>2015-11-16 22:45:45 -0600
committerGianmarco Reverberi <gianmarco.reverberi@gmail.com>2015-12-17 18:10:59 +0100
commitf961bd1389174a9148a65b79c928283b9ef033c1 (patch)
treeda88ec0181c77143578e451dfa78d7ded866314e
parentc671f64b4fa7bc0a4e7207b805cd0bd38fd8df34 (diff)
downloadandroid_packages_apps_CMFileManager-cm-13.0-backup.tar.gz
android_packages_apps_CMFileManager-cm-13.0-backup.tar.bz2
android_packages_apps_CMFileManager-cm-13.0-backup.zip
cmfm: this is TOYBOXcm-13.0-backup
* busybox is deprecated * remove awk usage * fix file system info Change-Id: I7c2bcbd5024e3be283c9fd6ad699183b6fb5bf1a
-rw-r--r--res/values/overlay.xml34
-rw-r--r--res/xml/command_list.xml46
-rw-r--r--src/com/cyanogenmod/filemanager/util/ParseHelper.java53
3 files changed, 68 insertions, 65 deletions
diff --git a/res/values/overlay.xml b/res/values/overlay.xml
index 6b624ad4..d5a4807c 100644
--- a/res/values/overlay.xml
+++ b/res/values/overlay.xml
@@ -37,38 +37,36 @@
/system/bin/cat,
/system/bin/chmod,
/system/bin/chown,
+ /system/bin/cp,
+ /system/bin/cut,
/system/bin/dd,
/system/bin/df,
+ /system/bin/dirname,
+ /system/bin/echo,
+ /system/bin/find,
+ /system/bin/grep,
+ /system/bin/groups,
/system/bin/gzip,
/system/bin/id,
/system/bin/kill,
/system/bin/ln,
/system/bin/ls,
+ /system/bin/md5sum,
/system/bin/mkdir,
/system/bin/mount,
/system/bin/mv,
/system/bin/ps,
+ /system/bin/pwd,
+ /system/bin/readlink,
/system/bin/rm,
/system/bin/sh,
- /system/xbin/awk,
- /system/xbin/bunzip2,
- /system/xbin/busybox,
+ /system/bin/sha1sum,
+ /system/bin/stat,
+ /system/bin/tar,
+ /system/bin/toybox,
+ /system/bin/xargs,
/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/stat,
- /system/xbin/tar,
- /system/xbin/xargs,
- /system/xbin/md5sum,
- /system/xbin/sha1sum
+ /system/xbin/gunzip
</string>
<!-- The root command -->
diff --git a/res/xml/command_list.xml b/res/xml/command_list.xml
index 874fd317..6b399a4c 100644
--- a/res/xml/command_list.xml
+++ b/res/xml/command_list.xml
@@ -31,16 +31,16 @@
-->
<CommandList xmlns="http://schemas.android.com/apk/res/com.cyanogenmod.filemanager">
<!-- Start code (append to commands; for retrieve the exit code) -->
- <startcode commandId="startcode" commandPath="/system/xbin/echo -n %1$s0%2$s ; " />
+ <startcode commandId="startcode" commandPath="/system/bin/echo -n %1$s0%2$s ; " />
<!-- Exit code (append to commands; for retrieve the exit code) -->
- <exitcode commandId="exitcode" commandPath=" ; /system/xbin/echo -n %1$s$?%2$s" />
+ <exitcode commandId="exitcode" commandPath=" ; /system/bin/echo -n %1$s$?%2$s" />
<!-- Shell commands -->
<command commandId="bash" commandPath="/system/bin/sh" commandArgs="" />
<command commandId="su" commandPath="/system/xbin/su" commandArgs="" />
<!-- Console info -->
- <command commandId="groups" commandPath="/system/xbin/groups" commandArgs="" />
+ <command commandId="groups" commandPath="/system/bin/groups" commandArgs="" />
<command commandId="id" commandPath="/system/bin/id" commandArgs="" />
<!-- FileSystem -->
@@ -48,58 +48,58 @@
<command commandId="mountpointinfo" commandPath="/system/bin/mount" commandArgs="" />
<!-- List/Find/Info -->
- <command commandId="ls" commandPath="/system/bin/ls" commandArgs="%1$s 1&gt; /dev/null &amp;&amp; /system/xbin/stat -t %1$s.* %1$s* 2&gt; /dev/null" />
- <command commandId="fileinfo" commandPath="/system/xbin/stat" commandArgs="-t %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/stat -t {} 2&gt;&amp;1 \\;" />
- <command commandId="quickfoldersearch" commandPath="/system/bin/ls" commandArgs="-aFd %1$s.* %1$s* 2&gt; /dev/null | /system/xbin/grep -e '^d' -e '^ld' | /system/xbin/cut -d&quot; &quot; -f2-" />
- <command commandId="readlink" commandPath="/system/bin/ls" commandArgs="%1$s 1&gt; /dev/null &amp;&amp; /system/xbin/stat -tL %1$s 2&gt;&amp;1" />
+ <command commandId="ls" commandPath="/system/bin/ls" commandArgs="%1$s 1&gt; /dev/null &amp;&amp; /system/bin/stat -t %1$s.* %1$s* 2&gt; /dev/null" />
+ <command commandId="fileinfo" commandPath="/system/bin/stat" commandArgs="-t %1$s" />
+ <command commandId="find" commandPath="/system/bin/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/bin/stat -t {} 2&gt;&amp;1 \\;" />
+ <command commandId="quickfoldersearch" commandPath="/system/bin/ls" commandArgs="-aFd %1$s.* %1$s* 2&gt; /dev/null | /system/bin/grep -e '^d' -e '^ld' | /system/bin/cut -d&quot; &quot; -f2-" />
+ <command commandId="readlink" commandPath="/system/bin/ls" commandArgs="%1$s 1&gt; /dev/null &amp;&amp; /system/bin/stat -t -L %1$s 2&gt;&amp;1" />
<!-- Operational -->
<command commandId="chmod" commandPath="/system/bin/chmod" commandArgs="%1$s %2$s" />
<command commandId="chown" commandPath="/system/bin/chown" commandArgs="%1$s.%2$s %3$s" />
- <command commandId="cp" commandPath="/system/xbin/cp" commandArgs="-af %1$s %2$s" />
+ <command commandId="cp" commandPath="/system/bin/cp" commandArgs="-af %1$s %2$s" />
<command commandId="link" commandPath="/system/bin/ln" commandArgs="-s %1$s %2$s" />
<command commandId="mkdir" commandPath="/system/bin/mkdir" commandArgs="-p %1$s" />
- <command commandId="mv" commandPath="/system/bin/mv" commandArgs="%1$s %2$s || ( /system/xbin/cp -af %1$s %2$s &amp;&amp; /system/bin/rm -R %1$s )" />
+ <command commandId="mv" commandPath="/system/bin/mv" commandArgs="%1$s %2$s || ( /system/bin/cp -af %1$s %2$s &amp;&amp; /system/bin/rm -R %1$s )" />
<command commandId="rm" commandPath="/system/bin/rm" commandArgs="%1$s" />
<command commandId="rmdir" commandPath="/system/bin/rm" commandArgs="-R %1$s" />
<!-- Usage -->
- <command commandId="diskusage" commandPath="/system/bin/df" commandArgs="%1$s" />
- <command commandId="diskusageall" commandPath="/system/bin/df" commandArgs="" />
- <command commandId="folderusage" commandPath="/system/xbin/busybox" commandArgs="ls -alR %1$s 2&gt; /dev/null" />
+ <command commandId="diskusage" commandPath="/system/bin/df" commandArgs="-h %1$s" />
+ <command commandId="diskusageall" commandPath="/system/bin/df" commandArgs="-h" />
+ <command commandId="folderusage" commandPath="/system/bin/ls" commandArgs="-alR %1$s 2&gt; /dev/null" />
<!-- I/O -->
<command commandId="read" commandPath="/system/bin/cat" commandArgs="%1$s" />
- <command commandId="touch" commandPath="/system/xbin/echo" commandArgs="-n '' >> %1$s" />
+ <command commandId="touch" commandPath="/system/bin/echo" commandArgs="-n '' >> %1$s" />
<command commandId="write" commandPath="/system/bin/dd" commandArgs="bs=4k of=%1$s" />
<!-- Run -->
<command commandId="exec" commandPath="/system/bin/sh" commandArgs="%1$s" />
<!-- Misc -->
- <command commandId="dirname" commandPath="/system/xbin/dirname" commandArgs="%1$s" />
- <command commandId="echo" commandPath="/system/xbin/echo" commandArgs="%1$s" />
- <command commandId="checksum" commandPath="/system/xbin/md5sum" commandArgs="%1$s &amp;&amp; /system/xbin/sha1sum %1$s" />
+ <command commandId="dirname" commandPath="/system/bin/dirname" commandArgs="%1$s" />
+ <command commandId="echo" commandPath="/system/bin/echo" commandArgs="%1$s" />
+ <command commandId="checksum" commandPath="/system/bin/md5sum" commandArgs="%1$s &amp;&amp; /system/bin/sha1sum %1$s" />
<!-- Process control and info -->
- <command commandId="pid_shell" commandPath="/system/xbin/echo" commandArgs="$$" />
- <command commandId="pid_shell_cmds" commandPath="/system/bin/ps" commandArgs="| /system/xbin/grep -w %1$s | /system/xbin/awk '{print $2}' | /system/xbin/grep -v -w %1$s" />
- <command commandId="pid_cmd" commandPath="/system/bin/ps" commandArgs="| /system/xbin/grep %1$s | /system/xbin/grep -w %2$s | /system/xbin/awk '{print $2}'" />
+ <command commandId="pid_shell" commandPath="/system/bin/echo" commandArgs="$$" />
+ <command commandId="pid_shell_cmds" commandPath="/system/bin/ps" commandArgs="| /system/bin/grep -w %1$s | /system/bin/cut -c 11-16 | /system/bin/grep -v -w %1$s" />
+ <command commandId="pid_cmd" commandPath="/system/bin/ps" commandArgs="| /system/bin/grep %1$s | /system/bin/grep -w %2$s | /system/bin/cut -c 11-16" />
<command commandId="sendsignal" commandPath="/system/bin/kill" commandArgs="-%1$s %2$s" />
<command commandId="terminate" commandPath="/system/bin/kill" commandArgs="%1$s" />
<!-- Compress -->
- <command commandId="tar" commandPath="/system/xbin/tar" commandArgs="-C%1$s -%2$scvf %3$s [@]" />
+ <command commandId="tar" commandPath="/system/bin/tar" commandArgs="-C%1$s -%2$scvf %3$s [@]" />
<command commandId="gzip" commandPath="/system/bin/gzip" commandArgs="%1$s" />
<command commandId="bzip" commandPath="/system/xbin/bzip2" commandArgs="-f %1$s" />
<command commandId="zip" commandPath="cd" commandArgs="%1$s &amp;&amp; ( /system/xbin/zip -9 -r -y %2$s [@] || cd /)" />
<!-- Uncompress -->
- <command commandId="untar" commandPath="/system/bin/mkdir" commandArgs="-p %2$s &amp;&amp; /system/xbin/tar -C %2$s -%1$sxvf %3$s" />
+ <command commandId="untar" commandPath="/system/bin/mkdir" commandArgs="-p %2$s &amp;&amp; /system/bin/tar -C %2$s -%1$sxvf %3$s" />
<command commandId="unzip" commandPath="/system/bin/mkdir" commandArgs="-p %1$s &amp;&amp; /system/xbin/unzip -o %2$s -d %1$s" />
<command commandId="gunzip" commandPath="/system/xbin/gunzip" commandArgs="-f %1$s" />
- <command commandId="bunzip" commandPath="/system/xbin/bunzip2" commandArgs="-f %1$s" />
+ <command commandId="bunzip" commandPath="/system/xbin/bzip2" commandArgs="-d -f %1$s" />
<command commandId="unlzma" commandPath="/system/xbin/unlzma" commandArgs="-f %1$s" />
<command commandId="uncompress" commandPath="/system/xbin/uncompress" commandArgs="-f %1$s" />
<command commandId="unxz" commandPath="/system/xbin/unxz" commandArgs="-f %1$s" />
diff --git a/src/com/cyanogenmod/filemanager/util/ParseHelper.java b/src/com/cyanogenmod/filemanager/util/ParseHelper.java
index ada51aae..7129af55 100644
--- a/src/com/cyanogenmod/filemanager/util/ParseHelper.java
+++ b/src/com/cyanogenmod/filemanager/util/ParseHelper.java
@@ -254,13 +254,14 @@ public final class ParseHelper {
*/
public static DiskUsage toDiskUsage(final String src) throws ParseException {
- // Filesystem Size Used Free Blksize
- // /dev 414M 48K 414M 4096
- // /mnt/asec 414M 0K 414M 4096
- // /mnt/secure/asec: Permission denied
+ // Filesystem Size Used Avail Use% Mounted on
+ // tmpfs 1.3G 88K 1.3G 1% /dev
+ // tmpfs 1.3G 0 1.3G 0% /mnt
+ // /dev/block/mmcblk0p14 1.2G 966M 337M 75% /system
+ // /dev/fuse 55G 18G 37G 34% /storage/emulated
try {
- final int fields = 5;
+ final int fields = 6;
//Permission denied or invalid statistics
if (src.indexOf(":") != -1) { //$NON-NLS-1$
@@ -279,7 +280,7 @@ public final class ParseHelper {
}
//Return the disk usage
- return new DiskUsage(data[0], toBytes(data[1]), toBytes(data[2]), toBytes(data[3]));
+ return new DiskUsage(data[5], toBytes(data[1]), toBytes(data[2]), toBytes(data[3]));
} catch (Exception e) {
throw new ParseException(e.getMessage(), 0);
@@ -295,34 +296,38 @@ public final class ParseHelper {
*/
public static MountPoint toMountPoint(final String src) throws ParseException {
- // rootfs / rootfs ro,relatime 0 0
- // tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
- // devpts /dev/pts devpts rw,relatime,mode=600 0 0
- // /dev/block/vold/179:25 /mnt/emmc vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000, gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1, shortname=mixed,utf8,errors=remount-ro 0 0
+ // rootfs on / type rootfs (ro,seclabel,relatime)
+ // tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,size=1460476k,nr_inodes=142719,mode=755)
+ // devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
+ // /dev/block/mmcblk0p14 on /system type ext4 (rw,seclabel,relatime,data=ordered)
try {
//Extract all the info
String line = src;
- int pos = line.lastIndexOf(" "); //$NON-NLS-1$
- int pass = Integer.parseInt(line.substring(pos + 1));
- line = line.substring(0, pos).trim();
- pos = line.lastIndexOf(" "); //$NON-NLS-1$
- int dump = Integer.parseInt(line.substring(pos + 1));
- line = line.substring(0, pos).trim();
- pos = line.indexOf(" "); //$NON-NLS-1$
+ // Device
+ int pos = line.indexOf(" "); //$NON-NLS-1$
String device = line.substring(0, pos).trim();
line = line.substring(pos).trim();
- pos = line.lastIndexOf(" "); //$NON-NLS-1$
- String options = line.substring(pos + 1).trim();
- line = line.substring(0, pos).trim();
- pos = line.lastIndexOf(" "); //$NON-NLS-1$
- String type = line.substring(pos + 1).trim();
+ // Skip "on"
+ pos = line.indexOf(" "); //$NON-NLS-1$
+ line = line.substring(pos).trim();
+ // Mount point
+ pos = line.indexOf(" "); //$NON-NLS-1$
String mountPoint = line.substring(0, pos).trim();
-
+ line = line.substring(pos).trim();
+ // Skip "type"
+ pos = line.indexOf(" "); //$NON-NLS-1$
+ line = line.substring(pos).trim();
+ // Type
+ pos = line.indexOf(" "); //$NON-NLS-1$
+ String type = line.substring(0, pos).trim();
+ line = line.substring(pos).trim();
+ // Options
+ String options = line.substring(1, line.length() - 1).trim();
//Return the mount point
- return new MountPoint(mountPoint, device, type, options, dump, pass, false, false);
+ return new MountPoint(mountPoint, device, type, options, /*dump*/0, /*pass*/0, false, false);
} catch (Exception e) {
throw new ParseException(e.getMessage(), 0);