Commit 5a3f8ea4 authored by Geoff Brown's avatar Geoff Brown
Browse files

Bug 853502 - Add df output to sutagent device info; r=jmaher DONTBUILD

parent de8429e6
Loading
Loading
Loading
Loading
+22 −6
Original line number Diff line number Diff line
@@ -441,6 +441,12 @@ public class DoCommand {
                    strReturn += GetProcessInfo();
                    strReturn += "\n";
                    strReturn += GetSutUserInfo();
                    strReturn += "\n";
                    strReturn += GetDiskInfo("/data");
                    strReturn += "\n";
                    strReturn += GetDiskInfo("/system");
                    strReturn += "\n";
                    strReturn += GetDiskInfo("/mnt/sdcard");
                    }
                else
                    {
@@ -495,6 +501,15 @@ public class DoCommand {
                            strReturn += GetTemperatureInfo();
                            break;

                        case DISK:
                            strReturn += "\n";
                            strReturn += GetDiskInfo("/data");
                            strReturn += "\n";
                            strReturn += GetDiskInfo("/system");
                            strReturn += "\n";
                            strReturn += GetDiskInfo("/mnt/sdcard");
                            break;

                        default:
                            break;
                        }
@@ -2670,18 +2685,19 @@ private void CancelNotification()
        return "Temperature: " + sTempVal;
        }

    // todo
    public String GetDiskInfo(String sPath)
        {
        String sRet = "";
        StatFs statFS = new StatFs(sPath);

        int nBlockCount = statFS.getBlockCount();
        int nBlockSize = statFS.getBlockSize();
        int nBlocksAvail = statFS.getAvailableBlocks();
        int nBlocksFree = statFS.getFreeBlocks();
        long nBlockCount = statFS.getBlockCount();
        long nBlockSize = statFS.getBlockSize();
        long nBlocksAvail = statFS.getAvailableBlocks();
        // Free is often the same as Available, but can include reserved
        // blocks that are not available to normal applications.
        // long nBlocksFree = statFS.getFreeBlocks();

        sRet = "total:     " + (nBlockCount * nBlockSize) + "\nfree:      " + (nBlocksFree * nBlockSize) + "\navailable: " + (nBlocksAvail * nBlockSize);
        sRet = sPath + ": " + (nBlockCount * nBlockSize) + " total, " + (nBlocksAvail * nBlockSize) + " available";

        return (sRet);
        }