From 47b388c18ada3a643d253a62edfc310af71c3c40 Mon Sep 17 00:00:00 2001 From: "bhutani.92" Date: Fri, 25 Nov 2016 14:38:36 +0530 Subject: [PATCH] Fixed TSAM-9053 Cannot resume music player on incoming calls Change-Id: I12c87a7ae02bfca17219831791a20aed76c94451 Signed-off-by: bhutani.92 --- src/common/mp-app.c | 9 +++++++++ src/view/mp-player-view.c | 9 +++++++++ src/widget/mp-album-detail-list.c | 17 +++++++++++++++++ src/widget/mp-artist-detail-list.c | 17 +++++++++++++++++ src/widget/mp-minicontroller.c | 18 +++++++++--------- src/widget/mp-now-playing.c | 9 +++++++++ src/widget/mp-track-list.c | 17 +++++++++++++++++ 7 files changed, 87 insertions(+), 9 deletions(-) diff --git a/src/common/mp-app.c b/src/common/mp-app.c index f81faa3..3c500f6 100755 --- a/src/common/mp-app.c +++ b/src/common/mp-app.c @@ -644,6 +644,15 @@ _mp_app_media_key_event_cb(media_key_e key, media_key_event_e event, void *user_ if (_mp_is_current_focus_available(ad) != 0) { if (key == MEDIA_KEY_PLAY) { ERROR_TRACE("Some other application has the focus currently... Returning..."); + char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; + if (message) { + int ret = notification_status_message_post(dgettext("music-player", message)); + if (ret != 0) { + ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + } else { + DEBUG_TRACE("message: [%s]", message); + } + } return; } else { ERROR_TRACE("Some other application has the focus currently... Changing state in paused state..."); diff --git a/src/view/mp-player-view.c b/src/view/mp-player-view.c index 10a8cbf..b880493 100755 --- a/src/view/mp-player-view.c +++ b/src/view/mp-player-view.c @@ -2212,6 +2212,15 @@ static void _mp_player_view_play_pause_btn_clicked_cb(void *data, Evas_Object *o if (_mp_is_current_focus_available(ad) != 0) { ERROR_TRACE("Some other application has the focus currently... Returning..."); + char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; + if (message) { + int ret = notification_status_message_post(dgettext("music-player", message)); + if (ret != 0) { + ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + } else { + DEBUG_TRACE("message: [%s]", message); + } + } return; } diff --git a/src/widget/mp-album-detail-list.c b/src/widget/mp-album-detail-list.c index 93ca36a..66fe98c 100755 --- a/src/widget/mp-album-detail-list.c +++ b/src/widget/mp-album-detail-list.c @@ -24,6 +24,7 @@ #include "mp-common.h" #include "mp-widget.h" #include "mp-play.h" +#include "mp-minicontroller.h" #include "mp-edit-callback.h" #include "mp-album-detail-view.h" @@ -197,6 +198,22 @@ _mp_album_detail_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) MpList_t *list = data; MP_CHECK(list); + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + if (_mp_is_current_focus_available(ad) != 0) { + ERROR_TRACE("Some other application has the focus currently... Returning..."); + char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; + if (message) { + int ret = notification_status_message_post(dgettext("music-player", message)); + if (ret != 0) { + ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + } else { + DEBUG_TRACE("message: [%s]", message); + } + } + return; + } + mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); diff --git a/src/widget/mp-artist-detail-list.c b/src/widget/mp-artist-detail-list.c index f6124ea..725a261 100755 --- a/src/widget/mp-artist-detail-list.c +++ b/src/widget/mp-artist-detail-list.c @@ -24,6 +24,7 @@ #include "mp-common.h" #include "mp-widget.h" #include "mp-play.h" +#include "mp-minicontroller.h" #include "mp-common.h" static char * @@ -329,6 +330,22 @@ _mp_artist_detail_list_select_cb(void *data, Evas_Object * obj, void *event_info MpArtistDetailList_t *list = (MpArtistDetailList_t *)data; MP_CHECK(list); + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + if (_mp_is_current_focus_available(ad) != 0) { + ERROR_TRACE("Some other application has the focus currently... Returning..."); + char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; + if (message) { + int ret = notification_status_message_post(dgettext("music-player", message)); + if (ret != 0) { + ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + } else { + DEBUG_TRACE("message: [%s]", message); + } + } + return; + } + mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); diff --git a/src/widget/mp-minicontroller.c b/src/widget/mp-minicontroller.c index a10e8f7..9edcc22 100755 --- a/src/widget/mp-minicontroller.c +++ b/src/widget/mp-minicontroller.c @@ -683,15 +683,6 @@ int _mp_is_current_focus_available(struct appdata *ad) DEBUG_TRACE("Playback state changed by : %d", changed_by); if (changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_CALL || changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_VOIP || changed_by == SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE) { DEBUG_TRACE("Cannot resume Music Player due to call"); - char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; - if (message) { - int ret = notification_status_message_post(dgettext("music-player", message)); - if (ret != 0) { - ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); - } else { - DEBUG_TRACE("message: [%s]", message); - } - } return -1; } @@ -712,6 +703,15 @@ static void _mp_minicontroller_play_pause_btn_clicked_cb(void *data, Evas_Object if (_mp_is_current_focus_available(ad) != 0) { ERROR_TRACE("Some other application has the focus currently... Returning..."); + char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; + if (message) { + int ret = notification_status_message_post(dgettext("music-player", message)); + if (ret != 0) { + ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + } else { + DEBUG_TRACE("message: [%s]", message); + } + } return; } diff --git a/src/widget/mp-now-playing.c b/src/widget/mp-now-playing.c index 701a9a7..90864ff 100755 --- a/src/widget/mp-now-playing.c +++ b/src/widget/mp-now-playing.c @@ -564,6 +564,15 @@ static void _mp_now_playing_btn_clicked_cb(void *data, Evas_Object *obj, void *e if (_mp_is_current_focus_available(ad) != 0) { ERROR_TRACE("Some other application has the focus currently... Returning..."); + char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; + if (message) { + int ret = notification_status_message_post(dgettext("music-player", message)); + if (ret != 0) { + ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + } else { + DEBUG_TRACE("message: [%s]", message); + } + } return; } diff --git a/src/widget/mp-track-list.c b/src/widget/mp-track-list.c index b545407..03eb720 100644 --- a/src/widget/mp-track-list.c +++ b/src/widget/mp-track-list.c @@ -26,6 +26,7 @@ #include "mp-play.h" #include "mp-edit-callback.h" #include "mp-player-mgr.h" +#include "mp-minicontroller.h" #include #include @@ -258,6 +259,22 @@ _mp_track_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info) MpList_t *list = data; MP_CHECK(list); + struct appdata *ad = mp_util_get_appdata(); + MP_CHECK(ad); + if (_mp_is_current_focus_available(ad) != 0) { + ERROR_TRACE("Some other application has the focus currently... Returning..."); + char *message = STR_MP_UNABLE_TO_PLAY_DURING_CALL; + if (message) { + int ret = notification_status_message_post(dgettext("music-player", message)); + if (ret != 0) { + ERROR_TRACE("notification_status_message_post()... [0x%x]", ret); + } else { + DEBUG_TRACE("message: [%s]", message); + } + } + return; + } + mp_list_item_data_t *item = (mp_list_item_data_t *) elm_object_item_data_get(gli); MP_CHECK(item); -- 2.34.1