Fix : The exception handling according to the situation
[platform/framework/native/content.git] / src / FCnt_ContentManagerImpl.cpp
index 2a77bd0..07614cb 100644 (file)
 #include <aul/aul.h>
 #include <FAppApp.h>
 #include <FBaseSysLog.h>
+#include <FBaseDateTime.h>
 #include <FBaseInteger.h>
 #include <FBaseByteBuffer.h>
+#include <FBaseUtilStringTokenizer.h>
 #include <FCntContentManager.h>
 #include <FCntContentManagerUtil.h>
 #include <FCntImageContentInfo.h>
@@ -56,6 +58,7 @@ using namespace std;
 using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
 using namespace Tizen::Io;
 using namespace Tizen::Locations;
 using namespace Tizen::System;
@@ -296,16 +299,21 @@ _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
        SysTryReturn(NID_CNT, pInfoImpl != null, UuId::GetInvalidUuId(), E_INVALID_ARG,
                        "[E_INVALID_ARG] Invalid argument is used. ContentInfo is invalid.");
 
-       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(pInfoImpl->GetContentPath(), true), UuId::GetInvalidUuId(),
-                       E_INVALID_ARG, "[E_INVALID_ARG] The contentPath is not compatible.");
-       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(pInfoImpl->GetContentPath()), UuId::GetInvalidUuId(), E_FILE_NOT_FOUND,
-                       "[E_FILE_NOT_FOUND] The file corresponding to contentInfo could not be found.");
+       String contentPath(pInfoImpl->GetPhysicalContentPath());
+       String changedPath(L"");
+
+       result r = ChangeTizenPathToCompat(contentPath, changedPath);
+       SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] Failed to perform ChangeTizenPathToCompat.", GetErrorMessage(r));
+
+       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(changedPath), UuId::GetInvalidUuId(), E_FILE_NOT_FOUND,
+                       "[%s] The file cound not be found.", GetErrorMessage(E_FILE_NOT_FOUND));
+
        SysTryReturn(NID_CNT, pInfoImpl->GetContentId() == UuId::GetInvalidUuId(), UuId::GetInvalidUuId(),
                        E_INVALID_ARG, "[E_INVALID_ARG] The contentId is not empty.");
 
        // Compare the type of input parameter and system
        ContentType inputType = pInfoImpl->GetContentType();
-       ContentType sysType = _ContentManagerUtilImpl::CheckContentType(pInfoImpl->GetContentPath(), true);
+       ContentType sysType = _ContentManagerUtilImpl::CheckContentType(contentPath, true);
 
        ClearLastResult();
 
@@ -320,7 +328,7 @@ _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
        }
 
        // Save data to database with contentPath.
-       unique_ptr<char[]> pStr(_StringConverter::CopyToCharArrayN(contentInfo.GetContentPath()));
+       unique_ptr<char[]> pStr(_StringConverter::CopyToCharArrayN(contentPath));
        SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                        "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -334,7 +342,7 @@ _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
        pMediaInfo.reset(tempMediaInfo);
 
        ContentId contentId = SaveDataToDatabase(pMediaInfo.get(), pInfoImpl);
-       result r = GetLastResult();
+       r = GetLastResult();
        SysTryCatch(NID_CNT, contentId != UuId::GetInvalidUuId(), , r,
                        "[%s] The registration to database failed.", GetErrorMessage(r));
 
@@ -343,7 +351,20 @@ _ContentManagerImpl::CreateContent(const ContentInfo& contentInfo)
 CATCH:
        // There are two steps(insert and update) for content registration.
        // If the update failed after inserting, the inserted data SHOULD be deleted from here.
-       val = media_info_delete_from_db(pStr.get());
+       char* pTempMediaId = null;
+       unique_ptr<char, CharDeleter> pMediaId(null);
+       val = media_info_get_media_id(pMediaInfo.get(), &pTempMediaId);
+       if (pTempMediaId != null)
+       {
+               pMediaId.reset(pTempMediaId);
+       }
+       else
+       {
+               SysLog(NID_CNT, "Failed to perform media_info_get_media_id operation.");
+               return UuId::GetInvalidUuId();
+       }
+
+       val = media_info_delete_from_db(pMediaId.get());
        SysLog(NID_CNT, "The result of deletion from database[%d].", val);
 
        return UuId::GetInvalidUuId();
@@ -360,7 +381,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        "[E_INVALID_ARG] byteBuffer is invalid.");
 
        // Check parameters(for path compatibility)
-       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(destinationPath, false), UuId::GetInvalidUuId(),
+       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(destinationPath), UuId::GetInvalidUuId(),
                        E_INVALID_ARG, "[E_INVALID_ARG] %ls is not compatible.", destinationPath.GetPointer());
        SysTryReturn(NID_CNT, !_FileImpl::IsFileExist(destinationPath), UuId::GetInvalidUuId(), E_FILE_ALREADY_EXIST,
                        "[E_FILE_ALREADY_EXIST] The specified file already exists.");
@@ -395,6 +416,10 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
        media_info_h tempMediaInfo = null;
        unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
        unique_ptr<char[]> pStr(null);
+       String destPath(L"");
+
+       r = ChangeCompatPathToTizen(destinationPath, destPath);
+       SysTryCatch(NID_CNT, !IsFailed(r), , r, "[%s] Failed to perform ChangedCompatPathToTizen.", GetErrorMessage(r));
 
        if (pContentInfo != null)
        {
@@ -423,7 +448,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                }
 
                // Sets the content path
-               pInfoImpl->SetContentPath(destinationPath);
+               pInfoImpl->SetContentPath(destPath);
        }
        else
        {
@@ -438,7 +463,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for ImageContentInfoImpl.");
 
-                       imageContentInfoImpl.SetContentPath(destinationPath);
+                       imageContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&imageContentInfoImpl);
                }
                else if (contentType == CONTENT_TYPE_AUDIO)
@@ -447,7 +472,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for AudioContentInfoImpl.");
 
-                       audioContentInfoImpl.SetContentPath(destinationPath);
+                       audioContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&audioContentInfoImpl);
                }
                else if (contentType == CONTENT_TYPE_VIDEO)
@@ -456,7 +481,7 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for VideoContentInfoImpl.");
 
-                       videoContentInfoImpl.SetContentPath(destinationPath);
+                       videoContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&videoContentInfoImpl);
                }
                else
@@ -465,13 +490,13 @@ _ContentManagerImpl::CreateContent(const ByteBuffer& byteBuffer, const String& d
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for OtherContentInfoImpl.");
 
-                       otherContentInfoImpl.SetContentPath(destinationPath);
+                       otherContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&otherContentInfoImpl);
                }
        }
 
        // Register the content to database directly.
-       pStr.reset(_StringConverter::CopyToCharArrayN(destinationPath));
+       pStr.reset(_StringConverter::CopyToCharArrayN(destPath));
        SysTryCatch(NID_CNT, pStr != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
        val = media_info_insert_to_db(pStr.get(), &tempMediaInfo);
@@ -496,7 +521,20 @@ CATCH:
 
        if (pMediaInfo != null)
        {
-               val = media_info_delete_from_db(pStr.get());
+               char* pTempMediaId = null;
+               unique_ptr<char, CharDeleter> pMediaId(null);
+               val = media_info_get_media_id(pMediaInfo.get(), &pTempMediaId);
+               if (pTempMediaId != null)
+               {
+                       pMediaId.reset(pTempMediaId);
+               }
+               else
+               {
+                       SysLog(NID_CNT, "Failed to perform media_info_get_media_id operation.");
+                       return UuId::GetInvalidUuId();
+               }
+
+               val = media_info_delete_from_db(pMediaId.get());
                SysLog(NID_CNT, "The result of deletion from database[%d].", val);
        }
 
@@ -517,24 +555,11 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
        // Check parameters(for path compatibility)
        SysTryReturn(NID_CNT, VerifyHomeFilePathCompatibility(sourcePath), UuId::GetInvalidUuId(), E_INVALID_ARG,
                        "[E_INVALID_ARG] %ls is not compatible.", sourcePath.GetPointer());
-       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(destinationPath, false), UuId::GetInvalidUuId(),
+       SysTryReturn(NID_CNT, VerifyMediaFilePathCompatibility(destinationPath), UuId::GetInvalidUuId(),
                        E_INVALID_ARG, "[E_INVALID_ARG] %ls is not compatible.", destinationPath.GetPointer());
 
-       result r = E_SUCCESS;
-       bool isCopy = false;
-
-       if (deleteSource) // move
-       {
-               r = _FileImpl::Move(sourcePath, destinationPath);
-               SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r, "[%s] Moving the file failed.", GetErrorMessage(r));
-       }
-       else // copy
-       {
-               r = _FileImpl::Copy(sourcePath, destinationPath, true);
-               SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r, "[%s] Copying the file failed.", GetErrorMessage(r));
-
-               isCopy = true;
-       }
+       result r = _FileImpl::Copy(sourcePath, destinationPath, true);
+       SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r, "[%s] Copying the file failed.", GetErrorMessage(r));
 
        int val = 0;
        ContentId contentId;
@@ -546,6 +571,10 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
        media_info_h tempMediaInfo = null;
        unique_ptr<media_info_s, _MediaInfoDeleter> pMediaInfo(null);
        unique_ptr<char[]> pStr(null);
+       String destPath(L"");
+
+       r = ChangeCompatPathToTizen(destinationPath, destPath);
+       SysTryCatch(NID_CNT, !IsFailed(r), , r, "[%s] Failed to perform ChangedCompatPathToTizen.", GetErrorMessage(r));
 
        if (pContentInfo != null)
        {
@@ -574,7 +603,7 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                }
 
                // Set the content path
-               pInfoImpl->SetContentPath(destinationPath);
+               pInfoImpl->SetContentPath(destPath);
        }
        else
        {
@@ -589,7 +618,7 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for ImageContentInfoImpl.");
 
-                       imageContentInfoImpl.SetContentPath(destinationPath);
+                       imageContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&imageContentInfoImpl);
                }
                else if (contentType == CONTENT_TYPE_AUDIO)
@@ -598,7 +627,7 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for AudioContentInfoImpl.");
 
-                       audioContentInfoImpl.SetContentPath(destinationPath);
+                       audioContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&audioContentInfoImpl);
                }
                else if (contentType == CONTENT_TYPE_VIDEO)
@@ -607,7 +636,7 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for VideoContentInfoImpl.");
 
-                       videoContentInfoImpl.SetContentPath(destinationPath);
+                       videoContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&videoContentInfoImpl);
                }
                else
@@ -616,12 +645,12 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
                        SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY,
                                        "[E_OUT_OF_MEMORY] Failed to perform Construct for OtherContentInfoImpl.");
 
-                       otherContentInfoImpl.SetContentPath(destinationPath);
+                       otherContentInfoImpl.SetContentPath(destPath);
                        pInfoImpl = dynamic_cast< _ContentInfoImpl* >(&otherContentInfoImpl);
                }
        }
 
-       pStr.reset(_StringConverter::CopyToCharArrayN(destinationPath));
+       pStr.reset(_StringConverter::CopyToCharArrayN(destPath));
        SysTryCatch(NID_CNT, pStr != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
        val = media_info_insert_to_db(pStr.get(), &tempMediaInfo);
@@ -635,25 +664,42 @@ _ContentManagerImpl::CreateContent(const String& sourcePath, const String& desti
        SysTryCatch(NID_CNT, contentId != UuId::GetInvalidUuId(), , r,
                        "[%s] SaveDataToDatabase failed.", GetErrorMessage(r));
 
+       if (deleteSource)
+       {
+               unique_ptr<char[]> pContentPath(_StringConverter::CopyToCharArrayN(sourcePath));
+               SysTryCatch(NID_CNT, !IsFailed(r), , E_OUT_OF_MEMORY, "[%s] pContentPath is null.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+               r = _FileImpl::Remove(sourcePath);
+               SysTryCatch(NID_CNT, !IsFailed(r), , r, "[%s] Failed to perform Remove operation.", GetErrorMessage(r));
+
+               val = media_content_scan_file(pContentPath.get());
+               SysTryLog(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, "Failed to perform media_content_scan_file[%d].", val);
+       }
+
        return contentId;
 
 CATCH:
        result saveResult = GetLastResult();
 
-       if (isCopy)
-       {
-               r = _FileImpl::Remove(destinationPath);
-               SysLog(NID_CNT, "Remove[%s].", GetErrorMessage(r));
-       }
-       else
-       {
-               r = _FileImpl::Move(destinationPath, sourcePath);
-               SysLog(NID_CNT, "Move[%s].", GetErrorMessage(r));
-       }
+       r = _FileImpl::Remove(destinationPath);
+       SysLog(NID_CNT, "Remove[%s].", GetErrorMessage(r));
 
        if (pMediaInfo != null)
        {
-               val = media_info_delete_from_db(pStr.get());
+               char* pTempMediaId = null;
+               unique_ptr<char, CharDeleter> pMediaId(null);
+               val = media_info_get_media_id(pMediaInfo.get(), &pTempMediaId);
+               if (pTempMediaId != null)
+               {
+                       pMediaId.reset(pTempMediaId);
+               }
+               else
+               {
+                       SysLog(NID_CNT, "Failed to perform media_info_get_media_id operation.");
+                       return UuId::GetInvalidUuId();
+               }
+
+               val = media_info_delete_from_db(pMediaId.get());
                SysLog(NID_CNT, "The result of deletion from database[%d].", val);
        }
 
@@ -692,19 +738,23 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
 
        unique_ptr<char, CharDeleter> pFilePath(pTempFilePath);
        String contentPath(pFilePath.get());
-
-       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(contentPath), null, E_FILE_NOT_FOUND,
-                       "[E_FILE_NOT_FOUND] The file corresponding to contentId could not be found.");
+       String changedPath(L"");
 
        result r = E_SUCCESS;
 
+       r = ChangeTizenPathToCompat(contentPath, changedPath);
+       SysTryReturn(NID_CNT, !IsFailed(r), null, r, "[%s] Failed to perform ChangeTizenPathToCompat.", GetErrorMessage(r));
+
+       SysTryReturn(NID_CNT, _FileImpl::IsFileExist(changedPath), null, E_FILE_NOT_FOUND,
+                       "[E_FILE_NOT_FOUND] The file corresponding to contentId could not be found.");
+
        if (systemType == SYSTEM_TYPE_IMAGE)
        {
                unique_ptr< ImageContentInfo > pImageContentInfo(new (nothrow) ImageContentInfo);
                SysTryReturn(NID_CNT, pImageContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = pImageContentInfo->Construct(&contentPath);
+               r = pImageContentInfo->Construct(&changedPath);
                r = ConvertErrorToResult(r);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r,
                                "[%s] Failed to perform Construct operation to ImageContentInfo.", GetErrorMessage(r));
@@ -724,7 +774,7 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
                SysTryReturn(NID_CNT, pAudioContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = pAudioContentInfo->Construct(&contentPath);
+               r = pAudioContentInfo->Construct(&changedPath);
                r = ConvertErrorToResult(r);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r,
                                "[%s] Failed to perform Construct operation to AudioContentInfo.", GetErrorMessage(r));
@@ -744,7 +794,7 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
                SysTryReturn(NID_CNT, pVideoContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = pVideoContentInfo->Construct(&contentPath);
+               r = pVideoContentInfo->Construct(&changedPath);
                r = ConvertErrorToResult(r);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r,
                                "[%s] Failed to perform Construct operation to VideoContentInfo.", GetErrorMessage(r));
@@ -764,7 +814,7 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
                SysTryReturn(NID_CNT, pOtherContentInfo != null, null, E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               r = pOtherContentInfo->Construct(&contentPath);
+               r = pOtherContentInfo->Construct(&changedPath);
                r = ConvertErrorToResult(r);
                SysTryReturn(NID_CNT, !IsFailed(r), null, r,
                                "[%s] Failed to perform Construct operation to OtherContentInfo.", GetErrorMessage(r));
@@ -788,14 +838,14 @@ _ContentManagerImpl::GetContentInfoN(const ContentId& contentId) const
 result
 _ContentManagerImpl::UpdateContent(const ContentInfo& contentInfo)
 {
-       ContentId contentId = contentInfo.GetContentId();
-       SysTryReturnResult(NID_CNT, contentId != UuId::GetInvalidUuId(), E_INVALID_ARG, "The content id is invalid.");
-       SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(contentInfo.GetContentPath()), E_FILE_NOT_FOUND,
-                       "The file corresponding to contentInfo could not be found.");
-
        const _ContentInfoImpl* pInfoImpl = _ContentInfoImpl::GetInstance(contentInfo);
        SysTryReturnResult(NID_CNT, pInfoImpl != null, E_INVALID_ARG, "Invalid argument is used. ContentInfo is invalid.");
 
+       ContentId contentId = pInfoImpl->GetContentId();
+       SysTryReturnResult(NID_CNT, contentId != UuId::GetInvalidUuId(), E_INVALID_ARG, "The content id is invalid.");
+       SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(pInfoImpl->GetContentPath()), E_FILE_NOT_FOUND,
+                       "The file corresponding to contentInfo could not be found.");
+
        result r = UpdateDataToDatabase(pInfoImpl);
        SysTryReturnResult(NID_CNT, !IsFailed(r), r, "UpdateDataToDatabase failed.");
 
@@ -828,16 +878,20 @@ _ContentManagerImpl::DeleteContent(const ContentId& contentId)
                        "media_info_get_file_path failed[%d].", val);
 
        unique_ptr<char, CharDeleter> pContentPath(pTempPath);
+       String contentPath(pContentPath.get());
+       String changedPath(L"");
+
+       r = ChangeTizenPathToCompat(contentPath, changedPath);
+       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "[%s] Failed to perform ChangeTizenPathToCompat.", GetErrorMessage(r));
 
-       String contentPath = String(pContentPath.get());
-       SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(contentPath), E_FILE_NOT_FOUND,
+       SysTryReturnResult(NID_CNT, _FileImpl::IsFileExist(changedPath), E_FILE_NOT_FOUND,
                        "The file corresponding to contentId could not be found.");
 
        val = media_info_delete_from_db(pContentId.get());
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
                        "media_info_delete_From_db failed[%d].", val);
 
-       r = _FileImpl::Remove(contentPath);
+       r = _FileImpl::Remove(changedPath);
        SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "The file is not deleted.");
 
        return r;
@@ -943,78 +997,71 @@ _ContentManagerImpl::UpdateDataToDatabase(const _ContentInfoImpl* pContentInfoIm
        result r = E_SUCCESS;
        unique_ptr<char[]> pValue(null);
 
-       if (!pContentInfoImpl->GetAuthor().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       // author
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-               val = media_info_set_author(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_author failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetCategory().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       val = media_info_set_author(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_author failed[%d].", val);
 
-               val = media_info_set_category(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_category failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetContentName().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       // category
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-               val = media_info_set_content_name(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_content_name failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetDescription().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       val = media_info_set_category(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_category failed[%d].", val);
 
-               val = media_info_set_description(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_description failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetKeyword().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       // content name
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-               val = media_info_set_keyword(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_keyword failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetLocationTag().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       val = media_info_set_content_name(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_content_name failed[%d].", val);
 
-               val = media_info_set_location_tag(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_location_tag failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetProvider().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       // description
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-               val = media_info_set_provider(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_provider failed[%d].", val);
-       }
-       if (!pContentInfoImpl->GetRating().IsEmpty())
-       {
-               pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
-               SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       val = media_info_set_description(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_description failed[%d].", val);
 
-               val = media_info_set_age_rating(pMediaInfo.get(), pValue.get());
-               SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
-                               "media_info_set_age_rating failed[%d].", val);
-       }
+       // keyword
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+       val = media_info_set_keyword(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_keyword failed[%d].", val);
+
+       // location tag
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+       val = media_info_set_location_tag(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_location_tag failed[%d].", val);
+
+       // provider
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+       val = media_info_set_provider(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_provider failed[%d].", val);
+
+       // rating
+       pValue.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
+       SysTryReturnResult(NID_CNT, pValue != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+       val = media_info_set_age_rating(pMediaInfo.get(), pValue.get());
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_set_age_rating failed[%d].", val);
+
+       // latitude, longitude, altitude
        if (Double::Compare(pContentInfoImpl->GetLatitude(), DEFAULT_COORDINATE) != 0 &&
                        Double::Compare(pContentInfoImpl->GetLongitude(), DEFAULT_COORDINATE) != 0)
        {
@@ -1046,20 +1093,28 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
                                                                                                _ContentInfoImpl* pContentInfoImpl) const
 {
        ClearLastResult();
+       result r = E_SUCCESS;
 
        SysTryReturn(NID_CNT, pContentInfoImpl != null, UuId::GetInvalidUuId(), E_INVALID_ARG,
                        "[E_INVALID_ARG] Invalid argument is used. ContentInfo is invalid.");
 
+       String contentPath(pContentInfoImpl->GetPhysicalContentPath());
+       String changedPath(L"");
+
+       r = ChangeTizenPathToCompat(contentPath, changedPath);
+       SysTryReturn(NID_CNT, !IsFailed(r), UuId::GetInvalidUuId(), r,
+                       "[%s] Failed to perform ChangeTizenPathToCompat.", GetErrorMessage(r));
+
        String mimeType(L"");
-       String extension = _FileImpl::GetFileExtension(pContentInfoImpl->GetContentPath());
-       result r = GetLastResult();
+       String extension = _FileImpl::GetFileExtension(changedPath);
+       r = GetLastResult();
        if (IsFailed(r))
        {
                ClearLastResult();
 
                SysLog(NID_CNT, "[%s] Failed to perform GetFileExtension operation.", GetErrorMessage(r));
 
-               unique_ptr<char[]> pTempPath(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentPath()));
+               unique_ptr<char[]> pTempPath(_StringConverter::CopyToCharArrayN(contentPath));
                SysTryReturn(NID_CNT, pTempPath != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
                                "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
@@ -1079,7 +1134,7 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
        {
                SysLog(NID_CNT, "The format of content is jpg.");
 
-               ImageMetadata* pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(pContentInfoImpl->GetContentPath(), true);
+               ImageMetadata* pImageMetadata = _ContentManagerUtilImpl::GetImageMetaN(changedPath, true);
                if (pImageMetadata != null)
                {
                        pContentInfoImpl->SetLatitude(pImageMetadata->GetLatitude());
@@ -1094,86 +1149,79 @@ _ContentManagerImpl::SaveDataToDatabase(const media_info_h pMediaInfo,
        int val = 0;
        unique_ptr<char[]> pStr(null);
 
-       if (pContentInfoImpl->GetAuthor() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       // author
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetAuthor()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               val = media_info_set_author(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_author failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetCategory() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       val = media_info_set_author(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_author failed[%d].", val);
 
-               val = media_info_set_category(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_category failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetContentName() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       // category
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetCategory()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               val = media_info_set_content_name(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_content_name failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetDescription() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       val = media_info_set_category(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_category failed[%d].", val);
 
-               val = media_info_set_description(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_description failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetKeyword() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       // content name
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetContentName()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               val = media_info_set_keyword(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_keyword failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetLocationTag() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       val = media_info_set_content_name(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_content_name failed[%d].", val);
 
-               val = media_info_set_location_tag(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_location_tag failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetProvider() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       // description
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetDescription()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
-               val = media_info_set_provider(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_provider failed[%d].", val);
-       }
-       if (pContentInfoImpl->GetRating() != null)
-       {
-               pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
-               SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
-                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
+       val = media_info_set_description(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_description failed[%d].", val);
 
-               val = media_info_set_age_rating(pMediaInfo, pStr.get());
-               SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
-                               "media_info_set_age_rating failed[%d].", val);
-       }
+       // keyword
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetKeyword()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+       val = media_info_set_keyword(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_keyword failed[%d].", val);
+
+       // location tag
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetLocationTag()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+       val = media_info_set_location_tag(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_location_tag failed[%d].", val);
+
+       // provider
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetProvider()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+       val = media_info_set_provider(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_provider failed[%d].", val);
+
+       // rating
+       pStr.reset(_StringConverter::CopyToCharArrayN(pContentInfoImpl->GetRating()));
+       SysTryReturn(NID_CNT, pStr != null, UuId::GetInvalidUuId(), E_OUT_OF_MEMORY,
+                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+       val = media_info_set_age_rating(pMediaInfo, pStr.get());
+       SysTryReturn(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, UuId::GetInvalidUuId(), ConvertError(val),
+                       "media_info_set_age_rating failed[%d].", val);
+
+       // latitude, longitude, altitude
        if (Double::Compare(pContentInfoImpl->GetLatitude(), DEFAULT_COORDINATE) != 0 &&
                        Double::Compare(pContentInfoImpl->GetLongitude(), DEFAULT_COORDINATE) != 0)
        {
@@ -1264,30 +1312,8 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, int systemTy
 
                String strFilePath(pStrValue.get());
 
-               // If the api version is 2.0, the content path has to be changed.
-               if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
-               {
-                       if (strFilePath.StartsWith(Environment::GetMediaPath(), 0))
-                       {
-                               r = strFilePath.Replace(Environment::GetMediaPath(), OSP_MEDIA_PHONE);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "The content path is not changed.");
-                       }
-                       else if (strFilePath.StartsWith(Environment::GetExternalStoragePath(), 0))
-                       {
-                               r = strFilePath.Replace(Environment::GetExternalStoragePath(), OSP_MEDIA_MMC);
-                               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Replace failed.");
-                       }
-                       else
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] The content path is not supported.");
-                               return E_INVALID_ARG;
-                       }
-               }
-
                pContentInfoImpl->SetContentPath(strFilePath);
-
-               SysSecureLog(NID_CNT, "INFO: contentPath[%ls]", strFilePath.GetPointer());
+               SysSecureLog(NID_CNT, "INFO: contentPath[%ls]", (pContentInfoImpl->GetContentPath()).GetPointer());
        }
 
        // mimeType
@@ -1346,6 +1372,20 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, int systemTy
        pContentInfoImpl->SetDateTime(dt);
        SysLog(NID_CNT, "INFO: dateTime[%ls]", ((pContentInfoImpl->GetDateTime()).ToString()).GetPointer());
 
+       // modifiedTime
+       time_t modifiedTime = 0;
+       val = media_info_get_modified_time(pMediaInfo, &modifiedTime);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "media_info_get_modified_time failed[%d].", val);
+
+       r = dt.SetValue(1970, 1, 1);
+       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform datetime.SetValue operation.");
+       r = dt.AddSeconds(modifiedTime);
+       SysTryReturnResult(NID_CNT, !IsFailed(r), r, "Failed to perform datetime.AddSeconds operation.");
+
+       pContentInfoImpl->SetModifiedTime(dt);
+       SysLog(NID_CNT, "INFO: modifiedTime[%ls]", ((pContentInfoImpl->GetModifiedTime()).ToString()).GetPointer());
+
        // thumbnailPath
        val = media_info_get_thumbnail_path(pMediaInfo, &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
@@ -1357,7 +1397,6 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, int systemTy
                String thumbnailPath(pStrValue.get());
 
                pContentInfoImpl->SetThumbnailPath(thumbnailPath);
-
                SysLog(NID_CNT, "INFO: thumbnailPath[%ls]", (pContentInfoImpl->GetThumbnailPath()).GetPointer());
        }
 
@@ -1539,7 +1578,9 @@ _ContentManagerImpl::MakeContentInfo(const media_info_h pMediaInfo, int systemTy
 result
 _ContentManagerImpl::MakeImageContentInfo(const media_info_h pMediaInfo, void* pInfoImpl) const
 {
+       result r = E_SUCCESS;
        int intValue = 0;
+       bool boolValue = false;
        image_meta_h pTempMeta = null;
        unique_ptr<image_meta_h, _ImageMetaDeleter> pImageMeta(null);
 
@@ -1619,6 +1660,114 @@ _ContentManagerImpl::MakeImageContentInfo(const media_info_h pMediaInfo, void* p
                SysLog(NID_CNT, "META: title[%ls]", fileName.GetPointer());
        }
 
+       // dateTaken
+       val = image_meta_get_date_taken(*(pImageMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "image_meta_get_date_taken failed[%d].", val);
+
+       DateTime dt;
+
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
+               String dateTaken(pStrValue.get());
+               String newDateTaken(L"");
+
+               // detour the unexpected datetaken format
+               String tempDelim(L"+-Z");
+               String token;
+
+               StringTokenizer tempStrTok(dateTaken, tempDelim);
+
+               r = tempStrTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               dateTaken = token;
+
+               String delim(L": ");
+               String year(L"");
+
+               StringTokenizer strTok(dateTaken, delim);
+
+               r = strTok.SetDelimiters(delim);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform SetDelimiters operation.");
+
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               year = token;
+
+               // Append month
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               r = newDateTaken.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newDateTaken.Append(L"/");
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               // Append day
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               r = newDateTaken.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newDateTaken.Append(L"/");
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               // Append year
+               r = newDateTaken.Append(year);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newDateTaken.Append(L" ");
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               String newDelim(L" ");
+
+               r = strTok.SetDelimiters(newDelim);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform SetDelimiters operation.");
+
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               r = newDateTaken.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = DateTime::Parse(newDateTaken, dt);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform Parse operation for DateTime.");
+       }
+       else
+       {
+               dt = DateTime::GetMinValue();
+       }
+
+       pImageContentInfoImpl->SetImageTakenDate(dt);
+       SysLog(NID_CNT, "META: dateTaken[%ls]", dt.ToString().GetPointer());
+
+       // isBurstShot
+       val = image_meta_is_burst_shot(*(pImageMeta.get()), &boolValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "image_meta_is_burst_shot failed[%d].", val);
+
+       pImageContentInfoImpl->SetBurstShot(boolValue);
+       SysLog(NID_CNT, "META: isBurstShot[%d]", boolValue);
+
+       // burstShotId
+       val = image_meta_get_burst_id(*(pImageMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "image_meta_get_burst_id failed[%d].", val);
+
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
+               String burstShotId(pStrValue.get());
+
+               pImageContentInfoImpl->SetBurstShotId(burstShotId);
+               SysLog(NID_CNT, "META: burstShotId[%ls]", burstShotId.GetPointer());
+       }
+
        return E_SUCCESS;
 }
 
@@ -1900,14 +2049,7 @@ _ContentManagerImpl::MakeVideoContentInfo(const media_info_h pMediaInfo, void* p
        pVideoContentInfoImpl->SetDuration(intValue);
        SysLog(NID_CNT, "META: duration[%d]", intValue);
 
-       // Get from metadata extractor (framerate, audio bitrate, video bitrate)
-       VideoMetadata* pVideoMetadata = ContentManagerUtil::GetVideoMetaN(pVideoContentInfoImpl->GetContentPath());
-       result r = GetLastResult();
-       SysTryReturnResult(NID_CNT, pVideoMetadata != null, r, "GetVideoMetadata() failed.");
-
-       pVideoContentInfoImpl->SetFramerate(pVideoMetadata->GetFramerate());
-       pVideoContentInfoImpl->SetAudioBitrate(pVideoMetadata->GetAudioBitrate());
-       pVideoContentInfoImpl->SetVideoBitrate(pVideoMetadata->GetVideoBitrate());
+       // Get some information from metadata extractor when calling VideoContentInfo (framerate, audio bitrate, video bitrate)
 
        return E_SUCCESS;
 }
@@ -1940,57 +2082,67 @@ _ContentManagerImpl::VerifyHomeFilePathCompatibility(const String& contentPath)
 }
 
 bool
-_ContentManagerImpl::VerifyMediaFilePathCompatibility(const String& contentPath, bool checkVersion) const
+_ContentManagerImpl::VerifyMediaFilePathCompatibility(const String& contentPath) const
 {
        ClearLastResult();
 
-       result r = E_SUCCESS;
-
        if (!_AppInfo::IsOspCompat())
        {
-               if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0) || contentPath.StartsWith(OSP_MEDIA_MMC, 0))
-               {
-                       SysLogException(NID_CNT, E_INVALID_ARG, "[E_INVALID_ARG] /Media or /Storagecard/Media is not supported.");
-                       return false;
-               }
                if (!(contentPath.StartsWith(Environment::GetMediaPath(), 0) ||
                                contentPath.StartsWith(Environment::GetExternalStoragePath(), 0)))
                {
-                       SysLogException(NID_CNT, E_INVALID_ARG, "[E_INVALID_ARG] This path is not supported.");
+                       SysLogException(NID_CNT, E_INVALID_ARG, "[%s] This path is not supported.", GetErrorMessage(E_INVALID_ARG));
                        return false;
                }
        }
        else
        {
-               String tempPath(contentPath);
-
                // prior to 2.0
-               if (contentPath.StartsWith(OSP_MEDIA_PHONE, 0))
-               {
-                       r = tempPath.Replace(OSP_MEDIA_PHONE, Environment::GetMediaPath());
-                       SysTryReturn(NID_CNT, !IsFailed(r), false, E_INVALID_ARG, "[E_INVALID_ARG] Replace failed.");
-               }
-               else if (contentPath.StartsWith(OSP_MEDIA_MMC, 0))
-               {
-                       r = tempPath.Replace(OSP_MEDIA_MMC, Environment::GetExternalStoragePath());
-                       SysTryReturn(NID_CNT, !IsFailed(r), false, E_INVALID_ARG, "[E_INVALID_ARG] Replace failed.");
-               }
-               else
+               if (!(contentPath.StartsWith(OSP_MEDIA_PHONE, 0)) ||
+                               (contentPath.StartsWith(OSP_MEDIA_MMC, 0)))
                {
-                       // CreateContent(const ByteBuffer&, ...) and CreateContent (const Sring&, ...) can receive old path like /Media/.
-                       // but CreateContent(const ContentInfo&) always receive new path like /opt/media/ because ContentInfo class convert the path from /Media/ to /opt/media.
-                       if (!checkVersion)
-                       {
-                               SysLogException(NID_CNT, E_INVALID_ARG,
-                                               "[E_INVALID_ARG] The path should start with /Home, /Media, or /Storagecard/Media.");
-                               return false;
-                       }
+                       SysLogException(NID_CNT, E_INVALID_ARG, "[%s] The path should start with /Media, or /Storagecard/Media.", GetErrorMessage(E_INVALID_ARG));
+                       return false;
                }
        }
 
        return true;
 }
 
+result
+_ContentManagerImpl::ChangeTizenPathToCompat(const String& contentPath, String& changedPath) const
+{
+       result r = E_SUCCESS;
+       changedPath = contentPath;
+
+       // If the api version is 2.0, the content path has to be changed.
+       if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+       {
+               r = _FileImpl::ConvertPhysicalToVirtualPath(contentPath, changedPath);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG,
+                               "[%s] Failed to convert physical path to virtual path.", GetErrorMessage(E_INVALID_ARG));
+       }
+
+       return r;
+}
+
+result
+_ContentManagerImpl::ChangeCompatPathToTizen(const String& contentPath, String& changedPath) const
+{
+       result r = E_SUCCESS;
+       changedPath = contentPath;
+
+       // If the api version is 2.0, the content path has to be changed.
+       if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
+       {
+               r = _FileImpl::ConvertVirtualToPhysicalPath(contentPath, changedPath);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG,
+                               "[%s] Failed to convert virtual path to physical path.", GetErrorMessage(E_INVALID_ARG));
+       }
+
+       return r;
+}
+
 void
 _ContentManagerImpl::SetListener(IContentUpdateEventListener* pListener)
 {