Move MarkBootSuccessful to BootControlInterface.
Updating the boot flags to mark the current boot as successful is
platform-specific and part of the BootControlInterface's job. This
patch moves this to a new async method in this interface.
Bug: 24077637
Test: FEATURES=test emerge-link update_engine; cros flash in Chrome OS; tested on a dragonboard.
Change-Id: I23c3ed915dd8d2588a90d84b212bb04977957975
diff --git a/boot_control_android.cc b/boot_control_android.cc
index 4bb3b92..43a1c18 100644
--- a/boot_control_android.cc
+++ b/boot_control_android.cc
@@ -16,10 +16,12 @@
#include "update_engine/boot_control_android.h"
-#include <base/logging.h>
+#include <base/bind.h>
#include <base/files/file_util.h>
+#include <base/logging.h>
#include <base/strings/string_util.h>
#include <chromeos/make_unique_ptr.h>
+#include <chromeos/message_loops/message_loop.h>
#include <cutils/properties.h>
#include <fs_mgr.h>
@@ -174,4 +176,15 @@
return ret == 0;
}
+bool BootControlAndroid::MarkBootSuccessfulAsync(
+ base::Callback<void(bool)> callback) {
+ int ret = module_->markBootSuccessful(module_);
+ if (ret < 0) {
+ LOG(ERROR) << "Unable to mark boot successful: " << strerror(-ret);
+ }
+ return chromeos::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(callback, ret == 0)) !=
+ chromeos::MessageLoop::kTaskIdNull;
+}
+
} // namespace chromeos_update_engine