From 6fef89baf6479c7d441fb267156f7456ed88922f Mon Sep 17 00:00:00 2001 From: kamaljeet chauhan Date: Tue, 30 Jun 2020 14:04:48 +0530 Subject: [PATCH] [Non-Acr] AppId updated for the foreground applications in dumpsys output Change-Id: I73c1e897dc54fb2d2ba584465f1499ff68c4c9e6 Signed-off-by: kamaljeet chauhan (cherry picked from commit 0c06ba93607ab80cfff3165e33d4a2c836342d79) --- src/battery_dump/bm_listeners.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/battery_dump/bm_listeners.c b/src/battery_dump/bm_listeners.c index b52115b..2eb9458 100644 --- a/src/battery_dump/bm_listeners.c +++ b/src/battery_dump/bm_listeners.c @@ -121,6 +121,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; @@ -772,6 +788,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 { @@ -785,11 +805,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 { @@ -805,6 +830,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"); @@ -968,17 +995,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) -- 2.7.4