Merge "Defer marking boot successful when checkpointing"
This commit is contained in:
commit
90edbb17f8
2 changed files with 31 additions and 6 deletions
|
@ -42,12 +42,15 @@ cc_library_static {
|
||||||
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"libotautil",
|
"libotautil",
|
||||||
|
"libvold_binder",
|
||||||
],
|
],
|
||||||
|
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"android.hardware.boot@1.0",
|
"android.hardware.boot@1.0",
|
||||||
"libbase",
|
"libbase",
|
||||||
"libcutils",
|
"libcutils",
|
||||||
|
"libbinder",
|
||||||
|
"libutils",
|
||||||
],
|
],
|
||||||
|
|
||||||
proto: {
|
proto: {
|
||||||
|
@ -70,6 +73,7 @@ cc_binary {
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"libupdate_verifier",
|
"libupdate_verifier",
|
||||||
"libotautil",
|
"libotautil",
|
||||||
|
"libvold_binder",
|
||||||
],
|
],
|
||||||
|
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
|
@ -80,6 +84,7 @@ cc_binary {
|
||||||
"libhidlbase",
|
"libhidlbase",
|
||||||
"liblog",
|
"liblog",
|
||||||
"libprotobuf-cpp-lite",
|
"libprotobuf-cpp-lite",
|
||||||
|
"libbinder",
|
||||||
"libutils",
|
"libutils",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "update_verifier/update_verifier.h"
|
#include "update_verifier/update_verifier.h"
|
||||||
|
#include <android/os/IVold.h>
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -56,6 +57,8 @@
|
||||||
#include <android-base/strings.h>
|
#include <android-base/strings.h>
|
||||||
#include <android-base/unique_fd.h>
|
#include <android-base/unique_fd.h>
|
||||||
#include <android/hardware/boot/1.0/IBootControl.h>
|
#include <android/hardware/boot/1.0/IBootControl.h>
|
||||||
|
#include <binder/BinderService.h>
|
||||||
|
#include <binder/Status.h>
|
||||||
#include <cutils/android_reboot.h>
|
#include <cutils/android_reboot.h>
|
||||||
|
|
||||||
#include "care_map.pb.h"
|
#include "care_map.pb.h"
|
||||||
|
@ -376,13 +379,30 @@ int update_verifier(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult cr;
|
bool supports_checkpoint = false;
|
||||||
module->markBootSuccessful([&cr](CommandResult result) { cr = result; });
|
auto sm = android::defaultServiceManager();
|
||||||
if (!cr.success) {
|
android::sp<android::IBinder> binder = sm->getService(android::String16("vold"));
|
||||||
LOG(ERROR) << "Error marking booted successfully: " << cr.errMsg;
|
if (binder) {
|
||||||
return reboot_device();
|
auto vold = android::interface_cast<android::os::IVold>(binder);
|
||||||
|
android::binder::Status status = vold->supportsCheckpoint(&supports_checkpoint);
|
||||||
|
if (!status.isOk()) {
|
||||||
|
LOG(ERROR) << "Failed to check if checkpoints supported. Continuing";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Failed to obtain vold Binder. Continuing";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!supports_checkpoint) {
|
||||||
|
CommandResult cr;
|
||||||
|
module->markBootSuccessful([&cr](CommandResult result) { cr = result; });
|
||||||
|
if (!cr.success) {
|
||||||
|
LOG(ERROR) << "Error marking booted successfully: " << cr.errMsg;
|
||||||
|
return reboot_device();
|
||||||
|
}
|
||||||
|
LOG(INFO) << "Marked slot " << current_slot << " as booted successfully.";
|
||||||
|
} else {
|
||||||
|
LOG(INFO) << "Deferred marking slot " << current_slot << " as booted successfully.";
|
||||||
}
|
}
|
||||||
LOG(INFO) << "Marked slot " << current_slot << " as booted successfully.";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(INFO) << "Leaving update_verifier.";
|
LOG(INFO) << "Leaving update_verifier.";
|
||||||
|
|
Loading…
Reference in a new issue