odrefresh: Defaults to using "speed" for compiling system_server.

Most device builds use the speed configuration for system_server preopt,
unless "dalvik.vm.systemservercompilerfilter" is set to "speed-profile".
odrefresh should not change this behavior.

Bug: 195653499
Test: adb shell odrefresh --force-compile
    (Found "/apex/com.android.art/bin/dex2oat64
    --dex-file=/system/framework/services.jar
    ...
    --compiler-filter=speed" in logcat)
Test: adb shell setprop dalvik.vm.systemservercompilerfilter speed-profile && adb shell odrefresh --force-compile
    (Found "/apex/com.android.art/bin/dex2oat64
    --dex-file=/system/framework/services.jar
    ...
    --profile-file-fd=...
    --compiler-filter=speed-profile" in logcat)
Test: atest odsign_e2e_tests

Change-Id: I85feeceef4c1410451765274bd02c634d7d8051f
diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc
index e7655b0..12199b3 100644
--- a/odrefresh/odrefresh.cc
+++ b/odrefresh/odrefresh.cc
@@ -1290,7 +1290,13 @@
       AddDex2OatInstructionSet(&args, isa);
       const std::string jar_name(android::base::Basename(jar));
       const std::string profile = Concatenate({GetAndroidRoot(), "/framework/", jar_name, ".prof"});
-      AddDex2OatProfileAndCompilerFilter(&args, &readonly_files_raii, profile);
+      std::string compiler_filter =
+          android::base::GetProperty("dalvik.vm.systemservercompilerfilter", {});
+      if (compiler_filter == "speed-profile") {
+        AddDex2OatProfileAndCompilerFilter(&args, &readonly_files_raii, profile);
+      } else {
+        args.emplace_back("--compiler-filter=speed");
+      }
 
       const std::string image_location = GetSystemServerImagePath(/*on_system=*/false, jar);
       const std::string install_location = android::base::Dirname(image_location);