Avoid resolving startup const strings without a profile

Without a profile, the behavior should be to resolve no strings instead
of resolving them all.

Bug: 127609587
Test: test-art-host
Change-Id: I374ce60f2a731fd0a561226999e9ce5a6ac2c2e4
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index bcd573b..c5aad58 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -667,6 +667,11 @@
 void CompilerDriver::ResolveConstStrings(const std::vector<const DexFile*>& dex_files,
                                          bool only_startup_strings,
                                          TimingLogger* timings) {
+  if (only_startup_strings && GetCompilerOptions().GetProfileCompilationInfo() == nullptr) {
+    // If there is no profile, don't resolve any strings. Resolving all of the strings in the image
+    // will cause a bloated app image and slow down startup.
+    return;
+  }
   ScopedObjectAccess soa(Thread::Current());
   StackHandleScope<1> hs(soa.Self());
   ClassLinker* const class_linker = Runtime::Current()->GetClassLinker();