Set request type differently to each recovery mode.
Recovery for install will emit uninstall signal, and recovery for
update(RecoveryUpdate) will emit upgrade signal.
Change-Id: I619e041e9541ef00d84bdbe1150aa4265e60e67a
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
// send START signal as soon as possible if not sent
if (pi_->state() == PkgmgrSignal::State::NOT_SENT) {
if (!context_->pkgid.get().empty()) {
+ // set request type before sending start signal
+ pi_->SetRequestType(context_->request_type.get());
pi_->SendStarted(context_->pkg_type.get(), context_->pkgid.get());
}
}
if (pi_) {
// send START if pkgid was not parsed
if (pi_->state() == PkgmgrSignal::State::NOT_SENT) {
+ // set request type before sending start signal
+ pi_->SetRequestType(context_->request_type.get());
pi_->SendStarted(context_->pkg_type.get(), context_->pkgid.get());
}
pi_->SendFinished(process_status,
std::unique_ptr<PkgmgrSignal> PkgMgrInterface::CreatePkgmgrSignal() const {
if (!pkgmgr_installer_interface_->ShouldCreateSignal())
return nullptr;
- return std::unique_ptr<PkgmgrSignal>(new PkgmgrSignal(pi_, GetRequestType()));
+ return std::unique_ptr<PkgmgrSignal>(new PkgmgrSignal(pi_));
}
bool PkgMgrInterface::GetIsForceRemoval() const {
const uid_t kGlobalUserUid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER);
const std::map<ci::RequestType, const char*> kEventStr = {
{ci::RequestType::Install, PKGMGR_INSTALLER_INSTALL_EVENT_STR},
- {ci::RequestType::Recovery, PKGMGR_INSTALLER_INSTALL_EVENT_STR},
+ {ci::RequestType::Recovery, PKGMGR_INSTALLER_UNINSTALL_EVENT_STR},
+ {ci::RequestType::RecoveryUpdate, PKGMGR_INSTALLER_UPGRADE_EVENT_STR},
{ci::RequestType::Reinstall, PKGMGR_INSTALLER_UPGRADE_EVENT_STR},
{ci::RequestType::Uninstall, PKGMGR_INSTALLER_UNINSTALL_EVENT_STR},
{ci::RequestType::PartialUninstall, PKGMGR_INSTALLER_UNINSTALL_EVENT_STR},
PkgmgrSignal::State PkgmgrSignal::state_ = PkgmgrSignal::State::NOT_SENT;
-PkgmgrSignal::PkgmgrSignal(pkgmgr_installer* pi, RequestType req_type)
- : pi_(pi), request_type_(req_type), error_message_sent_(false) {
+PkgmgrSignal::PkgmgrSignal(pkgmgr_installer* pi)
+ : pi_(pi), request_type_(RequestType::Unknown), error_message_sent_(false) {
uid_ = pkgmgr_installer_get_uid(pi_);
request_mode_ = GetRequestMode(uid_);
}
return true;
}
+void PkgmgrSignal::SetRequestType(RequestType req_type) {
+ request_type_ = req_type;
+}
+
bool PkgmgrSignal::SendSignal(
const char* key,
const char* value,
* Constructor
*
* \param pi pointer for pkgmgr_installer structure
- * \param req_type request type
*/
- explicit PkgmgrSignal(pkgmgr_installer* pi, RequestType req_type);
+ explicit PkgmgrSignal(pkgmgr_installer* pi);
/**
* "start" Signal sending
bool IsFinished() const;
/**
+ * Set current request type
+ *
+ * \param req_type request type
+ */
+ void SetRequestType(RequestType req_type);
+
+ /**
* Getter of state of the object
*
*\return current state
Delta,
Move,
Recovery,
+ RecoveryUpdate,
MountInstall,
MountUpdate,
ManifestDirectInstall,
break;
case RequestType::Update:
LOG(INFO) << "Running recovery for update installation";
+ // There are two recovery types. One is recovery of install,
+ // the other is recovery of update. They should have send
+ // different signal.
+ context_->request_type.set(RequestType::RecoveryUpdate);
break;
case RequestType::Delta:
LOG(INFO) << "Running recovery for delta installation";
+ context_->request_type.set(RequestType::RecoveryUpdate);
break;
case RequestType::MountInstall:
LOG(INFO) << "Running recovery for mount install installation";
break;
case RequestType::MountUpdate:
LOG(INFO) << "Running recovery for mount update installation";
+ context_->request_type.set(RequestType::RecoveryUpdate);
break;
case RequestType::ReadonlyUpdateInstall:
LOG(INFO) << "Running recovery for readonly update installation";
+ context_->request_type.set(RequestType::RecoveryUpdate);
context_->is_readonly_package.set(true);
context_->root_application_path.set(
GetRootAppPath(true, context_->uid.get()));