Loading cmds/installd/dexopt.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -73,6 +73,10 @@ static bool is_debug_runtime() { return android::base::GetProperty("persist.sys.dalvik.vm.lib.2", "") == "libartd.so"; } static bool is_debuggable_build() { return android::base::GetBoolProperty("ro.debuggable", false); } static bool clear_profile(const std::string& profile) { unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC)); if (ufd.get() < 0) { Loading Loading @@ -197,7 +201,8 @@ static const char* get_location_from_path(const char* path) { static void run_dex2oat(int zip_fd, int oat_fd, int input_vdex_fd, int output_vdex_fd, int image_fd, const char* input_file_name, const char* output_file_name, int swap_fd, const char* instruction_set, const char* compiler_filter, bool debuggable, bool post_bootcomplete, int profile_fd, const char* class_loader_context) { bool debuggable, bool post_bootcomplete, bool try_debug_for_background, int profile_fd, const char* class_loader_context) { static const unsigned int MAX_INSTRUCTION_SET_LEN = 7; if (strlen(instruction_set) >= MAX_INSTRUCTION_SET_LEN) { Loading Loading @@ -274,7 +279,12 @@ static void run_dex2oat(int zip_fd, int oat_fd, int input_vdex_fd, int output_vd } // If the runtime was requested to use libartd.so, we'll run dex2oatd, otherwise dex2oat. const char* dex2oat_bin = is_debug_runtime() ? "/system/bin/dex2oatd" : "/system/bin/dex2oat"; const char* dex2oat_bin = "/system/bin/dex2oat"; static const char* kDex2oatDebugPath = "/system/bin/dex2oatd"; if (is_debug_runtime() || (try_debug_for_background && is_debuggable_build())) { DCHECK(access(kDex2oatDebugPath, X_OK) == 0); dex2oat_bin = kDex2oatDebugPath; } static const char* RUNTIME_ARG = "--runtime-arg"; Loading Loading @@ -1609,6 +1619,7 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins bool boot_complete = (dexopt_flags & DEXOPT_BOOTCOMPLETE) != 0; bool profile_guided = (dexopt_flags & DEXOPT_PROFILE_GUIDED) != 0; bool is_secondary_dex = (dexopt_flags & DEXOPT_SECONDARY_DEX) != 0; bool try_debug_for_background = (dexopt_flags & DEXOPT_IDLE_BACKGROUND_JOB) != 0; // Check if we're dealing with a secondary dex file and if we need to compile it. std::string oat_dir_str; Loading Loading @@ -1704,6 +1715,7 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins compiler_filter, debuggable, boot_complete, try_debug_for_background, reference_profile_fd.get(), class_loader_context); _exit(68); /* only get here on exec failure */ Loading cmds/installd/installd_constants.h +3 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,9 @@ constexpr int DEXOPT_SECONDARY_DEX = 1 << 5; constexpr int DEXOPT_FORCE = 1 << 6; constexpr int DEXOPT_STORAGE_CE = 1 << 7; constexpr int DEXOPT_STORAGE_DE = 1 << 8; // Tells the compiler that it is invoked from the background service. This // controls whether extra debugging flags can be used (taking more compile time.) constexpr int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9; /* all known values for dexopt flags */ constexpr int DEXOPT_MASK = Loading Loading
cmds/installd/dexopt.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -73,6 +73,10 @@ static bool is_debug_runtime() { return android::base::GetProperty("persist.sys.dalvik.vm.lib.2", "") == "libartd.so"; } static bool is_debuggable_build() { return android::base::GetBoolProperty("ro.debuggable", false); } static bool clear_profile(const std::string& profile) { unique_fd ufd(open(profile.c_str(), O_WRONLY | O_NOFOLLOW | O_CLOEXEC)); if (ufd.get() < 0) { Loading Loading @@ -197,7 +201,8 @@ static const char* get_location_from_path(const char* path) { static void run_dex2oat(int zip_fd, int oat_fd, int input_vdex_fd, int output_vdex_fd, int image_fd, const char* input_file_name, const char* output_file_name, int swap_fd, const char* instruction_set, const char* compiler_filter, bool debuggable, bool post_bootcomplete, int profile_fd, const char* class_loader_context) { bool debuggable, bool post_bootcomplete, bool try_debug_for_background, int profile_fd, const char* class_loader_context) { static const unsigned int MAX_INSTRUCTION_SET_LEN = 7; if (strlen(instruction_set) >= MAX_INSTRUCTION_SET_LEN) { Loading Loading @@ -274,7 +279,12 @@ static void run_dex2oat(int zip_fd, int oat_fd, int input_vdex_fd, int output_vd } // If the runtime was requested to use libartd.so, we'll run dex2oatd, otherwise dex2oat. const char* dex2oat_bin = is_debug_runtime() ? "/system/bin/dex2oatd" : "/system/bin/dex2oat"; const char* dex2oat_bin = "/system/bin/dex2oat"; static const char* kDex2oatDebugPath = "/system/bin/dex2oatd"; if (is_debug_runtime() || (try_debug_for_background && is_debuggable_build())) { DCHECK(access(kDex2oatDebugPath, X_OK) == 0); dex2oat_bin = kDex2oatDebugPath; } static const char* RUNTIME_ARG = "--runtime-arg"; Loading Loading @@ -1609,6 +1619,7 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins bool boot_complete = (dexopt_flags & DEXOPT_BOOTCOMPLETE) != 0; bool profile_guided = (dexopt_flags & DEXOPT_PROFILE_GUIDED) != 0; bool is_secondary_dex = (dexopt_flags & DEXOPT_SECONDARY_DEX) != 0; bool try_debug_for_background = (dexopt_flags & DEXOPT_IDLE_BACKGROUND_JOB) != 0; // Check if we're dealing with a secondary dex file and if we need to compile it. std::string oat_dir_str; Loading Loading @@ -1704,6 +1715,7 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins compiler_filter, debuggable, boot_complete, try_debug_for_background, reference_profile_fd.get(), class_loader_context); _exit(68); /* only get here on exec failure */ Loading
cmds/installd/installd_constants.h +3 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,9 @@ constexpr int DEXOPT_SECONDARY_DEX = 1 << 5; constexpr int DEXOPT_FORCE = 1 << 6; constexpr int DEXOPT_STORAGE_CE = 1 << 7; constexpr int DEXOPT_STORAGE_DE = 1 << 8; // Tells the compiler that it is invoked from the background service. This // controls whether extra debugging flags can be used (taking more compile time.) constexpr int DEXOPT_IDLE_BACKGROUND_JOB = 1 << 9; /* all known values for dexopt flags */ constexpr int DEXOPT_MASK = Loading