#include <manifest_parser/utils/logging.h>
+#include <aul.h>
+#include <bundle_cpp.h>
#include <unistd.h>
#include <sys/types.h>
#include <systemd/sd-login.h>
PkgmgrSignal::PkgmgrSignal(pkgmgr_installer* pi)
: pi_(pi), state_(State::NOT_SENT), request_type_(RequestType::Unknown),
- error_message_sent_(false) {
+ error_message_sent_(false), is_upgrade_(false) {
uid_ = pkgmgr_installer_get_uid(pi_);
request_mode_ = GetRequestMode(uid_);
}
if (key == kEventStr.end())
return false;
+ if (strcmp(key->second, PKGMGR_INSTALLER_UPGRADE_EVENT_STR) == 0)
+ is_upgrade_ = true;
+
+ pkgmgr_installer_set_is_upgrade(pi_, is_upgrade_ ? 1 : 0);
+
if (!SendSignal(PKGMGR_INSTALLER_START_KEY_STR, key->second, type, pkgid))
return false;
if (state_ != State::STARTED)
return false;
+ pkgmgr_installer_set_is_upgrade(pi_, is_upgrade_ ? 1 : 0);
+
if (result != Step::Status::OK && !error_message_sent_) {
if (!SendSignal(
PKGMGR_INSTALLER_ERROR_KEY_STR,
PKGMGR_INSTALLER_ERROR_KEY_STR,
std::to_string(static_cast<int>(result)).c_str(), type, pkgid);
}
+
if (!SendSignal(
PKGMGR_INSTALLER_END_KEY_STR, GetResultKey(result), type, pkgid))
return false;
for (auto l : user_list_)
SendSignal(l.first,
PKGMGR_INSTALLER_END_KEY_STR, GetResultKey(result), type, pkgid);
+
state_ = State::FINISHED;
return true;
}
if (state_ != State::STARTED)
return false;
+ pkgmgr_installer_set_is_upgrade(pi_, is_upgrade_ ? 1 : 0);
+
std::string error_value = std::to_string(static_cast<int>(result));
if (!error_message.empty())
error_value = error_value + ":" + error_message;
const char* value,
const std::string& type,
const std::string& pkgid) const {
+ if (!strcmp(key, "start") || !strcmp(key, "error") || !strcmp(key, "end")) {
+ uid_t uid = pkgmgr_installer_get_uid(pi_);
+ tizen_base::Bundle b({
+ { AUL_K_PKGID, pkgid },
+ { AUL_K_PACKAGETYPE, type },
+ { AUL_K_PKG_EVENT_NAME, key },
+ { AUL_K_PKG_EVENT_RESULT, value }
+ });
+
+ if (aul_package_pre_event_send(uid, b.GetHandle()) != AUL_R_OK)
+ LOG(ERROR) << "aul_package_pre_event_send() is failed";
+ }
+
// send pkgmgr signal
if (pkgmgr_installer_send_signal(
pi_,
case RequestMode::USER:
if (uid_ != uids[i])
continue;
- // if global pkg is installed,
- // user pkg operation will be handled as update.
- if (pkg_query_for_global.IsPackageInstalled(ci::RequestMode::GLOBAL))
- user_list_.emplace_back(uids[i], RequestType::Update);
- else
- user_list_.emplace_back(uids[i], request_type_);
+ user_list_.emplace_back(uids[i], request_type_);
break;
default:
user_list_.emplace_back(uids[i], request_type_);