Fix issue #8768456: Settings > App Info under reports...

...app storage size for apps w/ .so files

The lib directories are tagged with the apk install number,
so must be explicitly passed down to installd.

Change-Id: Iae8815afd6ba964f5b2ed86a0d04a91827391ed6
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index e544be7..8e14a2c 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -421,7 +421,7 @@
 }
 
 int get_size(const char *pkgname, int persona, const char *apkpath,
-             const char *fwdlock_apkpath, const char *asecpath,
+             const char *libdirpath, const char *fwdlock_apkpath, const char *asecpath,
              int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize,
              int64_t* _asecsize)
 {
@@ -460,8 +460,8 @@
     }
 
         /* add in size of any libraries */
-    if (!create_pkg_path_in_dir(path, &android_app_lib_dir, pkgname, PKG_DIR_POSTFIX)) {
-        d = opendir(path);
+    if (libdirpath != NULL && libdirpath[0] != '!') {
+        d = opendir(libdirpath);
         if (d != NULL) {
             dfd = dirfd(d);
             codesize += calculate_dir_size(dfd);
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 230899b..c918633 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -84,7 +84,7 @@
     int res = 0;
 
         /* pkgdir, persona, apkpath */
-    res = get_size(arg[0], atoi(arg[1]), arg[2], arg[3], arg[4],
+    res = get_size(arg[0], atoi(arg[1]), arg[2], arg[3], arg[4], arg[5],
             &codesize, &datasize, &cachesize, &asecsize);
 
     /*
@@ -138,7 +138,7 @@
     { "fixuid",               3, do_fixuid },
     { "freecache",            1, do_free_cache },
     { "rmcache",              2, do_rm_cache },
-    { "getsize",              5, do_get_size },
+    { "getsize",              6, do_get_size },
     { "rmuserdata",           2, do_rm_user_data },
     { "movefiles",            0, do_movefiles },
     { "linklib",              3, do_linklib },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index 033d5a3..fbfc876 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -203,9 +203,9 @@
 int move_dex(const char *src, const char *dst);
 int rm_dex(const char *path);
 int protect(char *pkgname, gid_t gid);
-int get_size(const char *pkgname, int persona, const char *apkpath, const char *fwdlock_apkpath,
-             const char *asecpath, int64_t *codesize, int64_t *datasize, int64_t *cachesize,
-             int64_t *asecsize);
+int get_size(const char *pkgname, int persona, const char *apkpath, const char *libdirpath,
+             const char *fwdlock_apkpath, const char *asecpath, int64_t *codesize,
+             int64_t *datasize, int64_t *cachesize, int64_t *asecsize);
 int free_cache(int64_t free_size);
 int dexopt(const char *apk_path, uid_t uid, int is_public);
 int movefiles();