Add multiuser path converting logic 75/106575/1 accepted/tizen/common/20161222.131250 accepted/tizen/ivi/20161223.095407 accepted/tizen/mobile/20161223.095345 submit/tizen/20161222.060743
authorWootak Jung <wootak.jung@samsung.com>
Thu, 22 Dec 2016 05:54:42 +0000 (14:54 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 22 Dec 2016 05:54:42 +0000 (14:54 +0900)
- ringtone path should be converted to multiuser path

Change-Id: I2b80faa99d481e0688c7e63b4f51f60e4f97baeb

common/CMakeLists.txt
common/include/callmgr-util.h
common/src/callmgr-util.c
common/src/callmgr-vconf.c
module/src/callmgr-contact.c
packaging/call-manager.spec

index f66380a3f64491e877f15f69a808cb3efc2258f1..22aeafdce49d5fe47b468b566282b77c8a84849c 100644 (file)
@@ -20,6 +20,7 @@ pkg_check_modules(common_pkgs REQUIRED
        notification
        msg-service
        libsystemd-login
+       libtzplatform-config
 )
 
 FOREACH(flag ${common_pkgs_CFLAGS})
index 6e0f521bc8cc39d2e55467c3ed77c0c86d474cc9..2280df701a618baac8ef09cf0235b86f18646bd2 100644 (file)
@@ -152,5 +152,7 @@ gboolean _callmgr_util_check_access_control(cynara *p_cynara, GDBusMethodInvocat
 
 int _callmgr_util_service_check_voice_mail(char *phonenumber, int sim_slot, gboolean *is_voicemail_number);
 
+char *_callmgr_util_get_multiuser_path(char *path);
+
 #endif //__CALLMGR_UTIL_H__
 
index 2fae3e98b0d9c10e71e2aea125adfbbca92b44e6..1e93176e6aec3aa1ec7b0fe49494ec505ccf0851 100644 (file)
@@ -33,6 +33,7 @@
 #include <cynara-creds-gdbus.h>
 #include <cynara-session.h>
 #include <systemd/sd-login.h>
+#include <tzplatform_config.h>
 
 #include "callmgr-util.h"
 #include "callmgr-log.h"
@@ -57,6 +58,8 @@
 #define CISS_AUL_CMD "org.tizen.ciss"
 #define CISS_MODE_OPT "REQ"
 
+#define COMPAT_DIR "/opt/usr/media"
+
 typedef struct _callmgr_thread_data {
        unsigned int call_id;
        int sim_slot;
@@ -905,3 +908,31 @@ int _callmgr_util_check_disturbing_setting(const char *number, gboolean *is_do_n
        notification_system_setting_free_system_setting(system_setting);
        return 0;
 }
+
+/*
+ * Get multi-user path from compat path
+ * i.g., /opt/usr/media/... to TZ_USER_CONTENT/...
+ */
+char *_callmgr_util_get_multiuser_path(char *path)
+{
+       int path_len;
+       char *origin_path;
+
+       if (path == NULL)
+               return NULL;
+
+       path_len = strlen(COMPAT_DIR);
+       if (!strncmp(path, COMPAT_DIR, path_len)) {
+               uid_t uid = 0;
+               __callmgr_util_get_active_uid(&uid);
+               tzplatform_set_user(uid);
+
+               origin_path = g_strdup_printf("%s%s",
+                       tzplatform_getenv(TZ_USER_CONTENT), path + path_len);
+
+               tzplatform_reset_user();
+               return origin_path;
+       } else {
+               return g_strdup(path);
+       }
+}
index c7d94f5a30b2958ea6a57cd4d37be8a6a7084313..a7c11eed0bc6541d4674ff34098b39c24437577a 100644 (file)
@@ -201,7 +201,8 @@ int _callmgr_vconf_get_ringtone_path(char **ringtone_path)
 
                return -1;
        } else {
-               *ringtone_path = g_strdup(path);
+               *ringtone_path = _callmgr_util_get_multiuser_path(path);
+               dbg("ringtone_path: [%s]", *ringtone_path);
 
                return 0;
        }
index a10fd3abb0a53933520258bc4409e83d1ea7c55c..dd1a8816772802b180789e349d61863a5cd1c8ae 100644 (file)
@@ -165,7 +165,8 @@ static int __callmgr_ct_get_group_ringtone(int person_id, callmgr_contact_info_t
                                if (CONTACTS_ERROR_NONE != err) {
                                        err("contacts_record_get_str(group id path) error %d", err);
                                } else {
-                                       contact_info->caller_ringtone_path = g_strdup(ringtone_path);
+                                       contact_info->caller_ringtone_path = _callmgr_util_get_multiuser_path(ringtone_path);
+                                       dbg("caller_ringtone_path: [%s]", contact_info->caller_ringtone_path);
 
                                        g_free(ringtone_path);
                                        ringtone_path = NULL;
@@ -206,7 +207,8 @@ static int __callmgr_ct_get_caller_ringtone(int person_id, callmgr_contact_info_
                        err("contacts_record_get_str(ringtone path) error %d", err);
                } else {
                        info("Caller ringtone");
-                       contact_info->caller_ringtone_path = g_strdup(ringtone_path);
+                       contact_info->caller_ringtone_path = _callmgr_util_get_multiuser_path(ringtone_path);
+                       dbg("caller_ringtone_path: [%s]", contact_info->caller_ringtone_path);
                        free(ringtone_path);
                }
                contacts_record_destroy(person_record, TRUE);
index 6e488978ab70529a36e666aaeb2b88ae6e292771..682657f242a6ffc2d142862a20a74267bc77361e 100644 (file)
@@ -1,6 +1,6 @@
 %define major 0
 %define minor 1
-%define patchlevel 96
+%define patchlevel 97
 %define ext_feature 0
 
 Name:           call-manager