From: jy910.yun Date: Tue, 4 Jun 2013 13:39:42 +0000 (+0900) Subject: change device node control api from plugin to device-node X-Git-Tag: submit/tizen_2.2/20130714.154253~7^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b08f7a962b9dd1a46b0a57fdcf46e28881eb0f0;p=framework%2Fsystem%2Fsystem-server.git change device node control api from plugin to device-node Signed-off-by: giyeol.ok --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c9eea3a..ce19a03 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,6 @@ pkg_check_modules(pkgs REQUIRED dlog syspopup-caller notification - devman device-node libsmack) diff --git a/include/ss_data.h b/include/ss_data.h index dac4149..0a08245 100644 --- a/include/ss_data.h +++ b/include/ss_data.h @@ -85,6 +85,8 @@ enum { #define PREDEF_DEVICE_CHANGED "device_changed" #define PREDEF_INTERNAL_POWEROFF "internal_poweroff" +#define PROCESS_GROUP_SET "process_group_set" + #define OOMADJ_SU (-17) #define OOMADJ_INIT (-16) #define OOMADJ_FOREGRD_LOCKED (-15) diff --git a/packaging/system-server.spec b/packaging/system-server.spec index fbce09e..b117178 100755 --- a/packaging/system-server.spec +++ b/packaging/system-server.spec @@ -16,7 +16,6 @@ BuildRequires: pkgconfig(heynoti) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(sysman) BuildRequires: pkgconfig(tapi) -BuildRequires: pkgconfig(devman) BuildRequires: pkgconfig(pmapi) BuildRequires: pkgconfig(edbus) BuildRequires: pkgconfig(dlog) diff --git a/ss_device_change_handler.c b/ss_device_change_handler.c index 178f126..acde084 100755 --- a/ss_device_change_handler.c +++ b/ss_device_change_handler.c @@ -95,13 +95,13 @@ static int check_lowbat_charge_device(int bInserted) int bat_state = -1; int ret = -1; if (bInserted == 1) { - if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) == 0) { + if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) < 0) { if (val == 1) bChargeDeviceInserted = 1; return 0; } } else if (bInserted == 0) { - if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) == 0) { + if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_NOW, &val) < 0) { if (val == 0 && bChargeDeviceInserted == 1) { bChargeDeviceInserted = 0; //low bat popup during charging device removing @@ -210,7 +210,6 @@ static void earkey_chgdet_cb(struct ss_main_data *ad) { int val; PRT_TRACE("jack - earkey changed\n"); - if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_EARKEY_ONLINE, &val) == 0) vconf_set_int(VCONFKEY_SYSMAN_EARJACKKEY, val); } diff --git a/ss_lowbat_handler.c b/ss_lowbat_handler.c index 8999d54..b091de9 100755 --- a/ss_lowbat_handler.c +++ b/ss_lowbat_handler.c @@ -200,9 +200,7 @@ static int lowbat_process(int bat_percent, void *ad) } else { new_bat_state = BATTERY_NORMAL; if (new_bat_capacity == BATTERY_FULL) { - if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_FULL, &bat_full) < 0) { - PRT_TRACE_ERR("fail to read charge full from kernel"); - } + device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CHARGE_FULL, &bat_full); if (bat_full == 1) { if (vconf_state != VCONFKEY_SYSMAN_BAT_FULL) ret=vconf_set_int(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, VCONFKEY_SYSMAN_BAT_FULL); @@ -256,10 +254,7 @@ static int lowbat_read() { int bat_percent; - if (device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &bat_percent) < 0) { - PRT_TRACE_ERR("fail to read power capacity from kernel"); - return -1; - } + device_get_property(DEVICE_TYPE_POWER, PROP_POWER_CAPACITY, &bat_percent); return bat_percent; } diff --git a/ss_pmon_handler.c b/ss_pmon_handler.c index 42ef9e1..c5476be 100644 --- a/ss_pmon_handler.c +++ b/ss_pmon_handler.c @@ -150,7 +150,6 @@ static int pmon_process(int pid, void *ad) return -1; } close(fd); - if ( device_set_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_MP_PNP, new_pid) < 0) { PRT_TRACE_ERR("Write new pid failed"); } diff --git a/ss_predefine.c b/ss_predefine.c index 7e57841..bf3a441 100644 --- a/ss_predefine.c +++ b/ss_predefine.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/ss_procmgr.c b/ss_procmgr.c index 9a6faee..2d48c7b 100755 --- a/ss_procmgr.c +++ b/ss_procmgr.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "include/ss_data.h" @@ -28,6 +29,8 @@ #define LIMITED_BACKGRD_NUM 15 #define MAX_BACKGRD_OOMADJ (OOMADJ_BACKGRD_UNLOCKED + LIMITED_BACKGRD_NUM) +#define PROCESS_VIP "process_vip" +#define PROCESS_PERMANENT "process_permanent" int get_app_oomadj(int pid, int *oomadj) { @@ -368,6 +371,28 @@ int set_backgrd_action(int argc, char **argv) return ret; } +int set_process_group_action(int argc, char **argv) +{ + int pid = -1; + int ret = -1; + + if (argc != 2) + return -1; + if ((pid = atoi(argv[0])) < 0) + return -1; + + if (strncmp(argv[1], PROCESS_VIP, strlen(PROCESS_VIP)) == 0) + ret = device_set_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_MP_VIP, pid); + else if (strncmp(argv[1], PROCESS_PERMANENT, strlen(PROCESS_PERMANENT)) == 0) + ret = device_set_property(DEVICE_TYPE_PROCESS, PROP_PROCESS_MP_PNP, pid); + + if (ret == 0) + PRT_TRACE_ERR("%s : pid %d", argv[1], pid); + else + PRT_TRACE_ERR("fail to set %s : pid %d",argv[1], pid); + return 0; +} + int ss_process_manager_init(void) { ss_action_entry_add_internal(PREDEF_FOREGRD, set_foregrd_action, NULL, @@ -379,5 +404,6 @@ int ss_process_manager_init(void) ss_action_entry_add_internal(PREDEF_INACTIVE, set_inactive_action, NULL, NULL); ss_action_entry_add_internal(OOMADJ_SET, set_oomadj_action, NULL, NULL); + ss_action_entry_add_internal(PROCESS_GROUP_SET, set_process_group_action, NULL, NULL); return 0; }