[Non-Acr] AppId updated for the foreground applications in dumpsys output 18/237418/2 accepted/tizen/unified/20200707.141020 submit/tizen/20200703.060319
authorkamaljeet chauhan <kamal.jc@samsung.com>
Tue, 30 Jun 2020 08:34:48 +0000 (14:04 +0530)
committerkamaljeet chauhan <kamal.jc@samsung.com>
Tue, 30 Jun 2020 11:27:11 +0000 (16:57 +0530)
Change-Id: I73c1e897dc54fb2d2ba584465f1499ff68c4c9e6
Signed-off-by: kamaljeet chauhan <kamal.jc@samsung.com>
src/battery_dump/bm_listeners.c

index 8175156..2f246ba 100644 (file)
@@ -118,6 +118,22 @@ int bm_listener_dbus_deinit()
        return BATTERY_MONITOR_ERROR_NONE;
 }
 
+static int fill_AppId_info(char *app_id)
+{
+       ENTER;
+       int ret = 0;
+       data_obj->event_tag->uid = 1000;
+       data_obj->event_tag->string_info = g_string_sized_new(7);
+       if (!data_obj->event_tag->string_info) {
+               _ERR("memory allocation  failed ");
+               ret = 1;
+               return ret;
+       }
+       g_string_append_printf(data_obj->event_tag->string_info, "%s", app_id);
+       EXIT;
+       return ret;
+}
+
 static int fill_battery_info()
 {
        ENTER;
@@ -767,6 +783,10 @@ static int fill_app_status_change(int val, char *app_id)
                                        int *temp = (int *)prv_data;
                                        *temp = app_hsp;
                                        _INFO(" sp index for this app id is = %d and apphsp= %d", *temp, app_hsp);
+                                       if (fill_AppId_info(app_id)) {
+                                               error_code = 1;
+                                               goto out;
+                                       }
                                        error_code = 0;
                                        goto out;
                                } else {
@@ -780,11 +800,16 @@ static int fill_app_status_change(int val, char *app_id)
                                        *temp = app_hsp;
                                        _INFO("This App is not present in the list, inserting it");
                                        g_hash_table_insert(app_list, app_id, temp);
+                                       if (fill_AppId_info(app_id)) {
+                                               error_code = 1;
+                                               goto out;
+                                       }
                                        error_code = 0;
                                        return error_code;
                                }
                        } else {
                                _ERR(" data_obj->event_tag object creation fails ");
+                               error_code = 1;
                                goto out;
                        }
                } else {
@@ -800,6 +825,8 @@ static int fill_app_status_change(int val, char *app_id)
                                        app_hsp = *tmp;
                                        error_code = 0;
                                        data_obj->event_tag->sp_idx = app_hsp;
+                                       if (fill_AppId_info(app_id))
+                                               error_code = 1;
                                        goto out;
                                } else {
                                        _INFO(" This App is not present in the list and in background");
@@ -963,17 +990,20 @@ static void bm_create_event_data(int type, int val, char *app)
        else
                prev_battery_level = data_obj->battery_level;
 
-       if (data_obj->event_tag) {
+       if (data_obj->event_tag && type != LISTEN_APP_STATUS) {
                data_obj->event_tag->uid = 1000;
                data_obj->event_tag->string_info = g_string_sized_new(7);
                if (!data_obj->event_tag->string_info) {
                        _ERR("memory allocation  failed ");
                        return;
                }
+
                g_string_append_printf(data_obj->event_tag->string_info, "%s", "Tizen");
+       }
+       if (data_obj->event_tag) {
                _DBG("Data Value of listener event uid : %d ", data_obj->event_tag->uid);
-               _DBG("Data Value of listener event string : %s  sp index = `%d",
-                               data_obj->event_tag->string_info->str, data_obj->event_tag->sp_idx);
+               _DBG("Data Value of listener event string : %s  sp index = %d",
+                       data_obj->event_tag->string_info->str, data_obj->event_tag->sp_idx);
        }
 
        if (type == LISTEN_POWERLOCKUNLOCK_STATE)