2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <appcore-efl.h>
35 #include "taskmanager.h"
37 #include "_util_log.h"
38 #include "_util_efl.h"
43 #include "_progressbar.h"
48 pthread_mutex_t mutex_for_graph_update = PTHREAD_MUTEX_INITIALIZER;
49 static Elm_Object_Item *g_egi;
51 /* group list:gl, data list:dl, button list:bl, no list: nl */
52 static Elm_Genlist_Item_Class itc_gl;
53 static Elm_Genlist_Item_Class itc_hl;
54 static Elm_Genlist_Item_Class itc_dl;
55 static Elm_Genlist_Item_Class itc_bl;
56 static Elm_Genlist_Item_Class itc_nl;
57 static Elm_Genlist_Item_Class itc_separator4;
58 static Elm_Genlist_Item_Class itc_separator2;
60 static char *button_text[TS_MAX] = {
61 "IDS_TASKMGR_BUTTON_CLOSE_ALL_APPLICATIONS",
62 "IDS_TASKMGR_BUTTON_CLEAR_HISTORY_ABB"
65 static void end_all_inuse_cb(void *data, Evas_Object *obj, void *event_info);
66 static void delete_all_history_cb(void *data, Evas_Object *obj,
68 void (*func_del[TS_MAX]) (void *data, Evas_Object *obj, void *event_info) = {
69 &end_all_inuse_cb, &delete_all_history_cb};
71 static void end_inuse_cb(void *data, Evas_Object *obj, void *event_info);
72 static void delete_history_cb(void *data, Evas_Object *obj, void *event_info);
73 void (*func_end[TS_MAX]) (void *data, Evas_Object *obj, void *event_info) = {
74 &end_inuse_cb, &delete_history_cb};
76 static char *group_name[TS_MAX] = {
77 "IDS_TASKMGR_HEADER_RUNNING",
78 "IDS_TASKMGR_MBODY_RECENTLY_USED"
81 static char *nolist_text[TS_MAX] = {
82 "IDS_TASKMGR_MBODY_NO_APPS_OPEN",
83 "IDS_TASKMGR_MBODY_NO_RECENTLY_USED_APPS"
86 void taskmanager_free_info(struct _task_info *info);
87 Eina_Bool _update_list(void *data);
89 static void clear_genlist(void *data)
93 struct appdata *ad = data;
96 elm_genlist_clear(ad->gl);
100 void clear_task_manager_list(void *data)
102 ret_if(data == NULL);
104 struct appdata *ad = data;
105 _free_einalist_all(ad);
109 static void app_genlist_item_update(void *data)
111 ret_if(data == NULL);
113 struct appdata *ad = (struct appdata *)data;
115 Elm_Object_Item *it_r;
116 Eina_List *realized_item_list, *l_r;
117 unsigned int cnt = 0;
119 realized_item_list = elm_genlist_realized_items_get(ad->gl);
120 cnt = eina_list_count(realized_item_list);
122 EINA_LIST_FOREACH(realized_item_list, l_r, it_r) {
124 elm_genlist_item_update(it_r);
130 Eina_Bool alert_app_info(void *data)
132 retv_if(data == NULL, -1);
134 struct appdata *ad = (struct appdata *)data;
136 app_genlist_item_update(ad);
137 return ECORE_CALLBACK_CANCEL;
140 static void end_all_inuse_cb(void *data, Evas_Object *obj, void *event_info)
142 ret_if(data == NULL);
144 struct appdata *ad = data;
145 char buf[_BUF_MAX] = { 0, };
147 ad->mode = MODE_END_ALL_INUSE;
148 snprintf(buf, sizeof(buf), T_("IDS_TASKMGR_POP_CLOSE_ALL_APPS_Q_THIS_MAY_CAUSE_DATA_TO_BE_LOST"));
150 evas_object_del(ad->popup_ask);
151 ad->popup_ask = NULL;
153 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
157 delete_all_history_cb(void *data, Evas_Object *obj, void *event_info)
160 ret_if(data == NULL);
162 struct appdata *ad = data;
163 char buf[_BUF_MAX] = { 0, };
165 ad->mode = MODE_DEL_ALL_HISTORY;
166 snprintf(buf, sizeof(buf), T_("IDS_TASKMGR_POP_CLEAR_ALL_APP_HISTORY_Q"));
168 evas_object_del(ad->popup_ask);
169 ad->popup_ask = NULL;
171 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
174 static void end_inuse_cb(void *data, Evas_Object *obj, void *event_info)
176 ret_if(data == NULL);
178 struct _task_info *info_ev = (struct _task_info *)data;
179 struct appdata *ad = info_ev->ad;
180 char buf[_BUF_MAX] = { 0, };
182 ad->mode = MODE_END_INUSE;
183 snprintf(buf, _BUF_MAX, T_("IDS_TASKMGR_POP_CLOSE_PS_APP_Q_THIS_MAY_CAUSE_DATA_TO_BE_LOST"), info_ev->app_name);
185 evas_object_del(ad->popup_ask);
186 ad->popup_ask = NULL;
188 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
189 g_egi = (void *)info_ev->it;
192 static void delete_history_cb(void *data, Evas_Object *obj, void *event_info)
194 ret_if(data == NULL);
196 struct _task_info *info_ev = (struct _task_info *)data;
197 struct appdata *ad = info_ev->ad;
198 char buf[_BUF_MAX] = { 0, };
200 ad->mode = MODE_DEL_HISTORY;
202 snprintf(buf, _BUF_MAX, T_("IDS_TASKMGR_POP_CLEAR_PS_HISTORY_Q"), info_ev->app_name);
204 evas_object_del(ad->popup_ask);
205 ad->popup_ask = NULL;
207 ad->popup_ask = _add_popup_ask(ad->win, buf, ad);
208 g_egi = (void *)info_ev->it;
211 static void nl_sel(void *data, Evas_Object *obj, void *event_info)
214 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
215 elm_genlist_item_selected_set(item, EINA_FALSE);
219 static char *nl_text_get(void *data, Evas_Object *obj, const char *part)
221 char buf[_BUF_MAX] = { 0, };
223 if (!strcmp(part, "elm.text")) {
224 snprintf(buf, sizeof(buf), "%s", T_(nolist_text[(int)data]));
231 static void _gl_sel_app(void *data, Evas_Object *obj, void *event_info)
234 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
235 struct appdata *ad = (struct appdata *)data;
236 struct _task_info *info;
237 /* parameter to block double click */
238 static int selected = 0;
239 Elm_Object_Item *it = (Elm_Object_Item *) event_info;
241 elm_genlist_item_selected_set(it, EINA_FALSE);
243 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
246 if (ad->update_timer) {
247 ecore_timer_del(ad->update_timer);
248 ad->update_timer = NULL;
256 _E("[Error] Cannot find genlist item\n");
261 info = (struct _task_info *)elm_object_item_data_get(item);
263 _E("[Error] Cannot get item data: info\n");
269 /* when application is alive */
270 aul_resume_pid(info->pid);
273 /* when application is dead */
274 if (info->pkg_name == NULL) {
275 util_show_popup_with_message(info->ad->win,
277 T_("IDS_TASKMGR_POP_UNABLE_TO_OPEN_APPLICATION"));
282 _unset_notification_level(info->ad->win);
285 if (!strcmp(info->pkg_name, "org.tizen.phone")) {
286 /* exception : Because dialer doesn't need bundle
287 * since being unifyed dialer, voice call and video call
289 aul_launch_app(info->pkg_name, NULL);
292 aul_launch_app(info->pkg_name, info->b);
299 static Evas_Object *_gl_content_get_app(void *data, Evas_Object *obj,
302 struct _task_info *info = (struct _task_info *)data;
303 char buf[_BUF_MAX] = { 0, };
305 Evas_Object *icon = NULL;
306 Evas_Object *btn = NULL;
308 Evas_Object *rt, *icon_ly = NULL;
310 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
312 if (!strcmp(part, "elm.icon.1")) {
313 snprintf(buf, sizeof(buf), "%s", info->icn_path);
314 retvm_if(buf == NULL, NULL, "%s icon is NULL\n", info->app_name);
315 if (!ecore_file_exists(buf) || strlen(buf) < 4)
316 snprintf((char *)buf, (size_t) sizeof(buf),
317 (const char *)IMAGEDIR "/icon_taskmgr.png");
319 if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
320 icon_ly = _add_layout(obj, buf, "icon");
323 icon_ly = elm_icon_add(obj);
324 elm_icon_file_set(icon_ly, buf, NULL);
327 icon = _add_layout(obj, EDJ_NAME, "icon");
328 retvm_if(icon == NULL, NULL, "Cannot add layout: icon\n");
330 rt = evas_object_rectangle_add(evas_object_evas_get(obj));
331 retvm_if(rt == NULL, NULL, "Failed to add rectangle\n");
333 evas_object_color_set(rt, 0, 0, 0, 0);
334 evas_object_size_hint_min_set(rt,
335 (int)72 * elm_scale_get(),
336 (int)72 * elm_scale_get());
337 elm_object_part_content_set(icon, "icon_ly", rt);
339 elm_object_part_content_set(icon, "icon", icon_ly);
343 } else if (!strcmp(part, "elm.icon.2")) {
344 btn = elm_button_add(obj);
345 elm_object_text_set(btn, S_("IDS_COM_BODY_END"));
346 elm_object_style_set(btn, "default");
348 evas_object_smart_callback_add(btn, "clicked",
349 func_end[info->category], info);
350 elm_object_focus_set(btn, EINA_FALSE);
351 evas_object_propagate_events_set(btn, EINA_FALSE);
359 static char *_gl_text_get_app(void *data, Evas_Object *obj, const char *part)
361 struct _task_info *info = (struct _task_info *)data;
362 char buf[_BUF_MAX] = { 0, };
365 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
366 retvm_if(part == NULL, NULL, "Invalid argument: part is NULL\n");
368 if (!strcmp(part, "elm.text.1")) {
369 snprintf(buf, _BUF_MAX, "%s", info->app_name);
372 } else if (!strcmp(part, "elm.text.2")) {
373 if (info->category == TS_INUSE) {
374 snprintf(buf, _BUF_MAX, "CPU: %.1f%%", info->cpu);
379 elm_object_signal_emit(info->it, "prog.hide.mem","taskmanager");
387 static void _bl_sel(void *data, Evas_Object *obj, void *event_info)
390 int mode = (int)data;
392 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
394 elm_genlist_item_selected_set(item, EINA_FALSE);
397 static char *_bl_text_get(void *data, Evas_Object *obj, const char *part)
399 if (!strcmp(part, "elm.text")) {
400 return strdup(T_(button_text[(int)data]));
406 static Evas_Object *_bl_content_get(void *data, Evas_Object *obj,
409 Evas_Object *btn = NULL;
410 struct appdata *ad = evas_object_data_get(obj, "appdata");
412 if (!strcmp(part, "elm.icon")) {
414 btn = elm_button_add(obj);
415 elm_object_style_set(btn, "default");
417 elm_object_text_set(btn, T_(button_text[(int)data]));
418 evas_object_smart_callback_add(btn, "clicked",
419 func_del[(int)data], ad);
420 elm_object_focus_set(btn, EINA_FALSE);
422 evas_object_size_hint_min_set(btn, 0, 50);
423 evas_object_size_hint_max_set(btn, 0, 50);
424 evas_object_propagate_events_set(btn, EINA_FALSE);
432 static char *_gl_text_get_title(void *data, Evas_Object *obj, const char *part)
436 if (!strcmp(part, "elm.text")) {
437 snprintf(buf, sizeof(buf), "%s (%d)",
438 T_(group_name[(int)data]), _get_grp_cnt((int)data));
444 static char *_gl_text_get_his(void *data, Evas_Object *obj, const char *part)
446 struct _task_info *info = (struct _task_info *)data;
447 char buf[_BUF_MAX] = { 0, };
450 if (!strcmp(part, "elm.text")) {
451 snprintf(buf, _BUF_MAX, "%s", info->app_name);
457 static Evas_Object *_gl_content_get_his(void *data, Evas_Object *obj,
460 struct _task_info *info = (struct _task_info *)data;
461 char buf[_BUF_MAX] = { 0, };
463 Evas_Object *icon = NULL;
464 Evas_Object *btn = NULL;
466 Evas_Object *rt, *icon_ly = NULL;
467 retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
469 if (!strcmp(part, "elm.icon.1")) {
470 snprintf(buf, sizeof(buf), "%s", info->icn_path);
471 retvm_if(buf == NULL, NULL, "%s icon is NULL\n", info->app_name);
472 if (!ecore_file_exists(buf) || strlen(buf) < 4)
473 snprintf((char *)buf, (size_t) sizeof(buf),
474 (const char *)IMAGEDIR "/icon_taskmgr.png");
476 if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
477 icon_ly = _add_layout(obj, buf, "icon");
480 icon_ly = elm_icon_add(obj);
481 elm_icon_file_set(icon_ly, buf, NULL);
484 icon = _add_layout(obj, EDJ_NAME, "icon");
485 retvm_if (icon == NULL, NULL, "Cannot add layout: icon\n");
487 rt = evas_object_rectangle_add(evas_object_evas_get(obj));
488 retvm_if (rt == NULL, NULL, "Failed to add rectangle\n");
490 evas_object_color_set(rt, 0, 0, 0, 0);
491 evas_object_size_hint_min_set(rt,
492 (int)72 * elm_scale_get(),
493 (int)72 * elm_scale_get());
494 elm_object_part_content_set(icon, "icon_ly", rt);
496 elm_object_part_content_set(icon, "icon", icon_ly);
500 } else if (!strcmp(part, "elm.icon.2")) {
501 btn = elm_button_add(obj);
502 elm_object_text_set(btn, S_("IDS_COM_OPT_DELETE"));
503 elm_object_style_set(btn, "default");
505 evas_object_smart_callback_add(btn, "clicked",
506 func_end[info->category], info);
507 elm_object_focus_set(btn, EINA_FALSE);
508 evas_object_propagate_events_set(btn, EINA_FALSE);
519 itc_gl.item_style = "grouptitle";
520 itc_gl.func.text_get = _gl_text_get_title;
522 itc_dl.item_style = "2text.2icon.7";
523 itc_dl.func.text_get = _gl_text_get_app;
524 itc_dl.func.content_get = _gl_content_get_app;
526 itc_hl.item_style = "1text.2icon.1";
527 itc_hl.func.text_get = _gl_text_get_his;
528 itc_hl.func.content_get = _gl_content_get_his;
530 itc_separator4.item_style = "dialogue/seperator.4";
531 itc_separator2.item_style = "dialogue/seperator.2";
533 itc_bl.item_style = "dialogue/bg/1icon";
534 itc_bl.func.content_get = _bl_content_get;
536 itc_nl.item_style = "1text";
537 itc_nl.func.text_get = nl_text_get;
541 int check_genlist(struct appdata *ad)
543 Elm_Object_Item *egi;
544 struct _task_info *info;
547 egi = elm_genlist_first_item_get(ad->gl);
549 info = (struct _task_info *)elm_object_item_data_get(egi);
551 _D("%s info[0x%x]\n", (int)info < 3 ? "-" : info->app_name, info);
555 egi = elm_genlist_item_next_get(egi);
561 int _set_genlist_from_eina(struct appdata *ad)
565 Elm_Object_Item *git, *item;
566 struct _task_info *info;
569 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
570 retvm_if(ad->gl == NULL, -1, "Invalid argument:genlist is NULL\n");
572 for (i = 0; i < TS_MAX; i++) {
573 git = elm_genlist_item_append(ad->gl, &itc_gl,
575 ELM_GENLIST_ITEM_NONE,
577 retvm_if(git == NULL, -1, "Failed append item\n");
578 elm_genlist_item_select_mode_set(git, EINA_TRUE);
580 if (eina_list_count(ad->applist[i]) > 0) {
582 item = elm_genlist_item_append(ad->gl, &itc_separator4,
584 ELM_GENLIST_ITEM_NONE,
586 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
589 item = elm_genlist_item_append(ad->gl, &itc_bl,
591 ELM_GENLIST_ITEM_NONE,
594 item = elm_genlist_item_append(ad->gl, &itc_separator2,
596 ELM_GENLIST_ITEM_NONE,
598 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
600 ad->applist[i] = eina_list_nth_list(ad->applist[i], 0);
601 EINA_LIST_FOREACH(ad->applist[i], l, info) {
603 info->it = elm_genlist_item_append(ad->gl,
604 (i == TS_INUSE) ? &itc_dl : &itc_hl,
606 ELM_GENLIST_ITEM_NONE,
611 item = elm_genlist_item_append(ad->gl, &itc_nl,
613 ELM_GENLIST_ITEM_NONE,
615 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
621 Eina_Bool _update_list(void *data)
624 struct appdata *ad = data;
625 Eina_List *l, *l_next;
626 struct _task_info *info;
628 pthread_mutex_lock(&mutex_for_graph_update);
630 if(ad->applist[TS_INUSE] == NULL) {
631 _D("inuse is NULL\n");
632 return ECORE_CALLBACK_CANCEL;
634 ad->applist[TS_INUSE] = eina_list_nth_list(ad->applist[TS_INUSE], 0);
635 _D("%d\n", eina_list_count(ad->applist[TS_INUSE]));
637 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
638 elm_genlist_item_update(info->it);
641 pthread_mutex_unlock(&mutex_for_graph_update);
642 return ECORE_CALLBACK_RENEW;
645 void *_update_pthread_cb(void *data)
648 struct appdata *ad = data;
651 Eina_List *l, *l_next;
652 struct _task_info *info;
656 if (ad->ending == EINA_FALSE) {
657 if(ad->applist[TS_INUSE] == NULL) {
658 _D("in use list is NULL\n");
659 return ECORE_CALLBACK_CANCEL;
662 _get_sysconf(&ncpu, &tick);
664 ad->applist[TS_INUSE] = eina_list_nth_list(ad->applist[TS_INUSE], 0);
665 if (eina_list_count(ad->applist[TS_INUSE]) < 1) {
666 _D("list count is 0\n");
670 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
672 info->cpu = _get_cpu_ratio(info, ncpu, tick);
673 _D("%d / %lf\n", info->pid, info->cpu);
685 void _set_genlist(struct appdata *ad)
688 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
689 int ret = AUL_R_ERROR;
691 int sleep_value = 1000;
695 while (ret != AUL_R_OK && retry_cnt < 5) {
697 ret = aul_app_get_running_app_info(runapp_info_get, ad);
699 if (ret != AUL_R_OK) {
700 _D("Fail to get running app information from ail");
707 taskmanager_get_history_app_info(ad);
708 _set_genlist_from_eina(ad);
712 void _init_pthread(void)
714 pthread_mutex_init(&pm, NULL);
715 pthread_cond_init(&pc, NULL);
718 void _fini_pthread(void)
726 void refresh_app_info(struct appdata *ad)
729 retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
731 _free_einalist_all(ad);
740 void _del_popup_timer(struct appdata *ad)
742 if (ad->popup_timer) {
743 ecore_timer_del(ad->popup_timer);
744 ad->popup_timer = NULL;
748 void taskmanager_free_info(struct _task_info *info)
751 if (info->app_name) {
752 free(info->app_name);
753 info->app_name = NULL;
755 if (info->pkg_name) {
756 free(info->pkg_name);
757 info->pkg_name = NULL;
759 if (info->icn_path) {
760 free(info->icn_path);
761 info->icn_path = NULL;
768 void _restart_pthread(struct appdata *ad)
772 if (eina_list_count(ad->applist[TS_INUSE]) > 0) {
774 pthread_create(&pt, NULL, _update_pthread_cb, ad);
776 if (ad->update_timer) {
777 ecore_timer_del(ad->update_timer);
778 ad->update_timer = NULL;
780 ad->update_timer = ecore_timer_add(2.0, _update_list, ad);
783 int response_end_inuse(struct appdata *ad)
786 Eina_List *l, *l_next;
787 struct _task_info *info;
788 Elm_Object_Item *egi;
790 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
792 ad->ending = EINA_TRUE;
794 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
795 _D("applist pid : %d", info->pid);
796 if (info->it == g_egi) {
797 _D("matched applist pid : %d", info->pid);
799 if (aul_terminate_pid(info->pid) < 0) {
800 kill(info->pid, SIGKILL);
806 ad->ending = EINA_FALSE;
811 Eina_Bool _refresh_idler_cb(void *data)
814 struct appdata *ad = (struct appdata *)data;
815 retvm_if(data == NULL, ECORE_CALLBACK_CANCEL, "Invalid argument: appdata is NULL\n:");
817 _del_popup_timer(ad);
818 _del_progressbar(ad);
819 refresh_app_info(ad);
820 return ECORE_CALLBACK_CANCEL;
823 int response_end_all_inuse(struct appdata *ad)
826 struct _task_info *info;
828 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
830 ad->ending = EINA_TRUE;
832 if(ad->update_timer) {
833 ecore_timer_del(ad->update_timer);
834 ad->update_timer = NULL;
837 ad->endcnt = eina_list_count(ad->applist[TS_INUSE]);
838 _D("set end count (%d)\n", ad->endcnt);
840 EINA_LIST_FOREACH(ad->applist[TS_INUSE], l, info) {
842 _D("applist pid : %d", info->pid);
844 if (aul_terminate_pid(info->pid) < 0) {
845 kill(info->pid, SIGKILL);
851 ad->ending = EINA_FALSE;
855 int response_del_history(struct appdata *ad)
857 Eina_List *l, *l_next;
858 struct _task_info *info;
859 Elm_Object_Item *egi;
861 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
863 _show_progressbar(ad);
864 EINA_LIST_FOREACH_SAFE(ad->applist[TS_HISTORY], l, l_next, info) {
865 _D("history applist pid : %d", info->pid);
866 if (info->it == g_egi) {
868 if (rua_init() == -1) {
871 rua_delete_history_with_pkgname(info->pkg_name);
874 ad->applist[TS_HISTORY] =
875 eina_list_remove_list(ad->applist[TS_HISTORY], l);
878 bundle_free(info->b);
881 elm_object_item_del(info->it);
882 taskmanager_free_info(info);
887 refresh_app_info(ad);
888 _del_popup_timer(ad);
889 _del_progressbar(ad);
891 ad->mode = MODE_NONE;
895 int response_del_all_history(struct appdata *ad)
898 struct _task_info *info;
900 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
902 if(ad->update_timer) {
903 _D("update timer is deleted\n");
904 ecore_timer_del(ad->update_timer);
905 ad->update_timer = NULL;
909 _show_progressbar(ad);
911 if (rua_init() == -1) {
915 EINA_LIST_FOREACH(ad->applist[TS_HISTORY], l, info) {
917 rua_delete_history_with_pkgname(info->pkg_name);
921 if (eina_list_count(ad->applist[TS_INUSE]) == 0) {
926 refresh_app_info(ad);
927 _del_popup_timer(ad);
928 _del_progressbar(ad);
930 ad->mode = MODE_NONE;
934 int response_kill_inuse(struct appdata *ad)
936 Eina_List *l, *l_next;
937 struct _task_info *info;
938 Elm_Object_Item *egi;
940 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
942 _show_progressbar(ad);
944 EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
945 _D("kill applist pid : %d", info->pid);
946 if (info->it == g_egi) {
948 kill(info->pid, SIGKILL);
951 ad->applist[TS_INUSE] =
952 eina_list_remove_list(ad->applist[TS_INUSE], l);
953 taskmanager_free_info(info);
957 refresh_app_info(ad);
958 _del_progressbar(ad);
963 int response_kill_all_inuse(struct appdata *ad)
966 struct _task_info *info;
968 retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
970 _show_progressbar(ad);
972 EINA_LIST_FOREACH(ad->applist[TS_INUSE], l, info) {
973 _D("kill all applist pid : %d", info->pid);
976 kill(info->pid, SIGKILL);
980 refresh_app_info(ad);
981 _del_progressbar(ad);