sync with tizen_2.0
[platform/framework/native/appfw.git] / src / app / FApp_AppControlRegistry.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file         FApp_AppControlRegistry.cpp
20  * @brief       This is the implementation for the _AppControlRegistry.cpp class.
21  */
22
23 #include <new>
24 #include <unique_ptr.h>
25 #include <app.h>
26 #include <bundle.h>
27
28 #include <FBaseErrors.h>
29 #include <FBaseSysLog.h>
30 #include <FBaseColAllElementsDeleter.h>
31 #include <FBaseColHashMap.h>
32 #include <FAppAppControl.h>
33 #include <FIoRegistry.h>
34 #include <FIoFile.h>
35
36 #include <FBase_StringConverter.h>
37 #include <FIo_RegistryImpl.h>
38
39 #include "FAppPkg_PackageManagerImpl.h"
40 #include "FApp_AppControlImpl.h"
41 #include "FApp_Aul.h"
42 #include "FApp_AppControlRegistry.h"
43 #include "FApp_AppMessageImpl.h"
44 #include "FApp_TemplateUtil.h"
45 #ifdef _SINGLETON_CLEANUP
46 #include "FApp_LongevityManager.h"
47 #endif
48
49 using namespace Tizen::App::Package;
50 using namespace Tizen::Base;
51 using namespace Tizen::Base::Collection;
52 using namespace Tizen::Io;
53
54 namespace
55 {
56
57 const wchar_t ACTL_PRIVATE_FILE[] = L"/usr/etc/app-control-system.ini";
58 const wchar_t ACTL_DEFAULT_FILE[] = L"/usr/etc/app-control-info.ini";
59 const wchar_t ACTL_LEGACY_FILE[] = L"/usr/etc/app-control-alias.ini";
60 const wchar_t ACTL_ALIAS_FILE[] = L"/usr/etc/app-control-appid.ini";
61 const wchar_t ACTL_PRIVATE_ALIAS_FILE[] = L"/usr/etc/app-control-private-appid.ini";
62
63 const wchar_t TIZEN_ALIAS_APPID_PREFIX[] = L"tizen.";
64
65 const String ACTL_REGISTRY_OP_NUM = L"OPID_Count";
66 const String ACTL_REGISTRY_PUBLIC = L"Public";
67 const String ACTL_REGISTRY_LAUNCH_TYPE = L"LaunchType";
68 const String ACTL_REGISTRY_PATH = L"Path";
69 const String ACTL_REGISTRY_CATEGORY = L"Category";
70 const String ACTL_REGISTRY_TITLE = L"Title";
71 const String ACTL_REGISTRY_ALIAS_PROVIDER = L"PROVIDER_ALIAS";
72
73 const int PKG_CATEGORY_LEN = 256;
74 const int PKG_APPID_LEN = 256;
75 const int REG_VALUE_BUFFER_LEN = 256;
76
77 }
78
79
80 namespace Tizen { namespace App
81 {
82
83 _AppControlRegistry* _AppControlRegistry::__pSelf = null;
84
85 _AppControlRegistry::_AppControlRegistry(void)
86 {
87         __nativeList.Construct();
88
89         __aliasList.Construct();
90
91         __aliasOperation.Construct();
92
93         __aliasAppId.Construct();
94 }
95
96 _AppControlRegistry::~_AppControlRegistry(void)
97 {
98         _DeleteCollection<AppControl>(__nativeList);
99
100         _DeleteCollectionMapValue<String, _AppControlAliasEntry>(__aliasList);
101 }
102
103 _AppControlRegistry*
104 _AppControlRegistry::GetInstance(void)
105 {
106         if (__pSelf == null)
107         {
108                 SysLog(NID_APP, "Create new instance");
109                 __pSelf = new (std::nothrow) _AppControlRegistry();
110                 SysTryReturn(NID_APP, __pSelf != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory.");
111                 SysAssertf(__pSelf != null, "AppControl registry instance creation failure");
112
113                 __pSelf->LoadRegistry();
114
115                 __pSelf->LoadLegacyList();
116
117                 __pSelf->LoadAliasList();
118
119 #ifdef _SINGLETON_CLEANUP
120                 _LongevityManager::GetInstance().RegisterOwnership(*__pSelf);
121 #endif
122         }
123
124         return __pSelf;
125 }
126
127 result
128 _AppControlRegistry::LoadRegistry(void)
129 {
130         _RegistryImpl reg;
131
132         String regPath = ACTL_PRIVATE_FILE;
133
134         // if ACTL_SYSTEM does not exist, then use default name
135         if (!File::IsFileExist(regPath))
136         {
137                 regPath = ACTL_DEFAULT_FILE;
138         }
139
140         result r = reg.Construct(regPath, REG_OPEN_READ_ONLY, null);
141         SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
142
143         const int sec_count = reg.GetAllSectionCount();
144         SysTryReturnResult(NID_APP, !(sec_count <= 0), E_OBJ_NOT_FOUND, "Registry contains no data.");
145
146         SysLog(NID_APP, "Loading %d sections from %ls", sec_count, regPath.GetPointer());
147
148         int index = 0;
149         int size = 0;
150         int num = 0;
151         String actl_path;
152         String actl_name;
153
154
155         // actual parameter manipulation
156         for (int i = 0; i < sec_count; i++)
157         {
158                 ///////////////////////////////////////////////////////////////////////
159                 // appcontrol Id
160                 String sec_name(reg.GetSectionName(i));
161                 sec_name.Trim();
162
163                 if (sec_name.IsEmpty())
164                 {
165                         continue;
166                 }
167
168                 int public_open = 0;
169                 int launch_type = 0;
170
171                 ///////////////////////////////////////////////////////////////////////
172                 // Plubic
173                 index = reg.GetEntryIndex(i, ACTL_REGISTRY_PUBLIC);
174                 if (index >= 0)
175                 {
176                         size = sizeof(size);
177                         num = 0;
178
179                         reg.GetEntryValue(i, index, REG_VALUE_TYPE_INT, &num, &size);
180                         if (num == 1)
181                         {
182                                 // public
183                                 public_open = 1;
184                         }
185                 }
186
187                 ///////////////////////////////////////////////////////////////////////
188                 // Launch type
189                 index = reg.GetEntryIndex(i, ACTL_REGISTRY_LAUNCH_TYPE);
190                 if (index >= 0)
191                 {
192                         size = sizeof(size);
193
194                         reg.GetEntryValue(i, index, REG_VALUE_TYPE_INT, &launch_type, &size);
195                 }
196
197                 ///////////////////////////////////////////////////////////////////////
198                 // Path
199                 index = reg.GetEntryIndex(i, ACTL_REGISTRY_PATH);
200                 if (index >= 0)
201                 {
202                         size = REG_VALUE_BUFFER_LEN;
203                         reg.GetEntryValue(i, index, REG_VALUE_TYPE_STRING, &actl_path, &size);
204
205                         if (launch_type == _APPCONTROL_TYPE_OSP)
206                         {
207                                 if (!_Aul::IsInstalled(actl_path))
208                                 {
209                                         SysLog(NID_APP, "Osp app %ls not installed.", actl_path.GetPointer());
210                                         continue;
211                                 }
212                                 // [FIXME] retrieve from package info here
213                         }
214                 }
215
216                 ///////////////////////////////////////////////////////////////////////
217                 // Name
218                 // [FIXME] SLP localized name here
219                 index = reg.GetEntryIndex(i, ACTL_REGISTRY_TITLE);
220                 if (index >= 0)
221                 {
222                         size = REG_VALUE_BUFFER_LEN;
223                         reg.GetEntryValue(i, index, REG_VALUE_TYPE_STRING, &actl_name, &size);
224                 }
225
226                 //SysLog(NID_APP, "%dth iteration : %ls", i, sec_name.GetPointer());
227
228                 ///////////////////////////////////////////////////////////////////////
229                 // Number of operation Id
230                 index = reg.GetEntryIndex(i, ACTL_REGISTRY_OP_NUM);
231                 if (index >= 0)
232                 {
233                         size = sizeof(size);
234                         reg.GetEntryValue(i, index, REG_VALUE_TYPE_INT, &num, &size);
235
236                         String tagName;
237                         String actl_opId;
238
239                         //SysLog(NID_APP, "number of operation %d for index %d", num, index);
240
241                         for (int j = 0; j < num; j++)
242                         {
243                                 size = REG_VALUE_BUFFER_LEN;
244
245                                 ///////////////////////////////////////////////////////////////
246                                 // operation Id
247                                 tagName.Format(10, L"OPID_%d", j);
248
249                                 index = reg.GetEntryIndex(i, tagName);
250                                 if (index >= 0)
251                                 {
252                                         reg.GetEntryValue(i, index, REG_VALUE_TYPE_STRING, &actl_opId, &size);
253                                         actl_opId.Trim();
254                                 }
255                                 //SysLog(NID_APP, "Operation(%d) %ls", index, actl_opId.GetPointer());
256
257                                 ///////////////////////////////////////////////////////////////
258                                 // AppControl allocation
259
260                                 int prop = 0;
261                                 if (public_open == 1)
262                                 {
263                                         prop |= _APPCONTROL_PROPERTY_PUBLIC;
264                                 }
265
266                                 switch (launch_type)
267                                 {
268                                 case _APPCONTROL_TYPE_NATIVE:
269                                         prop |= _APPCONTROL_PROPERTY_SLP;
270                                         break;
271                                 case _APPCONTROL_TYPE_OSP:
272                                         prop |= _APPCONTROL_PROPERTY_OSP;
273                                         break;
274                                 default:
275                                         SysLog(NID_APP, "Invalid launch type %d", launch_type);
276                                         break;
277                                 }
278
279                                 //SysLog(NID_APP, "(%ls, %ls)", sec_name.GetPointer(), actl_opId.GetPointer());
280                                 AppControl* pAc = _AppControlImpl::CreateN(actl_path, sec_name, actl_opId, actl_name, prop);
281
282                                 if (pAc)
283                                 {
284                                         __nativeList.Add(pAc);
285                                 }
286                                 else
287                                 {
288                                         SysLog(NID_APP, "Failed to create AppControl instance (%ls, %ls, %d, %d)",
289                                                                 sec_name.GetPointer(), actl_opId.GetPointer(), public_open, launch_type);
290                                 }
291                         }
292                 }
293
294         }
295
296         SysLog(NID_APP, "Finished loading %d entries", __nativeList.GetCount());
297
298         return E_SUCCESS;
299 }
300
301 result
302 _AppControlRegistry::LoadLegacyList(void)
303 {
304         _RegistryImpl reg;
305
306         const String& regPath(ACTL_LEGACY_FILE);
307
308         result r = reg.Construct(regPath, REG_OPEN_READ_ONLY, null);
309         SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
310
311         const int sec_count = reg.GetAllSectionCount();
312         SysTryReturnResult(NID_APP, !(sec_count <= 0), E_OBJ_NOT_FOUND, "Registry contains no data.");
313
314         SysLog(NID_APP, "Loading %d sections from %ls", sec_count, regPath.GetPointer());
315
316         String aliasProvider;
317         String value;
318
319
320         // actual parameter manipulation
321         for (int i = 0; i < sec_count; i++)
322         {
323                 ///////////////////////////////////////////////////////////////////////
324                 // appcontrol Id
325                 const String& secName(reg.GetSectionName(i));
326
327                 ///////////////////////////////////////////////////////////////////////
328                 // aliased appcontrol name
329                 const int index = reg.GetEntryIndex(i, ACTL_REGISTRY_ALIAS_PROVIDER);
330                 if (index >= 0)
331                 {
332                         int size = REG_VALUE_BUFFER_LEN;
333                         reg.GetEntryValue(i, index, REG_VALUE_TYPE_STRING, &aliasProvider, &size);
334                 }
335
336                 ///////////////////////////////////////////////////////////////////////
337                 // Operations
338                 IList* pList = reg.GetAllEntryNamesN(secName);
339                 if (pList == null)
340                 {
341                         continue;
342                 }
343
344                 std::unique_ptr<IEnumerator> pEnum(pList->GetEnumeratorN());
345
346                 while (pEnum->MoveNext() == E_SUCCESS)
347                 {
348                         String* pStr = dynamic_cast<String*>(pEnum->GetCurrent());
349
350                         if (pStr == null || pStr->IsEmpty() || pStr->Equals(ACTL_REGISTRY_ALIAS_PROVIDER, false))
351                         {
352                                 continue;
353                         }
354
355                         r = reg.GetValue(secName, *pStr, value);
356                         if (IsFailed(r))
357                         {
358                                 SysLog(NID_APP, "[%s] Propagating.", GetErrorMessage(r));
359                                 continue;
360                         }
361
362                         bool b = false;
363                         __aliasOperation.ContainsKey(*pStr, b);
364                         if (b)
365                         {
366                                 __aliasOperation.SetValue(*pStr, value);
367                         }
368                         else
369                         {
370                                 __aliasOperation.Add(*pStr, value);
371                         }
372
373                         // add entry to aliasList
374                         _AppControlAliasEntry* pEntry = new (std::nothrow) _AppControlAliasEntry(secName, *pStr, aliasProvider, value);
375                         SysTryReturnResult(NID_APP, pEntry != null, E_OUT_OF_MEMORY, "Insufficient memory.");
376
377                         if (pEntry)
378                         {
379                                 SysLog(NID_APP, "(%ls, %ls)", secName.GetPointer(), aliasProvider.GetPointer());
380                                 __aliasList.Add(secName, pEntry);
381                         }
382                 }
383
384                 pList->RemoveAll(true);
385                 delete pList;
386         }
387
388         SysLog(NID_APP, "Finished loading %d entries with %d operation aliases.", __aliasList.GetCount(), __aliasOperation.GetCount());
389
390         return E_SUCCESS;
391 }
392
393 result
394 _AppControlRegistry::LoadAliasList(void)
395 {
396         _RegistryImpl reg;
397
398         String regPath = ACTL_PRIVATE_ALIAS_FILE;
399
400         // if ACTL_SYSTEM does not exist, then use default name
401         if (!File::IsFileExist(regPath))
402         {
403                 regPath = ACTL_ALIAS_FILE;
404         }
405
406         result r = reg.Construct(regPath, REG_OPEN_READ_ONLY, null);
407         SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
408
409         HashMap* pMap = null;
410         r = reg.GetEntryListN(L"Alias", &pMap);
411         if (r != E_SUCCESS)
412         {
413                 SysLog(NID_APP, "[%s] Propagating.", GetErrorMessage(r));
414                 delete pMap;
415                 return r;
416         }
417
418         String* pKey = null;
419         String* pVal = null;
420         std::unique_ptr<IMapEnumerator> pEnum(pMap->GetMapEnumeratorN());
421         SysTryCatch(NID_APP, pEnum.get(), r = E_OUT_OF_MEMORY , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory error.");
422
423         while(pEnum->MoveNext() == E_SUCCESS)
424         {
425                 pKey = static_cast<String*>(pEnum->GetKey());
426                 pVal = static_cast<String*>(pEnum->GetValue());
427
428                 __aliasAppId.Add(*pKey, *pVal);
429                 //SysLog(NID_APP, "(%ls, %ls)", pKey->GetPointer(), pVal->GetPointer());
430         }
431
432         SysLog(NID_APP, "Loading %d alias sections", __aliasAppId.GetCount());
433
434 CATCH:
435         delete pMap;
436
437         return r;
438 }
439
440
441 AppControl*
442 _AppControlRegistry::GetNativeAppControlN(const String& aId, const String& oId) const
443 {
444         std::unique_ptr< IEnumeratorT<AppControl*> > pEnum(__nativeList.GetEnumeratorN());
445
446         while (pEnum->MoveNext() == E_SUCCESS)
447         {
448                 AppControl* pAc = null;
449                 pEnum->GetCurrent(pAc);
450
451                 if (pAc->GetAppControlProviderId() == aId && pAc->GetOperationId() == oId)
452                 {
453                         SysLog(NID_APP, "Found matching AppControl (%ls, %ls)", aId.GetPointer(), oId.GetPointer());
454                         return _AppControlImpl::CreateN(*pAc);
455                 }
456         }
457
458         SysLog(NID_APP, "No matching AppControl (%ls, %ls)", aId.GetPointer(), oId.GetPointer());
459
460         return null;
461 }
462
463 //
464 // data structure for _AppControlRegistry::GetAppControlListN() only
465 // 
466 struct AppSvcIterData
467 {
468 public:
469         AppSvcIterData(ArrayList* pArr, const String& op) : pArray(pArr), operation(op) {}
470
471         ArrayList* pArray;
472         const String& operation;
473 };
474
475 //
476 // callback function for _AppControlRegistry::GetAppControlListN()
477 //
478 static int
479 AppSvcIterFnCb(const char* pAppId, void* pData)
480 {
481         SysAssert(pData != null);
482
483         AppSvcIterData* pAppSvcIterData = static_cast<AppSvcIterData*>(pData);
484         ArrayList* pList = pAppSvcIterData->pArray;
485         SysAssert(pList != null);
486         const String& operation = pAppSvcIterData->operation;
487
488         if (pAppId == NULL)
489         {
490                 SysLog(NID_APP, "Empty appId received.");
491                 return -1;
492         }
493
494         String appId = pAppId;
495         AppControl* pAc = _AppControlImpl::CreateN(appId, operation, false);
496         if (pAc == null)
497         {
498                 SysLog(NID_APP, "AppControl allocation failure for %ls.", appId.GetPointer());
499                 return -1;
500         }
501
502         pList->Add(pAc);
503
504         return 0;
505 }
506
507 Tizen::Base::Collection::ArrayList*
508 _AppControlRegistry::FindAppControlListN(const String* pOid, const String* pUri, const String* pMimeType, const String* pCategory) const
509 {
510         String operation = (pOid) ? *pOid : TIZEN_OPERATION_MAIN;
511
512         std::unique_ptr<bundle, BundleDeleter> pBundle(bundle_create());
513         SysTryReturn(NID_APP, pBundle.get(), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Bundle creation failure.");
514
515         _AppMessageImpl::SetOperation(pBundle.get(), operation);
516
517         if (pUri)
518         {
519                 _AppMessageImpl::SetUri(pBundle.get(), *pUri);
520         }
521
522         if (pMimeType)
523         {
524                 _AppMessageImpl::SetMime(pBundle.get(), *pMimeType);
525         }
526
527         if (pCategory)
528         {
529                 _AppMessageImpl::SetCategory(pBundle.get(), *pCategory);
530         }
531
532         ArrayList* pList = new (std::nothrow) ArrayList;
533         SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] ArrayList creation failure.");
534         pList->Construct();
535
536         AppSvcIterData data(pList, operation);
537
538         appsvc_get_list(pBundle.get(), AppSvcIterFnCb, reinterpret_cast<void*>(&data));
539
540         if (pList->GetCount() == 0)
541         {
542                 SysLog(NID_APP, "Found no AppControl entry for operation %ls.", operation.GetPointer());
543
544                 delete pList;
545                 pList = null;
546         }
547
548         return pList;
549 }
550
551 _AppControlRegistry::_AppControlAliasEntry*
552 _AppControlRegistry::GetAppControlAliasEntry(const String& aId, const String& oId) const
553 {
554         std::unique_ptr< IEnumeratorT<_AppControlAliasEntry*> > pEnum(__aliasList.GetValuesN(aId));
555         if (pEnum.get() == null)
556         {
557                 SysLog(NID_APP, "[E_OBJ_NOT_FOUND] No alias entry for %ls.", aId.GetPointer());
558                 return null;
559         }
560
561         while (pEnum->MoveNext() == E_SUCCESS)
562         {
563                 _AppControlAliasEntry* pEntry = null;
564                 pEnum->GetCurrent(pEntry);
565                 if (pEntry->provider == aId && pEntry->operation == oId)
566                 {
567                         SysLog(NID_APP, "Found matching AppControl (%ls, %ls)->(%ls, %ls)", aId.GetPointer(), oId.GetPointer(), pEntry->provider2.GetPointer(), pEntry->operation2.GetPointer());
568
569                         return pEntry;
570                 }
571         }
572
573         return null;
574 }
575
576 _AppControlRegistry::_AppControlAliasEntry*
577 _AppControlRegistry::GetReverseAppControlAliasEntry(const String& aId, const String& oId) const
578 {
579         std::unique_ptr< IMapEnumeratorT<String, _AppControlAliasEntry*> > pEnum(__aliasList.GetMapEnumeratorN());
580
581         while (pEnum->MoveNext() == E_SUCCESS)
582         {
583                 _AppControlAliasEntry* pEntry = null;
584                 pEnum->GetValue(pEntry);
585                 if (pEntry->provider2 == aId && pEntry->operation2 == oId)
586                 {
587                         SysLog(NID_APP, "Found matching AppControl (%ls, %ls)<-(%ls, %ls)", aId.GetPointer(), oId.GetPointer(), pEntry->provider.GetPointer(), pEntry->operation.GetPointer());
588
589                         return pEntry;
590                 }
591         }
592
593         return null;
594 }
595
596 AppControl*
597 _AppControlRegistry::GetAliasAppControlN(const String& aId, const String& oId) const
598 {
599         _AppControlAliasEntry* pEntry = GetAppControlAliasEntry(aId, oId);
600
601         if (pEntry)
602         {
603                 AppControl* pAc = GetNativeAppControlN(pEntry->provider2, pEntry->operation2);
604                 if (pAc)
605                 {
606                         _AppControlImpl* pImpl = _AppControlImpl::GetInstance(*pAc);
607                         pImpl->SetProperty(_APPCONTROL_PROPERTY_ALIAS);
608                 }
609                 else
610                 {
611                         pAc = GetAppControlN(pEntry->provider2, pEntry->operation2);
612                         if (pAc)
613                         {
614                                 _AppControlImpl* pImpl = _AppControlImpl::GetInstance(*pAc);
615                                 pImpl->SetProperty(_APPCONTROL_PROPERTY_ALIAS);
616                         }
617                         else
618                         {
619                                 SysLog(NID_APP, "No matching AppControl found.");
620                         }
621                 }
622
623                 return pAc;
624         }
625
626         SysLog(NID_APP, "No matching AppControl found.");
627         return null;
628 }
629
630 AppControl*
631 _AppControlRegistry::GetAppControlN(const String& appId, const String& operationId) const
632 {
633         bool changeAppId = false;
634
635         String actualAppId = appId;
636         if (appId.StartsWith(TIZEN_ALIAS_APPID_PREFIX, 0))
637         {
638                 String tmp;
639                 result r = __aliasAppId.GetValue(appId, tmp);
640                 if (r == E_SUCCESS)
641                 {
642                         actualAppId = tmp;
643                         SysLog(NID_APP, "Found alias appId (%ls -> %ls).", appId.GetPointer(), tmp.GetPointer());
644
645                         changeAppId = true;
646                 }
647         }
648
649         bool b = _Aul::IsInstalled(actualAppId);
650         SysTryReturn(NID_APP, b == true, null, E_APP_NOT_INSTALLED, "[E_APP_NOT_INSTALLED] %ls not installed.", actualAppId.GetPointer());
651
652         return _AppControlImpl::CreateN(actualAppId, operationId, changeAppId);
653 }
654
655 AppId
656 _AppControlRegistry::GetReverseAliasAppId(const AppId& appId) const
657 {
658         std::unique_ptr< IMapEnumeratorT<String, String> > pEnum(__aliasAppId.GetMapEnumeratorN());
659
660         String key;
661         String value;
662         while (pEnum->MoveNext() == E_SUCCESS)
663         {
664                 pEnum->GetKey(key);
665                 pEnum->GetValue(value);
666                 if (value == appId)
667                 {
668                         return key;
669                 }
670         }
671
672         SysLog(NID_APP, "No entry found for %ls", appId.GetPointer());
673         return L"";
674 }
675
676 String
677 _AppControlRegistry::GetAliasedOperation(const String& operation) const
678 {
679         bool b = false;
680         __aliasOperation.ContainsKey(operation, b);
681
682         if (b)
683         {
684                 String tmp;
685                 __aliasOperation.GetValue(operation, tmp);
686                 return tmp;
687         }
688         else
689         {
690                 return String();
691         }
692 }
693
694 } } // Tizen::App