src/_util_efl.c
src/_genlist.c
src/_logic.c
- src/_cpu.c
+# src/_cpu.c
src/_eina.c
# src/_info.c
src/_progressbar.c
<?xml version="1.0" encoding="utf-8"?>\r
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.taskmgr" version="0.14.3" install-location="internal-only">\r
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.taskmgr" version="0.14.4" install-location="internal-only">\r
<label>taskmgr</label>\r
<author email="hhh.kwon@samsung.com" href="www.samsung.com">Hong Kwon</author>\r
<description>Task Manager</description>\r
Name: org.tizen.taskmgr
Summary: Task Manager
-Version: 0.14.3
+Version: 0.14.4
Release: 1
Group: devel
License: Flora Software License
ail_appinfo_h handle;
ail_error_e ret;
- int i;
- int vali;
char *valc;
bool valb;
- char *icn_path;
char buf[1024] = { 0, };
struct appdata *ad = data;
struct _task_info *info;
- float usr = 0.0, sys = 0.0;
retvm_if(ainfo == NULL, -1, "Invalid argument: ainfo is NULL\n");
retvm_if(data == NULL, -1, "Invalid argument: data is NULL\n");
int flag = 0;
struct rua_rec rec_result = { 0, };
- char *val;
char **table = NULL;
char buf[1024] = { 0, };
int nrows = 0, ncols = 0;
int row = 0;
- int i, cnt;
ail_appinfo_h handle;
ail_error_e ret;
bool valb;
char *valc;
- int vali;
retvm_if(data == NULL, -1, "Invalid argument: data is NULL\n");
retvm_if(rua_init() == -1, -1, "Failed to rua_init\n");
int _subt_einalist_item(struct appdata *ad, int pid)
{
_D("func\n");
- Eina_List *l, *l_next;
+ Eina_List *l;
int ret = -1;
struct _task_info *info;
#include <vconf.h>
#include <utilX.h>
#include <aul.h>
+#include <rua.h>
#include <Ecore_X.h>
#include <Eina.h>
#include <unistd.h>
#include "_info.h"
#include "_progressbar.h"
-pthread_t pt;
-pthread_cond_t pc;
-pthread_mutex_t pm;
-pthread_mutex_t mutex_for_graph_update = PTHREAD_MUTEX_INITIALIZER;
static Elm_Object_Item *g_egi;
/* group list:gl, data list:dl, button list:bl, no list: nl */
retm_if(ad == NULL, "Invalid argument: appdata is NULL\n");
- _fini_pthread();
if (ad->update_timer) {
ecore_timer_del(ad->update_timer);
ad->update_timer = NULL;
} else {
icon_ly = elm_icon_add(obj);
- elm_icon_file_set(icon_ly, buf, NULL);
+ elm_image_file_set(icon_ly, buf, NULL);
}
icon = _add_layout(obj, EDJ_NAME, "icon");
{
struct _task_info *info = (struct _task_info *)data;
char buf[_BUF_MAX] = { 0, };
- Evas_Object *eo;
retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
retvm_if(part == NULL, NULL, "Invalid argument: part is NULL\n");
- if (!strcmp(part, "elm.text.1")) {
+ if (!strcmp(part, "elm.text")) {
snprintf(buf, _BUF_MAX, "%s", info->app_name);
return strdup(buf);
- } else if (!strcmp(part, "elm.text.2")) {
- if (info->category == TS_INUSE) {
- snprintf(buf, _BUF_MAX, "CPU: %.1f%%", info->cpu);
- return strdup(buf);
-
- } else {
- if (info->it) {
- elm_object_signal_emit(info->it, "prog.hide.mem","taskmanager");
- }
- return NULL;
- }
}
return NULL;
}
static void _bl_sel(void *data, Evas_Object *obj, void *event_info)
{
_D("func\n");
- int mode = (int)data;
- struct appdata *ad;
Elm_Object_Item *item = (Elm_Object_Item *) event_info;
-
elm_genlist_item_selected_set(item, EINA_FALSE);
}
-static char *_bl_text_get(void *data, Evas_Object *obj, const char *part)
-{
- if (!strcmp(part, "elm.text")) {
- return strdup(T_(button_text[(int)data]));
-
- }
- return NULL;
-}
-
static Evas_Object *_bl_content_get(void *data, Evas_Object *obj,
const char *part)
{
{
struct _task_info *info = (struct _task_info *)data;
char buf[_BUF_MAX] = { 0, };
- Evas_Object *eo;
if (!strcmp(part, "elm.text")) {
snprintf(buf, _BUF_MAX, "%s", info->app_name);
Evas_Object *icon = NULL;
Evas_Object *btn = NULL;
- Evas_Object *rt, *icon_ly = NULL;
retvm_if(data == NULL, NULL, "Invalid argument: task info is NULL\n");
if (!strcmp(part, "elm.icon.1")) {
snprintf((char *)buf, (size_t) sizeof(buf),
(const char *)IMAGEDIR "/icon_taskmgr.png");
- if (!strncmp(&buf[strlen(buf) - 3], "edj", 3)) {
- icon_ly = _add_layout(obj, buf, "icon");
-
- } else {
- icon_ly = elm_icon_add(obj);
- elm_icon_file_set(icon_ly, buf, NULL);
- }
+ icon = elm_icon_add(obj);
+ elm_image_file_set(icon, buf, NULL);
+ elm_image_preload_disabled_set(icon, EINA_TRUE);
- icon = _add_layout(obj, EDJ_NAME, "icon");
- retvm_if (icon == NULL, NULL, "Cannot add layout: icon\n");
-
- rt = evas_object_rectangle_add(evas_object_evas_get(obj));
- retvm_if (rt == NULL, NULL, "Failed to add rectangle\n");
-
- evas_object_color_set(rt, 0, 0, 0, 0);
- evas_object_size_hint_min_set(rt,
+ evas_object_size_hint_min_set(icon,
(int)72 * elm_config_scale_get(),
(int)72 * elm_config_scale_get());
- elm_object_part_content_set(icon, "icon_ly", rt);
-
- elm_object_part_content_set(icon, "icon", icon_ly);
return icon;
itc_gl.item_style = "grouptitle";
itc_gl.func.text_get = _gl_text_get_title;
- itc_dl.item_style = "2text.2icon.7";
+ //itc_dl.item_style = "2text.2icon.7";
+ itc_dl.item_style = "1text.2icon.4";
itc_dl.func.text_get = _gl_text_get_app;
itc_dl.func.content_get = _gl_content_get_app;
{
Elm_Object_Item *egi;
struct _task_info *info;
- int i = 1;
egi = elm_genlist_first_item_get(ad->gl);
while(egi) {
return 0;
}
-Eina_Bool _update_list(void *data)
-{
-_D("func\n");
- struct appdata *ad = data;
- Eina_List *l, *l_next;
- struct _task_info *info;
-
- pthread_mutex_lock(&mutex_for_graph_update);
-
- if(ad->applist[TS_INUSE] == NULL) {
- _D("inuse is NULL\n");
- pthread_mutex_unlock(&mutex_for_graph_update);
- ad->update_timer = NULL;
- return ECORE_CALLBACK_CANCEL;
- }
- ad->applist[TS_INUSE] = eina_list_nth_list(ad->applist[TS_INUSE], 0);
- _D("%d\n", eina_list_count(ad->applist[TS_INUSE]));
-
- EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
- elm_genlist_item_fields_update(info->it, "elm.text*", ELM_GENLIST_ITEM_FIELD_TEXT);
- }
- pthread_mutex_unlock(&mutex_for_graph_update);
- return ECORE_CALLBACK_RENEW;
-}
-
-void *_update_pthread_cb(void *data)
-{
-_D("func\n");
- struct appdata *ad = data;
- long tick;
- int ncpu;
- Eina_List *l, *l_next;
- struct _task_info *info;
- int old_cancel_state;
-
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancel_state);
-
- while(1) {
-
- if (ad->ending == EINA_FALSE) {
- if(ad->applist[TS_INUSE] == NULL) {
- _D("in use list is NULL\n");
- return ECORE_CALLBACK_CANCEL;
- }
-
- _get_sysconf(&ncpu, &tick);
-
- ad->applist[TS_INUSE] = eina_list_nth_list(ad->applist[TS_INUSE], 0);
- if (eina_list_count(ad->applist[TS_INUSE]) < 1) {
- _D("list count is 0\n");
- return NULL;
- }
-
- EINA_LIST_FOREACH_SAFE(ad->applist[TS_INUSE], l, l_next, info) {
- if (info) {
- info->cpu = _get_cpu_ratio(info, ncpu, tick);
- _D("%d / %lf\n", info->pid, info->cpu);
- }
-
- }
- sleep(2);
- }
- }
-
- return NULL;
-
-}
-
void _set_genlist(struct appdata *ad)
{
_D("func\n");
}
-void _init_pthread(void)
-{
- pthread_mutex_init(&pm, NULL);
- pthread_cond_init(&pc, NULL);
-}
-
-void _fini_pthread(void)
-{
-_D("func\n");
- if (pt) {
- pthread_cancel(pt);
- }
-}
-
void refresh_app_info(struct appdata *ad)
{
_D("func\n");
}
}
-void _restart_pthread(struct appdata *ad)
-{
-_D("func\n");
- pthread_cancel(pt);
- if (eina_list_count(ad->applist[TS_INUSE]) > 0) {
-
- pthread_create(&pt, NULL, _update_pthread_cb, ad);
- pthread_detach(pt);
- if (ad->update_timer) {
- ecore_timer_del(ad->update_timer);
- ad->update_timer = NULL;
- }
- ad->update_timer = ecore_timer_add(2.0, _update_list, ad);
- }
-}
int response_end_inuse(struct appdata *ad)
{
_D("func\n");
Eina_List *l, *l_next;
struct _task_info *info;
- Elm_Object_Item *egi;
Eina_Bool dead = EINA_FALSE;
retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
{
Eina_List *l, *l_next;
struct _task_info *info;
- Elm_Object_Item *egi;
retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
{
Eina_List *l, *l_next;
struct _task_info *info;
- Elm_Object_Item *egi;
retvm_if(ad == NULL, -1, "Invalid argument: appdata is NULL\n");
#include <appcore-common.h>
+#include <ail.h>
#include <aul.h>
#include <Ecore_X.h>
#include <vconf.h>
int ret = -1;
- _fini_pthread();
if (ad->update_timer) {
ecore_timer_del(ad->update_timer);
ad->update_timer = NULL;
_del_popup_timer(ad);
_del_progressbar(ad);
refresh_app_info(ad);
- _restart_pthread(ad);
+ //_restart_pthread(ad);
break;
case MODE_END_ALL_INUSE:
_D("bb\n");
if (ad->endcnt <= 1) {
_D("count set 0\n");
+
+ if(ad->killall_timer)
+ {
+ ecore_timer_del(ad->killall_timer);
+ ad->killall_timer = NULL;
+ }
+
_del_popup_timer(ad);
_del_progressbar(ad);
refresh_app_info(ad);
- _restart_pthread(ad);
} else {
ad->endcnt--;
static void _back_cb(void *data, Evas_Object *obj, void *event_info)
{
- struct appdata *ad = (struct appdata *)data;
- /*
- _unset_notification_level(ad->win);
- */
elm_exit();
-
-}
-
-static void _drag_start_cb(void *data, Evas_Object *obj, void *event_info)
-{
- _D("func\n");
- struct appdata *ad = (struct appdata *)data;
- if (ad->update_timer) {
- ecore_timer_del(ad->update_timer);
- ad->update_timer = NULL;
- }
-}
-
-static void _drag_stop_cb(void *data, Evas_Object *obj, void *event_info)
-{
- _D("func\n");
- struct appdata *ad = (struct appdata *)data;
- if (ad->update_timer) {
- ecore_timer_del(ad->update_timer);
- ad->update_timer = NULL;
- }
- ad->update_timer = ecore_timer_add(2.0, _update_list, ad);
-}
-
-
-static void _anim_start_cb(void *data, Evas_Object *obj, void *event_info)
-{
- _D("func\n");
- struct appdata *ad = (struct appdata *)data;
- if (ad->update_timer) {
- ecore_timer_del(ad->update_timer);
- ad->update_timer = NULL;
- }
-}
-
-static void _anim_stop_cb(void *data, Evas_Object *obj, void *event_info)
-{
- _D("func\n");
- struct appdata *ad = (struct appdata *)data;
- if (ad->update_timer) {
- ecore_timer_del(ad->update_timer);
- ad->update_timer = NULL;
- }
- ad->update_timer = ecore_timer_add(2.0, _update_list, ad);
-}
-
-static void _moved_cb(void *data, Evas_Object *obj, void *event_info)
-{
- _D("func\n");
}
int _app_create(struct appdata *ad)
elm_genlist_block_count_set(gl, 20);
evas_object_data_set(gl, "appdata", ad);
elm_object_part_content_set(ly, "list", gl);
- evas_object_smart_callback_add(gl, "scroll,drag,start", _drag_start_cb, ad);
- evas_object_smart_callback_add(gl, "scroll,drag,stop", _drag_stop_cb, ad);
- evas_object_smart_callback_add(gl, "scroll,anim,start", _anim_start_cb, ad);
- evas_object_smart_callback_add(gl, "scroll,anim,stop", _anim_stop_cb, ad);
ad->gl = gl;
bt = elm_button_add(nv);
/* this func is to exit taskmanager after launching application */
static Eina_Bool __climsg_cb(void *data, int type, void *event)
{
+_D("%s\n", __func__);
static Atom a_deact;
pid_t pid_a, pid_d;
return ECORE_CALLBACK_CANCEL;
}
+static int runapp_count = 0;
+
+int _runapp_info_get_count(const aul_app_info *ainfo, void *data)
+{
+ ail_appinfo_h handle;
+ ail_error_e ret;
+ bool is_taskmanage;
+
+ retvm_if(ainfo == NULL, -1, "Invalid argument: ainfo is NULL\n");
+
+ retvm_if(ainfo->pid <= 0, -1, "Invalid pid(%u)\n", ainfo->pid);
+
+ /* filtering */
+ if (ainfo->pid == getpid())
+ {
+ return 0;
+ }
+
+ retvm_if(ainfo->pkg_name == NULL, 0, "Invalid pkg_name(%s)\n", ainfo->pkg_name);
+
+ ret = ail_package_get_appinfo(ainfo->pkg_name, &handle);
+ retvm_if(ret != AIL_ERROR_OK, -1,
+ "Failed to get appinfo, pkg_name:%s\n", ainfo->pkg_name);
+
+ ret = ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_TASKMANAGE_BOOL, &is_taskmanage);
+ if (is_taskmanage == 0) {
+ ret = ail_package_destroy_appinfo(handle);
+ retvm_if(ret != AIL_ERROR_OK, -1, "Failed to destroy appinfo\n");
+ return 0;
+ }
+
+ ++runapp_count;
+ _D("running(%s)\n", ainfo->pkg_name);
+ _D("runapp count : %d\n", runapp_count);
+
+ ret = ail_package_destroy_appinfo(handle);
+ retvm_if(ret != AIL_ERROR_OK, -1, "Failed to destroy appinfo\n");
+ return 0;
+}
+
+Eina_Bool _kill_all_timer_cb(void *data)
+{
+ _D("func\n");
+
+ struct appdata *ad = data;
+
+ int ret = AUL_R_ERROR;
+ int retry_cnt = 0;
+ int sleep_value = 500;
+
+ runapp_count = 0;
+
+ while(ret != AUL_R_OK && retry_cnt < 5)
+ {
+ usleep(sleep_value);
+ ret = aul_app_get_running_app_info(_runapp_info_get_count, ad);
+
+ if(ret != AUL_R_OK)
+ {
+ _D("Fail to get running app information\n");
+ }
+
+ retry_cnt++;
+ sleep_value *= 2;
+ }
+ _D("runapp count : %d\n", runapp_count);
+
+ /* count inuse app number */
+ /** if(count == 0) dead_cb */
+ if(runapp_count == 0)
+ {
+ _D("runapp_count == 0\n");
+ _del_popup_timer(ad);
+ _del_progressbar(ad);
+ refresh_app_info(ad);
+ //_restart_pthread(ad);
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ return ECORE_CALLBACK_RENEW;
+}
+
void _ok_response_cb(void *data, Evas_Object *obj, void *event_info)
{
struct appdata *ad = (struct appdata *)data;
_del_popup_timer(ad);
_show_progressbar(ad);
response_end_inuse(ad);
- _restart_pthread(ad);
+ //_restart_pthread(ad);
break;
case MODE_END_ALL_INUSE:
_del_popup_timer(ad);
_show_progressbar(ad);
response_end_all_inuse(ad);
+ ad->killall_timer = ecore_timer_add(2.0, _kill_all_timer_cb, ad);
break;
case MODE_DEL_HISTORY:
Eina_Bool _create_idler_cb(void *data)
{
- Evas_Object *pu, *bt1, *bt2;
struct appdata *ad = (struct appdata *)data;
retvm_if(ad == NULL, ECORE_CALLBACK_CANCEL, "Invalid argument\n");
_key_grab(ad);
- _init_pthread();
_get_win_geometry(ad);
ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, __climsg_cb, ad);
}
snprintf(buf, sizeof(buf), "%s/%s", IMAGEDIR, png);
- elm_icon_file_set(eo, buf, NULL);
- elm_icon_resizable_set(eo, 1, 1);
+ elm_image_file_set(eo, buf, NULL);
+ elm_image_resizable_set(eo, 1, 1);
evas_object_size_hint_aspect_set(eo, EVAS_ASPECT_CONTROL_VERTICAL, 1,
1);
return 0;
}
-static int rotate(enum appcore_rm m, void *data)
-{
- struct appdata *ad = data;
- int r;
-
- if (ad == NULL || ad->win == NULL)
- return 0;
-
- switch (m) {
- case APPCORE_RM_PORTRAIT_NORMAL:
- r = 0;
- break;
- case APPCORE_RM_PORTRAIT_REVERSE:
- r = 180;
- break;
- case APPCORE_RM_LANDSCAPE_NORMAL:
- r = 270;
- break;
- case APPCORE_RM_LANDSCAPE_REVERSE:
- r = 90;
- break;
- default:
- r = -1;
- break;
- }
-
- if (r >= 0)
- elm_win_rotation_with_resize_set(ad->win, r);
-
- return 0;
-}
-
int _get_vconf_idlelock(void)
{
int ret = -1;
void _exit_cb(void *data)
{
- struct appdata *ad = (struct appdata *)data;
int lock = IDLELOCK_ON;
lock = _get_vconf_idlelock();
appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE,
_lang_changed, ad);
- _restart_pthread(ad);
ecore_idler_add(_create_idler_cb, ad);
return 0;
static int app_terminate(void *data)
{
-_D("func\n");
- struct appdata *ad = data;
-// sleep(1);
-// ecore_timer_add(0.2, _exit_cb, NULL);
-
return 0;
}
static int app_pause(void *data)
{
-_D("func\n");
- _fini_pthread();
return 0;
}
struct appdata *ad = data;
refresh_app_info(ad);
+ if (ad->killall_timer) {
+ ecore_timer_del(ad->killall_timer);
+ ad->killall_timer = NULL;
+ }
if (ad->exit_timer) {
ecore_timer_del(ad->exit_timer);
ad->exit_timer = NULL;
Ecore_Timer *update_timer;
Ecore_Timer *exit_timer;
+ Ecore_Timer *killall_timer;
+
double mem_total;
int mode;
Evas_Object *load_edj(Evas_Object *parent, const char *file, const char *group);
int _unset_notification_level(Evas_Object *win);
int _set_notification_level(Evas_Object *win, Utilx_Notification_Level level);
+void _key_grab(struct appdata *ad);
void _exit_cb(void *data);
#endif