}
Step::Status StepPrivacyPrivilege::undo() {
- if (type_ == ActionType::Uninstall)
- return Step::Status::OK;
-
int ret = privilege_package_info_unset_package_privilege_info(
context_->uid.get(), context_->pkgid.get().c_str());
if (ret != PRVMGR_ERR_NONE) {
return Status::SECURITY_ERROR;
}
- if (context_->old_manifest_data.get()) {
- manifest_x* old_manifest = context_->old_manifest_data.get();
+ manifest_x* manifest = type_ == ActionType::Uninstall ?
+ context_->manifest_data.get() : context_->old_manifest_data.get();
+
+ if (manifest) {
if (!SetPrivacyPrivilege(context_->uid.get(),
context_->pkgid.get().c_str(),
- old_manifest,
- old_manifest->privileges)) {
+ manifest,
+ manifest->privileges)) {
LOG(ERROR) << "Failed undo privacy privilege";
return Step::Status::SECURITY_ERROR;
}