Merge "Add vdc checkpoint supportsBlockCheckpoint" am: 860c731158 am: 4c5ce24e80

am: ca54294cf8

Change-Id: Ibee238347b863404670e972f41cebcb4986c8435
This commit is contained in:
Paul Lawrence 2019-03-18 16:47:37 -07:00 committed by android-build-merger
commit 183f8cd213
6 changed files with 54 additions and 0 deletions

View file

@ -84,6 +84,30 @@ Status cp_supportsCheckpoint(bool& result) {
return Status::ok();
}
Status cp_supportsBlockCheckpoint(bool& result) {
result = false;
for (const auto& entry : fstab_default) {
if (entry.fs_mgr_flags.checkpoint_blk) {
result = true;
return Status::ok();
}
}
return Status::ok();
}
Status cp_supportsFileCheckpoint(bool& result) {
result = false;
for (const auto& entry : fstab_default) {
if (entry.fs_mgr_flags.checkpoint_fs) {
result = true;
return Status::ok();
}
}
return Status::ok();
}
Status cp_startCheckpoint(int retry) {
if (retry < -1) return Status::fromExceptionCode(EINVAL, "Retry count must be more than -1");
std::string content = std::to_string(retry + 1);

View file

@ -25,6 +25,10 @@ namespace vold {
android::binder::Status cp_supportsCheckpoint(bool& result);
android::binder::Status cp_supportsBlockCheckpoint(bool& result);
android::binder::Status cp_supportsFileCheckpoint(bool& result);
android::binder::Status cp_startCheckpoint(int retry);
android::binder::Status cp_commitChanges();

View file

@ -1011,5 +1011,19 @@ binder::Status VoldNativeService::supportsCheckpoint(bool* _aidl_return) {
return cp_supportsCheckpoint(*_aidl_return);
}
binder::Status VoldNativeService::supportsBlockCheckpoint(bool* _aidl_return) {
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_LOCK;
return cp_supportsBlockCheckpoint(*_aidl_return);
}
binder::Status VoldNativeService::supportsFileCheckpoint(bool* _aidl_return) {
ENFORCE_UID(AID_SYSTEM);
ACQUIRE_LOCK;
return cp_supportsFileCheckpoint(*_aidl_return);
}
} // namespace vold
} // namespace android

View file

@ -140,6 +140,8 @@ class VoldNativeService : public BinderService<VoldNativeService>, public os::Bn
binder::Status markBootAttempt();
binder::Status abortChanges();
binder::Status supportsCheckpoint(bool* _aidl_return);
binder::Status supportsBlockCheckpoint(bool* _aidl_return);
binder::Status supportsFileCheckpoint(bool* _aidl_return);
};
} // namespace vold

View file

@ -115,6 +115,8 @@ interface IVold {
void restoreCheckpointPart(@utf8InCpp String device, int count);
void markBootAttempt();
boolean supportsCheckpoint();
boolean supportsBlockCheckpoint();
boolean supportsFileCheckpoint();
@utf8InCpp String createStubVolume(@utf8InCpp String sourcePath,
@utf8InCpp String mountPath, @utf8InCpp String fsType,

View file

@ -109,6 +109,14 @@ int main(int argc, char** argv) {
bool supported = false;
checkStatus(vold->supportsCheckpoint(&supported));
return supported ? 1 : 0;
} else if (args[0] == "checkpoint" && args[1] == "supportsBlockCheckpoint" && args.size() == 2) {
bool supported = false;
checkStatus(vold->supportsBlockCheckpoint(&supported));
return supported ? 1 : 0;
} else if (args[0] == "checkpoint" && args[1] == "supportsFileCheckpoint" && args.size() == 2) {
bool supported = false;
checkStatus(vold->supportsFileCheckpoint(&supported));
return supported ? 1 : 0;
} else if (args[0] == "checkpoint" && args[1] == "startCheckpoint" && args.size() == 3) {
int retry;
if (!android::base::ParseInt(args[2], &retry)) exit(EINVAL);