X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Frequest.c;h=cfa9ac4cacc8c63a58188cd6db50e072812e752a;hb=f103069e3d58dfbbd45afb38983cf80c9a692327;hp=b3f916405a482197c1cc4d21af8ea9167e2e26be;hpb=28e6b5eabf0e3655fd6b002b4e6e71acae37eb75;p=platform%2Fcore%2Fappfw%2Fpkgmgr-server.git
diff --git a/src/request.c b/src/request.c
index b3f9164..cfa9ac4 100644
--- a/src/request.c
+++ b/src/request.c
@@ -78,6 +78,18 @@ static const char instropection_xml[] =
" "
" "
" "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
+ " "
" "
" "
" "
@@ -713,6 +725,91 @@ static int __handle_request_disable_pkgs(uid_t caller_uid,
return 0;
}
+static int __handle_request_enable_apps(uid_t caller_uid,
+ GDBusMethodInvocation *invocation, GVariant *parameters)
+{
+ uid_t target_uid = (uid_t)-1;
+ char *appid;
+ char *reqkey;
+ char buf[MAX_PKG_ARGS_LEN];
+ GVariantIter *iter;
+
+ g_variant_get(parameters, "(uas)", &target_uid, &iter);
+ if (target_uid == (uid_t)-1 || iter == NULL) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)", PKGMGR_R_ECOMM, ""));
+ return -1;
+ }
+
+ reqkey = __generate_reqkey("enable_apps");
+ if (reqkey == NULL) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)", PKGMGR_R_ENOMEM, ""));
+ return -1;
+ }
+
+ while (g_variant_iter_next(iter, "&s", &appid)) {
+ if (_push_queue(target_uid, caller_uid, reqkey,
+ REQUEST_TYPE_ENABLE_APP,
+ "default", appid, buf)) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)",
+ PKGMGR_R_ESYSTEM, ""));
+ free(reqkey);
+ return -1;
+ }
+ }
+
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)", PKGMGR_R_OK, reqkey));
+
+ free(reqkey);
+ return 0;
+}
+
+static int __handle_request_disable_apps(uid_t caller_uid,
+ GDBusMethodInvocation *invocation, GVariant *parameters)
+{
+ uid_t target_uid = (uid_t)-1;
+ char *appid;
+ char *reqkey;
+ char buf[MAX_PKG_ARGS_LEN];
+ GVariantIter *iter;
+
+ g_variant_get(parameters, "(uas)", &target_uid, &iter);
+ if (target_uid == (uid_t)-1 || iter == NULL) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)", PKGMGR_R_ECOMM, ""));
+ return -1;
+ }
+
+ reqkey = __generate_reqkey("disable_apps");
+ if (reqkey == NULL) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)", PKGMGR_R_ENOMEM, ""));
+ return -1;
+ }
+
+ while (g_variant_iter_next(iter, "&s", &appid)) {
+ if (_push_queue(target_uid, caller_uid, reqkey,
+ REQUEST_TYPE_DISABLE_APP,
+ "default", appid, buf)) {
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)",
+ PKGMGR_R_ESYSTEM, ""));
+ free(reqkey);
+ return -1;
+ }
+ }
+
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(is)", PKGMGR_R_OK, reqkey));
+
+ free(reqkey);
+ return 0;
+
+}
+
static int __handle_request_enable_app(uid_t caller_uid,
GDBusMethodInvocation *invocation, GVariant *parameters)
{
@@ -1531,6 +1628,10 @@ static void __handle_method_call(GDBusConnection *connection,
ret = __handle_request_enable_app(uid, invocation, parameters);
else if (g_strcmp0(method_name, "disable_app") == 0)
ret = __handle_request_disable_app(uid, invocation, parameters);
+ else if (g_strcmp0(method_name, "enable_apps") == 0)
+ ret = __handle_request_enable_apps(uid, invocation, parameters);
+ else if (g_strcmp0(method_name, "disable_apps") == 0)
+ ret = __handle_request_disable_apps(uid, invocation, parameters);
else if (g_strcmp0(method_name, "enable_global_app_for_uid") == 0)
ret = __handle_request_enable_global_app_for_uid(uid,
invocation, parameters);