summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2014-07-15 21:49:51 -0700
committerJeff Sharkey <jsharkey@android.com>2014-07-15 21:49:51 -0700
commitc796b681e52fbb792da9a5b4f30e935cc927c1d7 (patch)
tree9a950878af859787584debb9c9617809e1db53d1 /cmds
parent7869e224aaaf717b5ab86df00b60fd5be5a0996c (diff)
downloadframeworks_native-c796b681e52fbb792da9a5b4f30e935cc927c1d7.zip
frameworks_native-c796b681e52fbb792da9a5b4f30e935cc927c1d7.tar.gz
frameworks_native-c796b681e52fbb792da9a5b4f30e935cc927c1d7.tar.bz2
Offer to delete code cache directories.
Bug: 16187224 Change-Id: Ia860b051a34ffdfb4f6e0ea19f90cb73509c4eee
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c13
-rw-r--r--cmds/installd/installd.c6
-rw-r--r--cmds/installd/installd.h2
3 files changed, 20 insertions, 1 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 41a8f30..ba8edf2 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -310,10 +310,21 @@ int delete_cache(const char *pkgname, userid_t userid)
if (create_pkg_path(cachedir, pkgname, CACHE_DIR_POSTFIX, userid))
return -1;
- /* delete contents, not the directory, no exceptions */
+ /* delete contents, not the directory, no exceptions */
return delete_dir_contents(cachedir, 0, NULL);
}
+int delete_code_cache(const char *pkgname, userid_t userid)
+{
+ char codecachedir[PKG_PATH_MAX];
+
+ if (create_pkg_path(codecachedir, pkgname, CODE_CACHE_DIR_POSTFIX, userid))
+ return -1;
+
+ /* delete contents, not the directory, no exceptions */
+ return delete_dir_contents(codecachedir, 0, NULL);
+}
+
/* Try to ensure free_size bytes of storage are available.
* Returns 0 on success.
* This is rather simple-minded because doing a full LRU would
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index e072d0d..3be72a4 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -77,6 +77,11 @@ static int do_rm_cache(char **arg, char reply[REPLY_MAX])
return delete_cache(arg[0], atoi(arg[1])); /* pkgname, userid */
}
+static int do_rm_code_cache(char **arg, char reply[REPLY_MAX])
+{
+ return delete_code_cache(arg[0], atoi(arg[1])); /* pkgname, userid */
+}
+
static int do_get_size(char **arg, char reply[REPLY_MAX])
{
int64_t codesize = 0;
@@ -163,6 +168,7 @@ struct cmdinfo cmds[] = {
{ "fixuid", 3, do_fixuid },
{ "freecache", 1, do_free_cache },
{ "rmcache", 2, do_rm_cache },
+ { "rmcodecache", 2, do_rm_code_cache },
{ "getsize", 7, do_get_size },
{ "rmuserdata", 2, do_rm_user_data },
{ "movefiles", 0, do_movefiles },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index 258647a..7a5da98 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -59,6 +59,7 @@
#define PKG_LIB_POSTFIX "/lib"
#define CACHE_DIR_POSTFIX "/cache"
+#define CODE_CACHE_DIR_POSTFIX "/code_cache"
#define APP_SUBDIR "app/" // sub-directory under ANDROID_DATA
@@ -207,6 +208,7 @@ int make_user_data(const char *pkgname, uid_t uid, userid_t userid, const char*
int make_user_config(userid_t userid);
int delete_user(userid_t userid);
int delete_cache(const char *pkgname, userid_t userid);
+int delete_code_cache(const char *pkgname, userid_t userid);
int move_dex(const char *src, const char *dst, const char *instruction_set);
int rm_dex(const char *path, const char *instruction_set);
int protect(char *pkgname, gid_t gid);