Fix gdbus related issues 78/130178/2 accepted/tizen/unified/20170519.200634 submit/tizen/20170519.102149
authorKichan Kwon <k_c.kwon@samsung.com>
Fri, 19 May 2017 09:35:08 +0000 (18:35 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Fri, 19 May 2017 10:17:33 +0000 (19:17 +0900)
- Modify return argument type
- Fix method table overlapping
- Add missing return argument type

Change-Id: I10958b275c05f81b8f23fd3ca44fb6485f884b75
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/common/module.c
src/freezer/freezer.c
src/heart/heart-dbus.c
src/proc-stat/proc-monitor.c

index 50c91ba267f99fa1dc583dd90b25be2d7eb206d4..bf301dc51567f9aa975f7bf6082ddb442d5de280 100644 (file)
@@ -199,17 +199,20 @@ static void dbus_list_active_modules_handler(GDBusMethodInvocation *invocation,
 {
        struct module_ops *module;
        GSList *list_iter;
-       GVariantBuilder builder;
+       GVariantBuilder builder, *sub_builder;
 
        g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE);
+       sub_builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
 
        gslist_for_each_item(list_iter, modules_list) {
                module = (struct module_ops *)list_iter->data;
                if (module->initalized != MODULE_INITIALIZED)
                        continue;
 
-               g_variant_builder_add(&builder, "s", module->name);
+               g_variant_builder_add(sub_builder, "s", module->name);
        }
+       g_variant_builder_add_value(&builder, g_variant_new("as", sub_builder));
+       g_variant_builder_unref(sub_builder);
 
        g_dbus_method_invocation_return_value(invocation,
                        g_variant_builder_end(&builder));
index 474aa88d48c4da53d35bb3013e235f44558f0c09..c55a1e20404beaf294b761d287b9067dfdb7302f 100644 (file)
@@ -94,16 +94,10 @@ int resourced_freezer_proc_late_control(void)
 static void resourced_freezer_dbus_method_handler_generic(
                GDBusMethodInvocation *invocation, GVariant *params)
 {
-       /* FREEZER_SUSPEND method can be used when suspend mode is enabled */
-       if (resourced_freezer_is_suspended) {
-               if (!g_strcmp0(g_dbus_method_invocation_get_method_name(invocation),
-                                       METHOD_SET_FREEZER_SUSPEND) && !resourced_freezer_is_suspended())
-                       g_dbus_method_invocation_return_value(invocation,
-                                       g_variant_new("(i)", -1));
-       }
-
        if (resourced_freezer_dbus_method_handler)
                resourced_freezer_dbus_method_handler(invocation, params);
+       else
+               g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", 0));
 }
 
 static const char dbus_methods_xml[] =
index fee55c9bd09d62e18950a23d00d4f6f70041252f..1213f991fe407d8564b8a5094d15755785fd7f95 100644 (file)
@@ -68,7 +68,7 @@ static const char dbus_methods_xml_suffix[] =
 "      </interface>"
 "</node>";
 
-static int num_methods;
+static int num_methods = 2;
 static char dbus_methods_xml_body[MAX_XML_LEN];
 static struct d_bus_method dbus_methods[128] = {
        { "UpdateDataList", dbus_update_data_list },
@@ -95,5 +95,5 @@ int heart_dbus_init(void)
        g_strlcat(dbus_methods_xml, dbus_methods_xml_suffix, MAX_XML_LEN);
 
        return d_bus_register_methods(RESOURCED_PATH_LOGGING, dbus_methods_xml,
-                       dbus_methods, ARRAY_SIZE(dbus_methods));
+                       dbus_methods, num_methods);
 }
index eb48a032237fda20bc0c783167f7e2a31c8eae0b..c78299b776d9630b3a26845dc285b43b76814669 100755 (executable)
@@ -998,8 +998,10 @@ static const char dbus_methods_xml[] =
 "                      <arg type='u' name='MemSwap' direction='out'/>"
 "              </method>"
 "              <method name='ReclaimMemory'>"
+"                      <arg type='i' name='ZeroOnSuccess' direction='out'/>"
 "              </method>"
 "              <method name='PrePoweroff'>"
+"                      <arg type='i' name='MinusOne' direction='out'/>"
 "              </method>"
 /* Following functions are defined in proc-usage-stats.c */
 "              <method name='ProcMemoryUsage'>"