diff options
author | 2015-11-16 11:07:38 +0000 | |
---|---|---|
committer | 2015-11-16 11:07:38 +0000 | |
commit | 8161da7a0e54bc4af36e49353e4caad02de384dc (patch) | |
tree | a9c58f24cc24c1755cc91f2ce321535696b917be | |
parent | 81960facb673740acd41b72d21febea16ba4986c (diff) | |
parent | df9dadd5e5c287110d837c38aaec12bcf5e5d151 (diff) |
Merge "Remove obsolete profile handling from installd."
-rw-r--r-- | cmds/installd/commands.cpp | 43 | ||||
-rw-r--r-- | cmds/installd/installd.h | 18 | ||||
-rw-r--r-- | cmds/installd/utils.cpp | 39 |
3 files changed, 11 insertions, 89 deletions
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp index 46d72fd0fc..d3efb7c0b8 100644 --- a/cmds/installd/commands.cpp +++ b/cmds/installd/commands.cpp @@ -83,8 +83,6 @@ int uninstall(const char *uuid, const char *pkgname, userid_t userid) std::string _pkgdir(create_data_user_package_path(uuid, userid, pkgname)); const char* pkgdir = _pkgdir.c_str(); - remove_profile_file(pkgname); - /* delete contents AND directory, no exceptions */ return delete_dir_contents(pkgdir, 1, NULL); } @@ -745,7 +743,7 @@ static bool check_boolean_property(const char* property_name, bool default_value } static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, - const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set, + const char* output_file_name, int swap_fd, const char *instruction_set, bool vm_safe_mode, bool debuggable, bool post_bootcomplete, bool use_jit) { static const unsigned int MAX_INSTRUCTION_SET_LEN = 7; @@ -756,9 +754,6 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, return; } - 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; @@ -822,8 +817,6 @@ 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_variant_arg[strlen("--instruction-set-variant=") + PROPERTY_VALUE_MAX]; char instruction_set_features_arg[strlen("--instruction-set-features=") + PROPERTY_VALUE_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 dex2oat_Xms_arg[strlen("-Xms") + PROPERTY_VALUE_MAX]; char dex2oat_Xmx_arg[strlen("-Xmx") + PROPERTY_VALUE_MAX]; char dex2oat_compiler_filter_arg[strlen("--compiler-filter=") + PROPERTY_VALUE_MAX]; @@ -842,24 +835,6 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, sprintf(dex2oat_swap_fd, "--swap-fd=%d", swap_fd); } - bool have_profile_file = false; - bool have_top_k_profile_threshold = false; - if (profiler && (strcmp(pkgname, "*") != 0)) { - char profile_file[PKG_PATH_MAX]; - snprintf(profile_file, sizeof(profile_file), "%s/%s", - DALVIK_CACHE_PREFIX "profiles", pkgname); - struct stat st; - if ((stat(profile_file, &st) == 0) && (st.st_size > 0)) { - sprintf(profile_file_arg, "--profile-file=%s", profile_file); - have_profile_file = true; - if (property_get("dalvik.vm.profile.top-k-thr", prop_buf, NULL) > 0) { - snprintf(top_k_profile_threshold_arg, sizeof(top_k_profile_threshold_arg), - "--top-k-profile-threshold=%s", prop_buf); - have_top_k_profile_threshold = true; - } - } - } - // use the JIT if either it's specified as a dexopt flag or if the property is set use_jit = use_jit || check_boolean_property("debug.usejit"); if (have_dex2oat_Xms_flag) { @@ -884,6 +859,7 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, // Check whether all apps should be compiled debuggable. if (!debuggable) { + char prop_buf[PROPERTY_VALUE_MAX]; debuggable = (property_get("dalvik.vm.always_debuggable", prop_buf, "0") > 0) && (prop_buf[0] == '1'); @@ -894,8 +870,6 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, const char* argv[7 // program name, mandatory arguments and the final NULL + (have_dex2oat_isa_variant ? 1 : 0) + (have_dex2oat_isa_features ? 1 : 0) - + (have_profile_file ? 1 : 0) - + (have_top_k_profile_threshold ? 1 : 0) + (have_dex2oat_Xms_flag ? 2 : 0) + (have_dex2oat_Xmx_flag ? 2 : 0) + (have_dex2oat_compiler_filter_flag ? 1 : 0) @@ -918,12 +892,6 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, if (have_dex2oat_isa_features) { argv[i++] = instruction_set_features_arg; } - if (have_profile_file) { - argv[i++] = profile_file_arg; - } - if (have_top_k_profile_threshold) { - argv[i++] = top_k_profile_threshold_arg; - } if (have_dex2oat_Xms_flag) { argv[i++] = RUNTIME_ARG; argv[i++] = dex2oat_Xms_arg; @@ -1171,11 +1139,6 @@ int dexopt(const char *apk_path, uid_t uid, const char *pkgname, const char *ins goto fail; } - // Create profile file if there is a package name present. - if (strcmp(pkgname, "*") != 0) { - create_profile_file(pkgname, uid); - } - // Create a swap file if necessary. if (ShouldUseSwapFileForDexopt()) { // Make sure there really is enough space. @@ -1239,7 +1202,7 @@ int dexopt(const char *apk_path, uid_t uid, const char *pkgname, const char *ins } else { input_file_name++; } - run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, pkgname, + run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, instruction_set, vm_safe_mode, debuggable, boot_complete, use_jit); } else { ALOGE("Invalid dexopt needed: %d\n", dexopt_needed); diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h index df13fe4e72..8c48b88df9 100644 --- a/cmds/installd/installd.h +++ b/cmds/installd/installd.h @@ -2,16 +2,16 @@ ** ** Copyright 2008, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ @@ -231,8 +231,6 @@ char *build_string3(const char *s1, const char *s2, const char *s3); int ensure_dir(const char* path, mode_t mode, uid_t uid, gid_t gid); int ensure_media_user_dirs(const char* uuid, userid_t userid); int ensure_config_user_dirs(userid_t userid); -int create_profile_file(const char *pkgname, gid_t gid); -void remove_profile_file(const char *pkgname); /* commands.c */ diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp index e58391fb04..abbd021716 100644 --- a/cmds/installd/utils.cpp +++ b/cmds/installd/utils.cpp @@ -1143,42 +1143,3 @@ int ensure_config_user_dirs(userid_t userid) { return 0; } - -int create_profile_file(const char *pkgname, gid_t gid) { - const char *profile_dir = DALVIK_CACHE_PREFIX "profiles"; - char profile_file[PKG_PATH_MAX]; - - snprintf(profile_file, sizeof(profile_file), "%s/%s", profile_dir, pkgname); - - // The 'system' user needs to be able to read the profile to determine if dex2oat - // needs to be run. This is done in dalvik.system.DexFile.isDexOptNeededInternal(). So - // we assign ownership to AID_SYSTEM and ensure it's not world-readable. - - int fd = open(profile_file, O_WRONLY | O_CREAT | O_NOFOLLOW | O_CLOEXEC, 0660); - - // Always set the uid/gid/permissions. The file could have been previously created - // with different permissions. - if (fd >= 0) { - if (fchown(fd, AID_SYSTEM, gid) < 0) { - ALOGE("cannot chown profile file '%s': %s\n", profile_file, strerror(errno)); - close(fd); - unlink(profile_file); - return -1; - } - - if (fchmod(fd, 0660) < 0) { - ALOGE("cannot chmod profile file '%s': %s\n", profile_file, strerror(errno)); - close(fd); - unlink(profile_file); - return -1; - } - close(fd); - } - return 0; -} - -void remove_profile_file(const char *pkgname) { - char profile_file[PKG_PATH_MAX]; - snprintf(profile_file, sizeof(profile_file), "%s/%s", DALVIK_CACHE_PREFIX "profiles", pkgname); - unlink(profile_file); -} |