Support for storing OAT files in app directory
Changes to installd:
- dexopt now allows oat_dir param for custom output directory
- Added helper method calculate_oat_file_path for calculating oat file
output location based on oat_dir and apk_path.
Bug: 19550105
Change-Id: I6b079207310583adeb6dad918a58034a059e34c4
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 8f94170..5b71175 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -23,7 +23,7 @@
#define BUFFER_MAX 1024 /* input buffer for commands */
-#define TOKEN_MAX 8 /* max number of arguments in buffer */
+#define TOKEN_MAX 16 /* max number of arguments in buffer */
#define REPLY_MAX 256 /* largest reply allowed */
static int do_ping(char **arg __unused, char reply[REPLY_MAX] __unused)
@@ -38,10 +38,10 @@
static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused)
{
- /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate,
- debuggable */
- return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0,
- atoi(arg[6]));
+ /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate
+ debuggable, outputPath */
+ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0,
+ atoi(arg[6]), arg[7]);
}
static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused)
@@ -154,8 +154,20 @@
static int do_patchoat(char **arg, char reply[REPLY_MAX] __unused) {
/* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate,
- debuggable */
- return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1, 0);
+ debuggable, outputPath */
+ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1, 0, "!");
+}
+
+static int do_create_oat_dir(char **arg, char reply[REPLY_MAX] __unused)
+{
+ /* oat_dir, instruction_set */
+ return create_oat_dir(arg[0], arg[1]);
+}
+
+static int do_rm_package_dir(char **arg, char reply[REPLY_MAX] __unused)
+{
+ /* oat_dir */
+ return rm_package_dir(arg[0]);
}
struct cmdinfo {
@@ -167,7 +179,7 @@
struct cmdinfo cmds[] = {
{ "ping", 0, do_ping },
{ "install", 4, do_install },
- { "dexopt", 7, do_dexopt },
+ { "dexopt", 8, do_dexopt },
{ "markbootcomplete", 1, do_mark_boot_complete },
{ "movedex", 3, do_move_dex },
{ "rmdex", 2, do_rm_dex },
@@ -187,6 +199,8 @@
{ "idmap", 3, do_idmap },
{ "restorecondata", 3, do_restorecon_data },
{ "patchoat", 5, do_patchoat },
+ { "createoatdir", 2, do_create_oat_dir },
+ { "rmpackagedir", 1, do_rm_package_dir},
};
static int readx(int s, void *_buf, int count)