Fix bug with constantly appearing earphone icon 06/222206/2
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 10 Jan 2020 09:39:42 +0000 (10:39 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Fri, 10 Jan 2020 11:41:44 +0000 (12:41 +0100)
Do not assume that earphone icon should be displayed when tv out
is available.

Change-Id: Ie470c777b1dd6d0722f7164a8302d1074d75c614

src/modules/information/earphone.c

index 3ffc788..37e7d53 100644 (file)
@@ -79,7 +79,6 @@ static void hide_image_icon(void)
 void check_jack_port(void *data)
 {
        bool is_jack_connected;
-       bool is_tv_out_connected;
        int ret;
 
        retm_if(data == NULL, "Invalid parameter!");
@@ -93,14 +92,13 @@ void check_jack_port(void *data)
        ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_AUDIO_JACK_CONNECTED, &is_jack_connected);
        retm_if(ret != RUNTIME_INFO_ERROR_NONE, "runtime_info_get_value_bool failed[%s]", get_error_message(ret));
 
-       ret = runtime_info_get_value_bool(RUNTIME_INFO_KEY_TV_OUT_CONNECTED, &is_tv_out_connected);
-       retm_if(ret != RUNTIME_INFO_ERROR_NONE, "runtime_info_get_value_bool failed[%s]", get_error_message(ret));
-
-       if (is_jack_connected || is_tv_out_connected) {
+       if (is_jack_connected) {
                _D("Earphone connected");
                show_image_icon();
-       } else
+       } else {
+               _D("Earphone disonnected");
                hide_image_icon();
+       }
 }
 
 void indicator_earphone_change_cb(runtime_info_key_e key, void *data)
@@ -128,9 +126,6 @@ static int register_earphone_module(void *data)
        ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_AUDIO_JACK_CONNECTED, indicator_earphone_change_cb, data);
        retvm_if(ret != RUNTIME_INFO_ERROR_NONE, FAIL, "runtime_info_set_changed_cb failed[%s]", get_error_message(ret));
 
-       ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_TV_OUT_CONNECTED, indicator_earphone_change_cb, data);
-       retvm_if(ret != RUNTIME_INFO_ERROR_NONE, FAIL, "runtime_info_set_changed_cb failed[%s]", get_error_message(ret));
-
        check_jack_port(data);
 
        return ret;
@@ -143,8 +138,5 @@ static int unregister_earphone_module(void)
        ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_AUDIO_JACK_CONNECTED);
        retvm_if(ret != RUNTIME_INFO_ERROR_NONE, FAIL, "runtime_info_unset_changed_cb failed[%s]", get_error_message(ret));
 
-       ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_TV_OUT_CONNECTED);
-       retvm_if(ret != RUNTIME_INFO_ERROR_NONE, FAIL, "runtime_info_unset_changed_cb failed[%s]", get_error_message(ret));
-
        return ret;
 }