Revert "Revert "Disable check that no oat libraries are loaded.""
This reverts commit d133917ed51afb0c57c9512fddab7c68a3a36cfe.
Reason for revert: reland fix
Bug: 128529256
Change-Id: I950bc2f7e694dfcfe28e3379727079dde4ec7627
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index b03551b..2642cd8 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -645,7 +645,12 @@
void OatFileManager::SetOnlyUseSystemOatFiles(bool assert_no_files_loaded) {
ReaderMutexLock mu(Thread::Current(), *Locks::oat_file_manager_lock_);
if (assert_no_files_loaded) {
- CHECK_EQ(oat_files_.size(), GetBootOatFiles().size());
+ // Make sure all files that were loaded up to this point are on /system.
+ if (kIsTargetBuild) {
+ for (const std::unique_ptr<const OatFile>& oat_file : oat_files_) {
+ CHECK(LocationIsOnSystem(oat_file->GetLocation().c_str())) << oat_file->GetLocation();
+ }
+ }
}
only_use_system_oat_files_ = true;
}