Loading cmds/installd/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ cc_defaults { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], product_variables: { Loading Loading @@ -227,6 +228,7 @@ cc_binary { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], } Loading cmds/installd/dexopt.cpp +27 −6 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include <private/android_filesystem_config.h> #include <processgroup/sched_policy.h> #include <selinux/android.h> #include <server_configurable_flags/get_flags.h> #include <system/thread_defs.h> #include "dexopt.h" Loading Loading @@ -260,6 +261,13 @@ static std::string MapPropertyToArg(const std::string& property, return ""; } // Namespace for Android Runtime flags applied during boot time. static const char* RUNTIME_NATIVE_BOOT_NAMESPACE = "runtime_native_boot"; // Feature flag name for running the JIT in Zygote experiment, b/119800099. static const char* ENABLE_APEX_IMAGE = "enable_apex_image"; // Location of the apex image. static const char* kApexImage = "/system/framework/apex.art"; class RunDex2Oat : public ExecVHelper { public: RunDex2Oat(int zip_fd, Loading Loading @@ -293,6 +301,14 @@ class RunDex2Oat : public ExecVHelper { : "dalvik.vm.boot-dex2oat-threads"; std::string dex2oat_threads_arg = MapPropertyToArg(threads_property, "-j%s"); std::string bootclasspath; char* dex2oat_bootclasspath = getenv("DEX2OATBOOTCLASSPATH"); if (dex2oat_bootclasspath != nullptr) { bootclasspath = StringPrintf("-Xbootclasspath:%s", dex2oat_bootclasspath); } // If DEX2OATBOOTCLASSPATH is not in the environment, dex2oat is going to query // BOOTCLASSPATH. const std::string dex2oat_isa_features_key = StringPrintf("dalvik.vm.isa.%s.features", instruction_set); std::string instruction_set_features_arg = Loading Loading @@ -352,7 +368,16 @@ class RunDex2Oat : public ExecVHelper { bool generate_minidebug_info = kEnableMinidebugInfo && GetBoolProperty(kMinidebugInfoSystemProperty, kMinidebugInfoSystemPropertyDefault); std::string boot_image = MapPropertyToArg("dalvik.vm.boot-image", "-Ximage:%s"); std::string boot_image; std::string use_apex_image = server_configurable_flags::GetServerConfigurableFlag(RUNTIME_NATIVE_BOOT_NAMESPACE, ENABLE_APEX_IMAGE, /*default_value=*/ ""); if (use_apex_image == "true") { boot_image = StringPrintf("-Ximage:%s", kApexImage); } else { boot_image = MapPropertyToArg("dalvik.vm.boot-image", "-Ximage:%s"); } // clang FORTIFY doesn't let us use strlen in constant array bounds, so we // use arraysize instead. Loading Loading @@ -440,6 +465,7 @@ class RunDex2Oat : public ExecVHelper { AddArg(instruction_set_features_arg); AddRuntimeArg(boot_image); AddRuntimeArg(bootclasspath); AddRuntimeArg(dex2oat_Xms_arg); AddRuntimeArg(dex2oat_Xmx_arg); Loading Loading @@ -1961,11 +1987,6 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins /* child -- drop privileges before continuing */ drop_capabilities(uid); // Clear BOOTCLASSPATH. // Let dex2oat use the BCP from boot image, excluding updatable BCP // modules for AOT to avoid app recompilation after their upgrades. unsetenv("BOOTCLASSPATH"); SetDex2OatScheduling(boot_complete); if (flock(out_oat_fd.get(), LOCK_EX | LOCK_NB) != 0) { PLOG(ERROR) << "flock(" << out_oat_path << ") failed"; Loading cmds/installd/globals.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ static constexpr const char* PROFILES_SUBDIR = "misc/profiles"; // sub-directory static constexpr const char* PRIVATE_APP_SUBDIR = "app-private/"; // sub-directory under // ANDROID_DATA static constexpr const char* STAGING_SUBDIR = "pkg_staging/"; // sub-directory under ANDROID_DATA std::string android_app_dir; std::string android_app_ephemeral_dir; std::string android_app_lib_dir; Loading @@ -54,6 +56,7 @@ std::string android_media_dir; std::string android_mnt_expand_dir; std::string android_profiles_dir; std::string android_root_dir; std::string android_staging_dir; std::vector<std::string> android_system_dirs; Loading Loading @@ -110,6 +113,9 @@ bool init_globals_from_data_and_root(const char* data, const char* root) { // Get the android profiles directory. android_profiles_dir = android_data_dir + PROFILES_SUBDIR; // Get the android session staging directory. android_staging_dir = android_data_dir + STAGING_SUBDIR; // Take note of the system and vendor directories. android_system_dirs.clear(); android_system_dirs.push_back(android_root_dir + APP_SUBDIR); Loading cmds/installd/globals.h +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ extern std::string android_media_dir; extern std::string android_mnt_expand_dir; extern std::string android_profiles_dir; extern std::string android_root_dir; extern std::string android_staging_dir; extern std::vector<std::string> android_system_dirs; Loading cmds/installd/tests/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ cc_test { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], static_libs: [ "libdiskusage", Loading @@ -54,6 +55,7 @@ cc_test { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], static_libs: [ "libdiskusage", Loading @@ -77,6 +79,7 @@ cc_test { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], static_libs: [ "libdiskusage", Loading @@ -96,6 +99,7 @@ cc_test { "libbase", "libcutils", "libutils", "server_configurable_flags", ], static_libs: [ "liblog", Loading Loading
cmds/installd/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ cc_defaults { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], product_variables: { Loading Loading @@ -227,6 +228,7 @@ cc_binary { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], } Loading
cmds/installd/dexopt.cpp +27 −6 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include <private/android_filesystem_config.h> #include <processgroup/sched_policy.h> #include <selinux/android.h> #include <server_configurable_flags/get_flags.h> #include <system/thread_defs.h> #include "dexopt.h" Loading Loading @@ -260,6 +261,13 @@ static std::string MapPropertyToArg(const std::string& property, return ""; } // Namespace for Android Runtime flags applied during boot time. static const char* RUNTIME_NATIVE_BOOT_NAMESPACE = "runtime_native_boot"; // Feature flag name for running the JIT in Zygote experiment, b/119800099. static const char* ENABLE_APEX_IMAGE = "enable_apex_image"; // Location of the apex image. static const char* kApexImage = "/system/framework/apex.art"; class RunDex2Oat : public ExecVHelper { public: RunDex2Oat(int zip_fd, Loading Loading @@ -293,6 +301,14 @@ class RunDex2Oat : public ExecVHelper { : "dalvik.vm.boot-dex2oat-threads"; std::string dex2oat_threads_arg = MapPropertyToArg(threads_property, "-j%s"); std::string bootclasspath; char* dex2oat_bootclasspath = getenv("DEX2OATBOOTCLASSPATH"); if (dex2oat_bootclasspath != nullptr) { bootclasspath = StringPrintf("-Xbootclasspath:%s", dex2oat_bootclasspath); } // If DEX2OATBOOTCLASSPATH is not in the environment, dex2oat is going to query // BOOTCLASSPATH. const std::string dex2oat_isa_features_key = StringPrintf("dalvik.vm.isa.%s.features", instruction_set); std::string instruction_set_features_arg = Loading Loading @@ -352,7 +368,16 @@ class RunDex2Oat : public ExecVHelper { bool generate_minidebug_info = kEnableMinidebugInfo && GetBoolProperty(kMinidebugInfoSystemProperty, kMinidebugInfoSystemPropertyDefault); std::string boot_image = MapPropertyToArg("dalvik.vm.boot-image", "-Ximage:%s"); std::string boot_image; std::string use_apex_image = server_configurable_flags::GetServerConfigurableFlag(RUNTIME_NATIVE_BOOT_NAMESPACE, ENABLE_APEX_IMAGE, /*default_value=*/ ""); if (use_apex_image == "true") { boot_image = StringPrintf("-Ximage:%s", kApexImage); } else { boot_image = MapPropertyToArg("dalvik.vm.boot-image", "-Ximage:%s"); } // clang FORTIFY doesn't let us use strlen in constant array bounds, so we // use arraysize instead. Loading Loading @@ -440,6 +465,7 @@ class RunDex2Oat : public ExecVHelper { AddArg(instruction_set_features_arg); AddRuntimeArg(boot_image); AddRuntimeArg(bootclasspath); AddRuntimeArg(dex2oat_Xms_arg); AddRuntimeArg(dex2oat_Xmx_arg); Loading Loading @@ -1961,11 +1987,6 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins /* child -- drop privileges before continuing */ drop_capabilities(uid); // Clear BOOTCLASSPATH. // Let dex2oat use the BCP from boot image, excluding updatable BCP // modules for AOT to avoid app recompilation after their upgrades. unsetenv("BOOTCLASSPATH"); SetDex2OatScheduling(boot_complete); if (flock(out_oat_fd.get(), LOCK_EX | LOCK_NB) != 0) { PLOG(ERROR) << "flock(" << out_oat_path << ") failed"; Loading
cmds/installd/globals.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ static constexpr const char* PROFILES_SUBDIR = "misc/profiles"; // sub-directory static constexpr const char* PRIVATE_APP_SUBDIR = "app-private/"; // sub-directory under // ANDROID_DATA static constexpr const char* STAGING_SUBDIR = "pkg_staging/"; // sub-directory under ANDROID_DATA std::string android_app_dir; std::string android_app_ephemeral_dir; std::string android_app_lib_dir; Loading @@ -54,6 +56,7 @@ std::string android_media_dir; std::string android_mnt_expand_dir; std::string android_profiles_dir; std::string android_root_dir; std::string android_staging_dir; std::vector<std::string> android_system_dirs; Loading Loading @@ -110,6 +113,9 @@ bool init_globals_from_data_and_root(const char* data, const char* root) { // Get the android profiles directory. android_profiles_dir = android_data_dir + PROFILES_SUBDIR; // Get the android session staging directory. android_staging_dir = android_data_dir + STAGING_SUBDIR; // Take note of the system and vendor directories. android_system_dirs.clear(); android_system_dirs.push_back(android_root_dir + APP_SUBDIR); Loading
cmds/installd/globals.h +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ extern std::string android_media_dir; extern std::string android_mnt_expand_dir; extern std::string android_profiles_dir; extern std::string android_root_dir; extern std::string android_staging_dir; extern std::vector<std::string> android_system_dirs; Loading
cmds/installd/tests/Android.bp +4 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ cc_test { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], static_libs: [ "libdiskusage", Loading @@ -54,6 +55,7 @@ cc_test { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], static_libs: [ "libdiskusage", Loading @@ -77,6 +79,7 @@ cc_test { "libprocessgroup", "libselinux", "libutils", "server_configurable_flags", ], static_libs: [ "libdiskusage", Loading @@ -96,6 +99,7 @@ cc_test { "libbase", "libcutils", "libutils", "server_configurable_flags", ], static_libs: [ "liblog", Loading