summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-06-29 14:05:01 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-29 14:05:01 -0700
commit2c22882181e867c9ba4e74ee973b87a71db3389f (patch)
tree6593873639d24d7fba98e9b7d9cad8f709bf8de9 /cmds
parent9e1fb41b4fbfbd190560cf48f24939703a13eca5 (diff)
parent292f8bc9d1b790ab975a87a842c7fabc908b97e0 (diff)
downloadframeworks_base-2c22882181e867c9ba4e74ee973b87a71db3389f.zip
frameworks_base-2c22882181e867c9ba4e74ee973b87a71db3389f.tar.gz
frameworks_base-2c22882181e867c9ba4e74ee973b87a71db3389f.tar.bz2
Merge "Plumb information from the framework about asec container size."
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c15
-rw-r--r--cmds/installd/installd.c8
-rw-r--r--cmds/installd/installd.h3
3 files changed, 20 insertions, 6 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index d45ac19..26b9113 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -288,8 +288,9 @@ int protect(char *pkgname, gid_t gid)
}
int get_size(const char *pkgname, const char *apkpath,
- const char *fwdlock_apkpath,
- int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize)
+ const char *fwdlock_apkpath, const char *asecpath,
+ int64_t *_codesize, int64_t *_datasize, int64_t *_cachesize,
+ int64_t* _asecsize)
{
DIR *d;
int dfd;
@@ -300,6 +301,7 @@ int get_size(const char *pkgname, const char *apkpath,
int64_t codesize = 0;
int64_t datasize = 0;
int64_t cachesize = 0;
+ int64_t asecsize = 0;
/* count the source apk as code -- but only if it's not
* on the /system partition and its not on the sdcard.
@@ -324,6 +326,14 @@ int get_size(const char *pkgname, const char *apkpath,
}
}
+ /* compute asec size if it is given
+ */
+ if (asecpath != NULL && asecpath[0] != '!') {
+ if (stat(asecpath, &s) == 0) {
+ asecsize += stat_size(&s);
+ }
+ }
+
if (create_pkg_path(path, pkgname, PKG_DIR_POSTFIX, 0)) {
goto done;
}
@@ -370,6 +380,7 @@ done:
*_codesize = codesize;
*_datasize = datasize;
*_cachesize = cachesize;
+ *_asecsize = asecsize;
return 0;
}
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index c062d36..feb6b92 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -77,16 +77,18 @@ static int do_get_size(char **arg, char reply[REPLY_MAX])
int64_t codesize = 0;
int64_t datasize = 0;
int64_t cachesize = 0;
+ int64_t asecsize = 0;
int res = 0;
/* pkgdir, apkpath */
- res = get_size(arg[0], arg[1], arg[2], &codesize, &datasize, &cachesize);
+ res = get_size(arg[0], arg[1], arg[2], arg[3], &codesize, &datasize, &cachesize, &asecsize);
/*
* Each int64_t can take up 22 characters printed out. Make sure it
* doesn't go over REPLY_MAX in the future.
*/
- snprintf(reply, REPLY_MAX, "%" PRId64 " %" PRId64 " %" PRId64, codesize, datasize, cachesize);
+ snprintf(reply, REPLY_MAX, "%" PRId64 " %" PRId64 " %" PRId64 " %" PRId64,
+ codesize, datasize, cachesize, asecsize);
return res;
}
@@ -137,7 +139,7 @@ struct cmdinfo cmds[] = {
{ "freecache", 1, do_free_cache },
{ "rmcache", 1, do_rm_cache },
{ "protect", 2, do_protect },
- { "getsize", 3, do_get_size },
+ { "getsize", 4, do_get_size },
{ "rmuserdata", 2, do_rm_user_data },
{ "movefiles", 0, do_movefiles },
{ "linklib", 2, do_linklib },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index e5f6739..c5872b8 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -143,7 +143,8 @@ 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, const char *apkpath, const char *fwdlock_apkpath,
- int64_t *codesize, int64_t *datasize, int64_t *cachesize);
+ 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();