2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FAppPkg_PackageAppInfoImpl.cpp
19 * @brief This is the implementation for the _PackageAppInfoImpl class.
25 #include <unique_ptr.h>
27 #include <pkgmgr-info.h>
29 #include <FAppPkgPackageManager.h>
30 #include <FAppPkgPackageAppInfo.h>
31 #include <FBaseSysLog.h>
32 #include <FIoDatabase.h>
33 #include <FIoDbEnumerator.h>
34 #include <FIoDbStatement.h>
36 #include <FIoDirectory.h>
37 #include <FBase_StringConverter.h>
39 #include "FAppPkg_PackageManagerImpl.h"
40 #include "FApp_AppResourceImpl.h"
41 #include "FApp_TemplateUtil.h"
43 using namespace Tizen::Base;
44 using namespace Tizen::Base::Collection;
45 using namespace Tizen::Graphics;
46 using namespace Tizen::Io;
48 namespace Tizen { namespace App { namespace Package
52 _PackageAppInfoImpl::GetAppId(void) const
58 _PackageAppInfoImpl::SetAppId(const AppId& appId)
65 _PackageAppInfoImpl::GetAppName(void) const
71 _PackageAppInfoImpl::SetAppName(const String& appName)
78 _PackageAppInfoImpl::GetAppDisplayName(void) const
80 return __appDiplayName;
84 _PackageAppInfoImpl::SetAppDisplayName(const String& appDiplayName)
86 __appDiplayName = appDiplayName;
91 _PackageAppInfoImpl::GetAppMenuIconPath(void) const
97 _PackageAppInfoImpl::SetAppMenuIconPath(const String& iconPath)
99 __appIconPath = iconPath;
104 _PackageAppInfoImpl::GetAppSettingIconPath(void) const
106 return __appSettingIconPath;
110 _PackageAppInfoImpl::SetAppSettingIconPath(const Tizen::Base::String& appSettingIcon)
112 __appSettingIconPath = appSettingIcon;
117 _PackageAppInfoImpl::GetAppNotificationIconPath(void) const
119 return __appNotificationIconPath;
123 _PackageAppInfoImpl::SetAppNotificationIconPath(const String& notificationIconPath)
125 __appNotificationIconPath = notificationIconPath;
130 _PackageAppInfoImpl::GetAppTempIconPath(void) const
132 return __appTempIconPath;
136 _PackageAppInfoImpl::SetAppTempIconPath(const String& tempIconPath)
138 __appTempIconPath = tempIconPath;
143 _PackageAppInfoImpl::GetAppMenuIconN(void) const
145 Bitmap* pBitmap = null;
150 SysTryReturn(NID_APP, __appIconPath.IsEmpty() == false, null, E_FILE_NOT_FOUND, "appIconPath() is empty.");
152 iconPath = __appIconPath;
156 SysTryReturn(NID_APP, __appTempIconPath.IsEmpty() == false, null, E_FILE_NOT_FOUND, "__appTempIconPath() is empty.");
158 iconPath = __appTempIconPath;
161 SysLog(NID_APP, "iconPath = [%ls]", iconPath.GetPointer());
163 pBitmap = _AppResourceImpl::GetNonScalingBitmapN(iconPath);
169 _PackageAppInfoImpl::GetAppMetadataListN(void) const
173 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "__pAppInfoHandle is null.");
175 int res = PMINFO_R_OK;
177 std::unique_ptr< HashMap > pMap(new (std::nothrow) HashMap());
178 SysTryReturn(NID_APP, pMap, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
181 res = pkgmgrinfo_appinfo_foreach_metadata(__pAppInfoHandle, MetadataHandler, pMap.get());
182 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_metadata() failed. [%d]", res);
184 if (pMap->GetCount() <= 0)
189 return pMap.release();
193 SysLog(NID_APP, "GetAppMetadataListN() is not available.");
199 _PackageAppInfoImpl::GetAppCategoryListN(void) const
203 SysTryReturn(NID_APP, __pAppInfoHandle, null, E_SYSTEM, "[E_SYSTEM] __pAppInfoHandle is null.");
205 int res = PMINFO_R_OK;
207 std::unique_ptr< ArrayList > pList(new (std::nothrow) ArrayList());
208 SysTryReturn(NID_APP, pList, null, E_OUT_OF_MEMORY, "ArrayList creation failure.");
211 res = pkgmgrinfo_appinfo_foreach_category(__pAppInfoHandle, CategoryHandler, pList.get());
212 SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_foreach_category() failed. [%d]", res);
214 if (pList->GetCount() <= 0)
219 return pList.release();
223 SysLog(NID_APP, "GetAppCategoryListN() is not available.");
229 _PackageAppInfoImpl::IsMenuIconVisible(void) const
231 return __launchingIconVisible;
235 _PackageAppInfoImpl::SetMenuIconVisible(bool visible)
237 __launchingIconVisible = visible;
242 _PackageAppInfoImpl::IsMainApp(void) const
248 _PackageAppInfoImpl::SetMainApp(bool mainApp)
255 _PackageAppInfoImpl::AddCategory(String* pCategory)
257 result r = E_SUCCESS;
258 r = __pAppCategoryList->Add(*pCategory);
259 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppCategoryList->Add() is failed.");
265 _PackageAppInfoImpl::GetAppFeature(const String& key) const
267 SysTryReturn(NID_APP, __appId.IsEmpty() == false, L"", E_SYSTEM, "__appId is empty.");
273 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'",
274 key.GetPointer(), __appId.GetPointer());
276 SysLog(NID_APP, "query = [%ls]", query.GetPointer());
278 result r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
279 SysTryReturn(NID_APP, r == E_SUCCESS, L"", E_SYSTEM, "db.Construct() failed. [%s]", GetErrorMessage(r));
281 std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
282 SysTryReturn(NID_APP, pStmt, L"", E_SYSTEM, "CreateStatementN(%ls) failed. [%s]", query.GetPointer(), GetErrorMessage(GetLastResult()));
284 std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
285 SysTryReturn(NID_APP, pEnum, L"", E_SYSTEM, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
287 while (pEnum->MoveNext() == E_SUCCESS)
289 pEnum->GetStringAt(0, value);
292 SysLog(NID_APP, "value = [%ls]", value.GetPointer());
298 _PackageAppInfoImpl::GetInstance(PackageAppInfo* pPackageAppInfo)
302 return pPackageAppInfo->__pPackageAppInfoImpl;
309 _PackageAppInfoImpl::Construct(const AppId& appId)
311 SysTryReturnResult(NID_APP, appId.IsEmpty() == false, E_INVALID_ARG, "appId is empty.");
313 int res = PMINFO_R_OK;
314 char* pExePath = null;
315 char* pDisplayName = null;
316 char* pMenuIcon = null;
317 char* pSettingIcon = null;
318 char* pNotificationIcon = null;
319 bool mainApp = false;
320 bool menuIconVisible = false;
322 std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
323 SysTryReturnResult(NID_APP, pAppId, E_OUT_OF_MEMORY, "pAppId is null");
325 res = pkgmgrinfo_appinfo_get_appinfo(pAppId.get(), &__pAppInfoHandle);
326 SysTryReturnResult(NID_APP, res == 0, E_SYSTEM, "pkgmgrinfo_appinfo_get_appinfo failed, res = [%d], app = [%s]", res, pAppId.get());
328 __fromDatabase = true;
332 res = pkgmgrinfo_appinfo_get_exec(__pAppInfoHandle, &pExePath);
333 if (res == PMINFO_R_OK)
335 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec(): exe = [%s]", pExePath);
337 String exePath(pExePath);
338 int startIndex = exePath.GetLength() - 1;
340 result r = exePath.LastIndexOf(L'/', startIndex, indexOf);
344 exePath.SubString(indexOf + 1, appName);
346 SysLog(NID_APP, "appName = [%ls]", appName.GetPointer());
350 SysLog(NID_APP, "LastIndexOf is failed.");
355 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec() is failed. result = [%d]", res);
358 res = pkgmgrinfo_appinfo_get_label(__pAppInfoHandle, &pDisplayName);
359 if (res == PMINFO_R_OK)
361 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label(): displayName = [%s]", pDisplayName);
362 String displayName(pDisplayName);
363 SetAppDisplayName(displayName);
367 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label() is failed. result = [%d]", res);
370 res = pkgmgrinfo_appinfo_get_icon(__pAppInfoHandle, &pMenuIcon);
371 if (res == PMINFO_R_OK)
373 String menuIcon(pMenuIcon);
374 SetAppMenuIconPath(menuIcon);
378 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon() is failed. result = [%d]", res);
381 res = pkgmgrinfo_appinfo_get_setting_icon(__pAppInfoHandle, &pSettingIcon);
382 if (res == PMINFO_R_OK)
384 String settingIcon(pSettingIcon);
385 SetAppSettingIconPath(settingIcon);
389 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon() is failed. result = [%d]", res);
392 res = pkgmgrinfo_appinfo_get_notification_icon(__pAppInfoHandle, &pNotificationIcon);
393 if (res == PMINFO_R_OK)
395 String notificationIcon(pNotificationIcon);
396 SetAppNotificationIconPath(notificationIcon);
400 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon() is failed. result = [%d]", res);
403 res = pkgmgrinfo_appinfo_is_mainapp(__pAppInfoHandle, &mainApp);
404 if (res == PMINFO_R_OK)
406 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp(): mainApp = [%d]", mainApp);
411 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp() is failed. result = [%d]", res);
414 res = pkgmgrinfo_appinfo_is_nodisplay(__pAppInfoHandle, &menuIconVisible);
415 if (res == PMINFO_R_OK)
417 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay(): menuIconVisible = [%d]", menuIconVisible);
418 SetMenuIconVisible(!menuIconVisible);
422 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay() is failed. result = [%d]", res);
429 _PackageAppInfoImpl::CategoryHandler(const char* pCategoryName, void* pUserData)
431 SysTryReturn(NID_APP, pCategoryName != null, 0, E_SYSTEM, "[E_SYSTEM] pCategoryName must not be null.");
433 SysLog(NID_APP, "Category = [%s]", pCategoryName);
434 ArrayList* pList = (ArrayList*) pUserData;
436 String* pCategory = new (std::nothrow) String (pCategoryName);
437 SysTryReturn(NID_APP, pCategory != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pCategory instance must not be null.");
439 pList->Add(*pCategory);
445 _PackageAppInfoImpl::MetadataHandler(const char* pKey, const char* pValue, void* pUserData)
447 SysTryReturn(NID_APP, pKey, 0, E_SYSTEM, "pKey must not be null.");
448 SysTryReturn(NID_APP, pValue, 0, E_SYSTEM, "pValue must not be null.");
449 SysTryReturn(NID_APP, pUserData, 0, E_SYSTEM, "pUserData must not be null.");
451 SysLog(NID_APP, "Key = [%s], Value = [%s]", pKey, pValue);
453 MultiHashMap* pMultiMap = (MultiHashMap*) pUserData;
454 result r = pMultiMap->Add(*(new (std::nothrow) String(pKey)), *(new (std::nothrow) String(pValue)));
455 SysTryReturn(NID_APP, r == E_SUCCESS, -1, E_SYSTEM, "pMultiMap->Add() failed. [%s]", GetErrorMessage(GetLastResult()));
461 _PackageAppInfoImpl::_PackageAppInfoImpl(void)
462 : __launchingIconVisible(true)
464 , __fromDatabase(false)
465 , __pLaunchConditionImplList(null)
466 , __pNotificationImplList(null)
467 , __pAppFeatureImplList(null)
468 , __pDataControlImplList(null)
469 , __pAppControlImplList(null)
470 , __pAppCategoryList(null)
474 ,__pAppInfoHandle(null)
476 __pLaunchConditionImplList = new (std::nothrow) ArrayList;
477 SysTryReturnVoidResult(NID_APP, __pLaunchConditionImplList != null, E_OUT_OF_MEMORY, "__pLaunchConditionImplList instance must not be null.");
478 __pLaunchConditionImplList->Construct();
480 __pNotificationImplList = new (std::nothrow) ArrayList;
481 SysTryReturnVoidResult(NID_APP, __pNotificationImplList != null, E_OUT_OF_MEMORY, "__pNotificationImplList instance must not be null.");
482 __pNotificationImplList->Construct();
484 __pAppFeatureImplList = new (std::nothrow) ArrayList;
485 SysTryReturnVoidResult(NID_APP, __pAppFeatureImplList != null, E_OUT_OF_MEMORY, "__pAppFeatureImplList instance must not be null.");
486 __pAppFeatureImplList->Construct();
488 __pDataControlImplList = new (std::nothrow) ArrayList;
489 SysTryReturnVoidResult(NID_APP, __pDataControlImplList != null, E_OUT_OF_MEMORY, "__pDataControlImplList instance must not be null.");
490 __pDataControlImplList->Construct();
492 __pAppControlImplList = new (std::nothrow) ArrayList;
493 SysTryReturnVoidResult(NID_APP, __pAppControlImplList != null, E_OUT_OF_MEMORY, "__pAppControlImplList instance must not be null.");
494 __pAppControlImplList->Construct();
496 __pAppCategoryList = new (std::nothrow) ArrayList;
497 SysTryReturnVoidResult(NID_APP, __pAppCategoryList != null, E_OUT_OF_MEMORY, "__pAppCategoryList instance must not be null.");
498 __pAppCategoryList->Construct();
500 __pNameList = new (std::nothrow) HashMap;
501 SysTryReturnVoidResult(NID_APP, __pNameList != null, E_OUT_OF_MEMORY, "__pNameList instance must not be null.");
502 __pNameList->Construct();
506 _PackageAppInfoImpl::~_PackageAppInfoImpl(void)
508 __pLaunchConditionImplList->RemoveAll(true);
509 delete __pLaunchConditionImplList;
511 __pNotificationImplList->RemoveAll(true);
512 delete __pNotificationImplList;
514 __pAppFeatureImplList->RemoveAll(true);
515 delete __pAppFeatureImplList;
517 __pDataControlImplList->RemoveAll(true);
518 delete __pDataControlImplList;
520 __pAppControlImplList->RemoveAll(true);
521 delete __pAppControlImplList;
523 __pAppCategoryList->RemoveAll(true);
524 delete __pAppCategoryList;
526 __pNameList->RemoveAll(true);
529 if (__pAppInfoHandle)
531 pkgmgrinfo_appinfo_destroy_appinfo(__pAppInfoHandle);
534 if (File::IsFileExist(__appTempIconPath) == true)
536 File::Remove(__appTempIconPath);
538 String tmp(L"/tmp/__icon/");
539 Directory::Remove(tmp, true);
544 _PackageAppInfoImpl::GetName(void) const
550 _PackageAppInfoImpl::SetName(const String& name)
557 _PackageAppInfoImpl::GetType(void) const
563 _PackageAppInfoImpl::SetType(const String& type)
570 _PackageAppInfoImpl::GetDefault(void) const
576 _PackageAppInfoImpl::SetDefault(const String& defaultApp)
578 __default = defaultApp;
583 _PackageAppInfoImpl::GetLaunchConditionListN(void) const
585 result r = E_SUCCESS;
587 DbStatement* pStmt = null;
588 DbEnumerator* pEnum = null;
591 ArrayList* pList = null;
593 query.Format(1024, L"SELECT * FROM LaunchCondition WHERE ID = %d", GetUniqueId());
595 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
596 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
598 pStmt = db.CreateStatementN(query);
599 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
600 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
602 pEnum = db.ExecuteStatementN(*pStmt);
605 pList = new (std::nothrow) ArrayList;
606 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
609 while (pEnum->MoveNext() == E_SUCCESS)
611 _LaunchConditionInfoImpl* pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl;
612 SysTryReturn(NID_APP, pLaunchConditionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
617 pEnum->GetStringAt(1, name);
618 pEnum->GetStringAt(2, value);
620 pLaunchConditionImpl->SetName(name);
621 pLaunchConditionImpl->SetValue(value);
623 pList->Add(*pLaunchConditionImpl);
634 _PackageAppInfoImpl::GetLaunchConditionList(void) const
636 return __pLaunchConditionImplList;
640 _PackageAppInfoImpl::AddLaunchCondition(const _LaunchConditionInfoImpl& launchConditionImpl)
642 result r = E_SUCCESS;
643 r = __pLaunchConditionImplList->Add(launchConditionImpl);
644 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pLaunchConditionImplList->Add() is failed.");
650 _PackageAppInfoImpl::GetNotificationListN(void) const
652 result r = E_SUCCESS;
654 DbStatement* pStmt = null;
655 DbEnumerator* pEnum = null;
658 ArrayList* pList = null;
660 query.Format(1024, L"SELECT * FROM Notification WHERE ID = %d", GetUniqueId());
662 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
663 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
665 pStmt = db.CreateStatementN(query);
666 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
667 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
669 pEnum = db.ExecuteStatementN(*pStmt);
672 pList = new (std::nothrow) ArrayList;
673 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
676 while (pEnum->MoveNext() == E_SUCCESS)
678 _NotificationInfoImpl* pNotificationImpl = new (std::nothrow) _NotificationInfoImpl;
679 SysTryReturn(NID_APP, pNotificationImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
684 pEnum->GetStringAt(1, name);
685 pEnum->GetStringAt(2, value);
687 pNotificationImpl->SetName(name);
688 pNotificationImpl->SetValue(value);
690 pList->Add(*pNotificationImpl);
701 _PackageAppInfoImpl::GetNotificationList(void) const
703 return __pNotificationImplList;
707 _PackageAppInfoImpl::AddNotification(const _NotificationInfoImpl& notificationImpl)
709 result r = E_SUCCESS;
710 r = __pNotificationImplList->Add(notificationImpl);
711 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pNotificationImplList->Add() is failed.");
717 _PackageAppInfoImpl::GetAppFeatureListN(void) const
719 result r = E_SUCCESS;
721 DbStatement* pStmt = null;
722 DbEnumerator* pEnum = null;
725 ArrayList* pList = null;
727 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
729 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
730 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
732 pStmt = db.CreateStatementN(query);
733 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
734 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
736 pEnum = db.ExecuteStatementN(*pStmt);
739 pList = new (std::nothrow) ArrayList;
740 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
743 while (pEnum->MoveNext() == E_SUCCESS)
745 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
746 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
751 pEnum->GetStringAt(1, name);
752 pEnum->GetStringAt(2, value);
754 pAppFeatureImpl->SetName(name);
755 pAppFeatureImpl->SetValue(value);
757 pList->Add(*pAppFeatureImpl);
768 _PackageAppInfoImpl::GetAppFeatureList(void) const
770 return __pAppFeatureImplList;
773 HashMapT<String, _AppFeatureInfoImpl*>*
774 _PackageAppInfoImpl::GetAppFeatureMapN(void) const
776 result r = E_SUCCESS;
778 DbEnumerator* pEnum = null;
781 HashMapT<String, _AppFeatureInfoImpl*>* pMap = null;
783 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
785 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
786 SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
788 const DbStatement* pStmt = db.CreateStatementN(query);
789 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
790 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
792 pEnum = db.ExecuteStatementN(*pStmt);
795 pMap = new (std::nothrow) HashMapT<String, _AppFeatureInfoImpl*>;
796 SysTryReturn(NID_APP, pMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
802 while (pEnum->MoveNext() == E_SUCCESS)
804 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
805 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
807 pEnum->GetStringAt(1, name);
808 pEnum->GetStringAt(2, value);
810 pAppFeatureImpl->SetName(name);
811 pAppFeatureImpl->SetValue(value);
813 pMap->Add(name, pAppFeatureImpl);
824 _PackageAppInfoImpl::AddAppFeature(const _AppFeatureInfoImpl& appFeatureImpl)
826 result r = E_SUCCESS;
827 r = __pAppFeatureImplList->Add(appFeatureImpl);
828 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppFeatureImplList->Add() is failed.");
834 _PackageAppInfoImpl::GetDataControlListN(void) const
840 _PackageAppInfoImpl::GetDataControlList(void) const
842 return __pDataControlImplList;
846 _PackageAppInfoImpl::AddDataControl(_DataControlInfoImpl* pDataControl)
848 result r = E_SUCCESS;
849 r = __pDataControlImplList->Add(*pDataControl);
850 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pDataControlImplList->Add() is failed.");
856 _PackageAppInfoImpl::GetAppControlListN(void) const
862 _PackageAppInfoImpl::GetAppControlList(void) const
864 return __pAppControlImplList;
868 _PackageAppInfoImpl::AddAppControl(_AppControlInfoImpl* pAppControl)
870 result r = E_SUCCESS;
871 r = __pAppControlImplList->Add(*pAppControl);
872 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppControlImplList->Add() is failed.");
878 _PackageAppInfoImpl::GetPackageName(void) const
880 return __packageName;
884 _PackageAppInfoImpl::SetPackageName(const String& packageName)
886 __packageName = packageName;
891 _PackageAppInfoImpl::GetMainmenuIcon(void) const
893 return __mainmenuIcon;
897 _PackageAppInfoImpl::SetMainmenuIcon(const String& mainmenuIcon)
899 __mainmenuIcon = mainmenuIcon;
904 _PackageAppInfoImpl::GetSettingIcon(void) const
906 return __settingIcon;
910 _PackageAppInfoImpl::SetSettingIcon(const String& setting)
912 __settingIcon = setting;
917 _PackageAppInfoImpl::GetQuickpanelIcon(void) const
919 return __quickpanelIcon;
923 _PackageAppInfoImpl::SetQuickpanelIcon(const String& quickpanelIcon)
925 __quickpanelIcon = quickpanelIcon;
930 _PackageAppInfoImpl::IsMainmenuVisible(void) const
932 return __launchingIconVisible;
936 _PackageAppInfoImpl::SetMainmenuVisible(bool visible)
938 __launchingIconVisible = visible;
943 _PackageAppInfoImpl::AddName(const String& language, const String& name)
945 result r = E_SUCCESS;
946 r = __pNameList->Add(language, name);
952 _PackageAppInfoImpl::GetNameList(void) const
958 _PackageAppInfoImpl::GetUniqueId(void) const
960 result r = E_SUCCESS;
962 DbStatement* pStmt = null;
963 DbEnumerator* pEnum = null;
967 query.Format(1024, L"SELECT UNIQUE_ID FROM AppInfo WHERE APP_NAME = '%ls' and ID = %d", __name.GetPointer(), __pkgId);
969 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
970 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
972 pStmt = _PackageManagerImpl::CreateStatementN(db, query);
973 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
974 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
976 pEnum = _PackageManagerImpl::ExecuteStatementN(db, pStmt);
979 if (pEnum->MoveNext() == E_SUCCESS)
981 pEnum->GetIntAt(0, uniqueId);
997 _PackageAppInfoImpl::GetPkgId(void) const
1003 _PackageAppInfoImpl::SetUniqueId(int id)
1010 _PackageAppInfoImpl::SetPkgId(int id)
1017 _PackageAppInfoImpl::GetAppFeature(void) const
1019 return __appFeature;
1023 _PackageAppInfoImpl::SetAppFeature(int feature)
1025 __appFeature = feature;
1029 _LaunchConditionInfoImpl::_LaunchConditionInfoImpl(void)
1034 _LaunchConditionInfoImpl::~_LaunchConditionInfoImpl(void)
1040 _LaunchConditionInfoImpl::GetName(void) const
1046 _LaunchConditionInfoImpl::SetName(const String& name)
1053 _LaunchConditionInfoImpl::GetValue(void) const
1059 _LaunchConditionInfoImpl::SetValue(const String& value)
1065 _NotificationInfoImpl::_NotificationInfoImpl(void)
1070 _NotificationInfoImpl::~_NotificationInfoImpl(void)
1076 _NotificationInfoImpl::GetName(void) const
1082 _NotificationInfoImpl::SetName(const String& name)
1089 _NotificationInfoImpl::GetValue(void) const
1095 _NotificationInfoImpl::SetValue(const String& value)
1101 _AppFeatureInfoImpl::_AppFeatureInfoImpl(void)
1106 _AppFeatureInfoImpl::~_AppFeatureInfoImpl(void)
1112 _AppFeatureInfoImpl::GetName(void) const
1118 _AppFeatureInfoImpl::SetName(const String& name)
1125 _AppFeatureInfoImpl::GetValue(void) const
1131 _AppFeatureInfoImpl::SetValue(const String& value)
1137 _DataControlTypeImpl::_DataControlTypeImpl(void)
1142 _DataControlTypeImpl::~_DataControlTypeImpl(void)
1148 _DataControlTypeImpl::GetType(void) const
1154 _DataControlTypeImpl::SetType(const String& type)
1161 _DataControlTypeImpl::GetAccess(void) const
1167 _DataControlTypeImpl::SetAccess(const String& access)
1173 _DataControlInfoImpl::_DataControlInfoImpl(void)
1174 : __pControlTypeList(null)
1176 __pControlTypeList = new (std::nothrow) ArrayList;
1177 SysTryReturnVoidResult(NID_APP, __pControlTypeList != null, E_OUT_OF_MEMORY, "__pControlTypeList instance must not be null.");
1178 __pControlTypeList->Construct();
1181 _DataControlInfoImpl::~_DataControlInfoImpl(void)
1183 __pControlTypeList->RemoveAll(true);
1184 delete __pControlTypeList;
1188 _DataControlInfoImpl::GetProviderId(void) const
1190 return __providerId;
1194 _DataControlInfoImpl::SetProviderId(const String& providerId)
1196 __providerId = providerId;
1201 _DataControlInfoImpl::GetControlTypeList(void) const
1203 return __pControlTypeList;
1207 _DataControlInfoImpl::AddControlType(_DataControlTypeImpl* pControlType)
1209 __pControlTypeList->Add(*pControlType);
1213 _AppControlResolutionInfoImpl::_AppControlResolutionInfoImpl(void)
1214 : __pUriScheme(null)
1220 _AppControlResolutionInfoImpl::~_AppControlResolutionInfoImpl(void)
1222 delete __pUriScheme;
1227 _AppControlResolutionInfoImpl::GetUriScheme(void) const
1229 return __pUriScheme;
1233 _AppControlResolutionInfoImpl::SetUriScheme(String* pUriScheme)
1235 __pUriScheme = pUriScheme;
1240 _AppControlResolutionInfoImpl::GetMimeType(void) const
1246 _AppControlResolutionInfoImpl::SetMimeType(String* pMimeType)
1248 __pMimeType = pMimeType;
1252 _AppControlCapabilityInfoImpl::_AppControlCapabilityInfoImpl(void)
1255 ,__pResolutionList(null)
1257 __pResolutionList = new (std::nothrow) ArrayList;
1258 SysTryReturnVoidResult(NID_APP, __pResolutionList != null, E_OUT_OF_MEMORY, "__pResolutionList instance must not be null.");
1259 __pResolutionList->Construct();
1262 _AppControlCapabilityInfoImpl::~_AppControlCapabilityInfoImpl(void)
1264 __pResolutionList->RemoveAll(true);
1265 delete __pResolutionList;
1269 _AppControlCapabilityInfoImpl::GetUniqueId(void) const
1275 _AppControlCapabilityInfoImpl::SetUniqueId(int uniqueId)
1277 __uniqueId = uniqueId;
1282 _AppControlCapabilityInfoImpl::GetAppControlId(void) const
1284 return __appControlId;
1288 _AppControlCapabilityInfoImpl::SetAppControlId(int appControlId)
1290 __appControlId = appControlId;
1295 _AppControlCapabilityInfoImpl::GetOperationId(void) const
1297 return __operationId;
1301 _AppControlCapabilityInfoImpl::SetOperationId(const String& operationId)
1303 __operationId = operationId;
1308 _AppControlCapabilityInfoImpl::GetResolutionList(void) const
1310 return __pResolutionList;
1314 _AppControlCapabilityInfoImpl::AddResolution(_AppControlResolutionInfoImpl* pResolutionImpl)
1316 result r = E_SUCCESS;
1317 r = __pResolutionList->Add(*pResolutionImpl);
1318 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pResolutionList->Add() is failed.");
1323 _AppControlInfoImpl::_AppControlInfoImpl(void)
1325 ,__pCapabilityList(null)
1327 __pCapabilityList = new (std::nothrow) ArrayList;
1328 SysTryReturnVoidResult(NID_APP, __pCapabilityList != null, E_OUT_OF_MEMORY, "__pCapabilityList instance must not be null.");
1329 __pCapabilityList->Construct();
1332 _AppControlInfoImpl::~_AppControlInfoImpl(void)
1334 __pCapabilityList->RemoveAll(true);
1335 delete __pCapabilityList;
1339 _AppControlInfoImpl::GetUniqueId(void) const
1345 _AppControlInfoImpl::SetUniqueId(int uniqueId)
1347 __uniqueId = uniqueId;
1352 _AppControlInfoImpl::GetProviderId(void) const
1354 return __providerId;
1358 _AppControlInfoImpl::SetProviderId(const String& providerId)
1360 __providerId = providerId;
1365 _AppControlInfoImpl::GetCategory(void) const
1371 _AppControlInfoImpl::SetCategory(const String& category)
1373 __category = category;
1378 _AppControlInfoImpl::GetCapabilityList(void) const
1380 return __pCapabilityList;
1384 _AppControlInfoImpl::AddCapability(_AppControlCapabilityInfoImpl* pCapability)
1386 result r = E_SUCCESS;
1387 r = __pCapabilityList->Add(*pCapability);
1388 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pCapabilityList->Add() is failed.");
1393 } } } // Tizen::App::Package