Merge "Revert "Fix prevent defect for locales"" into devel_3.0_main
[platform/framework/native/appfw.git] / src / security / FSec_PrivacyInfoImpl.cpp
index d573eb2..d436b14 100755 (executable)
@@ -1,5 +1,4 @@
 //
-// Open Service Platform
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
 #include <unique_ptr.h>
 #include <FSecPrivacyInfo.h>
 #include <FBaseSysLog.h>
-#include <FBaseUtilStringTokenizer.h>
+#include <FBase_StringConverter.h>
 #include <FSec_AccessController.h>
+#include <privacy_info_client.h>
 #include "FSec_PrivacyInfoImpl.h"
 
 using namespace Tizen::Base;
-using namespace Tizen::Base::Utility;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Security;
 
@@ -79,11 +78,24 @@ String
 _PrivacyInfoImpl::GetDisplayName(void) const
 {
        String displayName;
-    StringTokenizer strTok(__privacyId, L"/");
-    while(strTok.HasMoreTokens() == true)
-    {
-       strTok.GetNextToken(displayName);
-    }
+
+       int ret = PRIV_MGR_ERROR_SUCCESS;
+       char* pPrivacyDisplayName;
+       privacy_info_client_s privacyInfo;
+
+       std::unique_ptr<char[]> pPrivacyId(null);
+       pPrivacyId.reset(_StringConverter::CopyToCharArrayN(__privacyId));
+       SysTryReturn(NID_SEC, pPrivacyId != null, displayName, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+
+       privacyInfo.privacy_id = pPrivacyId.get();
+       ret = privacy_info_client_get_privacy_display_name(&privacyInfo, &pPrivacyDisplayName);
+       SysTryReturn(NID_SEC, ret == PRIV_MGR_ERROR_SUCCESS, displayName, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       displayName.Append(pPrivacyDisplayName);
+
+       if (pPrivacyDisplayName != null)
+       {
+               free(pPrivacyDisplayName);
+       }
 
        return displayName;
 }
@@ -91,7 +103,7 @@ _PrivacyInfoImpl::GetDisplayName(void) const
 String
 _PrivacyInfoImpl::GetDescription(void) const
 {
-       String description("undefined");
+       String description("Undefined");
        return description;
 }