From ed6f353234101c01f7ce9be1636e21482c728f7b Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 14 Dec 2012 19:24:03 +0900 Subject: [PATCH] Revise the code for send the livebox system event. PAUSED/RESUMED system event handling codes are updated Change-Id: Ib3b70c21515758460f1065e379bc9b912a31d799 --- packaging/com.samsung.data-provider-slave.spec | 2 +- src/lb.c | 43 ++++++++++++++++++-------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/packaging/com.samsung.data-provider-slave.spec b/packaging/com.samsung.data-provider-slave.spec index 5eff321..eb11c55 100644 --- a/packaging/com.samsung.data-provider-slave.spec +++ b/packaging/com.samsung.data-provider-slave.spec @@ -1,6 +1,6 @@ Name: com.samsung.data-provider-slave Summary: Slave data provider -Version: 0.8.9 +Version: 0.8.10 Release: 1 Group: main/app License: Samsung Proprietary License diff --git a/src/lb.c b/src/lb.c index bb4a585..6911642 100644 --- a/src/lb.c +++ b/src/lb.c @@ -1259,13 +1259,19 @@ HAPI void lb_pause_all(void) continue; } + if (item->is_paused) { + DbgPrint("Instance %s is already paused\n", item->inst->id); + continue; + } + if (item->timer) { DbgPrint("Instance %s freeze timer\n", item->inst->item->pkgname); timer_freeze(item); - lb_sys_event(item->inst, item, LB_SYS_EVENT_PAUSED); } else { DbgPrint("Instance %s has no timer\n", item->inst->item->pkgname); } + + lb_sys_event(item->inst, item, LB_SYS_EVENT_PAUSED); } } @@ -1284,15 +1290,17 @@ HAPI void lb_resume_all(void) continue; } + if (item->is_paused) { + DbgPrint("Instance %s is still paused\n", item->inst->id); + continue; + } + if (item->timer) { DbgPrint("Instance %s resume timer\n", item->inst->item->pkgname); - if (!item->is_paused) { - timer_thaw(item); - lb_sys_event(item->inst, item, LB_SYS_EVENT_RESUMED); - } - } else { - DbgPrint("Instance %s has no timer\n", item->inst->item->pkgname); + timer_thaw(item); } + + lb_sys_event(item->inst, item, LB_SYS_EVENT_RESUMED); } } @@ -1323,11 +1331,16 @@ HAPI int lb_pause(const char *pkgname, const char *id) item->is_paused = 1; - if (item->timer) { - timer_freeze(item); - lb_sys_event(inst, item, LB_SYS_EVENT_PAUSED); + if (s_info.paused) { + DbgPrint("Already paused: %s\n", item->inst->id); + return 0; } + if (item->timer) + timer_freeze(item); + + lb_sys_event(inst, item, LB_SYS_EVENT_PAUSED); + return 0; } @@ -1358,11 +1371,15 @@ HAPI int lb_resume(const char *pkgname, const char *id) item->is_paused = 0; - if (!s_info.paused && item->timer) { - timer_thaw(item); - lb_sys_event(inst, item, LB_SYS_EVENT_RESUMED); + if (s_info.paused) { + DbgPrint("Instance %s is still paused\n", item->inst->id); + return 0; } + if (item->timer) + timer_thaw(item); + + lb_sys_event(inst, item, LB_SYS_EVENT_RESUMED); return 0; } -- 2.7.4