odrefresh: Respect "dalvik.vm.systemservercompilerfilter".
If the property is set, we should use whatever specified in the
property, rather than always using "speed".
This is brought up by bdc@. The change that merges into sc-dev is
already fixed. We need this fix in AOSP as well.
Bug: 195653499
Test: adb shell setprop dalvik.vm.systemservercompilerfilter verify && adb shell odrefresh --force-compile
(Found "/apex/com.android.art/bin/dex2oat64
--dex-file=/system/framework/services.jar
...
--compiler-filter=verify" in logcat)
Test: atest odsign_e2e_tests
Change-Id: Icb57ed5eb6b8976ecf6ac88bf8c278bbe144b450
diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc
index 12199b3..bf76010 100644
--- a/odrefresh/odrefresh.cc
+++ b/odrefresh/odrefresh.cc
@@ -1291,11 +1291,11 @@
const std::string jar_name(android::base::Basename(jar));
const std::string profile = Concatenate({GetAndroidRoot(), "/framework/", jar_name, ".prof"});
std::string compiler_filter =
- android::base::GetProperty("dalvik.vm.systemservercompilerfilter", {});
+ android::base::GetProperty("dalvik.vm.systemservercompilerfilter", "speed");
if (compiler_filter == "speed-profile") {
AddDex2OatProfileAndCompilerFilter(&args, &readonly_files_raii, profile);
} else {
- args.emplace_back("--compiler-filter=speed");
+ args.emplace_back("--compiler-filter=" + compiler_filter);
}
const std::string image_location = GetSystemServerImagePath(/*on_system=*/false, jar);