struct app_counter_s {
char *app_type;
int number[AT_WATCH_APP + 1];
+ int total;
};
static guint sid;
{
struct app_counter_s *ac = (struct app_counter_s *)data;
struct user_s *user = (struct user_s *)user_data;
- int total;
+ int previous_total = ac->total;
int r;
- total = ac->number[AT_UI_APP] + ac->number[AT_WIDGET_APP] +
+ ac->total = ac->number[AT_UI_APP] + ac->number[AT_WIDGET_APP] +
ac->number[AT_WATCH_APP];
- r = __update_app_type_info(ac->app_type, total, user->uid);
- if (r < 0)
- _W("Failed to update app type info");
+ if ((previous_total == 0 && ac->total > 0) ||
+ (previous_total > 0 && ac->total == 0)) {
+ r = __update_app_type_info(ac->app_type, ac->total, user->uid);
+ if (r < 0)
+ _W("Failed to update app type info");
+ }
- _D("app type(%s), total(%d)", ac->app_type, total);
+ _D("app type(%s), total(%d)", ac->app_type, ac->total);
}
static struct app_counter_s *__find_app_counter(GList *list,