pkgmgrinfo_appinfo_h handle;
int ret = pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle);
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get app info.");
+ LoggerE("Failed to get app info: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get app info."), out);
return;
}
std::shared_ptr<picojson::value> response{new picojson::value(picojson::object())};
LoggerD("checking if application is still alive");
- if (app_manager_get_app_id(that->pid_, &app_id) == APP_MANAGER_ERROR_NONE) {
+ int ret = app_manager_get_app_id(that->pid_, &app_id);
+ if (APP_MANAGER_ERROR_NONE == ret) {
LoggerD("application is alive - failure");
free(app_id);
// context is still alive, report error
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to kill application."),
&response->get<picojson::object>());
} else {
- LoggerD("application is dead - success");
+ LoggerD("application is dead - success: %d (%s)", ret, get_error_message(ret));
ReportSuccess(response->get<picojson::object>());
}
std::unique_ptr<char, void(*)(void*)> app_id_ptr(app_id, &std::free);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get application ID, error: %d", ret);
+ LoggerE("Failed to get application ID, error: %d (%s)", ret, get_error_message(ret));
result = PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get application ID.");
CHECK_RESULT(result, response, handler)
}
app_context_ptr(app_context, &app_context_destroy); // automatically release the memory
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get application context handle");
+ LoggerE("Failed to get application context handle: %d (%s)", ret, get_error_message(ret));
result = PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get application ID.");
CHECK_RESULT(result, response, handler)
}
int ret = app_context_get_pid(app_context, &pid);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get pid of terminated app (%d)", ret);
+ LoggerE("Failed to get pid of terminated app: %d (%s)", ret, get_error_message(ret));
return;
}
ret = app_manager_set_app_context_event_cb(terminate_callback, handler);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Error while registering app context event (%d)", ret);
+ LoggerE("Error while registering app context event: %d (%s)", ret, get_error_message(ret));
result = PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to register termination callback.");
CHECK_RESULT(result, response, handler)
}
ret = app_manager_terminate_app(app_context);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to terminate application.");
+ LoggerE("Failed to terminate application: %d (%s)", ret, get_error_message(ret));
result = PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to terminate application.");
CHECK_RESULT(result, response, handler)
}
if (ret < 0) {
result = PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error has occurred.");
+ LoggerD("Aul open return: %d (%s)", ret, get_error_message(ret));
switch (ret) {
case AUL_R_EINVAL:
case AUL_R_ERROR:
int ret = app_control_set_app_id(app_control_ptr.get(), app_id.c_str());
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Invalid parameter passed.");
+ LoggerE("Failed to set app id: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."),
&response->get<picojson::object>());
return;
int ret = app_control_set_launch_mode(app_control_ptr.get(), launch_mode);
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Setting launch mode failed.");
+ LoggerE("Setting launch mode failed: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Setting launch mode failed."),
&response->get<picojson::object>());
return;
&response->get<picojson::object>());
return;
default:
- LoggerE("app_control_send_launch_request returns UNKNOWN ERROR!!!");
+ LoggerE("app_control_send_launch_request returns: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."),
&response->get<picojson::object>());
return;
pkgmgrinfo_appinfo_h handle;
int ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get appInfo");
+ LoggerE("Failed to get appInfo: %d (%s)", ret, get_error_message(ret));
} else {
picojson::array* array = static_cast<picojson::array*>(user_data);
array->push_back(picojson::value(picojson::object()));
app_control_ptr.get(), app_control_matched, &array.first->second.get<picojson::array>());
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("app_control_foreach_app_matched error: %d", ret);
+ LoggerE("app_control_foreach_app_matched error: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR,"Unknown error"), &response_obj);
// remove copied ApplicationControl from result
int ret = app_manager_foreach_app_context(app_context_cb, &array);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("app_manager_foreach_app_context error");
+ LoggerE("app_manager_foreach_app_context error: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), &response_obj);
} else {
ReportSuccess(result, response_obj);
return;
default:
- LoggerE("app_manager_get_app_id returned: %d", ret);
+ LoggerE("app_manager_get_app_id returned: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), out);
return;
}
int ret = pkgmgrinfo_appinfo_get_installed_list(app_info_cb, &array);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("pkgmgrinfo_appinfo_get_installed_list error");
+ LoggerE("pkgmgrinfo_appinfo_get_installed_list error: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Unknown error."), &response_obj);
} else {
ReportSuccess(result, response_obj);
pkgmgrinfo_appinfo_h handle = nullptr;
- if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle)) {
- LoggerE("Failed to get app info");
+ int ret = pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle);
+ if (PMINFO_R_OK != ret) {
+ LoggerE("Failed to get app info: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get app info."), out);
return;
}
int ret = app_manager_get_app_info(app_id.c_str(), &handle);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get app info.");
+ LoggerE("Failed to get app info: %d (%s)", ret, get_error_message(ret));
return nullptr;
}
ret = app_info_get_package(handle, &pkg_id);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get package id.");
+ LoggerE("Failed to get package id: %d (%s)", ret, get_error_message(ret));
pkg_id = nullptr;
}
ret = app_info_destroy(handle);
if (APP_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to destroy app info.");
+ LoggerE("Failed to destroy app info: %d (%s)", ret, get_error_message(ret));
}
return pkg_id;
pkg_info_ptr(pkg_info, &package_info_destroy); // automatically release the memory
if (PACKAGE_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get package info.");
+ LoggerE("Failed to get package info: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get package info."), out);
return;
}
ret = package_info_foreach_cert_info(pkg_info, cert_info_cb, &result.get<picojson::array>());
if ((PACKAGE_MANAGER_ERROR_NONE != ret) && (PACKAGE_MANAGER_ERROR_IO_ERROR != ret)) {
- LoggerE("Failed to get certificates info.");
+ LoggerE("Failed to get certificates info: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get certificates info."), out);
return;
}
pkg_info_ptr(pkg_info, &pkgmgrinfo_pkginfo_destroy_pkginfo); // automatically release the memory
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get package info.");
+ LoggerE("Failed to get package info: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get package info."), out);
return;
}
ret = pkgmgrinfo_pkginfo_get_root_path(pkg_info, &root_path);
if (PMINFO_R_OK != ret || nullptr == root_path) {
- LoggerE("Failed to get root path.");
+ LoggerE("Failed to get root path: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get root path."), out);
return;
}
pkg_info_ptr(handle, &pkgmgrinfo_appinfo_destroy_appinfo); // automatically release the memory
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get app info.");
+ LoggerE("Failed to get app info: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::NOT_FOUND_ERR, "Failed to get app info."), out);
return;
}
ret = pkgmgrinfo_appinfo_foreach_metadata(handle, meta_data_cb, &result.get<picojson::array>());
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get metadata.");
+ LoggerE("Failed to get metadata: %d (%s)", ret, get_error_message(ret));
ReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to get metadata."), out);
return;
}
case Event::kUpdated:
{
pkgmgrinfo_appinfo_h handle = nullptr;
- if (PMINFO_R_OK != pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle)) {
- LoggerE("Failed to get application information handle.");
+ int ret = pkgmgrinfo_appinfo_get_appinfo(app_id.c_str(), &handle);
+ if (PMINFO_R_OK != ret) {
+ LoggerE("Failed to get application information handle: %d (%s)",
+ ret, get_error_message(ret));
continue;
}
auto info = data_obj.insert(std::make_pair(kData, picojson::value(picojson::object())));
int ret = package_info_create(package, &package_info);
if (PACKAGE_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to create package info");
+ LoggerE("Failed to create package info: %d (%s)", ret, get_error_message(ret));
return;
}
ApplicationIdCallback,
this);
if (PACKAGE_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to get application IDs");
+ LoggerE("Failed to get application IDs: %d (%s)", ret, get_error_message(ret));
}
ret = package_info_destroy(package_info);
if (PACKAGE_MANAGER_ERROR_NONE != ret) {
- LoggerE("Failed to destroy package info");
+ LoggerE("Failed to destroy package info: %d (%s)", ret, get_error_message(ret));
}
}
package_id_str.c_str(), NULL, NULL, NULL);
if (size < 0) {
- LoggerE("Failed to get installed size");
+ LoggerE("Failed to get installed size: %d (%s)", size, get_error_message(size));
}
pkgmgr_client_free(pc);
ret = bundle_add(data, "data", args.get("data").serialize().c_str());
if (ret != EVENT_ERROR_NONE) {
- LoggerE("bundle_add failed, error");
+ LoggerE("bundle_add failed, error: %d (%s)", ret, get_error_message(ret));
ReportError(out);
return;
}
if (ret == EVENT_ERROR_NONE) {
ReportSuccess(out);
} else {
- LoggerE("event_publish_app_event failed, error");
+ LoggerE("event_publish_app_event failed, error: %d (%s)", ret, get_error_message(ret));
ReportError(out);
}
}
if (key != "") {
ret = bundle_get_str(event_data, key.c_str(), &val);
if (EVENT_ERROR_NONE != ret) {
- LOGGER(ERROR) << "failed to read bundle data, error: " << ret;
+ LoggerE("failed to read bundle data, error: %d (%s)", ret, get_error_message(ret));
return;
}
state = std::string(val);
}
- LOGGER(DEBUG) << "state is: " << state;
+ LoggerD("State is %s", state.c_str());
event_o["value"] = picojson::value(state);
} else { // user event
ret = bundle_get_str(event_data, "data", &val);
if (EVENT_ERROR_NONE != ret) {
- LOGGER(ERROR) << "failed to read bundle data, error: " << ret;
+ LoggerE("failed to read bundle data, error: %d (%s)", ret, get_error_message(ret));
return;
}
event_handler_h event_handler;
ret = event_add_event_handler(event_name.c_str(), OnEvent, this, &event_handler);
- LOGGER(DEBUG) << "event_add_event_handler() result: " << ret;
+ LoggerD("event_add_event_handler() result: %d (%s)", ret, get_error_message(ret));
if (EVENT_ERROR_PERMISSION_DENIED == ret) {
LOGGER(ERROR) << "event_add_event_handler failed, error: " << ret;
return PlatformResult(ErrorCode::SECURITY_ERR, "The privilege is required");
ret = event_remove_event_handler(event_handler);
if (EVENT_ERROR_NONE != ret) {
- LOGGER(ERROR) << "event_remove_event_handler failed, error: " << ret;
+ LoggerE("event_remove_event_handler failed, error: %d (%s)", ret, get_error_message(ret));
return;
}
// application ID
ret = pkgmgrinfo_appinfo_get_appid(handle, &tmp_str);
if ((PMINFO_R_OK != ret) || (nullptr == tmp_str)) {
- LoggerE("Failed to get appid");
+ LoggerE("Failed to get appid: %d (%s)", ret, get_error_message(ret));
} else {
app_info->insert(std::make_pair("id", picojson::value(tmp_str)));
}
// name
ret = pkgmgrinfo_appinfo_get_label(handle, &tmp_str);
if ((PMINFO_R_OK != ret) || (nullptr == tmp_str)) {
- LoggerE("Failed to get label");
+ LoggerE("Failed to get label: %d (%s)", ret, get_error_message(ret));
} else {
app_info->insert(std::make_pair("name", picojson::value(tmp_str)));
}
// icon path
ret = pkgmgrinfo_appinfo_get_icon(handle, &tmp_str);
if ((PMINFO_R_OK != ret) || (nullptr == tmp_str)) {
- LoggerE("Failed to get icon path");
+ LoggerE("Failed to get icon path: %d (%s)", ret, get_error_message(ret));
} else {
app_info->insert(std::make_pair("iconPath", picojson::value(tmp_str)));
}
bool no_display = false;
ret = pkgmgrinfo_appinfo_is_nodisplay(handle, &no_display);
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get nodisplay");
+ LoggerE("Failed to get nodisplay: %d (%s)", ret, get_error_message(ret));
} else {
app_info->insert(std::make_pair("show", picojson::value(!no_display)));
}
&categories_array);
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get categories");
+ LoggerE("Failed to get categories: %d (%s)", ret, get_error_message(ret));
}
// package ID
ret = pkgmgrinfo_appinfo_get_pkgid(handle, &tmp_str);
if ((PMINFO_R_OK != ret) || (nullptr == tmp_str)) {
- LoggerE("Failed to get pkgid");
+ LoggerE("Failed to get pkgid: %d (%s)", ret, get_error_message(ret));
} else {
app_info->insert(std::make_pair("packageId", picojson::value(tmp_str)));
}
pkgmgrinfo_pkginfo_h pkginfo;
ret = pkgmgrinfo_pkginfo_get_pkginfo(tmp_str, &pkginfo);
if (PMINFO_R_OK != ret) {
- LoggerE("Failed to get package info");
+ LoggerE("Failed to get package info: %d (%s)", ret, get_error_message(ret));
} else {
// version
tmp_str = nullptr;
ret = pkgmgrinfo_pkginfo_get_version(pkginfo, &tmp_str);
if ((PMINFO_R_OK != ret) || (nullptr == tmp_str)) {
- LoggerE("Failed to get version");
+ LoggerE("Failed to get version: %d (%s)", ret, get_error_message(ret));
} else {
app_info->insert(std::make_pair("version", picojson::value(tmp_str)));
}
int installed_time = 0;
ret = pkgmgrinfo_pkginfo_get_installed_time(pkginfo, &installed_time);
if (ret != PMINFO_R_OK) {
- LoggerE("Fail to get installed date");
+ LoggerE("Fail to get installed date: %d (%s)", ret, get_error_message(ret));
} else {
app_info->insert(std::make_pair("installDate", picojson::value(1000.0 * installed_time)));
}
std::unique_ptr<char, void(*)(void*)> app_id_ptr(app_id, &std::free);
if ((APP_MANAGER_ERROR_NONE != ret) || (nullptr == app_id)) {
- LoggerD("Failed to get application ID from context.");
+ LoggerD("Failed to get application ID from context: %d (%s)", ret, get_error_message(ret));
return false;
}
ret = app_context_get_pid(handle, &pid);
if(ret != APP_MANAGER_ERROR_NONE) {
- LoggerD("Failed to get pid from context.");
+ LoggerD("Failed to get pid from context: %d (%s)", ret, get_error_message(ret));
return false;
}
if ((APP_CONTROL_ERROR_NONE == ret) && (nullptr != tmp_str)) {
LoggerD("operation: %s", tmp_str);
app_control_obj->insert(std::make_pair("operation", picojson::value(std::string(tmp_str))));
+ } else {
+ LoggerE("Get operation failed: %d (%s)", ret, get_error_message(ret));
}
clear(tmp_str);
if ((APP_CONTROL_ERROR_NONE == ret) && (nullptr != tmp_str)) {
LoggerD("MIME: %s", tmp_str);
app_control_obj->insert(std::make_pair("mime", picojson::value(std::string(tmp_str))));
+ } else {
+ LoggerE("Get mime failed: %d (%s)", ret, get_error_message(ret));
}
clear(tmp_str);
if ((APP_CONTROL_ERROR_NONE == ret) && (nullptr != tmp_str)) {
LoggerD("category: %s", tmp_str);
app_control_obj->insert(std::make_pair("category", picojson::value(std::string(tmp_str))));
+ } else {
+ LoggerE("Get category failed: %d (%s)", ret, get_error_message(ret));
}
clear(tmp_str);
ret = app_control_is_extra_data_array(app_control, key.c_str(), &is_array);
if (APP_CONTROL_ERROR_NONE != ret) {
- LoggerE("Failed to check whether extra data is array or not");
+ LoggerE("Failed to check whether extra data is array or not: %d (%s)", ret,
+ get_error_message(ret));
return;
}
}
free(value);
} else {
- LoggerE("Failed to get extra data array, errno: %d", ret);
+ LoggerE("Failed to get extra data array, errno: %d (%s)", ret, get_error_message(ret));
}
} else {
char* value = nullptr;
value_array.push_back(picojson::value(value));
free(value);
} else {
- LoggerE("Failed to get extra data, errno: %d", ret);
+ LoggerE("Failed to get extra data, errno: %d (%s)", ret, get_error_message(ret));
}
}