summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMyungki Lee <mk5004.lee@samsung.com>2017-08-25 18:46:44 +0900
committerMyungki Lee <mk5004.lee@samsung.com>2017-08-28 13:52:17 +0900
commitca633e89f0b67eeccea6399e2de3bbace279b2c7 (patch)
tree765672eaca5fc36ca65aa6a95426f39f07bbe305
parent0798306db51a41d8068aa2f6933808a0cde98929 (diff)
downloadnotification-ca633e89f0b67eeccea6399e2de3bbace279b2c7.tar.gz
notification-ca633e89f0b67eeccea6399e2de3bbace279b2c7.tar.bz2
notification-ca633e89f0b67eeccea6399e2de3bbace279b2c7.zip
Fixed the default viewer app to run async
Change-Id: I1de15c4dc9a62aad35b1b899d21e625c1caff375 Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
-rw-r--r--include/notification_viewer.h2
-rw-r--r--src/notification_viewer.c42
2 files changed, 24 insertions, 20 deletions
diff --git a/include/notification_viewer.h b/include/notification_viewer.h
index f1ed4c8..f75bdf4 100644
--- a/include/notification_viewer.h
+++ b/include/notification_viewer.h
@@ -18,6 +18,6 @@
#define __NOTIFICATION_VIEWER_H__
int notification_get_default_viewer(const char *path, char **default_viewer);
-int notification_launch_default_viewer(const char *default_viewer, int priv_id);
+int notification_launch_default_viewer(const char *default_viewer, int priv_id, uid_t uid);
#endif /* __NOTIFICATION_VIEWER_H__ */
diff --git a/src/notification_viewer.c b/src/notification_viewer.c
index b28fd8a..52d7f9b 100644
--- a/src/notification_viewer.c
+++ b/src/notification_viewer.c
@@ -20,6 +20,7 @@
#include <app_control_internal.h>
#include <iniparser.h>
+#include <aul_svc.h>
#include <notification.h>
#include <notification_debug.h>
@@ -50,43 +51,46 @@ EXPORT_API int notification_get_default_viewer(const char *path, char **default_
return 0;
}
-EXPORT_API int notification_launch_default_viewer(const char *default_viewer, int priv_id)
+EXPORT_API int notification_launch_default_viewer(const char *default_viewer, int priv_id, uid_t uid)
{
int ret;
char buf[32] = {0,};
- app_control_h app_control = NULL;
+ bundle *b = NULL;
- ret = app_control_create(&app_control);
- if (ret != APP_CONTROL_ERROR_NONE) {
- NOTIFICATION_ERR("Failed to create app_control[%x]", ret);
- goto out;
+ b = bundle_create();
+ if (b == NULL) {
+ NOTIFICATION_ERR("Failed to create bundle");
+ return NOTIFICATION_ERROR_OUT_OF_MEMORY;
}
- ret = app_control_set_app_id(app_control, default_viewer);
- if (ret != APP_CONTROL_ERROR_NONE) {
- NOTIFICATION_ERR("Failed to set app id to app_control[%x]", ret);
+ ret = aul_svc_set_appid(b, default_viewer);
+ if (ret != AUL_SVC_RET_OK) {
+ NOTIFICATION_ERR("Failed to set appid to bundle[%x]", ret);
goto out;
}
snprintf(buf, sizeof(buf), "%d", priv_id);
- ret = app_control_add_extra_data(app_control, "NOTIFICATION_PRIVATE_ID", buf);
- if (ret != APP_CONTROL_ERROR_NONE) {
- NOTIFICATION_ERR("Failed to add extra data to app_control[%x]", ret);
+ ret = aul_svc_add_data(b, "NOTIFICATION_PRIVATE_ID", buf);
+ if (ret != AUL_SVC_RET_OK) {
+ NOTIFICATION_ERR("Failed to add extra_data[%x]", ret);
goto out;
}
- ret = app_control_send_launch_request(app_control, NULL, NULL);
- if (ret != APP_CONTROL_ERROR_NONE) {
- NOTIFICATION_ERR("Failed to request app launch[%x]", ret);
- goto out;
+ ret = aul_svc_run_service_async_for_uid(b, 0, NULL, NULL, uid);
+ if (ret < 0) {
+ NOTIFICATION_ERR("Failed to request app launch[%d]", ret);
+ } else {
+ NOTIFICATION_INFO("successed to request app launch[%d],[%d]",
+ ret, uid);
+ ret = APP_CONTROL_ERROR_NONE;
}
out:
- if (app_control)
- app_control_destroy(app_control);
+ if (b)
+ bundle_free(b);
- if (ret == APP_CONTROL_ERROR_NONE)
+ if (ret == 0)
ret = NOTIFICATION_ERROR_NONE;
else
ret = NOTIFICATION_ERROR_IO_ERROR;