2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 * @file FAppPkg_PackageAppInfoImpl.cpp
18 * @brief This is the implementation for the _PackageAppInfoImpl class.
24 #include <unique_ptr.h>
26 #include <pkgmgr-info.h>
28 #include <FAppPkgPackageManager.h>
29 #include <FAppPkgPackageAppInfo.h>
30 #include <FBaseSysLog.h>
31 #include <FIoDatabase.h>
32 #include <FIoDbEnumerator.h>
33 #include <FIoDbStatement.h>
35 #include <FIoDirectory.h>
36 #include <FBase_StringConverter.h>
38 #include "FAppPkg_PackageManagerImpl.h"
39 #include "FApp_AppResourceImpl.h"
40 #include "FApp_TemplateUtil.h"
42 using namespace Tizen::Base;
43 using namespace Tizen::Base::Collection;
44 using namespace Tizen::Graphics;
45 using namespace Tizen::Io;
47 namespace Tizen { namespace App { namespace Package
51 _PackageAppInfoImpl::GetAppId(void) const
57 _PackageAppInfoImpl::SetAppId(const AppId& appId)
64 _PackageAppInfoImpl::GetAppName(void) const
70 _PackageAppInfoImpl::SetAppName(const String& appName)
77 _PackageAppInfoImpl::GetAppDisplayName(void) const
79 return __appDiplayName;
83 _PackageAppInfoImpl::SetAppDisplayName(const String& appDiplayName)
85 __appDiplayName = appDiplayName;
90 _PackageAppInfoImpl::GetAppMenuIconPath(void) const
96 _PackageAppInfoImpl::SetAppMenuIconPath(const String& iconPath)
98 __appIconPath = iconPath;
103 _PackageAppInfoImpl::GetAppSettingIconPath(void) const
105 return __appSettingIconPath;
109 _PackageAppInfoImpl::SetAppSettingIconPath(const String& appSettingIcon)
111 __appSettingIconPath = appSettingIcon;
116 _PackageAppInfoImpl::GetAppNotificationIconPath(void) const
118 return __appNotificationIconPath;
122 _PackageAppInfoImpl::SetAppNotificationIconPath(const String& notificationIconPath)
124 __appNotificationIconPath = notificationIconPath;
129 _PackageAppInfoImpl::GetAppMenuIconBufferN(int& size) const
133 char* pBuffer = new (std::nothrow) char[__iconSize];
134 SysTryReturn(NID_APP, pBuffer, null, E_OUT_OF_MEMORY, "pBuffer is null.");
136 memset(pBuffer, 0, __iconSize);
137 memcpy(pBuffer, __pIconBuffer, __iconSize);
149 _PackageAppInfoImpl::SetAppMenuIconBuffer(char* pBuffer, int size)
153 __pIconBuffer = new (std::nothrow) char[size];
154 SysTryReturnResult(NID_APP, __pIconBuffer, E_OUT_OF_MEMORY, "__pIconBuffer is null.");
158 memset(__pIconBuffer, 0, __iconSize);
159 memcpy(__pIconBuffer, pBuffer, __iconSize);
166 _PackageAppInfoImpl::GetAppMenuIconN(void) const
168 Bitmap* pBitmap = null;
173 if (__appIconPath.IsEmpty() == true)
178 iconPath = __appIconPath;
179 pBitmap = _AppResourceImpl::GetNonScalingBitmapN(iconPath);
183 if ((__pIconBuffer == null) || (__iconSize <= 0))
188 iconPath = L"/tmp/icon.png";
189 if (File::IsFileExist(iconPath) == true)
191 File::Remove(iconPath);
194 result r = E_SUCCESS;
197 r = file.Construct(iconPath, "w");
198 SysTryReturn(NID_APP, r == E_SUCCESS, null, E_SYSTEM, "file.Construct() failed.");
200 r = file.Write((void*)__pIconBuffer, __iconSize);
201 SysTryReturn(NID_APP, r == E_SUCCESS, null, E_SYSTEM, "file.Write() failed.");
205 pBitmap = _AppResourceImpl::GetNonScalingBitmapN(iconPath);
207 File::Remove(iconPath);
211 SysLog(NID_APP, "iconPath = [%ls]", iconPath.GetPointer());
217 _PackageAppInfoImpl::GetAppMetadataListN(void) const
221 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "__pAppInfoHandle is null.");
223 int res = PMINFO_R_OK;
225 std::unique_ptr< HashMap > pMap(new (std::nothrow) HashMap());
226 SysTryReturn(NID_APP, pMap, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
229 res = pkgmgrinfo_appinfo_foreach_metadata(__pAppInfoHandle, MetadataHandler, pMap.get());
230 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_metadata() failed. [%d]", res);
232 if (pMap->GetCount() <= 0)
237 return pMap.release();
241 SysLog(NID_APP, "GetAppMetadataListN() is not available.");
247 _PackageAppInfoImpl::GetAppCategoryListN(void) const
251 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "[E_SYSTEM] __pAppInfoHandle is null.");
253 int res = PMINFO_R_OK;
255 std::unique_ptr< ArrayList > pList(new (std::nothrow) ArrayList());
256 SysTryReturn(NID_APP, pList, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
259 res = pkgmgrinfo_appinfo_foreach_category(__pAppInfoHandle, CategoryHandler, pList.get());
260 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_category() failed. [%d]", res);
262 if (pList->GetCount() <= 0)
267 return pList.release();
271 SysLog(NID_APP, "GetAppCategoryListN() is not available.");
277 _PackageAppInfoImpl::IsMenuIconVisible(void) const
279 return __launchingIconVisible;
283 _PackageAppInfoImpl::SetMenuIconVisible(bool visible)
285 __launchingIconVisible = visible;
290 _PackageAppInfoImpl::IsMainApp(void) const
296 _PackageAppInfoImpl::SetMainApp(bool mainApp)
303 _PackageAppInfoImpl::IsServiceApp(void) const
309 _PackageAppInfoImpl::AddCategory(String* pCategory)
311 result r = E_SUCCESS;
312 r = __pAppCategoryList->Add(*pCategory);
313 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppCategoryList->Add() is failed.");
319 _PackageAppInfoImpl::GetAppFeature(const String& key) const
321 SysTryReturn(NID_APP, __appId.IsEmpty() == false, L"", E_SYSTEM, "__appId is empty.");
327 query.Format(1024, L"SELECT AppFeature.VALUE FROM AppInfo, AppFeature WHERE AppFeature.ID = AppInfo.UNIQUE_ID and AppFeature.NAME = '%ls' and AppInfo.PACKAGE_NAME = '%ls'",
328 key.GetPointer(), __appId.GetPointer());
330 SysLog(NID_APP, "query = [%ls]", query.GetPointer());
332 result r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
333 SysTryReturn(NID_APP, r == E_SUCCESS, L"", E_SYSTEM, "db.Construct() failed. [%s]", GetErrorMessage(r));
335 std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
336 SysTryReturn(NID_APP, pStmt, L"", E_SYSTEM, "CreateStatementN(%ls) failed. [%s]", query.GetPointer(), GetErrorMessage(GetLastResult()));
338 std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
339 if ((GetLastResult() == E_SUCCESS) && (pEnum == null))
343 SysTryReturn(NID_APP, pEnum, L"", E_SYSTEM, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
345 while (pEnum->MoveNext() == E_SUCCESS)
347 pEnum->GetStringAt(0, value);
350 SysLog(NID_APP, "value = [%ls]", value.GetPointer());
356 _PackageAppInfoImpl::GetInstance(PackageAppInfo* pPackageAppInfo)
360 return pPackageAppInfo->__pPackageAppInfoImpl;
367 _PackageAppInfoImpl::Construct(const AppId& appId)
369 SysTryReturnResult(NID_APP, appId.IsEmpty() == false, E_INVALID_ARG, "appId is empty.");
371 int res = PMINFO_R_OK;
372 char* pExePath = null;
373 char* pDisplayName = null;
374 char* pMenuIcon = null;
375 char* pSettingIcon = null;
376 char* pNotificationIcon = null;
377 char* pComponentType = null;
378 bool mainApp = false;
379 bool menuIconVisible = false;
381 std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
382 SysTryReturnResult(NID_APP, pAppId, E_OUT_OF_MEMORY, "pAppId is null");
384 res = pkgmgrinfo_appinfo_get_appinfo(pAppId.get(), &__pAppInfoHandle);
385 SysTryReturnResult(NID_APP, res == 0, E_SYSTEM, "pkgmgrinfo_appinfo_get_appinfo failed, res = [%d], app = [%s]", res, pAppId.get());
387 __fromDatabase = true;
391 res = pkgmgrinfo_appinfo_get_exec(__pAppInfoHandle, &pExePath);
392 if (res == PMINFO_R_OK)
394 String exePath(pExePath);
395 int startIndex = exePath.GetLength() - 1;
397 result r = exePath.LastIndexOf(L'/', startIndex, indexOf);
401 exePath.SubString(indexOf + 1, appName);
403 SysLog(NID_APP, "appName = [%ls]", appName.GetPointer());
407 SysLog(NID_APP, "LastIndexOf is failed.");
412 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec() is failed. result = [%d]", res);
415 res = pkgmgrinfo_appinfo_get_label(__pAppInfoHandle, &pDisplayName);
416 if (res == PMINFO_R_OK)
418 String displayName(pDisplayName);
419 SetAppDisplayName(displayName);
423 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label() is failed. result = [%d]", res);
426 res = pkgmgrinfo_appinfo_get_icon(__pAppInfoHandle, &pMenuIcon);
427 if (res == PMINFO_R_OK)
429 String menuIcon(pMenuIcon);
430 SetAppMenuIconPath(menuIcon);
434 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon() is failed. result = [%d]", res);
437 res = pkgmgrinfo_appinfo_get_setting_icon(__pAppInfoHandle, &pSettingIcon);
438 if (res == PMINFO_R_OK)
440 String settingIcon(pSettingIcon);
441 SetAppSettingIconPath(settingIcon);
445 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon() is failed. result = [%d]", res);
448 res = pkgmgrinfo_appinfo_get_notification_icon(__pAppInfoHandle, &pNotificationIcon);
449 if (res == PMINFO_R_OK)
451 String notificationIcon(pNotificationIcon);
452 SetAppNotificationIconPath(notificationIcon);
456 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon() is failed. result = [%d]", res);
459 res = pkgmgrinfo_appinfo_is_mainapp(__pAppInfoHandle, &mainApp);
460 if (res == PMINFO_R_OK)
466 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp() is failed. result = [%d]", res);
469 res = pkgmgrinfo_appinfo_is_nodisplay(__pAppInfoHandle, &menuIconVisible);
470 if (res == PMINFO_R_OK)
472 SetMenuIconVisible(!menuIconVisible);
476 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay() is failed. result = [%d]", res);
479 res = pkgmgrinfo_appinfo_get_component_type(__pAppInfoHandle, &pComponentType);
480 if (res == PMINFO_R_OK)
482 if (strcasecmp(pComponentType, "svcapp") == 0)
488 __serviceApp = false;
493 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_component() is failed. result = [%d]", res);
496 SysLog(NID_APP, "exe = [%s], displayName = [%s], mainApp = [%d], menuIconVisible = [%d], serviceApp = [%d]", pExePath, pDisplayName, mainApp, menuIconVisible, __serviceApp);
502 _PackageAppInfoImpl::CategoryHandler(const char* pCategoryName, void* pUserData)
504 SysTryReturn(NID_APP, pCategoryName != null, 0, E_SYSTEM, "[E_SYSTEM] pCategoryName must not be null.");
506 SysLog(NID_APP, "Category = [%s]", pCategoryName);
507 ArrayList* pList = (ArrayList*) pUserData;
509 String* pCategory = new (std::nothrow) String (pCategoryName);
510 SysTryReturn(NID_APP, pCategory != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pCategory instance must not be null.");
512 pList->Add(*pCategory);
518 _PackageAppInfoImpl::MetadataHandler(const char* pKey, const char* pValue, void* pUserData)
520 SysTryReturn(NID_APP, pKey, 0, E_SYSTEM, "pKey must not be null.");
521 SysTryReturn(NID_APP, pValue, 0, E_SYSTEM, "pValue must not be null.");
522 SysTryReturn(NID_APP, pUserData, 0, E_SYSTEM, "pUserData must not be null.");
524 SysLog(NID_APP, "Key = [%s], Value = [%s]", pKey, pValue);
526 MultiHashMap* pMultiMap = (MultiHashMap*) pUserData;
527 result r = pMultiMap->Add(*(new (std::nothrow) String(pKey)), *(new (std::nothrow) String(pValue)));
528 SysTryReturn(NID_APP, r == E_SUCCESS, -1, E_SYSTEM, "pMultiMap->Add() failed. [%s]", GetErrorMessage(GetLastResult()));
534 _PackageAppInfoImpl::_PackageAppInfoImpl(void)
535 : __launchingIconVisible(true)
537 , __serviceApp(false)
538 , __fromDatabase(false)
539 , __pLaunchConditionImplList(null)
540 , __pNotificationImplList(null)
541 , __pAppFeatureImplList(null)
542 , __pDataControlImplList(null)
543 , __pAppControlImplList(null)
544 , __pAppCategoryList(null)
549 , __pAppInfoHandle(null)
550 , __pIconBuffer(null)
553 __pLaunchConditionImplList = new (std::nothrow) ArrayList;
554 SysTryReturnVoidResult(NID_APP, __pLaunchConditionImplList != null, E_OUT_OF_MEMORY, "__pLaunchConditionImplList instance must not be null.");
555 __pLaunchConditionImplList->Construct();
557 __pNotificationImplList = new (std::nothrow) ArrayList;
558 SysTryReturnVoidResult(NID_APP, __pNotificationImplList != null, E_OUT_OF_MEMORY, "__pNotificationImplList instance must not be null.");
559 __pNotificationImplList->Construct();
561 __pAppFeatureImplList = new (std::nothrow) ArrayList;
562 SysTryReturnVoidResult(NID_APP, __pAppFeatureImplList != null, E_OUT_OF_MEMORY, "__pAppFeatureImplList instance must not be null.");
563 __pAppFeatureImplList->Construct();
565 __pDataControlImplList = new (std::nothrow) ArrayList;
566 SysTryReturnVoidResult(NID_APP, __pDataControlImplList != null, E_OUT_OF_MEMORY, "__pDataControlImplList instance must not be null.");
567 __pDataControlImplList->Construct();
569 __pAppControlImplList = new (std::nothrow) ArrayList;
570 SysTryReturnVoidResult(NID_APP, __pAppControlImplList != null, E_OUT_OF_MEMORY, "__pAppControlImplList instance must not be null.");
571 __pAppControlImplList->Construct();
573 __pAppCategoryList = new (std::nothrow) ArrayList;
574 SysTryReturnVoidResult(NID_APP, __pAppCategoryList != null, E_OUT_OF_MEMORY, "__pAppCategoryList instance must not be null.");
575 __pAppCategoryList->Construct();
577 __pNameList = new (std::nothrow) HashMap;
578 SysTryReturnVoidResult(NID_APP, __pNameList != null, E_OUT_OF_MEMORY, "__pNameList instance must not be null.");
579 __pNameList->Construct();
583 _PackageAppInfoImpl::~_PackageAppInfoImpl(void)
585 __pLaunchConditionImplList->RemoveAll(true);
586 delete __pLaunchConditionImplList;
588 __pNotificationImplList->RemoveAll(true);
589 delete __pNotificationImplList;
591 __pAppFeatureImplList->RemoveAll(true);
592 delete __pAppFeatureImplList;
594 __pDataControlImplList->RemoveAll(true);
595 delete __pDataControlImplList;
597 __pAppControlImplList->RemoveAll(true);
598 delete __pAppControlImplList;
600 __pAppCategoryList->RemoveAll(true);
601 delete __pAppCategoryList;
603 __pNameList->RemoveAll(true);
606 if (__pAppInfoHandle)
608 pkgmgrinfo_appinfo_destroy_appinfo(__pAppInfoHandle);
613 _PackageAppInfoImpl::GetName(void) const
619 _PackageAppInfoImpl::SetName(const String& name)
626 _PackageAppInfoImpl::GetType(void) const
632 _PackageAppInfoImpl::SetType(const String& type)
639 _PackageAppInfoImpl::GetDefault(void) const
645 _PackageAppInfoImpl::SetDefault(const String& defaultApp)
647 __default = defaultApp;
652 _PackageAppInfoImpl::GetLaunchConditionListN(void) const
654 result r = E_SUCCESS;
656 DbStatement* pStmt = null;
657 DbEnumerator* pEnum = null;
660 ArrayList* pList = null;
662 query.Format(1024, L"SELECT * FROM LaunchCondition WHERE ID = %d", GetUniqueId());
664 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
665 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
667 pStmt = db.CreateStatementN(query);
668 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
669 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
671 pEnum = db.ExecuteStatementN(*pStmt);
674 pList = new (std::nothrow) ArrayList;
675 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
678 while (pEnum->MoveNext() == E_SUCCESS)
680 _LaunchConditionInfoImpl* pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl;
681 SysTryReturn(NID_APP, pLaunchConditionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
686 pEnum->GetStringAt(1, name);
687 pEnum->GetStringAt(2, value);
689 pLaunchConditionImpl->SetName(name);
690 pLaunchConditionImpl->SetValue(value);
692 pList->Add(*pLaunchConditionImpl);
703 _PackageAppInfoImpl::GetLaunchConditionList(void) const
705 return __pLaunchConditionImplList;
709 _PackageAppInfoImpl::AddLaunchCondition(const _LaunchConditionInfoImpl& launchConditionImpl)
711 result r = E_SUCCESS;
712 r = __pLaunchConditionImplList->Add(launchConditionImpl);
713 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pLaunchConditionImplList->Add() is failed.");
719 _PackageAppInfoImpl::GetNotificationListN(void) const
721 result r = E_SUCCESS;
723 DbStatement* pStmt = null;
724 DbEnumerator* pEnum = null;
727 ArrayList* pList = null;
729 query.Format(1024, L"SELECT * FROM Notification WHERE ID = %d", GetUniqueId());
731 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
732 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
734 pStmt = db.CreateStatementN(query);
735 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
736 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
738 pEnum = db.ExecuteStatementN(*pStmt);
741 pList = new (std::nothrow) ArrayList;
742 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
745 while (pEnum->MoveNext() == E_SUCCESS)
747 _NotificationInfoImpl* pNotificationImpl = new (std::nothrow) _NotificationInfoImpl;
748 SysTryReturn(NID_APP, pNotificationImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
753 pEnum->GetStringAt(1, name);
754 pEnum->GetStringAt(2, value);
756 pNotificationImpl->SetName(name);
757 pNotificationImpl->SetValue(value);
759 pList->Add(*pNotificationImpl);
770 _PackageAppInfoImpl::GetNotificationList(void) const
772 return __pNotificationImplList;
776 _PackageAppInfoImpl::AddNotification(const _NotificationInfoImpl& notificationImpl)
778 result r = E_SUCCESS;
779 r = __pNotificationImplList->Add(notificationImpl);
780 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pNotificationImplList->Add() is failed.");
786 _PackageAppInfoImpl::GetAppFeatureListN(void) const
788 result r = E_SUCCESS;
790 DbStatement* pStmt = null;
791 DbEnumerator* pEnum = null;
794 ArrayList* pList = null;
796 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
798 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
799 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
801 pStmt = db.CreateStatementN(query);
802 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
803 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
805 pEnum = db.ExecuteStatementN(*pStmt);
808 pList = new (std::nothrow) ArrayList;
809 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
812 while (pEnum->MoveNext() == E_SUCCESS)
814 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
815 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
820 pEnum->GetStringAt(1, name);
821 pEnum->GetStringAt(2, value);
823 pAppFeatureImpl->SetName(name);
824 pAppFeatureImpl->SetValue(value);
826 pList->Add(*pAppFeatureImpl);
837 _PackageAppInfoImpl::GetAppFeatureList(void) const
839 return __pAppFeatureImplList;
842 HashMapT<String, _AppFeatureInfoImpl*>*
843 _PackageAppInfoImpl::GetAppFeatureMapN(void) const
845 result r = E_SUCCESS;
847 DbEnumerator* pEnum = null;
850 HashMapT<String, _AppFeatureInfoImpl*>* pMap = null;
852 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
854 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
855 SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
857 const DbStatement* pStmt = db.CreateStatementN(query);
858 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
859 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
861 pEnum = db.ExecuteStatementN(*pStmt);
864 pMap = new (std::nothrow) HashMapT<String, _AppFeatureInfoImpl*>;
865 SysTryReturn(NID_APP, pMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
871 while (pEnum->MoveNext() == E_SUCCESS)
873 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
874 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
876 pEnum->GetStringAt(1, name);
877 pEnum->GetStringAt(2, value);
879 pAppFeatureImpl->SetName(name);
880 pAppFeatureImpl->SetValue(value);
882 pMap->Add(name, pAppFeatureImpl);
893 _PackageAppInfoImpl::AddAppFeature(const _AppFeatureInfoImpl& appFeatureImpl)
895 result r = E_SUCCESS;
896 r = __pAppFeatureImplList->Add(appFeatureImpl);
897 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppFeatureImplList->Add() is failed.");
903 _PackageAppInfoImpl::GetDataControlListN(void) const
909 _PackageAppInfoImpl::GetDataControlList(void) const
911 return __pDataControlImplList;
915 _PackageAppInfoImpl::AddDataControl(_DataControlInfoImpl* pDataControl)
917 result r = E_SUCCESS;
918 r = __pDataControlImplList->Add(*pDataControl);
919 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pDataControlImplList->Add() is failed.");
925 _PackageAppInfoImpl::GetAppControlListN(void) const
931 _PackageAppInfoImpl::GetAppControlList(void) const
933 return __pAppControlImplList;
937 _PackageAppInfoImpl::AddAppControl(_AppControlInfoImpl* pAppControl)
939 result r = E_SUCCESS;
940 r = __pAppControlImplList->Add(*pAppControl);
941 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppControlImplList->Add() is failed.");
947 _PackageAppInfoImpl::GetPackageName(void) const
949 return __packageName;
953 _PackageAppInfoImpl::SetPackageName(const String& packageName)
955 __packageName = packageName;
960 _PackageAppInfoImpl::GetMainmenuIcon(void) const
962 return __mainmenuIcon;
966 _PackageAppInfoImpl::SetMainmenuIcon(const String& mainmenuIcon)
968 __mainmenuIcon = mainmenuIcon;
973 _PackageAppInfoImpl::GetSettingIcon(void) const
975 return __settingIcon;
979 _PackageAppInfoImpl::SetSettingIcon(const String& setting)
981 __settingIcon = setting;
986 _PackageAppInfoImpl::GetQuickpanelIcon(void) const
988 return __quickpanelIcon;
992 _PackageAppInfoImpl::SetQuickpanelIcon(const String& quickpanelIcon)
994 __quickpanelIcon = quickpanelIcon;
999 _PackageAppInfoImpl::IsMainmenuVisible(void) const
1001 return __launchingIconVisible;
1005 _PackageAppInfoImpl::SetMainmenuVisible(bool visible)
1007 __launchingIconVisible = visible;
1012 _PackageAppInfoImpl::AddName(const String& language, const String& name)
1014 result r = E_SUCCESS;
1015 r = __pNameList->Add(language, name);
1021 _PackageAppInfoImpl::GetNameList(void) const
1027 _PackageAppInfoImpl::GetUniqueId(void) const
1029 result r = E_SUCCESS;
1031 DbStatement* pStmt = null;
1032 DbEnumerator* pEnum = null;
1036 query.Format(1024, L"SELECT UNIQUE_ID FROM AppInfo WHERE APP_NAME = '%ls' and ID = %d", __name.GetPointer(), __pkgId);
1038 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
1039 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
1041 pStmt = _PackageManagerImpl::CreateStatementN(db, query);
1042 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
1043 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
1045 pEnum = _PackageManagerImpl::ExecuteStatementN(db, pStmt);
1048 if (pEnum->MoveNext() == E_SUCCESS)
1050 pEnum->GetIntAt(0, uniqueId);
1057 r = E_OBJ_NOT_FOUND;
1066 _PackageAppInfoImpl::GetPkgId(void) const
1072 _PackageAppInfoImpl::SetUniqueId(int id)
1079 _PackageAppInfoImpl::SetPkgId(int id)
1086 _PackageAppInfoImpl::GetAppFeature(void) const
1088 return __appFeature;
1092 _PackageAppInfoImpl::SetAppFeature(int feature)
1094 __appFeature = feature;
1098 _LaunchConditionInfoImpl::_LaunchConditionInfoImpl(void)
1103 _LaunchConditionInfoImpl::~_LaunchConditionInfoImpl(void)
1109 _LaunchConditionInfoImpl::GetName(void) const
1115 _LaunchConditionInfoImpl::SetName(const String& name)
1122 _LaunchConditionInfoImpl::GetValue(void) const
1128 _LaunchConditionInfoImpl::SetValue(const String& value)
1134 _NotificationInfoImpl::_NotificationInfoImpl(void)
1139 _NotificationInfoImpl::~_NotificationInfoImpl(void)
1145 _NotificationInfoImpl::GetName(void) const
1151 _NotificationInfoImpl::SetName(const String& name)
1158 _NotificationInfoImpl::GetValue(void) const
1164 _NotificationInfoImpl::SetValue(const String& value)
1170 _AppFeatureInfoImpl::_AppFeatureInfoImpl(void)
1175 _AppFeatureInfoImpl::~_AppFeatureInfoImpl(void)
1181 _AppFeatureInfoImpl::GetName(void) const
1187 _AppFeatureInfoImpl::SetName(const String& name)
1194 _AppFeatureInfoImpl::GetValue(void) const
1200 _AppFeatureInfoImpl::SetValue(const String& value)
1206 _DataControlTypeImpl::_DataControlTypeImpl(void)
1211 _DataControlTypeImpl::~_DataControlTypeImpl(void)
1217 _DataControlTypeImpl::GetType(void) const
1223 _DataControlTypeImpl::SetType(const String& type)
1230 _DataControlTypeImpl::GetAccess(void) const
1236 _DataControlTypeImpl::SetAccess(const String& access)
1242 _DataControlInfoImpl::_DataControlInfoImpl(void)
1243 : __pControlTypeList(null)
1245 __pControlTypeList = new (std::nothrow) ArrayList;
1246 SysTryReturnVoidResult(NID_APP, __pControlTypeList != null, E_OUT_OF_MEMORY, "__pControlTypeList instance must not be null.");
1247 __pControlTypeList->Construct();
1250 _DataControlInfoImpl::~_DataControlInfoImpl(void)
1252 __pControlTypeList->RemoveAll(true);
1253 delete __pControlTypeList;
1257 _DataControlInfoImpl::GetProviderId(void) const
1259 return __providerId;
1263 _DataControlInfoImpl::SetProviderId(const String& providerId)
1265 __providerId = providerId;
1270 _DataControlInfoImpl::GetControlTypeList(void) const
1272 return __pControlTypeList;
1276 _DataControlInfoImpl::AddControlType(_DataControlTypeImpl* pControlType)
1278 __pControlTypeList->Add(*pControlType);
1282 _AppControlResolutionInfoImpl::_AppControlResolutionInfoImpl(void)
1283 : __pUriScheme(null)
1289 _AppControlResolutionInfoImpl::~_AppControlResolutionInfoImpl(void)
1291 delete __pUriScheme;
1296 _AppControlResolutionInfoImpl::GetUriScheme(void) const
1298 return __pUriScheme;
1302 _AppControlResolutionInfoImpl::SetUriScheme(String* pUriScheme)
1304 __pUriScheme = pUriScheme;
1309 _AppControlResolutionInfoImpl::GetMimeType(void) const
1315 _AppControlResolutionInfoImpl::SetMimeType(String* pMimeType)
1317 __pMimeType = pMimeType;
1321 _AppControlCapabilityInfoImpl::_AppControlCapabilityInfoImpl(void)
1324 ,__pResolutionList(null)
1326 __pResolutionList = new (std::nothrow) ArrayList;
1327 SysTryReturnVoidResult(NID_APP, __pResolutionList != null, E_OUT_OF_MEMORY, "__pResolutionList instance must not be null.");
1328 __pResolutionList->Construct();
1331 _AppControlCapabilityInfoImpl::~_AppControlCapabilityInfoImpl(void)
1333 __pResolutionList->RemoveAll(true);
1334 delete __pResolutionList;
1338 _AppControlCapabilityInfoImpl::GetUniqueId(void) const
1344 _AppControlCapabilityInfoImpl::SetUniqueId(int uniqueId)
1346 __uniqueId = uniqueId;
1351 _AppControlCapabilityInfoImpl::GetAppControlId(void) const
1353 return __appControlId;
1357 _AppControlCapabilityInfoImpl::SetAppControlId(int appControlId)
1359 __appControlId = appControlId;
1364 _AppControlCapabilityInfoImpl::GetOperationId(void) const
1366 return __operationId;
1370 _AppControlCapabilityInfoImpl::SetOperationId(const String& operationId)
1372 __operationId = operationId;
1377 _AppControlCapabilityInfoImpl::GetResolutionList(void) const
1379 return __pResolutionList;
1383 _AppControlCapabilityInfoImpl::AddResolution(_AppControlResolutionInfoImpl* pResolutionImpl)
1385 result r = E_SUCCESS;
1386 r = __pResolutionList->Add(*pResolutionImpl);
1387 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pResolutionList->Add() is failed.");
1392 _AppControlInfoImpl::_AppControlInfoImpl(void)
1394 ,__pCapabilityList(null)
1396 __pCapabilityList = new (std::nothrow) ArrayList;
1397 SysTryReturnVoidResult(NID_APP, __pCapabilityList != null, E_OUT_OF_MEMORY, "__pCapabilityList instance must not be null.");
1398 __pCapabilityList->Construct();
1401 _AppControlInfoImpl::~_AppControlInfoImpl(void)
1403 __pCapabilityList->RemoveAll(true);
1404 delete __pCapabilityList;
1408 _AppControlInfoImpl::GetUniqueId(void) const
1414 _AppControlInfoImpl::SetUniqueId(int uniqueId)
1416 __uniqueId = uniqueId;
1421 _AppControlInfoImpl::GetProviderId(void) const
1423 return __providerId;
1427 _AppControlInfoImpl::SetProviderId(const String& providerId)
1429 __providerId = providerId;
1434 _AppControlInfoImpl::GetCategory(void) const
1440 _AppControlInfoImpl::SetCategory(const String& category)
1442 __category = category;
1447 _AppControlInfoImpl::GetCapabilityList(void) const
1449 return __pCapabilityList;
1453 _AppControlInfoImpl::AddCapability(_AppControlCapabilityInfoImpl* pCapability)
1455 result r = E_SUCCESS;
1456 r = __pCapabilityList->Add(*pCapability);
1457 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pCapabilityList->Add() is failed.");
1462 } } } // Tizen::App::Package