Preparing for work on string interning for AppImages.

* Allow classes that have string fields to be put into AppImages.
* Updated tracing messages to be more descriptive and searchable.
* Added new tracing objects to more accurately report time spent in
handling AppImages.

Test: Built image / flashed device / ran applications

(cherry picked from commit e3015b59fb297d236f0b3ce844eef81c67e423d3)

Change-Id: I6e5fba8c8ddeff8e077672b799d244e767478373
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index bcc3a22..d95f71a 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1251,6 +1251,8 @@
     ClassTable::ClassSet* new_class_set)
     REQUIRES(!Locks::dex_lock_)
     REQUIRES_SHARED(Locks::mutator_lock_) {
+  ScopedTrace app_image_timing("AppImage:Updating");
+
   Thread* const self = Thread::Current();
   gc::Heap* const heap = Runtime::Current()->GetHeap();
   const ImageHeader& header = space->GetImageHeader();
@@ -1311,7 +1313,7 @@
   }
   if (ClassLinker::kAppImageMayContainStrings) {
     // Fixup all the literal strings happens at app images which are supposed to be interned.
-    ScopedTrace timing("Fixup String Intern in image and dex_cache");
+    ScopedTrace timing("AppImage:InternString");
     const auto& image_header = space->GetImageHeader();
     const auto bitmap = space->GetMarkBitmap();  // bitmap of objects
     const uint8_t* target_base = space->GetMemMap()->Begin();
@@ -1324,7 +1326,7 @@
     bitmap->VisitMarkedRange(objects_begin, objects_end, fixup_intern_visitor);
   }
   if (kVerifyArtMethodDeclaringClasses) {
-    ScopedTrace timing("Verify declaring classes");
+    ScopedTrace timing("AppImage:VerifyDeclaringClasses");
     ReaderMutexLock rmu(self, *Locks::heap_bitmap_lock_);
     VerifyDeclaringClassVisitor visitor;
     header.VisitPackedArtMethods(&visitor, space->Begin(), kRuntimePointerSize);
@@ -1842,7 +1844,7 @@
       // Force every app image class's SubtypeCheck to be at least kIninitialized.
       //
       // See also ImageWriter::FixupClass.
-      ScopedTrace trace("Recalculate app image SubtypeCheck bitstrings");
+      ScopedTrace trace("AppImage:RecacluateSubtypeCheckBitstrings");
       MutexLock subtype_check_lock(Thread::Current(), *Locks::subtype_check_lock_);
       for (const ClassTable::TableSlot& root : temp_set) {
         SubtypeCheck<ObjPtr<mirror::Class>>::EnsureInitialized(root.Read());
@@ -1862,7 +1864,7 @@
   if (kIsDebugBuild && app_image) {
     // This verification needs to happen after the classes have been added to the class loader.
     // Since it ensures classes are in the class table.
-    ScopedTrace trace("VerifyAppImage");
+    ScopedTrace trace("AppImage:Verify");
     VerifyAppImage(header, class_loader, dex_caches, class_table, space);
   }