summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAndreas Gampe2015-03-03 11:15:06 -0600
committerAndreas Gampe2015-03-09 17:13:24 -0500
commit598c25e23f7c97470e09a2316513ddf2efdfb670 (patch)
tree39b9ed1fa44af89618400cb0f36e65d8f6f74102 /cmds
parent5fec79156d749322dcc0376da1d6cf4d9ee9ccf4 (diff)
downloadframeworks-native-598c25e23f7c97470e09a2316513ddf2efdfb670.tar.gz
frameworks-native-598c25e23f7c97470e09a2316513ddf2efdfb670.tar.xz
frameworks-native-598c25e23f7c97470e09a2316513ddf2efdfb670.zip
Installd: Pass debuggable flag
Pass the debuggable flag from the package manager to dex2oat. Change-Id: Id17ec72babe2ee88713a0d274eff86508de30666
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c17
-rw-r--r--cmds/installd/installd.c13
-rw-r--r--cmds/installd/installd.h2
3 files changed, 23 insertions, 9 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index 386d2f33a..8a31ca50d 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -698,7 +698,7 @@ static void run_patchoat(int input_fd, int oat_fd, const char* input_file_name,
698 698
699static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, 699static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
700 const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set, 700 const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set,
701 bool vm_safe_mode) 701 bool vm_safe_mode, bool debuggable)
702{ 702{
703 static const unsigned int MAX_INSTRUCTION_SET_LEN = 7; 703 static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;
704 704
@@ -816,6 +816,13 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
816 sprintf(dex2oat_compiler_filter_arg, "--compiler-filter=%s", dex2oat_compiler_filter_flag); 816 sprintf(dex2oat_compiler_filter_arg, "--compiler-filter=%s", dex2oat_compiler_filter_flag);
817 } 817 }
818 818
819 // Check whether all apps should be compiled debuggable.
820 if (!debuggable) {
821 debuggable =
822 (property_get("dalvik.vm.always_debuggable", prop_buf, "0") > 0) &&
823 (prop_buf[0] == '1');
824 }
825
819 ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name); 826 ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name);
820 827
821 const char* argv[7 // program name, mandatory arguments and the final NULL 828 const char* argv[7 // program name, mandatory arguments and the final NULL
@@ -828,6 +835,7 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
828 + (have_dex2oat_compiler_filter_flag ? 1 : 0) 835 + (have_dex2oat_compiler_filter_flag ? 1 : 0)
829 + (have_dex2oat_swap_fd ? 1 : 0) 836 + (have_dex2oat_swap_fd ? 1 : 0)
830 + (have_dex2oat_relocation_skip_flag ? 2 : 0) 837 + (have_dex2oat_relocation_skip_flag ? 2 : 0)
838 + (debuggable ? 1 : 0)
831 + dex2oat_flags_count]; 839 + dex2oat_flags_count];
832 int i = 0; 840 int i = 0;
833 argv[i++] = DEX2OAT_BIN; 841 argv[i++] = DEX2OAT_BIN;
@@ -862,6 +870,9 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
862 if (have_dex2oat_swap_fd) { 870 if (have_dex2oat_swap_fd) {
863 argv[i++] = dex2oat_swap_fd; 871 argv[i++] = dex2oat_swap_fd;
864 } 872 }
873 if (debuggable) {
874 argv[i++] = "--debuggable";
875 }
865 if (dex2oat_flags_count) { 876 if (dex2oat_flags_count) {
866 i += split(dex2oat_flags, argv + i); 877 i += split(dex2oat_flags, argv + i);
867 } 878 }
@@ -921,7 +932,7 @@ static bool ShouldUseSwapFileForDexopt() {
921 932
922int dexopt(const char *apk_path, uid_t uid, bool is_public, 933int dexopt(const char *apk_path, uid_t uid, bool is_public,
923 const char *pkgname, const char *instruction_set, 934 const char *pkgname, const char *instruction_set,
924 bool vm_safe_mode, bool is_patchoat) 935 bool vm_safe_mode, bool is_patchoat, bool debuggable)
925{ 936{
926 struct utimbuf ut; 937 struct utimbuf ut;
927 struct stat input_stat, dex_stat; 938 struct stat input_stat, dex_stat;
@@ -1069,7 +1080,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public,
1069 run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set); 1080 run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set);
1070 } else { 1081 } else {
1071 run_dex2oat(input_fd, out_fd, input_file, out_path, swap_fd, pkgname, instruction_set, 1082 run_dex2oat(input_fd, out_fd, input_file, out_path, swap_fd, pkgname, instruction_set,
1072 vm_safe_mode); 1083 vm_safe_mode, debuggable);
1073 } 1084 }
1074 exit(68); /* only get here on exec failure */ 1085 exit(68); /* only get here on exec failure */
1075 } else { 1086 } else {
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index 4dd83ae92..8f9417051 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -38,8 +38,10 @@ static int do_install(char **arg, char reply[REPLY_MAX] __unused)
38 38
39static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused) 39static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused)
40{ 40{
41 /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */ 41 /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate,
42 return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0); 42 debuggable */
43 return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), 0,
44 atoi(arg[6]));
43} 45}
44 46
45static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused) 47static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused)
@@ -151,8 +153,9 @@ static int do_restorecon_data(char **arg, char reply[REPLY_MAX] __attribute__((u
151} 153}
152 154
153static int do_patchoat(char **arg, char reply[REPLY_MAX] __unused) { 155static int do_patchoat(char **arg, char reply[REPLY_MAX] __unused) {
154 /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate */ 156 /* apk_path, uid, is_public, pkgname, instruction_set, vm_safe_mode, should_relocate,
155 return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1); 157 debuggable */
158 return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], 0, 1, 0);
156} 159}
157 160
158struct cmdinfo { 161struct cmdinfo {
@@ -164,7 +167,7 @@ struct cmdinfo {
164struct cmdinfo cmds[] = { 167struct cmdinfo cmds[] = {
165 { "ping", 0, do_ping }, 168 { "ping", 0, do_ping },
166 { "install", 4, do_install }, 169 { "install", 4, do_install },
167 { "dexopt", 6, do_dexopt }, 170 { "dexopt", 7, do_dexopt },
168 { "markbootcomplete", 1, do_mark_boot_complete }, 171 { "markbootcomplete", 1, do_mark_boot_complete },
169 { "movedex", 3, do_move_dex }, 172 { "movedex", 3, do_move_dex },
170 { "rmdex", 2, do_rm_dex }, 173 { "rmdex", 2, do_rm_dex },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index a9a19995e..47577d60f 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -220,7 +220,7 @@ int get_size(const char *pkgname, userid_t userid, const char *apkpath, const ch
220 int64_t *codesize, int64_t *datasize, int64_t *cachesize, int64_t *asecsize); 220 int64_t *codesize, int64_t *datasize, int64_t *cachesize, int64_t *asecsize);
221int free_cache(int64_t free_size); 221int free_cache(int64_t free_size);
222int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName, 222int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName,
223 const char *instruction_set, bool vm_safe_mode, bool should_relocate); 223 const char *instruction_set, bool vm_safe_mode, bool should_relocate, bool debuggable);
224int mark_boot_complete(const char *instruction_set); 224int mark_boot_complete(const char *instruction_set);
225int movefiles(); 225int movefiles();
226int linklib(const char* target, const char* source, int userId); 226int linklib(const char* target, const char* source, int userId);