Switch to exceptions for most cp calls
This switches the checkpoint calls that don't need to return a value
to return 0 on success, and an error on failure. This will be transalted
to exceptions for java binder users. needsCheckpoint and needsRollback
still return a boolean value.
Test: vdc setCheckpoint 2 then reboot 3 times checking state
Bug: 112901762
Change-Id: Idd3b5e6036631562a86d5123f533b86cf3bd6032
Merged-In: Idd3b5e6036631562a86d5123f533b86cf3bd6032
diff --git a/vdc.cpp b/vdc.cpp
index 6efd72c..e971d52 100644
--- a/vdc.cpp
+++ b/vdc.cpp
@@ -107,10 +107,8 @@
checkStatus(vold->encryptFstab(args[2]));
} else if (args[0] == "checkpoint" && args[1] == "startCheckpoint" && args.size() == 3) {
int retry;
- bool success = false;
if (!android::base::ParseInt(args[2], &retry)) exit(EINVAL);
- checkStatus(vold->startCheckpoint(retry, &success));
- return success ? 1 : 0;
+ checkStatus(vold->startCheckpoint(retry));
} else if (args[0] == "checkpoint" && args[1] == "needsCheckpoint" && args.size() == 2) {
bool enabled = false;
checkStatus(vold->needsCheckpoint(&enabled));
@@ -120,21 +118,13 @@
checkStatus(vold->needsRollback(&enabled));
return enabled ? 1 : 0;
} else if (args[0] == "checkpoint" && args[1] == "commitChanges" && args.size() == 2) {
- bool success = false;
- checkStatus(vold->commitChanges(&success));
- return success ? 1 : 0;
+ checkStatus(vold->commitChanges());
} else if (args[0] == "checkpoint" && args[1] == "prepareCheckpoint" && args.size() == 2) {
- bool success = false;
- checkStatus(vold->prepareCheckpoint(&success));
- return success ? 1 : 0;
+ checkStatus(vold->prepareCheckpoint());
} else if (args[0] == "checkpoint" && args[1] == "restoreCheckpoint" && args.size() == 3) {
- bool success = false;
- checkStatus(vold->restoreCheckpoint(args[2], &success));
- return success ? 1 : 0;
+ checkStatus(vold->restoreCheckpoint(args[2]));
} else if (args[0] == "checkpoint" && args[1] == "markBootAttempt" && args.size() == 2) {
- bool success = false;
- checkStatus(vold->markBootAttempt(&success));
- return success ? 1 : 0;
+ checkStatus(vold->markBootAttempt());
} else if (args[0] == "checkpoint" && args[1] == "abortChanges" && args.size() == 2) {
checkStatus(vold->abortChanges());
} else {