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

Commit da654af6 authored by Tianjie Xu's avatar Tianjie Xu
Browse files

Skip update verification if care_map is not found

Recently flashed devices may not have care_map.txt in /data/ota_package.
This leads to a failure of update-verifier and prevents boot
success flag from being set. So, we need to skip verification
in case the file is not found.

Error message:
... I update_verifier: Started with arg 1: nonencrypted
... I update_verifier: Booting slot 1: isSlotMarkedSuccessful=0
... E update_verifier: Care map /data/ota_package/care_map.txt not found.
... E update_verifier: Failed to verify all blocks in care map file

Bug: 30156449
Change-Id: Ia15f5f3e7ca2ea6981d49678e799b9f70d134faa
parent 4bbe0c93
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -105,9 +105,12 @@ static bool read_blocks(const std::string& blk_device_prefix, const std::string&

static bool verify_image(const std::string& care_map_name) {
    android::base::unique_fd care_map_fd(TEMP_FAILURE_RETRY(open(care_map_name.c_str(), O_RDONLY)));
    // If the device is flashed before the current boot, it may not have care_map.txt
    // in /data/ota_package. To allow the device to continue booting in this situation,
    // we should print a warning and skip the block verification.
    if (care_map_fd.get() == -1) {
        SLOGE("Care map %s not found.\n", care_map_name.c_str());
        return false;
        SLOGI("Warning: care map %s not found.\n", care_map_name.c_str());
        return true;
    }
    // Care map file has four lines (two lines if vendor partition is not present):
    // First line has the block device name, e.g./dev/block/.../by-name/system.