" <arg type='i' name='ret' direction='out'/>"
" <arg type='s' name='reqkey' direction='out'/>"
" </method>"
+ " <method name='getsize_sync'>"
+ " <arg type='u' name='uid' direction='in'/>"
+ " <arg type='s' name='pkgid' direction='in'/>"
+ " <arg type='i' name='get_type' direction='in'/>"
+ " <arg type='i' name='ret' direction='out'/>"
+ " <arg type='x' name='size_info' direction='out'/>"
+ " </method>"
" <method name='cleardata'>"
" <arg type='u' name='uid' direction='in'/>"
" <arg type='s' name='pkgid' direction='in'/>"
return 0;
}
+static int __handle_request_getsize_sync(uid_t caller_uid,
+ GDBusMethodInvocation *invocation, GVariant *parameters)
+{
+ uid_t target_uid = (uid_t)-1;
+ char *pkgid = NULL;
+ int get_type = -1;
+ char *reqkey;
+ char buf[4];
+
+ g_variant_get(parameters, "(u&si)", &target_uid, &pkgid, &get_type);
+ if (target_uid == (uid_t)-1 || pkgid == NULL || get_type == -1) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)", PKGMGR_R_ECOMM, ""));
+ return -1;
+ }
+
+ reqkey = __generate_reqkey(pkgid);
+ if (reqkey == NULL) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)", PKGMGR_R_ENOMEM, ""));
+ return -1;
+ }
+
+ snprintf(buf, sizeof(buf), "%d", get_type);
+ if (_push_queue(target_uid, caller_uid, reqkey, REQUEST_TYPE_GETSIZE_SYNC,
+ "pkgtool", pkgid, buf)) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)", 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 int __handle_request_cleardata(uid_t caller_uid,
GDBusMethodInvocation *invocation, GVariant *parameters)
{
ret = __handle_request_disable_pkgs(uid, invocation, parameters);
else if (g_strcmp0(method_name, "getsize") == 0)
ret = __handle_request_getsize(uid, invocation, parameters);
+ else if (g_strcmp0(method_name, "getsize_sync") == 0)
+ ret = __handle_request_getsize_sync(uid, invocation, parameters);
else if (g_strcmp0(method_name, "clearcache") == 0)
ret = __handle_request_clearcache(uid, invocation, parameters);
else if (g_strcmp0(method_name, "enable_app") == 0)