summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2014-08-26 19:28:57 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-26 19:28:57 +0000
commit2d509c01132cfa745b3fb2e40e67805cd0bc7f22 (patch)
tree1a7b7b71bbc1222a6e8984071ddb2e727f67641f /cmds
parentd3b6802cb7065cc46896869879cc414ffe98610c (diff)
parent7de2bde3c4c3a6ecc7e6f21e3f3322688b718c4a (diff)
downloadframeworks_native-2d509c01132cfa745b3fb2e40e67805cd0bc7f22.zip
frameworks_native-2d509c01132cfa745b3fb2e40e67805cd0bc7f22.tar.gz
frameworks_native-2d509c01132cfa745b3fb2e40e67805cd0bc7f22.tar.bz2
am 7de2bde3: Merge "Add vm_safe_mode to dexopt." into lmp-dev
* commit '7de2bde3c4c3a6ecc7e6f21e3f3322688b718c4a': Add vm_safe_mode to dexopt.
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c12
-rw-r--r--cmds/installd/installd.c9
-rw-r--r--cmds/installd/installd.h4
3 files changed, 15 insertions, 10 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index fd1d5bd..49d6934 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -674,7 +674,8 @@ static void run_patchoat(int input_fd, int oat_fd, const char* input_file_name,
}
static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
- const char* output_file_name, const char *pkgname, const char *instruction_set)
+ const char* output_file_name, const char *pkgname, const char *instruction_set,
+ bool vm_safe_mode)
{
static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;
@@ -766,6 +767,8 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
if (skip_compilation) {
strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=verify-none");
have_dex2oat_compiler_filter_flag = true;
+ } else if (vm_safe_mode) {
+ strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=interpret-only");
} else if (have_dex2oat_compiler_filter_flag) {
sprintf(dex2oat_compiler_filter_arg, "--compiler-filter=%s", dex2oat_compiler_filter_flag);
}
@@ -843,9 +846,9 @@ static int wait_child(pid_t pid)
}
}
-int dexopt(const char *apk_path, uid_t uid, int is_public,
+int dexopt(const char *apk_path, uid_t uid, bool is_public,
const char *pkgname, const char *instruction_set,
- int is_patchoat)
+ bool vm_safe_mode, bool is_patchoat)
{
struct utimbuf ut;
struct stat input_stat, dex_stat;
@@ -979,7 +982,8 @@ int dexopt(const char *apk_path, uid_t uid, int is_public,
if (is_patchoat) {
run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set);
} else {
- run_dex2oat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set);
+ run_dex2oat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set,
+ vm_safe_mode);
}
} else {
exit(69); /* Unexpected persist.sys.dalvik.vm.lib value */
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 746ce57..c06365d 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -38,8 +38,8 @@ static int do_install(char **arg, char reply[REPLY_MAX])
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], 0);
+ /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */
+ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0);
}
static int do_move_dex(char **arg, char reply[REPLY_MAX])
@@ -152,7 +152,8 @@ static int do_prune_dex_cache(char **arg __attribute__((unused)),
}
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);
+ /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */
+ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1);
}
struct cmdinfo {
@@ -164,7 +165,7 @@ struct cmdinfo {
struct cmdinfo cmds[] = {
{ "ping", 0, do_ping },
{ "install", 4, do_install },
- { "dexopt", 5, do_dexopt },
+ { "dexopt", 6, do_dexopt },
{ "movedex", 3, do_move_dex },
{ "rmdex", 2, do_rm_dex },
{ "remove", 2, do_remove },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index 9d420bd..c1d0148 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -216,8 +216,8 @@ int get_size(const char *pkgname, userid_t userid, const char *apkpath, const ch
const char *fwdlock_apkpath, const char *asecpath, const char *instruction_set,
int64_t *codesize, int64_t *datasize, int64_t *cachesize, int64_t *asecsize);
int free_cache(int64_t free_size);
-int dexopt(const char *apk_path, uid_t uid, int is_public, const char *pkgName,
- const char *instruction_set, int should_relocate);
+int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName,
+ const char *instruction_set, bool vm_safe_mode, bool should_relocate);
int movefiles();
int linklib(const char* target, const char* source, int userId);
int idmap(const char *target_path, const char *overlay_path, uid_t uid);