Modification in Listeners initialization 19/233619/1 accepted/tizen/5.5/unified/20200518.160950 submit/tizen_5.5/20200517.160518
authorkamaljeet chauhan <kamal.jc@samsung.com>
Sun, 17 May 2020 12:51:19 +0000 (18:21 +0530)
committerkamaljeet chauhan <kamal.jc@samsung.com>
Sun, 17 May 2020 12:51:19 +0000 (18:21 +0530)
Change-Id: I2be142cfc3945456b2fd1269f14ab7e953cae2d1
Signed-off-by: kamaljeet chauhan <kamal.jc@samsung.com>
src/battery_dump/bm_listeners.c

index d55b5af..0feddef 100644 (file)
@@ -34,7 +34,10 @@ static int ss_val = 0;
 static int ss_flag = 0;
 static history_item_s *data_obj = NULL;
 
-static int listener_hsp = 0;
+display_state_e display_flag = DISPLAY_STATE_SCREEN_OFF;
+static int listener_hsp = -1;
+static int bt_adaptor = 0;
+static int location_flag = 0;
 static int bt_hsp = 0;
 static int bt_connected_hsp = 0;
 static int bt_scan_hsp = 0;
@@ -1098,6 +1101,10 @@ void __bm_bt_adapter_state_changed_cb(int result, bt_adapter_state_e adapter_sta
        else
                bt_state = 0;
 
+       if(bt_adaptor == bt_state)
+               return;
+       else
+               bt_adaptor = bt_state;
        _INFO("__bm_bt_adapter_state_changed_cb  bt_state = %d ", bt_state);
        _INFO("buff_count: %d and fill_ptr = %d", buff_count , fill_ptr);
 
@@ -1279,6 +1286,11 @@ static void __bm_device_display_change(device_callback_e type, void *value, void
 
        display_state_e state = (display_state_e)value;
 
+       if(state == display_flag)
+               return;
+       else
+               display_flag = state;
+
        event_pool *device_event = (event_pool *)calloc(1, sizeof(event_pool));
        if (!device_event) {
                _ERR("Failed to allocated memory ");
@@ -1419,10 +1431,15 @@ static void __bm_location_change(keynode_t *key, void* data)
 {
        ENTER;
        _INFO("device location changed succeeded\n");
-       int charging = 0;
-       vconf_get_int(VCONFKEY_LOCATION_ENABLED, &charging);
+       int location = 0;
+       vconf_get_int(VCONFKEY_LOCATION_ENABLED, &location);
+
+       _INFO(" device location changed = %d ", location);
 
-       _INFO(" device location changed = %d ", charging);
+       if(location == location_flag)
+               return;
+       else
+               location_flag = location;
 
        event_pool *location_event = (event_pool *)calloc(1, sizeof(event_pool));
        if (!location_event) {
@@ -1430,7 +1447,7 @@ static void __bm_location_change(keynode_t *key, void* data)
                return;
        }
        location_event->type = LISTEN_LOCATION_CHANGE;
-       location_event->val = charging;
+       location_event->val = location;
        location_event->app = NULL;
 
        pthread_t producer;
@@ -2053,7 +2070,7 @@ int bd_initialize_listeners(void)
 {
        ENTER;
 
-       listener_hsp = 0;
+       listener_hsp = -1;
 
        /* Initialize Hash Table */
        if (!bm_initialize_history_data_obj())