Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-apps-CMFileManager: Commit

packages/apps/CMFileManager


Commit MetaInfo

Révision56d14850714219e98f4def409da7ed0a5efa14c1 (tree)
l'heure2015-12-18 11:56:08
AuteurGianmarco Reverberi <gianmarco.reverberi@gmai...>
CommiterRaj Yengisetty

Message de Log

cmfm: this is TOYBOX

* busybox is deprecated
* remove awk usage
* fix file system info

Change-Id: I7c2bcbd5024e3be283c9fd6ad699183b6fb5bf1a

Change Summary

Modification

--- a/res/values/overlay.xml
+++ b/res/values/overlay.xml
@@ -37,38 +37,36 @@
3737 /system/bin/cat,
3838 /system/bin/chmod,
3939 /system/bin/chown,
40+ /system/bin/cp,
41+ /system/bin/cut,
4042 /system/bin/dd,
4143 /system/bin/df,
44+ /system/bin/dirname,
45+ /system/bin/echo,
46+ /system/bin/find,
47+ /system/bin/grep,
48+ /system/bin/groups,
4249 /system/bin/gzip,
4350 /system/bin/id,
4451 /system/bin/kill,
4552 /system/bin/ln,
4653 /system/bin/ls,
54+ /system/bin/md5sum,
4755 /system/bin/mkdir,
4856 /system/bin/mount,
4957 /system/bin/mv,
5058 /system/bin/ps,
59+ /system/bin/pwd,
60+ /system/bin/readlink,
5161 /system/bin/rm,
5262 /system/bin/sh,
53- /system/xbin/awk,
54- /system/xbin/bunzip2,
55- /system/xbin/busybox,
63+ /system/bin/sha1sum,
64+ /system/bin/stat,
65+ /system/bin/tar,
66+ /system/bin/toybox,
67+ /system/bin/xargs,
5668 /system/xbin/bzip2,
57- /system/xbin/cp,
58- /system/xbin/cut,
59- /system/xbin/dirname,
60- /system/xbin/echo,
61- /system/xbin/find,
62- /system/xbin/grep,
63- /system/xbin/groups,
64- /system/xbin/gunzip,
65- /system/xbin/pwd,
66- /system/xbin/readlink,
67- /system/xbin/stat,
68- /system/xbin/tar,
69- /system/xbin/xargs,
70- /system/xbin/md5sum,
71- /system/xbin/sha1sum
69+ /system/xbin/gunzip
7270 </string>
7371
7472 <!-- The root command -->
--- a/res/xml/command_list.xml
+++ b/res/xml/command_list.xml
@@ -31,16 +31,16 @@
3131 -->
3232 <CommandList xmlns="http://schemas.android.com/apk/res/com.cyanogenmod.filemanager">
3333 <!-- Start code (append to commands; for retrieve the exit code) -->
34- <startcode commandId="startcode" commandPath="/system/xbin/echo -n %1$s0%2$s ; " />
34+ <startcode commandId="startcode" commandPath="/system/bin/echo -n %1$s0%2$s ; " />
3535 <!-- Exit code (append to commands; for retrieve the exit code) -->
36- <exitcode commandId="exitcode" commandPath=" ; /system/xbin/echo -n %1$s$?%2$s" />
36+ <exitcode commandId="exitcode" commandPath=" ; /system/bin/echo -n %1$s$?%2$s" />
3737
3838 <!-- Shell commands -->
3939 <command commandId="bash" commandPath="/system/bin/sh" commandArgs="" />
4040 <command commandId="su" commandPath="/system/xbin/su" commandArgs="" />
4141
4242 <!-- Console info -->
43- <command commandId="groups" commandPath="/system/xbin/groups" commandArgs="" />
43+ <command commandId="groups" commandPath="/system/bin/groups" commandArgs="" />
4444 <command commandId="id" commandPath="/system/bin/id" commandArgs="" />
4545
4646 <!-- FileSystem -->
@@ -48,58 +48,58 @@
4848 <command commandId="mountpointinfo" commandPath="/system/bin/mount" commandArgs="" />
4949
5050 <!-- List/Find/Info -->
51- <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" />
52- <command commandId="fileinfo" commandPath="/system/xbin/stat" commandArgs="-t %1$s" />
53- <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 \\;" />
54- <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-" />
55- <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" />
51+ <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" />
52+ <command commandId="fileinfo" commandPath="/system/bin/stat" commandArgs="-t %1$s" />
53+ <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 \\;" />
54+ <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-" />
55+ <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" />
5656
5757 <!-- Operational -->
5858 <command commandId="chmod" commandPath="/system/bin/chmod" commandArgs="%1$s %2$s" />
5959 <command commandId="chown" commandPath="/system/bin/chown" commandArgs="%1$s.%2$s %3$s" />
60- <command commandId="cp" commandPath="/system/xbin/cp" commandArgs="-af %1$s %2$s" />
60+ <command commandId="cp" commandPath="/system/bin/cp" commandArgs="-af %1$s %2$s" />
6161 <command commandId="link" commandPath="/system/bin/ln" commandArgs="-s %1$s %2$s" />
6262 <command commandId="mkdir" commandPath="/system/bin/mkdir" commandArgs="-p %1$s" />
63- <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 )" />
63+ <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 )" />
6464 <command commandId="rm" commandPath="/system/bin/rm" commandArgs="%1$s" />
6565 <command commandId="rmdir" commandPath="/system/bin/rm" commandArgs="-R %1$s" />
6666
6767 <!-- Usage -->
68- <command commandId="diskusage" commandPath="/system/bin/df" commandArgs="%1$s" />
69- <command commandId="diskusageall" commandPath="/system/bin/df" commandArgs="" />
70- <command commandId="folderusage" commandPath="/system/xbin/busybox" commandArgs="ls -alR %1$s 2&gt; /dev/null" />
68+ <command commandId="diskusage" commandPath="/system/bin/df" commandArgs="-h %1$s" />
69+ <command commandId="diskusageall" commandPath="/system/bin/df" commandArgs="-h" />
70+ <command commandId="folderusage" commandPath="/system/bin/ls" commandArgs="-alR %1$s 2&gt; /dev/null" />
7171
7272 <!-- I/O -->
7373 <command commandId="read" commandPath="/system/bin/cat" commandArgs="%1$s" />
74- <command commandId="touch" commandPath="/system/xbin/echo" commandArgs="-n '' >> %1$s" />
74+ <command commandId="touch" commandPath="/system/bin/echo" commandArgs="-n '' >> %1$s" />
7575 <command commandId="write" commandPath="/system/bin/dd" commandArgs="bs=4k of=%1$s" />
7676
7777 <!-- Run -->
7878 <command commandId="exec" commandPath="/system/bin/sh" commandArgs="%1$s" />
7979
8080 <!-- Misc -->
81- <command commandId="dirname" commandPath="/system/xbin/dirname" commandArgs="%1$s" />
82- <command commandId="echo" commandPath="/system/xbin/echo" commandArgs="%1$s" />
83- <command commandId="checksum" commandPath="/system/xbin/md5sum" commandArgs="%1$s &amp;&amp; /system/xbin/sha1sum %1$s" />
81+ <command commandId="dirname" commandPath="/system/bin/dirname" commandArgs="%1$s" />
82+ <command commandId="echo" commandPath="/system/bin/echo" commandArgs="%1$s" />
83+ <command commandId="checksum" commandPath="/system/bin/md5sum" commandArgs="%1$s &amp;&amp; /system/bin/sha1sum %1$s" />
8484
8585 <!-- Process control and info -->
86- <command commandId="pid_shell" commandPath="/system/xbin/echo" commandArgs="$$" />
87- <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" />
88- <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}'" />
86+ <command commandId="pid_shell" commandPath="/system/bin/echo" commandArgs="$$" />
87+ <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" />
88+ <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" />
8989 <command commandId="sendsignal" commandPath="/system/bin/kill" commandArgs="-%1$s %2$s" />
9090 <command commandId="terminate" commandPath="/system/bin/kill" commandArgs="%1$s" />
9191
9292 <!-- Compress -->
93- <command commandId="tar" commandPath="/system/xbin/tar" commandArgs="-C%1$s -%2$scvf %3$s [@]" />
93+ <command commandId="tar" commandPath="/system/bin/tar" commandArgs="-C%1$s -%2$scvf %3$s [@]" />
9494 <command commandId="gzip" commandPath="/system/bin/gzip" commandArgs="%1$s" />
9595 <command commandId="bzip" commandPath="/system/xbin/bzip2" commandArgs="-f %1$s" />
9696 <command commandId="zip" commandPath="cd" commandArgs="%1$s &amp;&amp; ( /system/xbin/zip -9 -r -y %2$s [@] || cd /)" />
9797
9898 <!-- Uncompress -->
99- <command commandId="untar" commandPath="/system/bin/mkdir" commandArgs="-p %2$s &amp;&amp; /system/xbin/tar -C %2$s -%1$sxvf %3$s" />
99+ <command commandId="untar" commandPath="/system/bin/mkdir" commandArgs="-p %2$s &amp;&amp; /system/bin/tar -C %2$s -%1$sxvf %3$s" />
100100 <command commandId="unzip" commandPath="/system/bin/mkdir" commandArgs="-p %1$s &amp;&amp; /system/xbin/unzip -o %2$s -d %1$s" />
101101 <command commandId="gunzip" commandPath="/system/xbin/gunzip" commandArgs="-f %1$s" />
102- <command commandId="bunzip" commandPath="/system/xbin/bunzip2" commandArgs="-f %1$s" />
102+ <command commandId="bunzip" commandPath="/system/xbin/bzip2" commandArgs="-d -f %1$s" />
103103 <command commandId="unlzma" commandPath="/system/xbin/unlzma" commandArgs="-f %1$s" />
104104 <command commandId="uncompress" commandPath="/system/xbin/uncompress" commandArgs="-f %1$s" />
105105 <command commandId="unxz" commandPath="/system/xbin/unxz" commandArgs="-f %1$s" />
--- a/src/com/cyanogenmod/filemanager/util/ParseHelper.java
+++ b/src/com/cyanogenmod/filemanager/util/ParseHelper.java
@@ -254,13 +254,14 @@ public final class ParseHelper {
254254 */
255255 public static DiskUsage toDiskUsage(final String src) throws ParseException {
256256
257- // Filesystem Size Used Free Blksize
258- // /dev 414M 48K 414M 4096
259- // /mnt/asec 414M 0K 414M 4096
260- // /mnt/secure/asec: Permission denied
257+ // Filesystem Size Used Avail Use% Mounted on
258+ // tmpfs 1.3G 88K 1.3G 1% /dev
259+ // tmpfs 1.3G 0 1.3G 0% /mnt
260+ // /dev/block/mmcblk0p14 1.2G 966M 337M 75% /system
261+ // /dev/fuse 55G 18G 37G 34% /storage/emulated
261262
262263 try {
263- final int fields = 5;
264+ final int fields = 6;
264265
265266 //Permission denied or invalid statistics
266267 if (src.indexOf(":") != -1) { //$NON-NLS-1$
@@ -279,7 +280,7 @@ public final class ParseHelper {
279280 }
280281
281282 //Return the disk usage
282- return new DiskUsage(data[0], toBytes(data[1]), toBytes(data[2]), toBytes(data[3]));
283+ return new DiskUsage(data[5], toBytes(data[1]), toBytes(data[2]), toBytes(data[3]));
283284
284285 } catch (Exception e) {
285286 throw new ParseException(e.getMessage(), 0);
@@ -295,34 +296,38 @@ public final class ParseHelper {
295296 */
296297 public static MountPoint toMountPoint(final String src) throws ParseException {
297298
298- // rootfs / rootfs ro,relatime 0 0
299- // tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
300- // devpts /dev/pts devpts rw,relatime,mode=600 0 0
301- // /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
299+ // rootfs on / type rootfs (ro,seclabel,relatime)
300+ // tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,size=1460476k,nr_inodes=142719,mode=755)
301+ // devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
302+ // /dev/block/mmcblk0p14 on /system type ext4 (rw,seclabel,relatime,data=ordered)
302303
303304 try {
304305
305306 //Extract all the info
306307 String line = src;
307- int pos = line.lastIndexOf(" "); //$NON-NLS-1$
308- int pass = Integer.parseInt(line.substring(pos + 1));
309- line = line.substring(0, pos).trim();
310- pos = line.lastIndexOf(" "); //$NON-NLS-1$
311- int dump = Integer.parseInt(line.substring(pos + 1));
312- line = line.substring(0, pos).trim();
313- pos = line.indexOf(" "); //$NON-NLS-1$
308+ // Device
309+ int pos = line.indexOf(" "); //$NON-NLS-1$
314310 String device = line.substring(0, pos).trim();
315311 line = line.substring(pos).trim();
316- pos = line.lastIndexOf(" "); //$NON-NLS-1$
317- String options = line.substring(pos + 1).trim();
318- line = line.substring(0, pos).trim();
319- pos = line.lastIndexOf(" "); //$NON-NLS-1$
320- String type = line.substring(pos + 1).trim();
312+ // Skip "on"
313+ pos = line.indexOf(" "); //$NON-NLS-1$
314+ line = line.substring(pos).trim();
315+ // Mount point
316+ pos = line.indexOf(" "); //$NON-NLS-1$
321317 String mountPoint = line.substring(0, pos).trim();
322-
318+ line = line.substring(pos).trim();
319+ // Skip "type"
320+ pos = line.indexOf(" "); //$NON-NLS-1$
321+ line = line.substring(pos).trim();
322+ // Type
323+ pos = line.indexOf(" "); //$NON-NLS-1$
324+ String type = line.substring(0, pos).trim();
325+ line = line.substring(pos).trim();
326+ // Options
327+ String options = line.substring(1, line.length() - 1).trim();
323328
324329 //Return the mount point
325- return new MountPoint(mountPoint, device, type, options, dump, pass, false, false);
330+ return new MountPoint(mountPoint, device, type, options, /*dump*/0, /*pass*/0, false, false);
326331
327332 } catch (Exception e) {
328333 throw new ParseException(e.getMessage(), 0);
Afficher sur ancien navigateur de dépôt.