From 56a22a1bf114164f5e43a99e22f7d17ba7648077 Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Wed, 28 Dec 2016 15:45:32 +0900 Subject: [PATCH 01/16] block: Not support extended partition Change-Id: I409ad0bffc7595f0c37a429db9a7c1b9c8ac5668 Signed-off-by: pr.jung --- src/block/block.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/block/block.c b/src/block/block.c index 4da278f..029756b 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -630,6 +630,11 @@ static struct block_data *make_block_data(const char *devnode, if (!devnode) return NULL; + if (!fs_type) { + _D("Not support extended partition"); + return NULL; + } + data = calloc(1, sizeof(struct block_data)); if (!data) return NULL; -- 2.7.4 From ecf4f147bf0a6d04e66546e74ddafb4032039659 Mon Sep 17 00:00:00 2001 From: Jeong Donghwan Date: Fri, 30 Dec 2016 13:27:41 +0900 Subject: [PATCH 02/16] key-fileter: turn off by power key when display on It need necessary check power key logic. The device should be turn off by power key when display state was on. Change-Id: I2ac36e752394404e3b069084b21015883b1e3772 Signed-off-by: Jeong Donghwan --- src/display/key-filter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/display/key-filter.c b/src/display/key-filter.c index 2ee2a39..beec03a 100644 --- a/src/display/key-filter.c +++ b/src/display/key-filter.c @@ -497,6 +497,8 @@ static int check_key(struct input_event *pinput, int fd) break; case KEY_POWER: ignore = process_power_key(pinput); + if (current_state_in_on()) + ignore = false; break; case KEY_SCREENLOCK: ignore = process_screenlock_key(pinput); -- 2.7.4 From 67dc5d4bd208f1a60bd4e93ba16cee96d1bb1d4c Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Fri, 6 Jan 2017 18:17:25 +0900 Subject: [PATCH 03/16] block: Remove useless code Change-Id: I80a2986f7ff19f8d33e78bef16080148d6d2e9a7 Signed-off-by: pr.jung --- src/block/block.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/block/block.c b/src/block/block.c index 029756b..ca461de 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -922,10 +922,8 @@ static Eina_Bool pipe_cb(void *data, Ecore_Fd_Handler *fdh) if (pdata.op == BLOCK_DEV_MOUNT && pdata.result < 0) { ret = change_mount_point(pdata.bdev, ""); - if (ret < 0) { - ret = -EPERM; + if (ret < 0) goto out; - } /* Modify /run/external-storage/id file */ create_file(pdata.bdev->data->id, pdata.bdev->data->mount_point); -- 2.7.4 From d6abe66afce396a24bbd1250c5cdb07f0347e1ef Mon Sep 17 00:00:00 2001 From: taeyoung Date: Thu, 12 Jan 2017 13:19:17 +0900 Subject: [PATCH 04/16] thermal: add legacy signal for thermal state Tizen 2.4 broadcasted a dbus signal for other apps to know the thermal state. Thus the signal needs to be applied to Tizen 3.0. The signal is just for legacy uses, and tizen 3.0 needs to add new signal for new thermal module. Change-Id: Ib1b947aabb30c434930ff88f45d41b6601183707 Signed-off-by: taeyoung --- src/thermal/thermal.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/thermal/thermal.c b/src/thermal/thermal.c index 5b197c8..ff20b26 100755 --- a/src/thermal/thermal.c +++ b/src/thermal/thermal.c @@ -192,6 +192,57 @@ static void thermal_add_noti(void) noti = add_notification("TempCooldownNotiOn"); } +static void broadcast_thermal_state_legacy(int state, int level) +{ + static int old = NOTHING; + int type; + char *param[1]; + + switch (state) { + case THERMAL_STATE_LOW: + case THERMAL_STATE_NORMAL: + type = NOTHING; + break; + case THERMAL_STATE_HIGH: + if (level == THERMAL_LEVEL_WARNING) + type = WARNING; + else if (level == THERMAL_LEVEL_CRITICAL || + level == THERMAL_LEVEL_POWEROFF) + type = CRITICAL; + else + type = NOTHING; + break; + default: + _E("Invalid state(%d)", state); + return; + } + + if (old == type) + return; + + switch (type) { + case NOTHING: + param[0] = "CoolDownRelease"; + break; + case WARNING: + param[0] = "WarningAction"; + break; + case CRITICAL: + param[0] = "LimitAction"; + break; + default: + _I("Invalid type (%d)", type); + return; + } + + old = type; + + broadcast_edbus_signal(DEVICED_PATH_SYSNOTI, + DEVICED_INTERFACE_SYSNOTI, + "CoolDownChanged", + "s", param); +} + static Eina_Bool thermal_overheat_time_broadcast(void *data) { int ret; @@ -290,6 +341,8 @@ static void thermal_action(struct thermal_info *info, void *data) } } + broadcast_thermal_state_legacy(info->state, info->level); + if (update == UPDATE) { old_state = info->state; old_level = info->level; -- 2.7.4 From c5a388a6c2e77a7f690d18489f9db7c9251d5173 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Thu, 12 Jan 2017 16:05:06 +0900 Subject: [PATCH 05/16] notification : change add_notification to send a few parameters when notification is sent, we sometimes need to send a few parameters. for example, int, char, string and so on. So, add_notification is modified to consider those cases. Change-Id: Ie191e29bddcb39e0eada395a8c6542a53aae1468 Signed-off-by: lokilee73 --- src/apps/apps.c | 30 +++++++++++++++++++++++++++--- src/apps/apps.h | 2 +- src/battery/lowbat-handler.c | 20 +++++++++++++++----- src/thermal/thermal.c | 2 +- src/usb/usb-state.c | 2 +- 5 files changed, 45 insertions(+), 11 deletions(-) mode change 100644 => 100755 src/usb/usb-state.c diff --git a/src/apps/apps.c b/src/apps/apps.c index 4b7cec6..d23334e 100755 --- a/src/apps/apps.c +++ b/src/apps/apps.c @@ -23,6 +23,7 @@ #include "core/edbus-handler.h" #define POPUP_METHOD "PopupLaunch" +#define BUFF_MAX 255 static const struct app_dbus_match { const char *type; @@ -92,15 +93,38 @@ int launch_message_post(char *type) return ret; } -int add_notification(char *type) +int add_notification(char *type, char *sig, ...) { + int ret; + int count; + int len; + char *data = NULL; + char *param[BUFF_MAX] = {NULL}; + va_list args; + if (!type) return -EINVAL; - return dbus_method_sync(POPUP_BUS_NAME, + if (sig) { + len = strlen(sig); + va_start(args, sig); + + for (count = 0; count < len; count++) { + data = va_arg(args, char *); + param[count] = data; + } + + va_end(args); + } + + ret = dbus_method_sync(POPUP_BUS_NAME, POPUP_PATH_NOTI, POPUP_INTERFACE_NOTI, - type, NULL, NULL); + type, + sig, + param); + + return ret; } int remove_notification(char *type, int id) diff --git a/src/apps/apps.h b/src/apps/apps.h index cfcea7a..b0c7a58 100755 --- a/src/apps/apps.h +++ b/src/apps/apps.h @@ -31,7 +31,7 @@ int launch_system_app(char *type, int num, ...); int launch_message_post(char *type); -int add_notification(char *type); +int add_notification(char *type, char *sig, ...); int remove_notification(char *type, int id); #endif /* __APPS_H__ */ diff --git a/src/battery/lowbat-handler.c b/src/battery/lowbat-handler.c index 782daea..097c20c 100755 --- a/src/battery/lowbat-handler.c +++ b/src/battery/lowbat-handler.c @@ -244,9 +244,10 @@ void power_off_timer_stop(void) power_off_timer = NULL; } -static void get_lowbat_noti_value(int low_battery_type, char **actvie_noti, char **event_noti) +static int get_lowbat_noti_value(int low_battery_type, char **actvie_noti, char **event_noti) { int len; + int ret = 1; len = strlen(battery.power_source_s); if (!strncmp(battery.power_source_s, POWER_SOURCE_NONE, len)) { @@ -257,6 +258,7 @@ static void get_lowbat_noti_value(int low_battery_type, char **actvie_noti, char *actvie_noti = "BatteryCriticalActNotiOn"; *event_noti = "BatteryCriticalNotiOn"; } + ret = 0; } else if (!strncmp(battery.power_source_s, POWER_SOURCE_AC, len) || !strncmp(battery.power_source_s, POWER_SOURCE_WIRELESS, len)) { if (low_battery_type == LOW_BATTERY) { @@ -280,6 +282,7 @@ static void get_lowbat_noti_value(int low_battery_type, char **actvie_noti, char *event_noti = NULL; } _I("actvie_noti=%s event_noti=%s", actvie_noti, event_noti); + return ret; } static int lowbat_popup(char *option) @@ -287,9 +290,11 @@ static int lowbat_popup(char *option) static int launched_poweroff; static int lowbat_popup_option; int ret; + int power_source = 1; int r_disturb, s_disturb, r_block, s_block; static char *value; char *active_noti = NULL, *event_noti = NULL; + char temp[10] = {NULL}; if (!option) { if (!value) @@ -302,10 +307,10 @@ static int lowbat_popup(char *option) launched_poweroff = 0; if (!strcmp(option, WARNING_LOW_BAT_ACT)) { - get_lowbat_noti_value(LOW_BATTERY, &active_noti, &event_noti); + power_source = get_lowbat_noti_value(LOW_BATTERY, &active_noti, &event_noti); lowbat_popup_option = LOWBAT_OPT_CHECK; } else if (!strcmp(option, CRITICAL_LOW_BAT_ACT)) { - get_lowbat_noti_value(CRITICAL_BATTERY, &active_noti, &event_noti); + power_source = get_lowbat_noti_value(CRITICAL_BATTERY, &active_noti, &event_noti); lowbat_popup_option = LOWBAT_OPT_WARNING; } else if (!strcmp(option, POWER_OFF_BAT_ACT)) { value = "poweroff"; @@ -359,7 +364,12 @@ direct_launch: _E("Failed to launch remove_active_noti : %d", ret); } - ret = add_notification(active_noti); + if (!power_source) { + snprintf(temp, sizeof(temp), "%d", cur_bat_capacity); + ret = add_notification(active_noti, "s", temp); + } else + ret = add_notification(active_noti, NULL, NULL); + if (ret < 0) _E("Failed to launch active_noti : %d", ret); else @@ -373,7 +383,7 @@ direct_launch: _E("Failed to launch remove_event_noti : %d", ret); } - ret = add_notification(event_noti); + ret = add_notification(event_noti, NULL, NULL); if (ret < 0) _E("Failed to launch event noti : %d", ret); else diff --git a/src/thermal/thermal.c b/src/thermal/thermal.c index ff20b26..a87c4cd 100755 --- a/src/thermal/thermal.c +++ b/src/thermal/thermal.c @@ -189,7 +189,7 @@ static void thermal_remove_popup(void) static void thermal_add_noti(void) { if (!noti) - noti = add_notification("TempCooldownNotiOn"); + noti = add_notification("TempCooldownNotiOn", NULL, NULL); } static void broadcast_thermal_state_legacy(int state, int level) diff --git a/src/usb/usb-state.c b/src/usb/usb-state.c old mode 100644 new mode 100755 index fc8d190..f015047 --- a/src/usb/usb-state.c +++ b/src/usb/usb-state.c @@ -190,7 +190,7 @@ void usb_state_update_state(usb_connection_state_e state, unsigned int mode) } } else if (mode & USB_FUNCTION_MTP) { if (noti_id < 0) - noti_id = add_notification("MediaDeviceNotiOn"); + noti_id = add_notification("MediaDeviceNotiOn", NULL, NULL); if (noti_id < 0) _E("Failed to show notification for usb connection"); } -- 2.7.4 From c9836ef9787f98467b30d9219966184fcac591da Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Fri, 13 Jan 2017 11:41:47 +0900 Subject: [PATCH 06/16] block: Modify mkdir mode option - 644 -> 0755 Change-Id: I90b1b910dfc56c8711730fe307cc18fd2ec51165 Signed-off-by: pr.jung --- src/block/block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/block/block.c b/src/block/block.c index ca461de..9b754ad 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -3104,12 +3104,12 @@ static void block_init(void *data) ret = stat(EXTERNAL_STORAGE_PATH, &buf); if (ret < 0) { - ret = mkdir(EXTERNAL_STORAGE_PATH, 644); + ret = mkdir(EXTERNAL_STORAGE_PATH, 0755); if (ret < 0) _E("Failed to make directory: %d", errno); } else if (!S_ISDIR(buf.st_mode)) { remove(EXTERNAL_STORAGE_PATH); - ret = mkdir(EXTERNAL_STORAGE_PATH, 644); + ret = mkdir(EXTERNAL_STORAGE_PATH, 0755); if (ret < 0) _E("Failed to make directory: %d", errno); } else -- 2.7.4 From 1987539ebc54801cfaf09238ced8c0a06803751d Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Sun, 15 Jan 2017 16:16:46 +0900 Subject: [PATCH 07/16] battery : change low battery default notification from event to active Change-Id: I143968efa79f38798a0d1df6de9975c2bdb79216 Signed-off-by: lokilee73 --- src/battery/lowbat-handler.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/battery/lowbat-handler.c b/src/battery/lowbat-handler.c index 097c20c..1a108ae 100755 --- a/src/battery/lowbat-handler.c +++ b/src/battery/lowbat-handler.c @@ -357,37 +357,37 @@ direct_launch: if (lowbat_popup_option == LOWBAT_OPT_CHECK || lowbat_popup_option == LOWBAT_OPT_WARNING) { - if (active_noti) { - if (active_noti_on > 0) { - ret = remove_notification("BatteryLowCriticalNotiOff", active_noti_on); + if (event_noti) { + if (event_noti_on > 0) { + ret = remove_notification("BatteryLowCriticalNotiOff", event_noti_on); if (ret < 0) - _E("Failed to launch remove_active_noti : %d", ret); + _E("Failed to remove event_noti : %d", ret); } if (!power_source) { snprintf(temp, sizeof(temp), "%d", cur_bat_capacity); - ret = add_notification(active_noti, "s", temp); + ret = add_notification(event_noti, "s", temp); } else - ret = add_notification(active_noti, NULL, NULL); + ret = add_notification(event_noti, NULL, NULL); if (ret < 0) _E("Failed to launch active_noti : %d", ret); else - active_noti_on = ret; + event_noti_on = ret; } - if (event_noti) { - if (event_noti_on > 0) { - ret = remove_notification("BatteryLowCriticalNotiOff", event_noti_on); + if (active_noti) { + if (active_noti_on > 0) { + ret = remove_notification("BatteryLowCriticalNotiOff", active_noti_on); if (ret < 0) - _E("Failed to launch remove_event_noti : %d", ret); + _E("Failed to launch remove active_noti : %d", ret); } - ret = add_notification(event_noti, NULL, NULL); + ret = add_notification(active_noti, NULL, NULL); if (ret < 0) - _E("Failed to launch event noti : %d", ret); + _E("Failed to launch active noti : %d", ret); else - event_noti_on = ret; + active_noti_on = ret; return ret; } } else -- 2.7.4 From 18e8cd1b0ce2ca6b91c6f7b1450488778943de26 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Mon, 16 Jan 2017 13:52:53 +0900 Subject: [PATCH 08/16] battery : add PROFILE_MOBILE to distinguish low battery noti between mobile and wearable active and event noti are sent for mobile and only active noti is sent for wearable. Change-Id: Ia2ea7fcbba91de4603e1f4db542366284feb3722 Signed-off-by: lokilee73 --- CMakeLists.txt | 3 +++ src/battery/lowbat-handler.c | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbda9c6..9f87c5a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,6 +228,9 @@ ADD_DEFINITIONS("-DENABLE_PM_LOG") IF(ENGINEER_MODE STREQUAL on) ADD_DEFINITIONS("-DENGINEER_MODE") ENDIF(ENGINEER_MODE STREQUAL on) +IF(PROFILE STREQUAL mobile) + ADD_DEFINITIONS("-DPROFILE_MOBILE") +ENDIF() IF(PROFILE STREQUAL tv) ADD_DEFINITIONS("-DPROFILE_TV") ENDIF() diff --git a/src/battery/lowbat-handler.c b/src/battery/lowbat-handler.c index 1a108ae..2a0032a 100755 --- a/src/battery/lowbat-handler.c +++ b/src/battery/lowbat-handler.c @@ -251,13 +251,21 @@ static int get_lowbat_noti_value(int low_battery_type, char **actvie_noti, char len = strlen(battery.power_source_s); if (!strncmp(battery.power_source_s, POWER_SOURCE_NONE, len)) { - if (low_battery_type == LOW_BATTERY) { + if (low_battery_type == LOW_BATTERY) *actvie_noti = "BatteryLowActNotiOn"; - *event_noti = "BatteryLowNotiOn"; - } else if (low_battery_type == CRITICAL_BATTERY) { + else if (low_battery_type == CRITICAL_BATTERY) *actvie_noti = "BatteryCriticalActNotiOn"; +#ifdef PROFILE_MOBILE + if (low_battery_type == LOW_BATTERY) + *event_noti = "BatteryLowNotiOn"; + else if (low_battery_type == CRITICAL_BATTERY) *event_noti = "BatteryCriticalNotiOn"; - } +#else + if (low_battery_type == LOW_BATTERY) + *event_noti = NULL; + else if (low_battery_type == CRITICAL_BATTERY) + *event_noti = NULL; +#endif ret = 0; } else if (!strncmp(battery.power_source_s, POWER_SOURCE_AC, len) || !strncmp(battery.power_source_s, POWER_SOURCE_WIRELESS, len)) { -- 2.7.4 From 7a2ee8c44d78b4c78a046f5ce984012a84b15544 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Fri, 20 Jan 2017 00:03:34 +0900 Subject: [PATCH 09/16] battery : fix a bug in active and event noti current battery value should be shown in active noti. but, it was applied to event noti. Change-Id: Iafb62c6a309870a23599a6b7d87d0c4766860f91 Signed-off-by: lokilee73 --- src/battery/lowbat-handler.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/battery/lowbat-handler.c b/src/battery/lowbat-handler.c index 2a0032a..f83bcce 100755 --- a/src/battery/lowbat-handler.c +++ b/src/battery/lowbat-handler.c @@ -373,15 +373,12 @@ direct_launch: } if (!power_source) { - snprintf(temp, sizeof(temp), "%d", cur_bat_capacity); - ret = add_notification(event_noti, "s", temp); - } else ret = add_notification(event_noti, NULL, NULL); - - if (ret < 0) - _E("Failed to launch active_noti : %d", ret); - else - event_noti_on = ret; + if (ret < 0) + _E("Failed to launch event_noti : %d", ret); + else + event_noti_on = ret; + } } if (active_noti) { @@ -391,7 +388,12 @@ direct_launch: _E("Failed to launch remove active_noti : %d", ret); } - ret = add_notification(active_noti, NULL, NULL); + if (!power_source) { + snprintf(temp, sizeof(temp), "%d", cur_bat_capacity); + ret = add_notification(active_noti, "s", temp); + } else + ret = add_notification(active_noti, NULL, NULL); + if (ret < 0) _E("Failed to launch active noti : %d", ret); else -- 2.7.4 From adbd810625c06f556ef7902e85e60672d9b7a043 Mon Sep 17 00:00:00 2001 From: taeyoung Date: Fri, 6 Jan 2017 18:36:02 +0900 Subject: [PATCH 10/16] display: set vconf key only if the value is changed Previously, the vconf key could be set with same value. Thus the display state callback of the capi-system-device could be called several times with same state. Now, the vconf key is updated only if the value is changed. Thus the callback of the api will be called once for a certain display state. Change-Id: I35a89dc6a882b58fb86c21a2b8a8b570231db97c Signed-off-by: taeyoung --- src/display/setting.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/display/setting.c b/src/display/setting.c index eacb720..f45c40e 100644 --- a/src/display/setting.c +++ b/src/display/setting.c @@ -125,6 +125,12 @@ int get_usb_status(int *val) int set_setting_pmstate(int val) { + static int old = -1; + + if (old == val) + return 0; + old = val; + display_state_send_system_event(val); return vconf_set_int(VCONFKEY_PM_STATE, val); } -- 2.7.4 From 8297a2f927a187acb14ff182e90c2868dd160a89 Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Tue, 24 Jan 2017 11:05:25 +0900 Subject: [PATCH 11/16] block: Check udev enumeration is done already Change-Id: I0a71a53af3290a837ad6f0f2c0881f2cddd905bc Signed-off-by: pr.jung --- src/block/block.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/block/block.c b/src/block/block.c index 9b754ad..8588027 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -2387,8 +2387,11 @@ static void remove_whole_block_device(void) static int booting_done(void *data) { /* if there is the attached device, try to mount */ - block_init_from_udev_enumerate(); - block_control = true; + unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, booting_done); + if (!block_control) { + block_control = true; + block_init_from_udev_enumerate(); + } block_boot = true; return 0; } -- 2.7.4 From 541019be2cc9d69996c4c684dd43174e73e33d18 Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Tue, 24 Jan 2017 14:00:16 +0900 Subject: [PATCH 12/16] block: Support compatibility with tizen 2.4 - Need to migrate app external images which is created on tizen 2.4 - Call app2ext_migrate_legacy_all() Change-Id: I719856571d8c227ea02a6feb6ba535dea4251c5d Signed-off-by: pr.jung --- src/block/block.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/block/block.c b/src/block/block.c index 8588027..f3de7d7 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -1150,6 +1150,10 @@ static int mount_start(struct block_device *bdev) data->state = BLOCK_MOUNT; + r = app2ext_migrate_legacy_all(); + if (r < 0) + _E("app2ext failed"); + out: _I("%s result : %s, %d", __func__, data->devnode, r); -- 2.7.4 From 84f41ca554390780800f35804a7447b0da199a6a Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Wed, 25 Jan 2017 13:46:15 +0900 Subject: [PATCH 13/16] block: Create external appdata directory after sdcard is mounted Change-Id: Idad207bfd5248e12a964c4bbc0f7b36bcc01253e Signed-off-by: pr.jung --- src/block/block.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/block/block.c b/src/block/block.c index f3de7d7..094a4d7 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -97,6 +97,10 @@ /* Maximum number of thread */ #define THREAD_MAX 5 +#define PKGDIR_BUS_NAME "org.tizen.pkgdir_tool" +#define PKGDIR_PATH "/org/tizen/pkgdir_tool" +#define PKGDIR_INTERFACE "org.tizen.pkgdir_tool" + enum block_dev_operation { BLOCK_DEV_MOUNT, BLOCK_DEV_UNMOUNT, @@ -1126,8 +1130,11 @@ out: static int mount_start(struct block_device *bdev) { + DBusMessage *msg; + DBusError err; struct block_data *data; int r; + bool ret_val; assert(bdev); assert(bdev->data); @@ -1154,6 +1161,22 @@ static int mount_start(struct block_device *bdev) if (r < 0) _E("app2ext failed"); + msg = dbus_method_sync_with_reply(PKGDIR_BUS_NAME, PKGDIR_PATH, + PKGDIR_INTERFACE, "CreateExternalDirsForAllPkgs", + NULL, NULL); + if (!msg) { + _D("Fail to create external directory"); + goto out; + } + + dbus_error_init(&err); + + r = dbus_message_get_args(msg, &err, DBUS_TYPE_BOOLEAN, &ret_val, DBUS_TYPE_INVALID); + if (!r) { + _E("no message : [%s:%s]", err.name, err.message); + dbus_error_free(&err); + } + out: _I("%s result : %s, %d", __func__, data->devnode, r); -- 2.7.4 From cb3b7ebfcc7e7700c6e7db0a6dbf117707a5c91f Mon Sep 17 00:00:00 2001 From: "pr.jung" Date: Tue, 7 Feb 2017 18:49:56 +0900 Subject: [PATCH 14/16] block: Check block device is already removed before deviced tries to remove block device - Prevent to remove already removed block device Change-Id: I32b9977fe8fcbcb4baed8c5d0d6d306acf24806c Signed-off-by: pr.jung --- src/block/block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/block/block.c b/src/block/block.c index 094a4d7..716ea08 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -797,7 +797,7 @@ static void free_block_device(struct block_device *bdev) } // Called By MainThread - Remove Device -static struct block_device *find_block_device(const char *devnode) +static struct block_device *find_block_device_for_device_remove(const char *devnode) { struct block_device *bdev; dd_list *elem; @@ -808,7 +808,7 @@ static struct block_device *find_block_device(const char *devnode) for (i = 0; i < THREAD_MAX; i++) { pthread_mutex_lock(&(th_manager[i].mutex)); DD_LIST_FOREACH(th_manager[i].block_dev_list, elem, bdev) { - if (bdev->data && + if (bdev->data && !bdev->removed && !strncmp(bdev->data->devnode, devnode, len)) { pthread_mutex_unlock(&(th_manager[i].mutex)); return bdev; @@ -2134,7 +2134,7 @@ static int remove_block_device(struct udev_device *dev, const char *devnode) struct block_device *bdev; int ret; - bdev = find_block_device(devnode); + bdev = find_block_device_for_device_remove(devnode); if (!bdev) { _E("fail to find block data for %s", devnode); return -ENODEV; -- 2.7.4 From 726aa99a5c47bef5624aea044d03b55167f9a137 Mon Sep 17 00:00:00 2001 From: taeyoung Date: Mon, 13 Feb 2017 21:35:01 +0900 Subject: [PATCH 15/16] common: fix memory leak issues Change-Id: I956e59695285e2ef9285008360c4393677dd54be Signed-off-by: taeyoung --- src/block/block.c | 14 ++++++++------ src/tzip/tzip-utility.c | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/block/block.c b/src/block/block.c index 716ea08..ee287e8 100644 --- a/src/block/block.c +++ b/src/block/block.c @@ -1935,6 +1935,12 @@ static int add_operation(struct block_device *bdev, get_operation_char(operation, name, sizeof(name)), bdev->data->devnode); + thread_id = bdev->thread_id; + if (thread_id < 0 || thread_id >= THREAD_MAX) { + _E("Fail to find thread to add"); + return -EPERM; + } + op = (struct operation_queue *)malloc(sizeof(struct operation_queue)); if (!op) { _E("malloc failed"); @@ -1948,12 +1954,6 @@ static int add_operation(struct block_device *bdev, msg = dbus_message_ref(msg); op->msg = msg; - thread_id = bdev->thread_id; - if (thread_id < 0 || thread_id >= THREAD_MAX) { - _E("Fail to find thread to add"); - return -EPERM; - } - /* LOCK * during adding queue and checking the queue length */ pthread_mutex_lock(&(th_manager[thread_id].mutex)); @@ -2101,6 +2101,8 @@ static int add_block_device(struct udev_device *dev, const char *devnode) thread_id = find_thread(bdev->data->devnode); if (thread_id < 0 || thread_id >= THREAD_MAX) { _E("Fail to find thread to add"); + free_block_data(data); + free(bdev); return -EPERM; } bdev->thread_id = thread_id; diff --git a/src/tzip/tzip-utility.c b/src/tzip/tzip-utility.c index 3553788..100c975 100644 --- a/src/tzip/tzip-utility.c +++ b/src/tzip/tzip-utility.c @@ -226,7 +226,7 @@ int add_dir_info(struct tzip_mount_entry *entry, const char *parent_dir, return -ENOMEM; } - dinfo->file_hash = g_hash_table_new_full( + dinfo->file_hash = g_hash_table_new_full( g_str_hash, g_str_equal, NULL, NULL); if (!dinfo->file_hash) { _E("Malloc failed"); @@ -238,6 +238,7 @@ int add_dir_info(struct tzip_mount_entry *entry, const char *parent_dir, dinfo->name = (char *)malloc(len); if (!dinfo->name) { _E("Malloc failed"); + g_hash_table_unref(dinfo->file_hash); free(dinfo); return -ENOMEM; } -- 2.7.4 From 67bb6ca1b0ad8ed65240879eb558045dfee6ae31 Mon Sep 17 00:00:00 2001 From: taeyoung Date: Mon, 23 Jan 2017 17:39:13 +0900 Subject: [PATCH 16/16] power: fix the privilege of the reboot operation Previously, the privilege of the reboot operation was "http://tizen.org/privilege/power" since the method is registered on the "org.tizen.system.deviced.power" interface. But the device_power_reboot() document of capi-system-device noticed that the operation requires "http://tizen.org/privilege/reboot" privilege. Now, the privilege of the reboot operation is changed to "http://tizen.org/privilege/reboot" according to the device_power_reboot(). For the change, the dbus method interface is changed to "org.tizen.system.deviced.reboot". Change-Id: I928fc35710f8713c74b84d0aa434fc60e084fc2c Signed-off-by: taeyoung --- scripts/deviced.conf | 5 +++++ src/core/edbus-handler.c | 1 + src/devicectl/devicectl.c | 3 ++- src/deviced/dd-deviced.h | 20 -------------------- src/libdeviced/deviced-noti.c | 12 +----------- src/power/power-handler.c | 2 +- src/shared/dbus.h | 3 +++ 7 files changed, 13 insertions(+), 33 deletions(-) diff --git a/scripts/deviced.conf b/scripts/deviced.conf index c580132..31bd840 100644 --- a/scripts/deviced.conf +++ b/scripts/deviced.conf @@ -14,6 +14,8 @@ + @@ -27,6 +29,9 @@ send_interface="org.tizen.system.deviced.power" privilege="http://tizen.org/privilege/power"/> +