Add an lshal command.
am: 85dd3ad89f

Change-Id: I43be1cd548f30d7d6e954411fc3db8b13e20f3c0
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index ee2b275..64f7b82 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -1243,7 +1243,7 @@
             fflush(stdout);
             int outFd = STDOUT_FILENO;
             if (g_outputFile) {
-                outFd = open(g_outputFile, O_WRONLY | O_CREAT);
+                outFd = open(g_outputFile, O_WRONLY | O_CREAT, 0644);
             }
             if (outFd == -1) {
                 printf("Failed to open '%s', err=%d", g_outputFile, errno);
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 914eaae..cdef7e1 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -1184,6 +1184,7 @@
         return;
     }
     while ((p = fts_read(fts)) != NULL) {
+        p->fts_number = p->fts_parent->fts_number;
         switch (p->fts_info) {
         case FTS_D:
             if (p->fts_level == 4
@@ -1192,7 +1193,6 @@
                     && !strcmp(p->fts_parent->fts_parent->fts_parent->fts_name, "Android")) {
                 p->fts_number = 1;
             }
-            p->fts_number = p->fts_parent->fts_number;
             // Fall through to count the directory
         case FTS_DEFAULT:
         case FTS_F:
@@ -1296,9 +1296,9 @@
             ATRACE_END();
 
             ATRACE_BEGIN("external");
-            auto extPath = create_data_media_package_path(uuid_, userId, pkgname, "data");
+            auto extPath = create_data_media_package_path(uuid_, userId, "data", pkgname);
             collectManualStats(extPath, &extStats);
-            auto mediaPath = create_data_media_package_path(uuid_, userId, pkgname, "media");
+            auto mediaPath = create_data_media_package_path(uuid_, userId, "media", pkgname);
             calculate_tree_size(mediaPath, &extStats.dataSize);
             ATRACE_END();
         }