Allow -Xjitsaveprofilinginfo for system server

setenforce 0 is still required to prevent selinux violations.

Test: adb shell setprop dalvik.vm.extra-opts "'-Xusejit:false -Xint -Xjitsaveprofilinginfo'" && adb shell start

Bug: 34927277
Bug: 36457259
Change-Id: I4d34b8662f596cb6d7a1ad0a2182ac88eb9bec41
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 44f8281..48efbe5 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -806,11 +806,11 @@
   // before fork aren't attributed to an app.
   heap_->ResetGcPerformanceInfo();
 
-
-  if (!is_system_server &&
+  // We may want to collect profiling samples for system server, but we never want to JIT there.
+  if ((!is_system_server || !jit_options_->UseJitCompilation()) &&
       !safe_mode_ &&
       (jit_options_->UseJitCompilation() || jit_options_->GetSaveProfilingInfo()) &&
-      jit_.get() == nullptr) {
+      jit_ == nullptr) {
     // Note that when running ART standalone (not zygote, nor zygote fork),
     // the jit may have already been created.
     CreateJit();