Pass down apex image if profilebootimage is enabled
Do this so that recompiled apps will use the right image.
Bug: 139883463
Test: manual
Change-Id: I3622e87a0759a0d5137da38c6f7f4a1c88e6a1e4
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 7eee749..19346c7 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -303,6 +303,9 @@
// Location of the apex image.
static const char* kApexImage = "/system/framework/apex.art";
+// Phenotype property name for enabling profiling the boot class path.
+static const char* PROFILE_BOOT_CLASS_PATH = "profilebootclasspath";
+
class RunDex2Oat : public ExecVHelper {
public:
RunDex2Oat(int zip_fd,
@@ -402,7 +405,15 @@
server_configurable_flags::GetServerConfigurableFlag(RUNTIME_NATIVE_BOOT_NAMESPACE,
ENABLE_APEX_IMAGE,
/*default_value=*/ "");
- if (use_apex_image == "true") {
+
+ std::string profile_boot_class_path = GetProperty("dalvik.vm.profilebootclasspath", "");
+ profile_boot_class_path =
+ server_configurable_flags::GetServerConfigurableFlag(
+ RUNTIME_NATIVE_BOOT_NAMESPACE,
+ PROFILE_BOOT_CLASS_PATH,
+ /*default_value=*/ profile_boot_class_path);
+
+ if (use_apex_image == "true" || profile_boot_class_path == "true") {
boot_image = StringPrintf("-Ximage:%s", kApexImage);
} else {
boot_image = MapPropertyToArg("dalvik.vm.boot-image", "-Ximage:%s");