Handle retry count
Test: vdc setCheckpoint 2 then reboot 3 times checking state
Bug: 112901762
Change-Id: I85a71d059bca27b76175b9bd8465cc453f0ddb8d
diff --git a/Checkpoint.cpp b/Checkpoint.cpp
index 1833733..8f86174 100644
--- a/Checkpoint.cpp
+++ b/Checkpoint.cpp
@@ -66,7 +66,7 @@
bool cp_startCheckpoint(int retry) {
if (retry < -1) return false;
- std::string content = std::to_string(retry);
+ std::string content = std::to_string(retry + 1);
if (retry == -1) {
sp<IBootControl> module = IBootControl::getService();
if (module) {
@@ -136,7 +136,7 @@
return false;
}
-bool cp_needsCheckpoint(void) {
+bool cp_needsCheckpoint() {
bool ret;
std::string content;
sp<IBootControl> module = IBootControl::getService();
@@ -148,7 +148,7 @@
return false;
}
-bool cp_prepareDriveForCheckpoint(const std::string&) {
+bool cp_prepareCheckpoint() {
auto fstab_default = std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)>{
fs_mgr_read_fstab_default(), fs_mgr_free_fstab};
if (!fstab_default) return false;
diff --git a/Checkpoint.h b/Checkpoint.h
index 54574a7..f3554cc 100644
--- a/Checkpoint.h
+++ b/Checkpoint.h
@@ -32,7 +32,7 @@
bool cp_needsCheckpoint();
-bool cp_prepareDriveForCheckpoint(const std::string& mountPoint);
+bool cp_prepareCheckpoint();
bool cp_restoreCheckpoint(const std::string& mountPoint);
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index 3884875..4a9ed5b 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -797,13 +797,11 @@
return ok();
}
-binder::Status VoldNativeService::prepareDriveForCheckpoint(const std::string& mountPoint,
- bool* _aidl_return) {
+binder::Status VoldNativeService::prepareCheckpoint(bool* _aidl_return) {
ENFORCE_UID(AID_SYSTEM);
- CHECK_ARGUMENT_PATH(mountPoint);
ACQUIRE_LOCK;
- *_aidl_return = cp_prepareDriveForCheckpoint(mountPoint);
+ *_aidl_return = cp_prepareCheckpoint();
return ok();
}
diff --git a/VoldNativeService.h b/VoldNativeService.h
index 594c002..3bc07b6 100644
--- a/VoldNativeService.h
+++ b/VoldNativeService.h
@@ -118,7 +118,7 @@
binder::Status needsCheckpoint(bool* _aidl_return);
binder::Status needsRollback(bool* _aidl_return);
binder::Status commitChanges(bool* _aidl_return);
- binder::Status prepareDriveForCheckpoint(const std::string& mountPoint, bool* _aidl_return);
+ binder::Status prepareCheckpoint(bool* _aidl_return);
binder::Status restoreCheckpoint(const std::string& mountPoint, bool* _aidl_return);
binder::Status markBootAttempt(bool* __aidl_return);
binder::Status abortChanges();
diff --git a/binder/android/os/IVold.aidl b/binder/android/os/IVold.aidl
index 27330fe..c95d5ad 100644
--- a/binder/android/os/IVold.aidl
+++ b/binder/android/os/IVold.aidl
@@ -101,7 +101,7 @@
boolean needsRollback();
void abortChanges();
boolean commitChanges();
- boolean prepareDriveForCheckpoint(@utf8InCpp String mountPoint);
+ boolean prepareCheckpoint();
boolean restoreCheckpoint(@utf8InCpp String device);
boolean markBootAttempt();
diff --git a/vdc.cpp b/vdc.cpp
index 5e2c37a..6efd72c 100644
--- a/vdc.cpp
+++ b/vdc.cpp
@@ -123,10 +123,9 @@
bool success = false;
checkStatus(vold->commitChanges(&success));
return success ? 1 : 0;
- } else if (args[0] == "checkpoint" && args[1] == "prepareDriveForCheckpoint" &&
- args.size() == 3) {
+ } else if (args[0] == "checkpoint" && args[1] == "prepareCheckpoint" && args.size() == 2) {
bool success = false;
- checkStatus(vold->prepareDriveForCheckpoint(args[2], &success));
+ checkStatus(vold->prepareCheckpoint(&success));
return success ? 1 : 0;
} else if (args[0] == "checkpoint" && args[1] == "restoreCheckpoint" && args.size() == 3) {
bool success = false;