+ if (__find_login_user(&uid) < 0) {
+ MSG_WARN("Cannot find login user");
+ }
+
+ MSG_DEBUG("login user id [%d]", uid);
+
+ return uid;
+}
+
+
+void* _msg_launch_app(void *data)
+{
+ pthread_mutex_lock(&mx);
+ if (data) {
+ msg_launch_app_data *ad = (msg_launch_app_data *)data;
+ int ret = aul_launch_app_for_uid(ad->app_id, ad->bundle_data, msg_get_login_user());
+ if (ret <= 0) {
+ MSG_ERR("aul_launch_app_for_uid() is failed : %d", ret);
+ }
+
+ g_free(ad->app_id);
+ bundle_free(ad->bundle_data);
+ g_free(ad);
+ }
+ pthread_mutex_unlock(&mx);
+
+ return NULL;
+}
+
+msg_error_t msg_launch_app(const char *app_id, bundle *bundle_data)
+{
+ msg_launch_app_data *data = (msg_launch_app_data *)calloc(1, sizeof(msg_launch_app_data));
+ if (data == NULL) {
+ MSG_ERR("Memory alloc failed!");
+ return MSG_ERR_MEMORY_ERROR;
+ }
+
+ data->app_id = g_strdup(app_id);
+ data->bundle_data = bundle_dup(bundle_data);
+ pthread_t thd;
+
+ if (pthread_create(&thd, NULL, &_msg_launch_app, data) < 0) {
+ MSG_ERR("pthread_create() error");
+ }
+
+ pthread_detach(thd);
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t msg_aul_svc_set_operation(bundle *bundle_data, const char *operation)
+{
+ int ret = aul_svc_set_operation(bundle_data, operation);
+ if (ret < 0) {
+ MSG_ERR("aul_svc_set_operation() is failed : %d", ret);
+ return MSG_ERR_UNKNOWN;
+ }
+
+ return MSG_SUCCESS;
+}
+
+
+msg_error_t msg_aul_svc_set_uri(bundle *bundle_data, char *uri)
+{
+ int ret = aul_svc_set_uri(bundle_data, uri);
+ if (ret < 0) {
+ MSG_ERR("aul_svc_set_uri() is failed : %d", ret);
+ return MSG_ERR_UNKNOWN;
+ }
+
+ return MSG_SUCCESS;
+}
+
+
+void msg_set_dpm_policy(int type, int state)
+{
+ dpm_policy_enable[type] = state;
+}
+
+
+bool msg_check_dpm_policy(int type)
+{
+ return dpm_policy_enable[MSG_SMS_TYPE];
+// return dpm_policy_enable[type];
+}
+
+
+void msg_syspopup_message(bool is_sending)
+{
+ MSG_INFO("popup toast for dpm restriction. is_sending [%d]", is_sending);
+
+ GDBusConnection *connection = NULL;
+ GDBusProxy *dbus_proxy = NULL;
+ GVariant *result = NULL;
+ GError *error = NULL;
+
+ connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (error) {
+ MSG_ERR("Connecting to system bus failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+ dbus_proxy = g_dbus_proxy_new_sync(connection, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ SYSPOPUP_BUS_NAME, SYSPOPUP_OBJECT_PATH, SYSPOPUP_INTERFACE, NULL, &error);
+ if (error) {
+ MSG_ERR("Connecting to proxy failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+ result = g_dbus_proxy_call_sync(dbus_proxy, SYSPOPUP_METHOD_SHOW,
+ g_variant_new("(s)", is_sending ? "message-sending" : "message-retrieving"),
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+ if (error) {
+ MSG_ERR("invoking proxy call failed: %s\n", error->message);
+ goto _DBUS_ERROR;
+ }
+
+_DBUS_ERROR:
+ if (error) {
+ g_error_free(error);
+ error = NULL;
+ }
+
+ if (connection) {
+ g_object_unref(connection);
+ connection = NULL;
+ }
+
+ if (dbus_proxy) {
+ g_object_unref(dbus_proxy);
+ dbus_proxy = NULL;
+ }
+
+ if (result) {
+ g_object_unref(result);
+ result = NULL;
+ }