pmqos: Remove hard-coded scenario names 74/133474/1
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 9 Jun 2017 08:49:53 +0000 (17:49 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 9 Jun 2017 08:55:52 +0000 (17:55 +0900)
This patch removes the hard-coded scenario names and unused functions.
When you want to add or remove the scenarios, you have to modify
the /etc/pass/pass-pmqos.conf file without any changes of pmqos code.

Change-Id: Ia267b4de362746aa370b94ed53ad783ad7ff6954
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pmqos/pmqos.c

index 248d5e4..26083ec 100644 (file)
@@ -303,58 +303,6 @@ error:
        return reply;
 }
 
-static DBusMessage *dbus_wifi_pmqos_handler(E_DBus_Object *obj, DBusMessage *msg)
-{
-       DBusMessageIter iter;
-       DBusMessage *reply;
-       const char *member;
-       char name[NAME_MAX];
-       int bps, val, ret;
-
-       if (!dbus_message_get_args(msg, NULL,
-                               DBUS_TYPE_INT32, &bps,
-                               DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID)) {
-               _E("there is no message");
-               ret = -EINVAL;
-               goto error;
-       }
-
-       if (bps < 0 || val < 0) {
-               ret = -EINVAL;
-               goto error;
-       }
-
-       member = dbus_message_get_member(msg);
-
-       /* combine bps and member */
-       snprintf(name, sizeof(name), "%s%d", member, bps);
-
-       if (val)
-               ret = pmqos_request(name, val);
-       else
-               ret = pmqos_cancel(name);
-
-error:
-       reply = dbus_message_new_method_return(msg);
-       dbus_message_iter_init_append(reply, &iter);
-       dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-       return reply;
-}
-
-static DBusMessage *dbus_getdefaultlocktime(E_DBus_Object *obj, DBusMessage *msg)
-{
-       DBusMessageIter iter;
-       DBusMessage *reply;
-       int ret;
-
-       ret = DEFAULT_PMQOS_TIMER;
-
-       reply = dbus_message_new_method_return(msg);
-       dbus_message_iter_init_append(reply, &iter);
-       dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &ret);
-       return reply;
-}
-
 static int get_methods_from_conf(const char *path, struct edbus_method **edbus_methods)
 {
        struct edbus_method *methods;
@@ -407,64 +355,8 @@ static int get_methods_from_conf(const char *path, struct edbus_method **edbus_m
 
 /* Add pmqos name as alphabetically */
 static const struct edbus_method edbus_methods[] = {
-        { "start",             NULL,  NULL, e_dbus_start_cb },
-        { "stop",              NULL,  NULL, e_dbus_stop_cb },
-       /*
-        * TODO: The hard-coded scenario info is no longer required. Therefore,
-        * the following code will be removed.
-       */
-       { "AppLaunch",            "i",    "i", dbus_pmqos_handler },
-       { "AppLaunchHome",        "i",    "i", dbus_pmqos_handler },
-       { "BeautyShot",           "i",    "i", dbus_pmqos_handler },
-       { "Browser",              "i",    "i", dbus_pmqos_handler },
-       { "BrowserDash",          "i",    "i", dbus_pmqos_handler },
-       { "BrowserJavaScript",    "i",    "i", dbus_pmqos_handler },
-       { "BrowserLoading",       "i",    "i", dbus_pmqos_handler },
-       { "BrowserScroll",        "i",    "i", dbus_pmqos_handler },
-       { "CallSound",            "i",    "i", dbus_pmqos_handler },
-       { "CameraBurstShot",      "i",    "i", dbus_pmqos_handler },
-       { "CameraCaptureAtRec",   "i",    "i", dbus_pmqos_handler },
-       { "CameraPreview",        "i",    "i", dbus_pmqos_handler },
-       { "CameraSoundAndShot",   "i",    "i", dbus_pmqos_handler },
-       { "ContactSearch",        "i",    "i", dbus_pmqos_handler },
-       { "Emergency",            "i",    "i", dbus_pmqos_handler },
-       { "GalleryScroll",        "i",    "i", dbus_pmqos_handler },
-       { "GalleryRotation",      "i",    "i", dbus_pmqos_handler },
-       { "GetDefaultLockTime",  NULL,    "i", dbus_getdefaultlocktime },
-       { "GpsSerialCno",         "i",    "i", dbus_pmqos_handler },
-       { "GpuBoost",             "i",    "i", dbus_pmqos_handler },
-       { "GpuWakeup",            "i",    "i", dbus_pmqos_handler },
-       { "HomeScreen",           "i",    "i", dbus_pmqos_handler },
-       { "ImageViewer",          "i",    "i", dbus_pmqos_handler },
-       { "IMEInput",             "i",    "i", dbus_pmqos_handler },
-       { "LockScreen",           "i",    "i", dbus_pmqos_handler },
-       { "LowBattery",           "i",    "i", dbus_pmqos_handler },
-       { "MtpSendFile",          "i",    "i", dbus_pmqos_handler },
-       { "MusicPlayLcdOn",       "i",    "i", dbus_pmqos_handler },
-       { "PowerSaving",          "i",    "i", dbus_pmqos_handler },
-       { "ProcessCrashed",       "i",    "i", dbus_pmqos_handler },
-       { "ReservedMode",         "i",    "i", dbus_pmqos_handler },
-       { "ScreenMirroring",      "i",    "i", dbus_pmqos_handler },
-       { "SmemoZoom",            "i",    "i", dbus_pmqos_handler },
-       { "SVoice",               "i",    "i", dbus_pmqos_handler },
-       { "WebappLaunch",         "i",    "i", dbus_pmqos_handler },
-       { "WifiThroughput",      "ii",    "i", dbus_wifi_pmqos_handler },
-       { "PowerOff",             "i",    "i", dbus_pmqos_handler },
-       { "WebAppDrag",           "i",    "i", dbus_pmqos_handler },
-       { "WebAppFlick",          "i",    "i", dbus_pmqos_handler },
-       { "SensorWakeup",         "i",    "i", dbus_pmqos_handler },
-       { "UgLaunch",             "i",    "i", dbus_pmqos_handler },
-       { "MusicScroll",          "i",    "i", dbus_pmqos_handler },
-       { "FileScroll",           "i",    "i", dbus_pmqos_handler },
-       { "VideoScroll",          "i",    "i", dbus_pmqos_handler },
-       { "EmailScroll",          "i",    "i", dbus_pmqos_handler },
-       { "ContactScroll",        "i",    "i", dbus_pmqos_handler },
-       { "TizenStoreScroll",     "i",    "i", dbus_pmqos_handler },
-       { "CallLogScroll",        "i",    "i", dbus_pmqos_handler },
-       { "MyfilesScroll",        "i",    "i", dbus_pmqos_handler },
-       { "MessageScroll",        "i",    "i", dbus_pmqos_handler },
-       { "SIOP",                 "i",    "i", dbus_pmqos_handler },
-       { "UltraPowerSaving",     "i",    "i", dbus_pmqos_handler },
+        { "start",             NULL,  NULL, e_dbus_start_cb },
+        { "stop",              NULL,  NULL, e_dbus_stop_cb },
 };
 
 static int pmqos_init_done(void *data, void *user_data)