summaryrefslogtreecommitdiffstats
path: root/update_verifier/update_verifier.cpp
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2019-01-23 04:57:28 +0100
committerDaniel Rosenberg <drosen@google.com>2019-02-07 22:26:05 +0100
commit15f22bddfbf62be9861d88e1a9b882f9eea7ef28 (patch)
tree6961ebcbdd26a50a2244ae3ff3dbb5f2878f5df5 /update_verifier/update_verifier.cpp
parentMerge "Add android::fs_mgr namespace for new Fstab code" (diff)
downloadandroid_bootable_recovery-15f22bddfbf62be9861d88e1a9b882f9eea7ef28.tar
android_bootable_recovery-15f22bddfbf62be9861d88e1a9b882f9eea7ef28.tar.gz
android_bootable_recovery-15f22bddfbf62be9861d88e1a9b882f9eea7ef28.tar.bz2
android_bootable_recovery-15f22bddfbf62be9861d88e1a9b882f9eea7ef28.tar.lz
android_bootable_recovery-15f22bddfbf62be9861d88e1a9b882f9eea7ef28.tar.xz
android_bootable_recovery-15f22bddfbf62be9861d88e1a9b882f9eea7ef28.tar.zst
android_bootable_recovery-15f22bddfbf62be9861d88e1a9b882f9eea7ef28.zip
Diffstat (limited to '')
-rw-r--r--update_verifier/update_verifier.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/update_verifier/update_verifier.cpp b/update_verifier/update_verifier.cpp
index d7cd061e2..5e5eac7ab 100644
--- a/update_verifier/update_verifier.cpp
+++ b/update_verifier/update_verifier.cpp
@@ -38,6 +38,7 @@
*/
#include "update_verifier/update_verifier.h"
+#include <android/os/IVold.h>
#include <dirent.h>
#include <errno.h>
@@ -56,6 +57,8 @@
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <android/hardware/boot/1.0/IBootControl.h>
+#include <binder/BinderService.h>
+#include <binder/Status.h>
#include <cutils/android_reboot.h>
#include "care_map.pb.h"
@@ -376,13 +379,30 @@ int update_verifier(int argc, char** argv) {
}
}
- CommandResult cr;
- module->markBootSuccessful([&cr](CommandResult result) { cr = result; });
- if (!cr.success) {
- LOG(ERROR) << "Error marking booted successfully: " << cr.errMsg;
- return reboot_device();
+ bool supports_checkpoint = false;
+ auto sm = android::defaultServiceManager();
+ android::sp<android::IBinder> binder = sm->getService(android::String16("vold"));
+ if (binder) {
+ 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.";