summaryrefslogtreecommitdiff
path: root/cmds/installd/installd.cpp
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2016-03-20 11:30:28 -0700
committer Andreas Gampe <agampe@google.com> 2016-03-23 14:49:57 -0700
commit4d0f825dd76a1972a3d081e771cde28513a1c6ff (patch)
tree9fd34dab18181c683713bd63a84c699d50658de2 /cmds/installd/installd.cpp
parentd97e18c038f23cecbe3d5e95fabf4dcd2bfaac20 (diff)
Installd: Separate profile merging and compilation
Create a new merge_profiles command to check and merge profiles. (Almost) always pass a profile to a dexopt pass. Require compilation filter input to dexopt and use it for dex2oat (except for hard overrides like safe-mode). Bug: 27689078 Change-Id: I1257857cc15c17e2271d1261ea4cc80752270fcb
Diffstat (limited to 'cmds/installd/installd.cpp')
-rw-r--r--cmds/installd/installd.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/cmds/installd/installd.cpp b/cmds/installd/installd.cpp
index 2bf27a2f04..dc3418a6a3 100644
--- a/cmds/installd/installd.cpp
+++ b/cmds/installd/installd.cpp
@@ -258,10 +258,27 @@ static int do_dexopt(char **arg, char reply[REPLY_MAX])
if ((dexopt_flags & DEXOPT_OTA) != 0) {
return do_ota_dexopt(arg, reply);
}
- /* apk_path, uid, pkgname, instruction_set, dexopt_needed, oat_dir, dexopt_flags, volume_uuid,
- use_profiles */
- return dexopt(arg[0], atoi(arg[1]), arg[2], arg[3], atoi(arg[4]),
- arg[5], dexopt_flags, parse_null(arg[7]), (atoi(arg[8]) == 0 ? false : true));
+ return dexopt(arg[0], // apk_path
+ atoi(arg[1]), // uid
+ arg[2], // pkgname
+ arg[3], // instruction_set
+ atoi(arg[4]), // dexopt_needed
+ arg[5], // oat_dir
+ dexopt_flags,
+ arg[7], // compiler_filter
+ parse_null(arg[8])); // volume_uuid
+}
+
+static int do_merge_profiles(char **arg, char reply[REPLY_MAX])
+{
+ uid_t uid = static_cast<uid_t>(atoi(arg[0]));
+ const char* pkgname = arg[1];
+ if (merge_profiles(uid, pkgname)) {
+ strncpy(reply, "true", REPLY_MAX);
+ } else {
+ strncpy(reply, "false", REPLY_MAX);
+ }
+ return 0;
}
static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] ATTRIBUTE_UNUSED)
@@ -388,6 +405,7 @@ struct cmdinfo cmds[] = {
{ "rmprofiles", 1, do_rm_profiles },
{ "linkfile", 3, do_link_file },
{ "move_ab", 3, do_move_ab },
+ { "merge_profiles", 2, do_merge_profiles },
};
static int readx(int s, void *_buf, int count)