" <method name='DisableFullPkg'>"
" <arg type='i' name='result' direction='out'/>"
" </method>"
+" <method name='PreMigrateLegacy'>"
+" <arg type='s' name='pkgid' direction='in'/>"
+" <arg type='i' name='uid' direction='in'/>"
+" <arg type='i' name='result' direction='out'/>"
+" </method>"
+" <method name='PostMigrateLegacy'>"
+" <arg type='s' name='pkgid' direction='in'/>"
+" <arg type='i' name='uid' direction='in'/>"
+" <arg type='i' name='result' direction='out'/>"
+" </method>"
+" <method name='MigrateLegacyAll'>"
+" <arg type='i' name='result' direction='out'/>"
+" </method>"
" </interface>"
"</node>";
static int _app2sd_server_generate_directory_list(GVariantIter *iter, GList **list)
{
int result = APP2EXT_SUCCESS;
- GVariantIter *iter;
gchar *str = NULL;
int type;
- GList *list = NULL;
app2ext_dir_details *dir_detail = NULL;
while (g_variant_iter_loop(iter, "(si)", &str, &type)) {
}
dir_detail->type = type;
- list = g_list_append(list, dir_detail);
+ *list = g_list_append(*list, dir_detail);
}
}
g_dbus_method_invocation_return_value(invocation, param);
}
+static void _app2sd_server_pre_migrate_legacy(GDBusConnection *connection,
+ const gchar *sender, GVariant *parameters,
+ GDBusMethodInvocation *invocation, uid_t sender_uid)
+{
+ GVariant *param = NULL;
+ int result = APP2EXT_SUCCESS;
+ char *pkgid = NULL;
+ uid_t target_uid = -1;
+ int ret = 0;
+
+ g_variant_get(parameters, "(&si)", &pkgid, &target_uid);
+
+ _D("pkgid(%s), target_uid(%d), sender_uid(%d)",
+ pkgid, target_uid, sender_uid);
+
+ if (!_app2sd_server_check_permission(sender_uid, sender_uid)) {
+ _E("Not permitted user!");
+ _app2sd_server_return_method_error(invocation,
+ APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
+ return;
+ }
+
+ ret = app2sd_pre_migrate_legacy(pkgid, target_uid);
+ if (ret) {
+ _E("error(%d)", ret);
+ result = ret;
+ }
+
+ param = g_variant_new("(i)", result);
+ g_dbus_method_invocation_return_value(invocation, param);
+}
+
+static void _app2sd_server_post_migrate_legacy(GDBusConnection *connection,
+ const gchar *sender, GVariant *parameters,
+ GDBusMethodInvocation *invocation, uid_t sender_uid)
+{
+ GVariant *param = NULL;
+ int result = APP2EXT_SUCCESS;
+ char *pkgid = NULL;
+ uid_t target_uid = -1;
+ int ret = 0;
+
+ g_variant_get(parameters, "(&si)", &pkgid, &target_uid);
+
+ _D("pkgid(%s), target_uid(%d), sender_uid(%d)",
+ pkgid, target_uid, sender_uid);
+
+ if (!_app2sd_server_check_permission(sender_uid, sender_uid)) {
+ _E("Not permitted user!");
+ _app2sd_server_return_method_error(invocation,
+ APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
+ return;
+ }
+
+ ret = app2sd_post_migrate_legacy(pkgid, target_uid);
+ if (ret) {
+ _E("error(%d)", ret);
+ result = ret;
+ }
+
+ param = g_variant_new("(i)", result);
+ g_dbus_method_invocation_return_value(invocation, param);
+}
+
+static void _app2sd_server_migrate_legacy_all(GDBusConnection *connection,
+ const gchar *sender, GVariant *parameters,
+ GDBusMethodInvocation *invocation, uid_t sender_uid)
+{
+ GVariant *param = NULL;
+ int result = APP2EXT_SUCCESS;
+ int ret = 0;
+
+ _D("sender_uid(%d)", sender_uid);
+
+ if (!_app2sd_server_check_permission(sender_uid, sender_uid)) {
+ _E("Not permitted user!");
+ _app2sd_server_return_method_error(invocation,
+ APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
+ return;
+ }
+
+ ret = app2sd_migrate_legacy_all();
+ if (ret) {
+ _E("error(%d)", ret);
+ result = ret;
+ }
+
+ param = g_variant_new("(i)", result);
+ g_dbus_method_invocation_return_value(invocation, param);
+}
+
static void handle_method_call(GDBusConnection *connection,
const gchar *sender, const gchar *object_path,
const gchar *interface_name, const gchar *method_name,
} else if (g_strcmp0(method_name, "DisableFullPkg") == 0) {
_app2sd_server_disable_full_pkg(connection, sender,
parameters, invocation, sender_uid);
+ } else if (g_strcmp0(method_name, "PreMigrateLegacy") == 0) {
+ _app2sd_server_pre_migrate_legacy(connection, sender,
+ parameters, invocation, sender_uid);
+ } else if (g_strcmp0(method_name, "PostMigrateLegacy") == 0) {
+ _app2sd_server_post_migrate_legacy(connection, sender,
+ parameters, invocation, sender_uid);
+ } else if (g_strcmp0(method_name, "MigrateLegacyAll") == 0) {
+ _app2sd_server_migrate_legacy_all(connection, sender,
+ parameters, invocation, sender_uid);
}
if (source_id)