Loading cmds/installd/Android.mk +10 −23 Original line number Original line Diff line number Diff line LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir) common_src_files := \ common_src_files := commands.c utils.c commands.c utils.c common_cflags := -Wall -Werror # # # Static library used in testing and executable # Static library used in testing and executable # # include $(CLEAR_VARS) include $(CLEAR_VARS) LOCAL_SRC_FILES := \ $(common_src_files) LOCAL_MODULE := libinstalld LOCAL_MODULE := libinstalld LOCAL_MODULE_TAGS := eng tests LOCAL_MODULE_TAGS := eng tests LOCAL_SRC_FILES := $(common_src_files) LOCAL_CFLAGS := $(common_cflags) LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY) # # Loading @@ -23,21 +20,11 @@ include $(BUILD_STATIC_LIBRARY) # # include $(CLEAR_VARS) include $(CLEAR_VARS) LOCAL_SRC_FILES := \ installd.c \ $(common_src_files) LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ libselinux LOCAL_STATIC_LIBRARIES := \ libdiskusage LOCAL_MODULE := installd LOCAL_MODULE := installd LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional LOCAL_CFLAGS := $(common_cflags) LOCAL_SRC_FILES := installd.c $(common_src_files) LOCAL_SHARED_LIBRARIES := libcutils liblog libselinux LOCAL_STATIC_LIBRARIES := libdiskusage LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE) cmds/installd/commands.c +30 −8 Original line number Original line Diff line number Diff line Loading @@ -625,18 +625,22 @@ static void run_dexopt(int zip_fd, int odex_fd, const char* input_file_name, static void run_dex2oat(int zip_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) { { char prop_buf[PROPERTY_VALUE_MAX]; bool profiler = (property_get("dalvik.vm.profiler", prop_buf, "0") > 0) && (prop_buf[0] == '1'); char dex2oat_Xms_flag[PROPERTY_VALUE_MAX]; bool have_dex2oat_Xms_flag = property_get("dalvik.vm.dex2oat-Xms", dex2oat_Xms_flag, NULL) > 0; char dex2oat_Xmx_flag[PROPERTY_VALUE_MAX]; bool have_dex2oat_Xmx_flag = property_get("dalvik.vm.dex2oat-Xmx", dex2oat_Xmx_flag, NULL) > 0; char dex2oat_flags[PROPERTY_VALUE_MAX]; char dex2oat_flags[PROPERTY_VALUE_MAX]; bool have_dex2oat_flags = property_get("dalvik.vm.dex2oat-flags", dex2oat_flags, NULL) > 0; bool have_dex2oat_flags = property_get("dalvik.vm.dex2oat-flags", dex2oat_flags, NULL) > 0; ALOGV("dalvik.vm.dex2oat-flags=%s\n", dex2oat_flags); ALOGV("dalvik.vm.dex2oat-flags=%s\n", dex2oat_flags); char prop_buf[PROPERTY_VALUE_MAX]; bool profiler = (property_get("dalvik.vm.profiler", prop_buf, "0") > 0) && (prop_buf[0] == '1'); static const char* DEX2OAT_BIN = "/system/bin/dex2oat"; static const char* DEX2OAT_BIN = "/system/bin/dex2oat"; // TODO: Make this memory value configurable with a system property b/15919420 static const char* RUNTIME_ARG = "--runtime-arg"; static const char* RUNTIME_ARG = "--runtime-arg"; static const char* MEMORY_MAX_ARG = "-Xmx512m"; static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig static const unsigned int MAX_INSTRUCTION_SET_LEN = 32; static const unsigned int MAX_INSTRUCTION_SET_LEN = 32; Loading @@ -654,6 +658,8 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, char instruction_set_arg[strlen("--instruction-set=") + MAX_INSTRUCTION_SET_LEN]; char instruction_set_arg[strlen("--instruction-set=") + MAX_INSTRUCTION_SET_LEN]; char profile_file_arg[strlen("--profile-file=") + PKG_PATH_MAX]; char profile_file_arg[strlen("--profile-file=") + PKG_PATH_MAX]; char top_k_profile_threshold_arg[strlen("--top-k-profile-threshold=") + PROPERTY_VALUE_MAX]; char top_k_profile_threshold_arg[strlen("--top-k-profile-threshold=") + PROPERTY_VALUE_MAX]; char dex2oat_Xms_arg[strlen("-Xms") + PROPERTY_VALUE_MAX]; char dex2oat_Xmx_arg[strlen("-Xmx") + PROPERTY_VALUE_MAX]; sprintf(zip_fd_arg, "--zip-fd=%d", zip_fd); sprintf(zip_fd_arg, "--zip-fd=%d", zip_fd); sprintf(zip_location_arg, "--zip-location=%s", input_file_name); sprintf(zip_location_arg, "--zip-location=%s", input_file_name); Loading @@ -679,16 +685,23 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, } } } } if (have_dex2oat_Xms_flag) { sprintf(dex2oat_Xms_arg, "-Xms%s", dex2oat_Xms_flag); } if (have_dex2oat_Xmx_flag) { sprintf(dex2oat_Xmx_arg, "-Xmx%s", dex2oat_Xmx_flag); } ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name); ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name); char* argv[9 // program name, mandatory arguments and the final NULL char* argv[7 // program name, mandatory arguments and the final NULL + (have_profile_file ? 1 : 0) + (have_profile_file ? 1 : 0) + (have_top_k_profile_threshold ? 1 : 0) + (have_top_k_profile_threshold ? 1 : 0) + (have_dex2oat_Xms_flag ? 2 : 0) + (have_dex2oat_Xmx_flag ? 2 : 0) + (have_dex2oat_flags ? 1 : 0)]; + (have_dex2oat_flags ? 1 : 0)]; int i = 0; int i = 0; argv[i++] = (char*)DEX2OAT_BIN; argv[i++] = (char*)DEX2OAT_BIN; argv[i++] = (char*)RUNTIME_ARG; argv[i++] = (char*)MEMORY_MAX_ARG; argv[i++] = zip_fd_arg; argv[i++] = zip_fd_arg; argv[i++] = zip_location_arg; argv[i++] = zip_location_arg; argv[i++] = oat_fd_arg; argv[i++] = oat_fd_arg; Loading @@ -700,9 +713,18 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, if (have_top_k_profile_threshold) { if (have_top_k_profile_threshold) { argv[i++] = top_k_profile_threshold_arg; argv[i++] = top_k_profile_threshold_arg; } } if (have_dex2oat_Xms_flag) { argv[i++] = (char*)RUNTIME_ARG; argv[i++] = dex2oat_Xms_arg; } if (have_dex2oat_Xmx_flag) { argv[i++] = (char*)RUNTIME_ARG; argv[i++] = dex2oat_Xmx_arg; } if (have_dex2oat_flags) { if (have_dex2oat_flags) { argv[i++] = dex2oat_flags; argv[i++] = dex2oat_flags; } } // Do not add after dex2oat_flags, they should override others for debugging. argv[i] = NULL; argv[i] = NULL; execv(DEX2OAT_BIN, (char* const *)argv); execv(DEX2OAT_BIN, (char* const *)argv); Loading Loading
cmds/installd/Android.mk +10 −23 Original line number Original line Diff line number Diff line LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir) common_src_files := \ common_src_files := commands.c utils.c commands.c utils.c common_cflags := -Wall -Werror # # # Static library used in testing and executable # Static library used in testing and executable # # include $(CLEAR_VARS) include $(CLEAR_VARS) LOCAL_SRC_FILES := \ $(common_src_files) LOCAL_MODULE := libinstalld LOCAL_MODULE := libinstalld LOCAL_MODULE_TAGS := eng tests LOCAL_MODULE_TAGS := eng tests LOCAL_SRC_FILES := $(common_src_files) LOCAL_CFLAGS := $(common_cflags) LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY) # # Loading @@ -23,21 +20,11 @@ include $(BUILD_STATIC_LIBRARY) # # include $(CLEAR_VARS) include $(CLEAR_VARS) LOCAL_SRC_FILES := \ installd.c \ $(common_src_files) LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ libselinux LOCAL_STATIC_LIBRARIES := \ libdiskusage LOCAL_MODULE := installd LOCAL_MODULE := installd LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional LOCAL_CFLAGS := $(common_cflags) LOCAL_SRC_FILES := installd.c $(common_src_files) LOCAL_SHARED_LIBRARIES := libcutils liblog libselinux LOCAL_STATIC_LIBRARIES := libdiskusage LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
cmds/installd/commands.c +30 −8 Original line number Original line Diff line number Diff line Loading @@ -625,18 +625,22 @@ static void run_dexopt(int zip_fd, int odex_fd, const char* input_file_name, static void run_dex2oat(int zip_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) { { char prop_buf[PROPERTY_VALUE_MAX]; bool profiler = (property_get("dalvik.vm.profiler", prop_buf, "0") > 0) && (prop_buf[0] == '1'); char dex2oat_Xms_flag[PROPERTY_VALUE_MAX]; bool have_dex2oat_Xms_flag = property_get("dalvik.vm.dex2oat-Xms", dex2oat_Xms_flag, NULL) > 0; char dex2oat_Xmx_flag[PROPERTY_VALUE_MAX]; bool have_dex2oat_Xmx_flag = property_get("dalvik.vm.dex2oat-Xmx", dex2oat_Xmx_flag, NULL) > 0; char dex2oat_flags[PROPERTY_VALUE_MAX]; char dex2oat_flags[PROPERTY_VALUE_MAX]; bool have_dex2oat_flags = property_get("dalvik.vm.dex2oat-flags", dex2oat_flags, NULL) > 0; bool have_dex2oat_flags = property_get("dalvik.vm.dex2oat-flags", dex2oat_flags, NULL) > 0; ALOGV("dalvik.vm.dex2oat-flags=%s\n", dex2oat_flags); ALOGV("dalvik.vm.dex2oat-flags=%s\n", dex2oat_flags); char prop_buf[PROPERTY_VALUE_MAX]; bool profiler = (property_get("dalvik.vm.profiler", prop_buf, "0") > 0) && (prop_buf[0] == '1'); static const char* DEX2OAT_BIN = "/system/bin/dex2oat"; static const char* DEX2OAT_BIN = "/system/bin/dex2oat"; // TODO: Make this memory value configurable with a system property b/15919420 static const char* RUNTIME_ARG = "--runtime-arg"; static const char* RUNTIME_ARG = "--runtime-arg"; static const char* MEMORY_MAX_ARG = "-Xmx512m"; static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig static const unsigned int MAX_INSTRUCTION_SET_LEN = 32; static const unsigned int MAX_INSTRUCTION_SET_LEN = 32; Loading @@ -654,6 +658,8 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, char instruction_set_arg[strlen("--instruction-set=") + MAX_INSTRUCTION_SET_LEN]; char instruction_set_arg[strlen("--instruction-set=") + MAX_INSTRUCTION_SET_LEN]; char profile_file_arg[strlen("--profile-file=") + PKG_PATH_MAX]; char profile_file_arg[strlen("--profile-file=") + PKG_PATH_MAX]; char top_k_profile_threshold_arg[strlen("--top-k-profile-threshold=") + PROPERTY_VALUE_MAX]; char top_k_profile_threshold_arg[strlen("--top-k-profile-threshold=") + PROPERTY_VALUE_MAX]; char dex2oat_Xms_arg[strlen("-Xms") + PROPERTY_VALUE_MAX]; char dex2oat_Xmx_arg[strlen("-Xmx") + PROPERTY_VALUE_MAX]; sprintf(zip_fd_arg, "--zip-fd=%d", zip_fd); sprintf(zip_fd_arg, "--zip-fd=%d", zip_fd); sprintf(zip_location_arg, "--zip-location=%s", input_file_name); sprintf(zip_location_arg, "--zip-location=%s", input_file_name); Loading @@ -679,16 +685,23 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, } } } } if (have_dex2oat_Xms_flag) { sprintf(dex2oat_Xms_arg, "-Xms%s", dex2oat_Xms_flag); } if (have_dex2oat_Xmx_flag) { sprintf(dex2oat_Xmx_arg, "-Xmx%s", dex2oat_Xmx_flag); } ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name); ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name); char* argv[9 // program name, mandatory arguments and the final NULL char* argv[7 // program name, mandatory arguments and the final NULL + (have_profile_file ? 1 : 0) + (have_profile_file ? 1 : 0) + (have_top_k_profile_threshold ? 1 : 0) + (have_top_k_profile_threshold ? 1 : 0) + (have_dex2oat_Xms_flag ? 2 : 0) + (have_dex2oat_Xmx_flag ? 2 : 0) + (have_dex2oat_flags ? 1 : 0)]; + (have_dex2oat_flags ? 1 : 0)]; int i = 0; int i = 0; argv[i++] = (char*)DEX2OAT_BIN; argv[i++] = (char*)DEX2OAT_BIN; argv[i++] = (char*)RUNTIME_ARG; argv[i++] = (char*)MEMORY_MAX_ARG; argv[i++] = zip_fd_arg; argv[i++] = zip_fd_arg; argv[i++] = zip_location_arg; argv[i++] = zip_location_arg; argv[i++] = oat_fd_arg; argv[i++] = oat_fd_arg; Loading @@ -700,9 +713,18 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, if (have_top_k_profile_threshold) { if (have_top_k_profile_threshold) { argv[i++] = top_k_profile_threshold_arg; argv[i++] = top_k_profile_threshold_arg; } } if (have_dex2oat_Xms_flag) { argv[i++] = (char*)RUNTIME_ARG; argv[i++] = dex2oat_Xms_arg; } if (have_dex2oat_Xmx_flag) { argv[i++] = (char*)RUNTIME_ARG; argv[i++] = dex2oat_Xmx_arg; } if (have_dex2oat_flags) { if (have_dex2oat_flags) { argv[i++] = dex2oat_flags; argv[i++] = dex2oat_flags; } } // Do not add after dex2oat_flags, they should override others for debugging. argv[i] = NULL; argv[i] = NULL; execv(DEX2OAT_BIN, (char* const *)argv); execv(DEX2OAT_BIN, (char* const *)argv); Loading