Merge "libsnapshot: Allow multiple calls to FinishedSnapshotWrites"

am: 09a0c98506

Change-Id: If259e2d4a9663575198aa1b14e13a4c9a50cf1e7
This commit is contained in:
Yifan Hong 2019-09-04 13:05:48 -07:00 committed by android-build-merger
commit ab13ed350e

View file

@ -152,7 +152,13 @@ bool SnapshotManager::FinishedSnapshotWrites() {
auto lock = LockExclusive();
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.";
return false;
}