From f961bd1389174a9148a65b79c928283b9ef033c1 Mon Sep 17 00:00:00 2001 From: Gianmarco Reverberi Date: Mon, 16 Nov 2015 22:45:45 -0600 Subject: cmfm: this is TOYBOX * busybox is deprecated * remove awk usage * fix file system info Change-Id: I7c2bcbd5024e3be283c9fd6ad699183b6fb5bf1a --- res/values/overlay.xml | 34 +++++++------- res/xml/command_list.xml | 46 +++++++++---------- .../cyanogenmod/filemanager/util/ParseHelper.java | 53 ++++++++++++---------- 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 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 @@ --> - + - + - + @@ -48,58 +48,58 @@ - - - - - + + + + + - + - + - - - + + + - + - - - + + + - - - + + + - + - + - + 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); -- cgit v1.2.3