Return record not found for AppId 32/230932/1 accepted/tizen/unified/20200417.152740 submit/tizen/20200416.055809
authorDewal Agarwal <d1.agarwal@samsung.com>
Tue, 31 Mar 2020 08:03:59 +0000 (13:33 +0530)
committerDewal Agarwal <d1.agarwal@samsung.com>
Thu, 16 Apr 2020 05:45:48 +0000 (05:45 +0000)
Change-Id: Iad43957b538efa33ab434578eacb6e550e0b8700
Signed-off-by: Dewal Agarwal <d1.agarwal@samsung.com>
src/bm_power_engine.c

index f9bdd67..5613a33 100644 (file)
@@ -111,6 +111,11 @@ int bm_engine_get_mah_usage_by_app_id_for_resource_id_ci(const gchar* app_id, gi
                _ERR("error reported, error = %d", error);
                return BATTERY_MONITOR_ERROR_INTERNAL;
        }
+       if (app_usage->AppId == NULL) {
+               _ERR("Battery Usage for AppId not found");
+               bm_appid_usage_free(app_usage);
+               return BATTERY_MONITOR_ERROR_RECORD_NOT_FOUND;
+       }
 
        if (resource_id == BM_PLUGIN_ID_BLE)
                *battery_usage = bm_calc_individual_mah_consumption(app_usage->rId_ble, cmah);
@@ -196,6 +201,11 @@ int bm_engine_get_total_mah_usage_by_app_id_ci(const gchar* app_id, gint64 start
                _ERR("error reported, error = %d", error);
                return BATTERY_MONITOR_ERROR_INTERNAL;
        }
+       if (app_usage->AppId == NULL) {
+               _ERR("Battery Usage for AppId not found");
+               bm_appid_usage_free(app_usage);
+               return BATTERY_MONITOR_ERROR_RECORD_NOT_FOUND;
+       }
        int total_consumption = (app_usage->rId_ble + app_usage->rId_wifi + app_usage->rId_cpu + \
                        app_usage->rId_display + app_usage->rId_device_network);
 #ifdef DISABLE_FEATURE_DATA_FROM_GPS_HRM_PLUGIN
@@ -344,6 +354,11 @@ int bm_engine_get_all_resource_usage_handle_ci(const gchar* app_id, gint64 start
                _ERR("error reported, error = %d", error);
                return BATTERY_MONITOR_ERROR_INTERNAL;
        }
+       if (app_usage->AppId == NULL) {
+               _ERR("Battery Usage for AppId not found");
+               bm_appid_usage_free(app_usage);
+               return BATTERY_MONITOR_ERROR_RECORD_NOT_FOUND;
+       }
        battery_data->ble_val = app_usage->rId_ble; battery_data->wifi_val = app_usage->rId_wifi;
        battery_data->cpu_val = app_usage->rId_cpu; battery_data->dp_val = app_usage->rId_display;
        battery_data->dn_val = app_usage->rId_device_network;