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

Commit ab13ed35 authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Merge "libsnapshot: Allow multiple calls to FinishedSnapshotWrites"

am: 09a0c985

Change-Id: If259e2d4a9663575198aa1b14e13a4c9a50cf1e7
parents 6777935a 09a0c985
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -152,7 +152,13 @@ bool SnapshotManager::FinishedSnapshotWrites() {
    auto lock = LockExclusive();
    auto lock = LockExclusive();
    if (!lock) return false;
    if (!lock) return false;


    if (ReadUpdateState(lock.get()) != UpdateState::Initiated) {
    auto update_state = ReadUpdateState(lock.get());
    if (update_state == UpdateState::Unverified) {
        LOG(INFO) << "FinishedSnapshotWrites already called before. Ignored.";
        return true;
    }

    if (update_state != UpdateState::Initiated) {
        LOG(ERROR) << "Can only transition to the Unverified state from the Initiated state.";
        LOG(ERROR) << "Can only transition to the Unverified state from the Initiated state.";
        return false;
        return false;
    }
    }