summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorAndreas Gampe2015-03-09 21:10:06 -0500
committerAndroid Git Automerger2015-03-09 21:10:06 -0500
commit1fc747d20c1a390e1de3d482d2eafde6dc7e6236 (patch)
tree1c364bd764c86b80f3a31c39d3da12a994c7a2e1 /cmds
parentb275b4dc3e5dcbae1e171bd51165a93f16332ef4 (diff)
parent5a25a63de2693177b15817fb19b684ca7bfec582 (diff)
downloadframeworks-native-1fc747d20c1a390e1de3d482d2eafde6dc7e6236.tar.gz
frameworks-native-1fc747d20c1a390e1de3d482d2eafde6dc7e6236.tar.xz
frameworks-native-1fc747d20c1a390e1de3d482d2eafde6dc7e6236.zip
am 5a25a63d: Merge "Installd: Pass debuggable flag"
* commit '5a25a63de2693177b15817fb19b684ca7bfec582': Installd: Pass debuggable flag
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 44c4988d8..d9376e1fe 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -699,7 +699,7 @@ static void run_patchoat(int input_fd, int oat_fd, const char* input_file_name,
699 699
700static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, 700static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
701 const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set, 701 const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set,
702 bool vm_safe_mode) 702 bool vm_safe_mode, bool debuggable)
703{ 703{
704 static const unsigned int MAX_INSTRUCTION_SET_LEN = 7; 704 static const unsigned int MAX_INSTRUCTION_SET_LEN = 7;
705 705
@@ -817,6 +817,13 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
817 sprintf(dex2oat_compiler_filter_arg, "--compiler-filter=%s", dex2oat_compiler_filter_flag); 817 sprintf(dex2oat_compiler_filter_arg, "--compiler-filter=%s", dex2oat_compiler_filter_flag);
818 } 818 }
819 819
820 // Check whether all apps should be compiled debuggable.
821 if (!debuggable) {
822 debuggable =
823 (property_get("dalvik.vm.always_debuggable", prop_buf, "0") > 0) &&
824 (prop_buf[0] == '1');
825 }
826
820 ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name); 827 ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name);
821 828
822 const char* argv[7 // program name, mandatory arguments and the final NULL 829 const char* argv[7 // program name, mandatory arguments and the final NULL
@@ -829,6 +836,7 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
829 + (have_dex2oat_compiler_filter_flag ? 1 : 0) 836 + (have_dex2oat_compiler_filter_flag ? 1 : 0)
830 + (have_dex2oat_swap_fd ? 1 : 0) 837 + (have_dex2oat_swap_fd ? 1 : 0)
831 + (have_dex2oat_relocation_skip_flag ? 2 : 0) 838 + (have_dex2oat_relocation_skip_flag ? 2 : 0)
839 + (debuggable ? 1 : 0)
832 + dex2oat_flags_count]; 840 + dex2oat_flags_count];
833 int i = 0; 841 int i = 0;
834 argv[i++] = DEX2OAT_BIN; 842 argv[i++] = DEX2OAT_BIN;
@@ -863,6 +871,9 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name,
863 if (have_dex2oat_swap_fd) { 871 if (have_dex2oat_swap_fd) {
864 argv[i++] = dex2oat_swap_fd; 872 argv[i++] = dex2oat_swap_fd;
865 } 873 }
874 if (debuggable) {
875 argv[i++] = "--debuggable";
876 }
866 if (dex2oat_flags_count) { 877 if (dex2oat_flags_count) {
867 i += split(dex2oat_flags, argv + i); 878 i += split(dex2oat_flags, argv + i);
868 } 879 }
@@ -922,7 +933,7 @@ static bool ShouldUseSwapFileForDexopt() {
922 933
923int dexopt(const char *apk_path, uid_t uid, bool is_public, 934int dexopt(const char *apk_path, uid_t uid, bool is_public,
924 const char *pkgname, const char *instruction_set, 935 const char *pkgname, const char *instruction_set,
925 bool vm_safe_mode, bool is_patchoat) 936 bool vm_safe_mode, bool is_patchoat, bool debuggable)
926{ 937{
927 struct utimbuf ut; 938 struct utimbuf ut;
928 struct stat input_stat, dex_stat; 939 struct stat input_stat, dex_stat;
@@ -1074,7 +1085,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public,
1074 run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set); 1085 run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set);
1075 } else { 1086 } else {
1076 run_dex2oat(input_fd, out_fd, input_file, out_path, swap_fd, pkgname, instruction_set, 1087 run_dex2oat(input_fd, out_fd, input_file, out_path, swap_fd, pkgname, instruction_set,
1077 vm_safe_mode); 1088 vm_safe_mode, debuggable);
1078 } 1089 }
1079 exit(68); /* only get here on exec failure */ 1090 exit(68); /* only get here on exec failure */
1080 } else { 1091 } 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);