Added notification indicator icon for Sound Player 84/91484/1 submit/tizen_3.0/20161018.001008 submit/tizen_mobile/20161009.144732
authorbhutani.92 <bhutani.92@samsung.com>
Sun, 9 Oct 2016 12:31:25 +0000 (18:01 +0530)
committerbhutani.92 <bhutani.92@samsung.com>
Sun, 9 Oct 2016 12:31:56 +0000 (18:01 +0530)
Change-Id: Ia049fde34d9cf57ec06707219931a52b05a9cfcd
Signed-off-by: bhutani.92 <bhutani.92@samsung.com>
src/common/include/mp-play.h
src/common/include/mp-util.h
src/common/mp-play.c
src/common/mp-util.c
src/mp-main.c

index 786fbf5b3279d730898e4e81663808de60faf81b..da5a0363e0b37da9708f1515f77d569583aa3340 100644 (file)
@@ -20,6 +20,7 @@
 #define __MP_PLAY_H_
 
 #include <Elementary.h>
+#include <notification_internal.h>
 #include "mp-define.h"
 
 #define MP_PLAY_ERROR_NO_SONGS -1
index a2af58ef674629e790e5a919e9491e6feb6d3266..29e5f3c1ce95aa274906675993e10fd338976a7e 100755 (executable)
@@ -37,6 +37,11 @@ typedef enum
        MP_DIR_HTTP
 }mp_dir_e;
 
+enum {
+       PREF_PLAYER_OFF = 0x00,
+       PREF_PLAYER_ON
+};
+
 enum {
        PREF_MUSIC_OFF = 0x00,
        PREF_MUSIC_PLAY,
@@ -48,6 +53,8 @@ enum {
 #define GET_WINDOW() ((mp_util_get_appdata()) ? mp_util_get_appdata()->win_main : NULL)
 #define CHECK_STORE    mp_util_is_store_enable()
 #define PREF_MUSIC_STATE "preference/org.tizen.music-player/state"
+#define PREF_SOUND_PLAYER_LAUNCH "preference/org.tizen.sound-player/launch_state"
+#define PREF_MUSIC_PLAYER_LAUNCH "preference/org.tizen.music-player/launch_state"
 
 int mp_setting_get_nowplaying_id(void);
 bool                   mp_util_is_streaming(const char *uri);
index 719d79eed267018ab6980f26bcf4ab0c1d8cd7fd..d8c73f3282627a9d4457f2283a26485b12a2492b 100755 (executable)
@@ -508,8 +508,6 @@ mp_play_start(void *data)
        ad->player_state = PLAY_STATE_PLAYING;
 
 
-#ifndef MP_SOUND_PLAYER
-
        if (!ad->noti) {
                DEBUG_TRACE("notification create");
 
@@ -527,9 +525,17 @@ mp_play_start(void *data)
                snprintf(icon_path, 1024, "%sshared_images/T02_control_circle_icon_play.png", shared_path);
                free(shared_path);
 
-               notification_delete_all(NOTIFICATION_TYPE_NOTI);
+#ifdef MP_SOUND_PLAYER
+               notification_delete_all_by_type("org.tizen.music-player", NOTIFICATION_TYPE_NOTI);
+#else
+               notification_delete_all_by_type("org.tizen.sound-player", NOTIFICATION_TYPE_NOTI);
+#endif
                ad->noti = notification_create(noti_type);
+#ifdef MP_SOUND_PLAYER
+               const char *tag = "minicontrol_sound";
+#else
                const char *tag = "minicontrol_music";
+#endif
                ret = notification_set_tag(ad->noti, tag);
                if (ret != NOTIFICATION_ERROR_NONE) {
                        DEBUG_TRACE("Unable to set tag [%d]", ret);
@@ -578,7 +584,6 @@ mp_play_start(void *data)
                ad->create_view_on_play = false;
                ad->preload_player_view = NULL;
        }
-#endif
        mp_ecore_idler_del(ad->create_on_play_lay_idler);
 
        _mp_play_start_lazy(ad);
index 7442c55d0e3233503e583c3a2fc701aec26a8dca..43822d9a64f62259d48763292af681c74379ad39 100755 (executable)
@@ -2621,7 +2621,6 @@ const char *util_get_file_path(const char *relative)
        return &buf[0];
 }
 
-#ifndef MP_SOUND_PLAYER
 void mp_post_notification_indicator(char *status)
 {
        startfunc;
@@ -2630,8 +2629,6 @@ void mp_post_notification_indicator(char *status)
        MP_CHECK(ad);
        int ret = NOTIFICATION_ERROR_NONE;
 
-       int applist = NOTIFICATION_DISPLAY_APP_INDICATOR;
-       notification_type_e noti_type = NOTIFICATION_TYPE_NOTI;
        notification_image_type_e img_type = NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR;
        char *path = app_get_shared_resource_path();
        if (!path) {
@@ -2701,4 +2698,3 @@ void mp_noti_read_ini_file(void *data, Ecore_File_Monitor *em, Ecore_File_Event
 
        fclose(file);
 }
-#endif
index cc7d7785818cb7335796c439007d9f8ad1f52568..7365cb101dc512fb6a5b2492a22be040e90217a4 100755 (executable)
@@ -139,10 +139,15 @@ _mp_main_init(struct appdata *ad)
        ad->music_setting_change_flag = false;
        ad->paused_by_user = true;
 
+#ifdef MP_SOUND_PLAYER
+       preference_set_int(PREF_SOUND_PLAYER_LAUNCH, PREF_PLAYER_ON);
+#else
+       preference_set_int(PREF_MUSIC_PLAYER_LAUNCH, PREF_PLAYER_ON);
+#endif
+
        mp_media_info_connect();
-       int state = RECORDER_DEVICE_STATE_IDLE;
+       recorder_device_state_e state = RECORDER_DEVICE_STATE_IDLE;
        recorder_get_device_state(RECORDER_TYPE_VIDEO, &state);
-       DEBUG_TRACE("Recorder state: %d", state);
 
        int ret = recorder_add_device_state_changed_cb(mp_recorder_state_cb, ad, &ad->recorder_id);
        if (ret != RECORDER_ERROR_NONE) {
@@ -1349,9 +1354,16 @@ mp_terminate(void *data)
        DEBUG_TRACE_FUNC();
        mp_retm_if(ad == NULL, "ad is null");
 
+#ifdef MP_SOUND_PLAYER
+       preference_set_int(PREF_SOUND_PLAYER_LAUNCH, PREF_PLAYER_OFF);
+#else
+       preference_set_int(PREF_MUSIC_PLAYER_LAUNCH, PREF_PLAYER_OFF);
+#endif
+
        mp_volume_finalize();
 
-       int ret = recorder_remove_device_state_changed_cb(ad->recorder_id);
+       int ret = RECORDER_ERROR_NONE;
+       ret = recorder_remove_device_state_changed_cb(ad->recorder_id);
        if (ret != RECORDER_ERROR_NONE) {
                ERROR_TRACE("Unable to remove callback for recorder state");
        }
@@ -1466,12 +1478,28 @@ mp_terminate(void *data)
        mp_music_view_mgr_release();
 #endif
 
-#ifndef MP_SOUND_PLAYER
-       if (ad->noti) {
-               notification_delete(ad->noti);
-               notification_free(ad->noti);
+       int music_state = PREF_PLAYER_OFF;
+       int sound_state = PREF_PLAYER_OFF;
+       ret = PREFERENCE_ERROR_NONE;
+       ret = preference_get_int(PREF_MUSIC_PLAYER_LAUNCH, &music_state);
+       if (ret != PREFERENCE_ERROR_NONE) {
+               ERROR_TRACE("Cannot determine PREF_MUSIC_PLAYER_LAUNCH key value");
+               music_state = PREF_PLAYER_OFF;
+       }
+       ret = PREFERENCE_ERROR_NONE;
+       ret = preference_get_int(PREF_SOUND_PLAYER_LAUNCH, &sound_state);
+       if (ret != PREFERENCE_ERROR_NONE) {
+               ERROR_TRACE("Cannot determine PREF_SOUND_PLAYER_LAUNCH key value");
+               sound_state = PREF_PLAYER_OFF;
+       }
+       if (music_state == PREF_PLAYER_OFF && sound_state == PREF_PLAYER_OFF) {
+               DEBUG_TRACE("Removing indicator icon from notification panel");
+               if (ad->noti) {
+                       notification_delete_all_by_type("org.tizen.music-player", NOTIFICATION_TYPE_NOTI);
+                       notification_delete_all_by_type("org.tizen.sound-player", NOTIFICATION_TYPE_NOTI);
+                       notification_free(ad->noti);
+               }
        }
-#endif
        return;
 }