{
std::string krateLauncherUri;
notification_h newNoti;
- app_control_h appControl;
+ app_control_h appControl = NULL;
char* pkgId;
+ int ret;
notification_clone(noti, &newNoti);
notification_get_pkgname(noti, &pkgId);
try {
PackageInfo pkg(pkgId, user.getUid());
- notification_set_image(newNoti, NOTIFICATION_IMAGE_TYPE_ICON, pkg.getIcon().c_str());
+ ret = notification_set_image(newNoti, NOTIFICATION_IMAGE_TYPE_ICON, pkg.getIcon().c_str());
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ throw runtime::Exception("notification_set_image");
+ }
} catch (runtime::Exception &e) {
- notification_set_image(newNoti, NOTIFICATION_IMAGE_TYPE_ICON, DEFAULT_ICON_PATH);
+ ret = notification_set_image(newNoti, NOTIFICATION_IMAGE_TYPE_ICON, DEFAULT_ICON_PATH);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ ERROR(std::string("Failed to set an image to noti : ") + e.what());
+ }
}
- notification_set_image(newNoti, NOTIFICATION_IMAGE_TYPE_ICON_SUB, NOTIFICATION_SUB_ICON_PATH);
+ ret = notification_set_image(newNoti, NOTIFICATION_IMAGE_TYPE_ICON_SUB, NOTIFICATION_SUB_ICON_PATH);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ ERROR("Failed to set a sub-image to noti");
+ }
- notification_get_launch_option(newNoti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&appControl);
- if (appControl != NULL) {
+ ret = notification_get_launch_option(newNoti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&appControl);
+ if (ret == NOTIFICATION_ERROR_NONE && appControl != NULL) {
char* appId = NULL, *uri = NULL;
app_control_get_app_id(appControl, &appId);
app_control_set_app_id(appControl, KRATE_DELEGATOR_APP);
app_control_set_uri(appControl, krateLauncherUri.c_str());
notification_set_launch_option(newNoti, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, appControl);
+ app_control_destroy(appControl);
}
notification_post_for_uid(newNoti, owner.getUid());
std::unordered_map<int, notification_h>::iterator it;
double progress;
char *str;
+ int ret;
it = notiHandleMap.find(privId);
if (it == notiHandleMap.end()) {
};
for (notification_image_type_e type : imageTypes) {
- notification_get_image(noti, type, &str);
- notification_set_image(it->second, type, str);
+ ret = notification_get_image(noti, type, &str);
+ if (ret == NOTIFICATION_ERROR_NONE) {
+ ret = notification_set_image(it->second, type, str);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ ERROR("Failed to copy an image of noti");
+ }
+ }
}
notification_text_type_e textTypes[] = {
};
for (notification_text_type_e type : textTypes) {
- notification_get_text(noti, type, &str);
- notification_set_text(it->second, type, str, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ ret = notification_get_text(noti, type, &str);
+ if (ret == NOTIFICATION_ERROR_NONE) {
+ ret = notification_set_text(it->second, type, str, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (ret != NOTIFICATION_ERROR_NONE) {
+ ERROR("Failed to copy a text of noti");
+ }
+ }
}
notification_get_size(noti, &progress);
for (int i = 0; i < GUMD_RETRY_COUNT && guser == NULL; i++) {
guser = gum_user_create_sync(FALSE);
}
+
+ if (guser == NULL) {
+ ret = 1;
+ break;
+ }
+
g_object_set(G_OBJECT(guser), "username", name.c_str(),
"usertype", GUM_USERTYPE_SECURITY, NULL);
ret = gum_user_add_sync(guser);
for (int i = 0; i < GUMD_RETRY_COUNT && guser == NULL; i++) {
guser = gum_user_get_sync(user.getUid(), FALSE);
}
+
+ if (guser == NULL) {
+ ret = 1;
+ break;
+ }
+
ret = gum_user_delete_sync(guser, TRUE);
g_object_unref(guser);
}
int PackageListCallback(pkgmgrinfo_pkginfo_h handle, void *data)
{
char* pkgid = nullptr;
- ::pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
+
+ if (::pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid) != PMINFO_R_OK) {
+ return 0;
+ }
std::vector<std::string>* packageList = static_cast<std::vector<std::string>*>(data);
packageList->push_back(pkgid);
componentType = static_cast<int>(comp);
}
- ::pkgmgrinfo_appinfo_is_nodisplay(handle, &noDisplayed);
- ::pkgmgrinfo_appinfo_is_taskmanage(handle, &taskManaged);
+ ret = ::pkgmgrinfo_appinfo_is_nodisplay(handle, &noDisplayed);
+ if (ret != PMINFO_R_OK) {
+ noDisplayed = false;
+ }
+
+ ret = ::pkgmgrinfo_appinfo_is_taskmanage(handle, &taskManaged);
+ if (ret != PMINFO_R_OK) {
+ taskManaged = false;
+ }
}
const std::string& ApplicationInfo::getId() const