Make system use patchoat to relocate during runtime.
Make installd understand a patchoat directive and carry it out.
Bug: 15358152
Change-Id: Ibe92d8b55a24bbf718b0416a21b76e5df7a2de26
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 35fba42..682aaff 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -39,7 +39,7 @@
static int do_dexopt(char **arg, char reply[REPLY_MAX])
{
/* apk_path, uid, is_public, pkgname, instruction_set */
- return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4]);
+ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0);
}
static int do_move_dex(char **arg, char reply[REPLY_MAX])
@@ -146,6 +146,10 @@
return prune_dex_cache(arg[0] /* subdirectory name */);
}
+static int do_patchoat(char **arg, char reply[REPLY_MAX]) {
+ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 1);
+}
+
struct cmdinfo {
const char *name;
unsigned numargs;
@@ -173,6 +177,7 @@
{ "idmap", 3, do_idmap },
{ "restorecondata", 3, do_restorecon_data },
{ "prunedexcache", 1, do_prune_dex_cache },
+ { "patchoat", 5, do_patchoat },
};
static int readx(int s, void *_buf, int count)