Added albumart to LockScreen 56/68556/7 submit/tizen_mobile/20160630.140934
authorbhutani.92 <bhutani.92@samsung.com>
Fri, 6 May 2016 07:46:14 +0000 (13:16 +0530)
committerbhutani.92 <bhutani.92@samsung.com>
Thu, 30 Jun 2016 10:06:14 +0000 (15:36 +0530)
Change-Id: I8e624125f24bee6025b50059898a7aeb3d9d83d6
Signed-off-by: bhutani.92 <bhutani.92@samsung.com>
org.tizen.music-player.xml
src/core/mp-setting-ctrl.c
src/include/mp-define.h
src/include/music.h
src/widget/mp-lockscreenmini.c
widget/src/mp-widget-create.c

index 957860830aa48e2cc4260a4f5c55d1cfcb2dc7a8..583528fce8334933942910c5b468502f868d47c5 100755 (executable)
                <privilege>http://tizen.org/privilege/mediastorage</privilege>
                <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
                <privilege>http://tizen.org/privilege/systemsettings</privilege>
+               <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
                <privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
                <privilege>http://tizen.org/privilege/externalstorage</privilege>
                <privilege>http://tizen.org/privilege/notification</privilege>
index c82e0260b795491c0cc9a04ef7e8f8cf3552e742..0028144ebf425b4ef3d9be4ba787bec3935d733f 100755 (executable)
@@ -832,32 +832,47 @@ mp_setting_save_shortcut(char *shortcut_title, char *artist, char *shortcut_desc
        FILE *fp = NULL;
        int ret = 0;
 
-       if (mp_file_exists(MP_SHORTCUT_INI_FILE_NAME_2)) {
-               ret = rename(MP_SHORTCUT_INI_FILE_NAME_2, MP_SHORTCUT_INI_FILE_NAME_3);
+       char *path = app_get_data_path();
+       char shortcut_path_0[1024] = {0};
+       char shortcut_path_1[1024] = {0};
+       char shortcut_path_2[1024] = {0};
+       char shortcut_path_3[1024] = {0};
+       if (path == NULL) {
+               return;
+       }
+
+       snprintf(shortcut_path_0, 1024, "%s%s", path, MP_SHORTCUT_INI_FILE_NAME_0);
+       snprintf(shortcut_path_1, 1024, "%s%s", path, MP_SHORTCUT_INI_FILE_NAME_1);
+       snprintf(shortcut_path_2, 1024, "%s%s", path, MP_SHORTCUT_INI_FILE_NAME_2);
+       snprintf(shortcut_path_3, 1024, "%s%s", path, MP_SHORTCUT_INI_FILE_NAME_3);
+
+       free(path);
+       if (mp_file_exists(shortcut_path_2)) {
+               ret = rename(shortcut_path_2, shortcut_path_3);
                if (ret != 0) {
                        ERROR_TRACE("Failed to rename file:error=%d", ret);
                        return;
                }
        }
-       if (mp_file_exists(MP_SHORTCUT_INI_FILE_NAME_1)) {
-               rename(MP_SHORTCUT_INI_FILE_NAME_1, MP_SHORTCUT_INI_FILE_NAME_2);
+       if (mp_file_exists(shortcut_path_1)) {
+               rename(shortcut_path_1, shortcut_path_2);
                if (ret != 0) {
                        ERROR_TRACE("Failed to rename file:error=%d", ret);
                        return;
                }
        }
-       if (mp_file_exists(MP_SHORTCUT_INI_FILE_NAME_0)) {
-               rename(MP_SHORTCUT_INI_FILE_NAME_0, MP_SHORTCUT_INI_FILE_NAME_1);
+       if (mp_file_exists(shortcut_path_0)) {
+               rename(shortcut_path_0, shortcut_path_1);
                if (ret != 0) {
                        ERROR_TRACE("Failed to rename file:error=%d", ret);
                        return;
                }
        }
 
-       fp = fopen(MP_SHORTCUT_INI_FILE_NAME_0, "w");   /* make new file. */
+       fp = fopen(shortcut_path_0, "w");       /* make new file. */
 
        if (fp == NULL) {
-               SECURE_ERROR("Failed to open ini files. : %s", MP_SHORTCUT_INI_FILE_NAME_0);
+               SECURE_ERROR("Failed to open ini files. : %s", shortcut_path_0);
                return;
        }
 
index df98f407767030a012349c0a0876cd7fe17b5ce1..546f9242e5868c27efa4e6f6f8cad0c14e9ebe71 100755 (executable)
 
 #define DATA_DIR       DATA_PREFIX"/data"
 
-#ifndef MP_INI_DIR
-#define MP_INI_DIR DATA_DIR
-#endif
-
 #define PKGNAME_FOR_SHORTCUT   PKG_NAME
 
 #define EDJ_PATH EDJDIR
@@ -406,14 +402,14 @@ typedef enum
 #ifndef MP_SOUND_PLAYER
 #define MP_LSCR_CONTROL                                "lock_music_ctrl"
 #else
-#define MP_LSCR_CONTROL                                        "lock_sound_ctrl"
+#define MP_LSCR_CONTROL                                "lock_sound_ctrl"
 #endif
 
 
-#define MP_SHORTCUT_INI_FILE_NAME_0            MP_INI_DIR"/shortcut_0.ini"
-#define MP_SHORTCUT_INI_FILE_NAME_1            MP_INI_DIR"/shortcut_1.ini"
-#define MP_SHORTCUT_INI_FILE_NAME_2            MP_INI_DIR"/shortcut_2.ini"
-#define MP_SHORTCUT_INI_FILE_NAME_3            MP_INI_DIR"/shortcut_3.ini"
+#define MP_SHORTCUT_INI_FILE_NAME_0            "shortcut_0.ini"
+#define MP_SHORTCUT_INI_FILE_NAME_1            "shortcut_1.ini"
+#define MP_SHORTCUT_INI_FILE_NAME_2            "shortcut_2.ini"
+#define MP_SHORTCUT_INI_FILE_NAME_3            "shortcut_3.ini"
 
 #define SINGLE_BYTE_MAX 0x7F
 
index 22e3773e6a6a04874b79d1e9337c646f3d58dac7..7314cd9d17271d2301b7ef31f2b3ef57b345b9d7 100755 (executable)
@@ -247,6 +247,8 @@ struct appdata
        bool exit_status;
        bool disable_detail_view;
 
+       char *lockscreen_wallpaper;
+
 #if 0
        Ecore_X_Window xwin;
 #else
index e9efc37c98d185093d965abdec0c5f510554cddf..52adf695ede2565cd1e62b9a02c8cb9937a08b0c 100755 (executable)
 #include "mp-player-view.h"
 #include <device/display.h>
 #include <device/callback.h>
+#include <system_settings.h>
 
 #ifdef MP_FEATURE_LOCKSCREEN
 
 int LOCKSCREEN_MINI_CONTROLLER_WIDTH;
 #define LOCKSCREEN_MINI_CONTROLLER_HEIGHT (93)
 
+/*lockscreen wallpaper length*/
+#define WALLPAPER_LENGTH 1024
+
 //#define LOCKSCREEN_MSG_DOMAIN_CONTROL_ACCESS (int)ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL
 
 
@@ -280,7 +284,6 @@ _load_lockscreenmini(struct appdata *ad)
        win = minicontrol_create_window("sound-minicontrol.LOCKSCREEN", MINICONTROL_TARGET_VIEWER_STOCK_LOCK_SCREEN, _lockscreen_cb);
 #endif
 
-
        if (!win) {
                return;
        }
@@ -288,6 +291,17 @@ _load_lockscreenmini(struct appdata *ad)
 
        ad->win_lockmini = win;
 
+       int ret = -1;
+       ad->lockscreen_wallpaper = (char *)malloc(WALLPAPER_LENGTH * sizeof(char));
+       ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, &ad->lockscreen_wallpaper);
+       if(ret != SYSTEM_SETTINGS_ERROR_NONE) {
+               ERROR_TRACE("Failed to get locksreen wallpaper");
+       }
+       if(ad->lockscreen_wallpaper)
+               DEBUG_TRACE("lockscreen_wallpaper path is: %s", ad->lockscreen_wallpaper);
+       else
+               ERROR_TRACE("Could not fetch current wallpaper path");
+
        /* load edje */
        _mp_lockscreenmini_update_layout(ad, false);
 
@@ -793,7 +807,9 @@ _mp_lockscreenmini_title_set(struct appdata *ad)
        DEBUG_TRACE("title set");
 
        MP_CHECK(ad);
-       Evas_Object *label = elm_object_part_content_get(ad->lockmini_layout, "elm.text");
+       Evas_Object *label = NULL;
+
+       label = elm_object_part_content_get(ad->lockmini_layout, "elm.text");
 
        mp_track_info_t *current_item = ad->current_track_info;
        MP_CHECK(current_item);
@@ -814,7 +830,7 @@ _mp_lockscreenmini_title_set(struct appdata *ad)
                }
        }
 
-       /*edje_object_part_text_set(_EDJ(ad->lockmini_layout), "artist.text", markup_artist);*/
+       edje_object_part_text_set(_EDJ(ad->lockmini_layout), "artist.text", markup_artist);
        if (!label) {
                label = mp_widget_slide_title_create(ad->lockmini_layout, "slide_roll", title);
                elm_object_part_content_set(ad->lockmini_layout, "elm.text", label);
@@ -840,6 +856,24 @@ mp_lockscreenmini_update(struct appdata *ad)
        mp_retm_if(ad == NULL, "appdata is NULL");
        MP_CHECK(ad->win_lockmini);
        MP_CHECK(!ad->is_lcd_off);
+       MP_CHECK(ad->current_track_info);
+
+       int ret = -1;
+
+       if (ad->current_track_info->thumbnail_path) {
+               DEBUG_TRACE("Thumbnail Location: %s", ad->current_track_info->thumbnail_path);
+               ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, ad->current_track_info->thumbnail_path);
+       }
+       else
+       {
+               char wallpaper_path[1024] = {0};
+               snprintf(wallpaper_path, 1024, "%s/res/shared_images/default_albumart.png", SHAREDDIR);
+               DEBUG_TRACE("Setting Default Thumbnail :%s", wallpaper_path);
+               ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, wallpaper_path);
+       }
+       if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
+               ERROR_TRACE("Failed to set locksreen wallpaper");
+       }
 
        mp_lockscreenmini_update_control(ad);
        if (ad->player_state == PLAY_STATE_PLAYING) {
@@ -877,7 +911,6 @@ mp_lockscreenmini_hide(struct appdata *ad)
        mp_ecore_timer_del(ad->lockmini_button_timer);
 
        return 0;
-
 }
 
 int
@@ -896,6 +929,10 @@ mp_lockscreenmini_destroy(struct appdata *ad)
        mp_ecore_timer_del(ad->lockmini_button_timer);
        ad->lockmini_visible = false;
 
+       int ret = system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, ad->lockscreen_wallpaper);
+       if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
+               ERROR_TRACE("Failed to set original locksreen wallpaper");
+       }
        char *path = app_get_data_path();
        char lscr_state[1024] = {0};
        snprintf(lscr_state, 1024, "%s%s", path, MP_LSCR_CONTROL);
index 97dbd9b042daba49cda8911740fd15baacb98eb8..98af1d0f9b10a328ba6893f697f7879d827a27b4 100644 (file)
@@ -148,7 +148,7 @@ static void mp_widget_read_ini_file_ecore(void *data, char *path)
                }
                if (!strcmp(key, "thumbnail")) {
                        if (value) {
-                               image_path = (char*)malloc((strlen(value) + 1) * sizeof(char));
+                               image_path = (char *)malloc((strlen(value) + 1) * sizeof(char));
 
                                if (image_path != NULL) {
                                        strncpy(image_path, value, strlen(value));