Mark A/B Boot success before committing checkpoint
This marks the slot as successful within commitChanges, increasing the available roll back window significantly. Test: When taking an update on a checkpoint enabled device, it marks the slot as successful just before committing the checkpoint. Visible in logs as call to vdc commitChanges, followed by "Marked slot as booted succesfully." Bug: 123260515 Change-Id: If71fcde57b3bdee2cfaabb590f123a2d00da3228
This commit is contained in:
parent
253b44ea6d
commit
886915bb6f
1 changed files with 12 additions and 0 deletions
|
@ -45,6 +45,7 @@ using android::fs_mgr::ReadDefaultFstab;
|
||||||
using android::fs_mgr::ReadFstabFromFile;
|
using android::fs_mgr::ReadFstabFromFile;
|
||||||
using android::hardware::hidl_string;
|
using android::hardware::hidl_string;
|
||||||
using android::hardware::boot::V1_0::BoolResult;
|
using android::hardware::boot::V1_0::BoolResult;
|
||||||
|
using android::hardware::boot::V1_0::CommandResult;
|
||||||
using android::hardware::boot::V1_0::IBootControl;
|
using android::hardware::boot::V1_0::IBootControl;
|
||||||
using android::hardware::boot::V1_0::Slot;
|
using android::hardware::boot::V1_0::Slot;
|
||||||
|
|
||||||
|
@ -108,6 +109,16 @@ Status cp_commitChanges() {
|
||||||
if (!isCheckpointing) {
|
if (!isCheckpointing) {
|
||||||
return Status::ok();
|
return Status::ok();
|
||||||
}
|
}
|
||||||
|
sp<IBootControl> module = IBootControl::getService();
|
||||||
|
if (module) {
|
||||||
|
CommandResult cr;
|
||||||
|
module->markBootSuccessful([&cr](CommandResult result) { cr = result; });
|
||||||
|
if (!cr.success) {
|
||||||
|
std::string msg = "Error marking booted successfully: " + std::string(cr.errMsg);
|
||||||
|
return Status::fromExceptionCode(EINVAL, String8(msg.c_str()));
|
||||||
|
}
|
||||||
|
LOG(INFO) << "Marked slot as booted successfully.";
|
||||||
|
}
|
||||||
// Must take action for list of mounted checkpointed things here
|
// Must take action for list of mounted checkpointed things here
|
||||||
// To do this, we walk the list of mounted file systems.
|
// To do this, we walk the list of mounted file systems.
|
||||||
// But we also need to get the matching fstab entries to see
|
// But we also need to get the matching fstab entries to see
|
||||||
|
@ -138,6 +149,7 @@ Status cp_commitChanges() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetProperty("vold.checkpoint_committed", "1");
|
SetProperty("vold.checkpoint_committed", "1");
|
||||||
|
LOG(INFO) << "Checkpoint has been committed.";
|
||||||
isCheckpointing = false;
|
isCheckpointing = false;
|
||||||
if (!android::base::RemoveFileIfExists(kMetadataCPFile, &err_str))
|
if (!android::base::RemoveFileIfExists(kMetadataCPFile, &err_str))
|
||||||
return Status::fromExceptionCode(errno, err_str.c_str());
|
return Status::fromExceptionCode(errno, err_str.c_str());
|
||||||
|
|
Loading…
Reference in a new issue