Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93c78c24 authored by Yo Chiang's avatar Yo Chiang
Browse files

Improve ImageManager error message

Print more helpful error messages to logcat.

Bug: 165471299
Test: Observe logcat
Change-Id: I3dca834a7cd3f653b038fc3a4020e96f500e1d1f
parent 920393dd
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -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) {