From 93c78c243d38619522e5e7c7605e1104748f4a88 Mon Sep 17 00:00:00 2001 From: Yo Chiang Date: Wed, 19 Aug 2020 17:14:39 +0800 Subject: [PATCH] Improve ImageManager error message Print more helpful error messages to logcat. Bug: 165471299 Test: Observe logcat Change-Id: I3dca834a7cd3f653b038fc3a4020e96f500e1d1f --- fs_mgr/libfiemap/image_manager.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/fs_mgr/libfiemap/image_manager.cpp b/fs_mgr/libfiemap/image_manager.cpp index f32e0ebfc..93fc1316f 100644 --- a/fs_mgr/libfiemap/image_manager.cpp +++ b/fs_mgr/libfiemap/image_manager.cpp @@ -640,16 +640,22 @@ bool ImageManager::Validate() { return false; } + bool ok = true; for (const auto& partition : metadata->partitions) { auto name = GetPartitionName(partition); auto image_path = GetImageHeaderPath(name); auto fiemap = SplitFiemap::Open(image_path); - if (!fiemap || !fiemap->HasPinnedExtents()) { - LOG(ERROR) << "Image is missing or was moved: " << image_path; - return false; + if (fiemap == nullptr) { + LOG(ERROR) << "SplitFiemap::Open(\"" << image_path << "\") failed"; + ok = false; + continue; + } + if (!fiemap->HasPinnedExtents()) { + LOG(ERROR) << "Image doesn't have pinned extents: " << image_path; + ok = false; } } - return true; + return ok; } bool ImageManager::DisableImage(const std::string& name) {