" <arg type='i' name='ret' direction='out'/>"
" <arg type='s' name='reqkey' direction='out'/>"
" </method>"
+ " <method name='enable_apps'>"
+ " <arg type='u' name='uid' direction='in'/>"
+ " <arg type='as' name='appids' direction='in'/>"
+ " <arg type='i' name='ret' direction='out'/>"
+ " <arg type='s' name='reqkey' direction='out'/>"
+ " </method>"
+ " <method name='disable_apps'>"
+ " <arg type='u' name='uid' direction='in'/>"
+ " <arg type='as' name='appids' direction='in'/>"
+ " <arg type='i' name='ret' direction='out'/>"
+ " <arg type='s' name='reqkey' direction='out'/>"
+ " </method>"
" <method name='enable_global_app_for_uid'>"
" <arg type='u' name='uid' direction='in'/>"
" <arg type='s' name='appid' direction='in'/>"
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)
{
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);