updater: Fix an issue when resuming an update.
We cannot skip "new" commands while resuming an update with last_command_file, because they read in the data sequentially from the package. Bug: 69858743 Test: Interrupt an update that has new commands. Check the update log. Change-Id: I05fb67246f5ea3ba2a0f78f10255c0d9b0bc2f5a
This commit is contained in:
parent
420f7f8df4
commit
98f875eee7
1 changed files with 6 additions and 3 deletions
|
@ -1730,8 +1730,12 @@ static Value* PerformBlockImageUpdate(const char* name, State* state,
|
|||
continue;
|
||||
}
|
||||
|
||||
// Skip all commands before the saved last command index when resuming an update.
|
||||
if (params.canwrite && params.cmdindex != -1 && params.cmdindex <= saved_last_command_index) {
|
||||
std::string cmdname = std::string(params.cmdname);
|
||||
|
||||
// Skip all commands before the saved last command index when resuming an update, except for
|
||||
// "new" command. Because new commands read in the data sequentially.
|
||||
if (params.canwrite && params.cmdindex != -1 && params.cmdindex <= saved_last_command_index &&
|
||||
cmdname != "new") {
|
||||
LOG(INFO) << "Skipping already executed command: " << params.cmdindex
|
||||
<< ", last executed command for previous update: " << saved_last_command_index;
|
||||
continue;
|
||||
|
@ -1748,7 +1752,6 @@ static Value* PerformBlockImageUpdate(const char* name, State* state,
|
|||
if (!params.canwrite && saved_last_command_index != -1 && params.cmdindex != -1 &&
|
||||
params.cmdindex <= saved_last_command_index) {
|
||||
// TODO(xunchang) check that the cmdline of the saved index is correct.
|
||||
std::string cmdname = std::string(params.cmdname);
|
||||
if ((cmdname == "move" || cmdname == "bsdiff" || cmdname == "imgdiff") &&
|
||||
!params.target_verified) {
|
||||
LOG(WARNING) << "Previously executed command " << saved_last_command_index << ": "
|
||||
|
|
Loading…
Reference in a new issue