return ret;
}
+static int __process_set_app_label(struct backend_job *job)
+{
+ int ret;
+ int mode = -1;
+
+ ret = pkgmgr_parser_update_app_label_info_in_usr_db(job->pkgid, job->appid,
+ job->args);
+ _return_value_to_caller(job->req_id, g_variant_new("(i)", ret));
+
+ return ret;
+}
+
gboolean queue_job(void *data)
{
struct backend_job *job = NULL;
ret = __process_get_restriction_mode(job);
_free_backend_job(job);
break;
+ case REQUEST_TYPE_SET_APP_LABEL:
+ ret = __process_set_app_label(job);
+ _free_backend_job(job);
default:
ret = -1;
break;
" <arg type='i' name='result' direction='out'/>"
" <arg type='i' name='ret' direction='out'/>"
" </method>"
+ " <method name='set_app_label'>"
+ " <arg type='u' name='uid' direction='in'/>"
+ " <arg type='s' name='appid' direction='in'/>"
+ " <arg type='s' name='label' direction='in'/>"
+ " <arg type='i' name='ret' direction='out'/>"
+ " </method>"
" </interface>"
"</node>";
static GDBusNodeInfo *instropection_data;
return 0;
}
+static int __handle_request_set_app_label(uid_t uid,
+ GDBusMethodInvocation *invocation, GVariant *parameters)
+{
+ uid_t target_uid = (uid_t)-1;
+ char *appid = NULL;
+ char *label = NULL;
+ char *reqkey;
+
+ g_variant_get(parameters, "(uss)", &target_uid, &appid, &label);
+ if (target_uid == (uid_t)-1 || appid == NULL || label == NULL) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(i)", PKGMGR_R_ECOMM));
+ return -1;
+ }
+
+ reqkey = __generate_reqkey("appid");
+ if (reqkey == NULL) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(i)", PKGMGR_R_ENOMEM));
+ return -1;
+ }
+
+ if (_push_queue(target_uid, reqkey,
+ REQUEST_TYPE_SET_APP_LABEL,
+ "default", appid, label)) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(i)", PKGMGR_R_ESYSTEM));
+ free(reqkey);
+ return -1;
+ }
+
+ if (!g_hash_table_insert(req_table, (gpointer)reqkey,
+ (gpointer)invocation))
+ ERR("reqkey already exists");
+
+ return 0;
+}
+
static uid_t __get_caller_uid(GDBusConnection *connection, const char *name)
{
GError *err = NULL;
else if (g_strcmp0(method_name, "get_restriction_mode") == 0)
ret = __handle_request_get_restriction_mode(uid, invocation,
parameters);
+ else if (g_strcmp0(method_name, "set_app_label") == 0)
+ ret = __handle_request_set_app_label(uid, invocation, parameters);
else
ret = -1;