summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2015-04-09 13:10:03 -0700
committerJeff Sharkey <jsharkey@android.com>2015-04-09 14:15:55 -0700
commit6fe28a06012250da85f808a0869f87e06e0bcce9 (patch)
treebe179fe50437f3872939e4f351ac6c174bd1ab34 /cmds
parent066fadb983b117a7682af00780d23d16232ab0e2 (diff)
downloadframeworks_native-6fe28a06012250da85f808a0869f87e06e0bcce9.zip
frameworks_native-6fe28a06012250da85f808a0869f87e06e0bcce9.tar.gz
frameworks_native-6fe28a06012250da85f808a0869f87e06e0bcce9.tar.bz2
Start accepting volume UUIDs from framework.
We're now parsing and passing through volume UUIDs sent across the command socket. The "!" argument value is treated as null, which means internal storage. Bug: 19993667 Change-Id: I17729a769ce687a2e94e85991a6338c77ded0b66
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.cpp3
-rw-r--r--cmds/installd/installd.cpp64
-rw-r--r--cmds/installd/installd.h2
3 files changed, 38 insertions, 31 deletions
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index ea59f5b..32a03f4 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -1542,8 +1542,7 @@ fail:
return -1;
}
-// TODO: extend to know about other volumes
-int restorecon_data(const char* uuid __attribute__((unused)), const char* pkgName,
+int restorecon_data(const char* uuid, const char* pkgName,
const char* seinfo, uid_t uid)
{
struct dirent *entry;
diff --git a/cmds/installd/installd.cpp b/cmds/installd/installd.cpp
index b98fd05..0f035d0 100644
--- a/cmds/installd/installd.cpp
+++ b/cmds/installd/installd.cpp
@@ -26,6 +26,14 @@
#define TOKEN_MAX 16 /* max number of arguments in buffer */
#define REPLY_MAX 256 /* largest reply allowed */
+static char* parse_null(char* arg) {
+ if (strcmp(arg, "!") == 0) {
+ return nullptr;
+ } else {
+ return arg;
+ }
+}
+
static int do_ping(char **arg __unused, char reply[REPLY_MAX] __unused)
{
return 0;
@@ -33,7 +41,7 @@ static int do_ping(char **arg __unused, char reply[REPLY_MAX] __unused)
static int do_install(char **arg, char reply[REPLY_MAX] __unused)
{
- return install(nullptr, arg[0], atoi(arg[1]), atoi(arg[2]), arg[3]); /* pkgname, uid, gid, seinfo */
+ return install(parse_null(arg[0]), arg[1], atoi(arg[2]), atoi(arg[3]), arg[4]); /* uuid, pkgname, uid, gid, seinfo */
}
static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused)
@@ -61,7 +69,7 @@ static int do_rm_dex(char **arg, char reply[REPLY_MAX] __unused)
static int do_remove(char **arg, char reply[REPLY_MAX] __unused)
{
- return uninstall(nullptr, arg[0], atoi(arg[1])); /* pkgname, userid */
+ return uninstall(parse_null(arg[0]), arg[1], atoi(arg[2])); /* uuid, pkgname, userid */
}
static int do_rename(char **arg, char reply[REPLY_MAX] __unused)
@@ -71,22 +79,22 @@ static int do_rename(char **arg, char reply[REPLY_MAX] __unused)
static int do_fixuid(char **arg, char reply[REPLY_MAX] __unused)
{
- return fix_uid(nullptr, arg[0], atoi(arg[1]), atoi(arg[2])); /* pkgname, uid, gid */
+ return fix_uid(parse_null(arg[0]), arg[1], atoi(arg[2]), atoi(arg[3])); /* uuid, pkgname, uid, gid */
}
static int do_free_cache(char **arg, char reply[REPLY_MAX] __unused) /* TODO int:free_size */
{
- return free_cache(nullptr, (int64_t)atoll(arg[0])); /* free_size */
+ return free_cache(parse_null(arg[0]), (int64_t)atoll(arg[1])); /* uuid, free_size */
}
static int do_rm_cache(char **arg, char reply[REPLY_MAX] __unused)
{
- return delete_cache(nullptr, arg[0], atoi(arg[1])); /* pkgname, userid */
+ return delete_cache(parse_null(arg[0]), arg[1], atoi(arg[2])); /* uuid, pkgname, userid */
}
static int do_rm_code_cache(char **arg, char reply[REPLY_MAX] __unused)
{
- return delete_code_cache(nullptr, arg[0], atoi(arg[1])); /* pkgname, userid */
+ return delete_code_cache(parse_null(arg[0]), arg[1], atoi(arg[2])); /* uuid, pkgname, userid */
}
static int do_get_size(char **arg, char reply[REPLY_MAX])
@@ -97,9 +105,9 @@ static int do_get_size(char **arg, char reply[REPLY_MAX])
int64_t asecsize = 0;
int res = 0;
- /* pkgdir, userid, apkpath */
- res = get_size(nullptr, arg[0], atoi(arg[1]), arg[2], arg[3], arg[4], arg[5],
- arg[6], &codesize, &datasize, &cachesize, &asecsize);
+ /* uuid, pkgdir, userid, apkpath */
+ res = get_size(parse_null(arg[0]), arg[1], atoi(arg[2]), arg[3], arg[4], arg[5], arg[6],
+ arg[7], &codesize, &datasize, &cachesize, &asecsize);
/*
* Each int64_t can take up 22 characters printed out. Make sure it
@@ -112,13 +120,13 @@ static int do_get_size(char **arg, char reply[REPLY_MAX])
static int do_rm_user_data(char **arg, char reply[REPLY_MAX] __unused)
{
- return delete_user_data(nullptr, arg[0], atoi(arg[1])); /* pkgname, userid */
+ return delete_user_data(parse_null(arg[0]), arg[1], atoi(arg[2])); /* uuid, pkgname, userid */
}
static int do_mk_user_data(char **arg, char reply[REPLY_MAX] __unused)
{
- return make_user_data(nullptr, arg[0], atoi(arg[1]), atoi(arg[2]), arg[3]);
- /* pkgname, uid, userid, seinfo */
+ return make_user_data(parse_null(arg[0]), arg[1], atoi(arg[2]), atoi(arg[3]), arg[4]);
+ /* uuid, pkgname, uid, userid, seinfo */
}
static int do_mk_user_config(char **arg, char reply[REPLY_MAX] __unused)
@@ -128,7 +136,7 @@ static int do_mk_user_config(char **arg, char reply[REPLY_MAX] __unused)
static int do_rm_user(char **arg, char reply[REPLY_MAX] __unused)
{
- return delete_user(nullptr, atoi(arg[0])); /* userid */
+ return delete_user(parse_null(arg[0]), atoi(arg[1])); /* uuid, userid */
}
static int do_movefiles(char **arg __unused, char reply[REPLY_MAX] __unused)
@@ -138,7 +146,7 @@ static int do_movefiles(char **arg __unused, char reply[REPLY_MAX] __unused)
static int do_linklib(char **arg, char reply[REPLY_MAX] __unused)
{
- return linklib(nullptr, arg[0], arg[1], atoi(arg[2]));
+ return linklib(parse_null(arg[0]), arg[1], arg[2], atoi(arg[3]));
}
static int do_idmap(char **arg, char reply[REPLY_MAX] __unused)
@@ -148,8 +156,8 @@ static int do_idmap(char **arg, char reply[REPLY_MAX] __unused)
static int do_restorecon_data(char **arg, char reply[REPLY_MAX] __attribute__((unused)))
{
- return restorecon_data(nullptr, arg[0], arg[1], atoi(arg[2]));
- /* pkgName, seinfo, uid*/
+ return restorecon_data(parse_null(arg[0]), arg[1], arg[2], atoi(arg[3]));
+ /* uuid, pkgName, seinfo, uid*/
}
static int do_create_oat_dir(char **arg, char reply[REPLY_MAX] __unused)
@@ -172,26 +180,26 @@ struct cmdinfo {
struct cmdinfo cmds[] = {
{ "ping", 0, do_ping },
- { "install", 4, do_install },
+ { "install", 5, do_install },
{ "dexopt", 9, do_dexopt },
{ "markbootcomplete", 1, do_mark_boot_complete },
{ "movedex", 3, do_move_dex },
{ "rmdex", 2, do_rm_dex },
- { "remove", 2, do_remove },
+ { "remove", 3, do_remove },
{ "rename", 2, do_rename },
- { "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 },
+ { "fixuid", 4, do_fixuid },
+ { "freecache", 2, do_free_cache },
+ { "rmcache", 3, do_rm_cache },
+ { "rmcodecache", 3, do_rm_code_cache },
+ { "getsize", 8, do_get_size },
+ { "rmuserdata", 3, do_rm_user_data },
{ "movefiles", 0, do_movefiles },
- { "linklib", 3, do_linklib },
- { "mkuserdata", 4, do_mk_user_data },
+ { "linklib", 4, do_linklib },
+ { "mkuserdata", 5, do_mk_user_data },
{ "mkuserconfig", 1, do_mk_user_config },
- { "rmuser", 1, do_rm_user },
+ { "rmuser", 2, do_rm_user },
{ "idmap", 3, do_idmap },
- { "restorecondata", 3, do_restorecon_data },
+ { "restorecondata", 4, do_restorecon_data },
{ "createoatdir", 2, do_create_oat_dir },
{ "rmpackagedir", 1, do_rm_package_dir},
};
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index 053de26..395d0ea 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -231,7 +231,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName,
bool debuggable, const char* oat_dir);
int mark_boot_complete(const char *instruction_set);
int movefiles();
-int linklib(const char *uuid, const char* target, const char* source, int userId);
+int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId);
int idmap(const char *target_path, const char *overlay_path, uid_t uid);
int restorecon_data(const char *uuid, const char* pkgName, const char* seinfo, uid_t uid);
int create_oat_dir(const char* oat_dir, const char *instruction_set);