connection/connection: BT tethering icon fix. 69/98769/3
authorRadoslaw Czerski <r.czerski@samsung.com>
Fri, 25 Nov 2016 14:02:28 +0000 (15:02 +0100)
committerRadoslaw Czerski <r.czerski@samsung.com>
Fri, 25 Nov 2016 14:17:34 +0000 (06:17 -0800)
Previously BT tethering icon have been shown when
tethering was switched on in device.
Now the icon is shown when device is connected to another device
sharing internet access via BT.

Change-Id: I2c401479c67df47eee92dfffb6d939be452487b5
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
src/modules/connection/connection.c

index 325e903..a8623e8 100644 (file)
@@ -253,6 +253,7 @@ static void on_noti(telephony_h handle, void *user_data)
        wifi_connection_state_e state;
 
        int ret = 0;
+       int network = 0;
        bool val;
        retm_if(user_data == NULL, "invalid parameter!!");
 
@@ -277,11 +278,11 @@ static void on_noti(telephony_h handle, void *user_data)
                return;
        }
 
-       ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_BLUETOOTH_TETHERING_ENABLED, &val);
+       ret = vconf_get_int(VCONFKEY_NETWORK_STATUS, &network);
        retm_if(ret != RUNTIME_INFO_ERROR_NONE, "runtime_info_get_value_bool failed: %s",
                        get_error_message(ret));
 
-       if (val) {
+       if (network == VCONFKEY_NETWORK_BLUETOOTH) {
                _D("bluetooth tethering on");
                isBTIconShowing = 1;
                show_image_icon(LEVEL_BT_TETHERING);
@@ -463,6 +464,11 @@ static void data_event_cb(const char *event_name, bundle *event_data, void *user
                on_noti(tel_list.handle[0], user_data);
 }
 
+static void network_status_cb(keynode_t *node, void *data)
+{
+       on_noti(tel_list.handle[0], data);
+}
+
 static int register_conn_module(void *data)
 {
        int ret;
@@ -501,11 +507,18 @@ static int register_conn_module(void *data)
                return FAIL;
        }
 
+       ret = vconf_notify_key_changed(VCONFKEY_NETWORK_STATUS, network_status_cb, data);
+       if (ret != OK) {
+               _E("vconf_notify_kay_change failed: %s", get_error_message(ret));
+               __deinit_tel();
+               return FAIL;
+       }
        return OK;
 }
 
 static int unregister_conn_module(void)
 {
+       vconf_ignore_key_changed(VCONFKEY_NETWORK_STATUS, network_status_cb);
        telephony_unset_state_changed_cb(tel_ready_cb);
        __deinit_tel();
        event_remove_event_handler(event);