summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-02-10 05:04:48 +0100
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-02-10 05:04:48 +0100
commit634b0c59f5124373b583c62a247ca3841c6cca10 (patch)
tree628a212ab059a5b3b2307060f400ed523b8f2fd8
parentSnap for 5286292 from 61fd028079a5b2a19574a41a2173b9b4719324a8 to qt-release (diff)
parentMerge "Defer marking boot successful when checkpointing" am: 90edbb17f8 am: 5837eba8ed (diff)
downloadandroid_bootable_recovery-634b0c59f5124373b583c62a247ca3841c6cca10.tar
android_bootable_recovery-634b0c59f5124373b583c62a247ca3841c6cca10.tar.gz
android_bootable_recovery-634b0c59f5124373b583c62a247ca3841c6cca10.tar.bz2
android_bootable_recovery-634b0c59f5124373b583c62a247ca3841c6cca10.tar.lz
android_bootable_recovery-634b0c59f5124373b583c62a247ca3841c6cca10.tar.xz
android_bootable_recovery-634b0c59f5124373b583c62a247ca3841c6cca10.tar.zst
android_bootable_recovery-634b0c59f5124373b583c62a247ca3841c6cca10.zip
-rw-r--r--update_verifier/Android.bp5
-rw-r--r--update_verifier/update_verifier.cpp32
2 files changed, 31 insertions, 6 deletions
diff --git a/update_verifier/Android.bp b/update_verifier/Android.bp
index 1b84619af..f6567137e 100644
--- a/update_verifier/Android.bp
+++ b/update_verifier/Android.bp
@@ -42,12 +42,15 @@ cc_library_static {
static_libs: [
"libotautil",
+ "libvold_binder",
],
shared_libs: [
"android.hardware.boot@1.0",
"libbase",
"libcutils",
+ "libbinder",
+ "libutils",
],
proto: {
@@ -70,6 +73,7 @@ cc_binary {
static_libs: [
"libupdate_verifier",
"libotautil",
+ "libvold_binder",
],
shared_libs: [
@@ -80,6 +84,7 @@ cc_binary {
"libhidlbase",
"liblog",
"libprotobuf-cpp-lite",
+ "libbinder",
"libutils",
],
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.";