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
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index f5cde42..11a9398 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -910,12 +910,11 @@
VolumeManager::Instance()->destroySandboxForApp(packageName, appId, sandboxId, userId));
}
-binder::Status VoldNativeService::startCheckpoint(int32_t retry, bool* _aidl_return) {
+binder::Status VoldNativeService::startCheckpoint(int32_t retry) {
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_LOCK;
- *_aidl_return = cp_startCheckpoint(retry);
- return ok();
+ return cp_startCheckpoint(retry);
}
binder::Status VoldNativeService::needsRollback(bool* _aidl_return) {
@@ -934,46 +933,40 @@
return ok();
}
-binder::Status VoldNativeService::commitChanges(bool* _aidl_return) {
+binder::Status VoldNativeService::commitChanges() {
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_LOCK;
- *_aidl_return = cp_commitChanges();
- return ok();
+ return cp_commitChanges();
}
-binder::Status VoldNativeService::prepareCheckpoint(bool* _aidl_return) {
+binder::Status VoldNativeService::prepareCheckpoint() {
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_LOCK;
- *_aidl_return = cp_prepareCheckpoint();
- return ok();
+ return cp_prepareCheckpoint();
}
-binder::Status VoldNativeService::restoreCheckpoint(const std::string& mountPoint,
- bool* _aidl_return) {
+binder::Status VoldNativeService::restoreCheckpoint(const std::string& mountPoint) {
ENFORCE_UID(AID_SYSTEM);
CHECK_ARGUMENT_PATH(mountPoint);
ACQUIRE_LOCK;
- *_aidl_return = cp_restoreCheckpoint(mountPoint);
- return ok();
+ return cp_restoreCheckpoint(mountPoint);
}
-binder::Status VoldNativeService::markBootAttempt(bool* _aidl_return) {
+binder::Status VoldNativeService::markBootAttempt() {
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_LOCK;
- *_aidl_return = cp_markBootAttempt();
- return ok();
+ return cp_markBootAttempt();
}
binder::Status VoldNativeService::abortChanges() {
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_LOCK;
- cp_abortChanges();
- return ok();
+ return cp_abortChanges();
}
} // namespace vold