Ignore bad profiles when --force-merge is specified

The ART profiles are cleaned lazily and may stay a long time on an
obsolete version if the corresponding apps are not used or updated. For
regular profiles this is not a problem, however for boot image profiles
they can trigger unnecessary merge errors. As such, we ignore them when
--force-merge is specified.

Test: profile tests
Bug: 139884006
Change-Id: I10d9a325d79b279c8ec4fe8d70696e9335a17099
diff --git a/profman/profile_assistant.cc b/profman/profile_assistant.cc
index 7107944..1695d8c 100644
--- a/profman/profile_assistant.cc
+++ b/profman/profile_assistant.cc
@@ -58,6 +58,12 @@
     ProfileCompilationInfo cur_info;
     if (!cur_info.Load(profile_files[i]->Fd(), /*merge_classes=*/ true, filter_fn)) {
       LOG(WARNING) << "Could not load profile file at index " << i;
+      if (options.IsForceMerge()) {
+        // If we have to merge forcefully, ignore load failures.
+        // This is useful for boot image profiles to ignore stale profiles which are
+        // cleared lazily.
+        continue;
+      }
       return kErrorBadProfiles;
     }