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
Merged-In: Icb57ed5eb6b8976ecf6ac88bf8c278bbe144b450
(cherry picked from commit 5503a8aef8019e536b9702326eccdc92e7be7644)
diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc
index e9c0c63..2cef50d 100644
--- a/odrefresh/odrefresh.cc
+++ b/odrefresh/odrefresh.cc
@@ -1140,11 +1140,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, 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);