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::AddCategory(String* pCategory)
305 result r = E_SUCCESS;
306 r = __pAppCategoryList->Add(*pCategory);
307 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppCategoryList->Add() is failed.");
313 _PackageAppInfoImpl::GetAppFeature(const String& key) const
315 SysTryReturn(NID_APP, __appId.IsEmpty() == false, L"", E_SYSTEM, "__appId is empty.");
321 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'",
322 key.GetPointer(), __appId.GetPointer());
324 SysLog(NID_APP, "query = [%ls]", query.GetPointer());
326 result r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
327 SysTryReturn(NID_APP, r == E_SUCCESS, L"", E_SYSTEM, "db.Construct() failed. [%s]", GetErrorMessage(r));
329 std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
330 SysTryReturn(NID_APP, pStmt, L"", E_SYSTEM, "CreateStatementN(%ls) failed. [%s]", query.GetPointer(), GetErrorMessage(GetLastResult()));
332 std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
333 if ((GetLastResult() == E_SUCCESS) && (pEnum == null))
337 SysTryReturn(NID_APP, pEnum, L"", E_SYSTEM, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
339 while (pEnum->MoveNext() == E_SUCCESS)
341 pEnum->GetStringAt(0, value);
344 SysLog(NID_APP, "value = [%ls]", value.GetPointer());
350 _PackageAppInfoImpl::GetInstance(PackageAppInfo* pPackageAppInfo)
354 return pPackageAppInfo->__pPackageAppInfoImpl;
361 _PackageAppInfoImpl::Construct(const AppId& appId)
363 SysTryReturnResult(NID_APP, appId.IsEmpty() == false, E_INVALID_ARG, "appId is empty.");
365 int res = PMINFO_R_OK;
366 char* pExePath = null;
367 char* pDisplayName = null;
368 char* pMenuIcon = null;
369 char* pSettingIcon = null;
370 char* pNotificationIcon = null;
371 bool mainApp = false;
372 bool menuIconVisible = false;
374 std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
375 SysTryReturnResult(NID_APP, pAppId, E_OUT_OF_MEMORY, "pAppId is null");
377 res = pkgmgrinfo_appinfo_get_appinfo(pAppId.get(), &__pAppInfoHandle);
378 SysTryReturnResult(NID_APP, res == 0, E_SYSTEM, "pkgmgrinfo_appinfo_get_appinfo failed, res = [%d], app = [%s]", res, pAppId.get());
380 __fromDatabase = true;
384 res = pkgmgrinfo_appinfo_get_exec(__pAppInfoHandle, &pExePath);
385 if (res == PMINFO_R_OK)
387 String exePath(pExePath);
388 int startIndex = exePath.GetLength() - 1;
390 result r = exePath.LastIndexOf(L'/', startIndex, indexOf);
394 exePath.SubString(indexOf + 1, appName);
396 SysLog(NID_APP, "appName = [%ls]", appName.GetPointer());
400 SysLog(NID_APP, "LastIndexOf is failed.");
405 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_exec() is failed. result = [%d]", res);
408 res = pkgmgrinfo_appinfo_get_label(__pAppInfoHandle, &pDisplayName);
409 if (res == PMINFO_R_OK)
411 String displayName(pDisplayName);
412 SetAppDisplayName(displayName);
416 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_label() is failed. result = [%d]", res);
419 res = pkgmgrinfo_appinfo_get_icon(__pAppInfoHandle, &pMenuIcon);
420 if (res == PMINFO_R_OK)
422 String menuIcon(pMenuIcon);
423 SetAppMenuIconPath(menuIcon);
427 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_icon() is failed. result = [%d]", res);
430 res = pkgmgrinfo_appinfo_get_setting_icon(__pAppInfoHandle, &pSettingIcon);
431 if (res == PMINFO_R_OK)
433 String settingIcon(pSettingIcon);
434 SetAppSettingIconPath(settingIcon);
438 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_setting_icon() is failed. result = [%d]", res);
441 res = pkgmgrinfo_appinfo_get_notification_icon(__pAppInfoHandle, &pNotificationIcon);
442 if (res == PMINFO_R_OK)
444 String notificationIcon(pNotificationIcon);
445 SetAppNotificationIconPath(notificationIcon);
449 SysLog(NID_APP, "pkgmgrinfo_appinfo_get_notification_icon() is failed. result = [%d]", res);
452 res = pkgmgrinfo_appinfo_is_mainapp(__pAppInfoHandle, &mainApp);
453 if (res == PMINFO_R_OK)
459 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_mainapp() is failed. result = [%d]", res);
462 res = pkgmgrinfo_appinfo_is_nodisplay(__pAppInfoHandle, &menuIconVisible);
463 if (res == PMINFO_R_OK)
465 SetMenuIconVisible(!menuIconVisible);
469 SysLog(NID_APP, "pkgmgrinfo_appinfo_is_nodisplay() is failed. result = [%d]", res);
472 SysLog(NID_APP, "exe = [%s], displayName = [%s], mainApp = [%d], menuIconVisible = [%d]", pExePath, pDisplayName, mainApp, menuIconVisible);
478 _PackageAppInfoImpl::CategoryHandler(const char* pCategoryName, void* pUserData)
480 SysTryReturn(NID_APP, pCategoryName != null, 0, E_SYSTEM, "[E_SYSTEM] pCategoryName must not be null.");
482 SysLog(NID_APP, "Category = [%s]", pCategoryName);
483 ArrayList* pList = (ArrayList*) pUserData;
485 String* pCategory = new (std::nothrow) String (pCategoryName);
486 SysTryReturn(NID_APP, pCategory != null, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pCategory instance must not be null.");
488 pList->Add(*pCategory);
494 _PackageAppInfoImpl::MetadataHandler(const char* pKey, const char* pValue, void* pUserData)
496 SysTryReturn(NID_APP, pKey, 0, E_SYSTEM, "pKey must not be null.");
497 SysTryReturn(NID_APP, pValue, 0, E_SYSTEM, "pValue must not be null.");
498 SysTryReturn(NID_APP, pUserData, 0, E_SYSTEM, "pUserData must not be null.");
500 SysLog(NID_APP, "Key = [%s], Value = [%s]", pKey, pValue);
502 MultiHashMap* pMultiMap = (MultiHashMap*) pUserData;
503 result r = pMultiMap->Add(*(new (std::nothrow) String(pKey)), *(new (std::nothrow) String(pValue)));
504 SysTryReturn(NID_APP, r == E_SUCCESS, -1, E_SYSTEM, "pMultiMap->Add() failed. [%s]", GetErrorMessage(GetLastResult()));
510 _PackageAppInfoImpl::_PackageAppInfoImpl(void)
511 : __launchingIconVisible(true)
513 , __fromDatabase(false)
514 , __pLaunchConditionImplList(null)
515 , __pNotificationImplList(null)
516 , __pAppFeatureImplList(null)
517 , __pDataControlImplList(null)
518 , __pAppControlImplList(null)
519 , __pAppCategoryList(null)
524 ,__pAppInfoHandle(null)
525 , __pIconBuffer(null)
528 __pLaunchConditionImplList = new (std::nothrow) ArrayList;
529 SysTryReturnVoidResult(NID_APP, __pLaunchConditionImplList != null, E_OUT_OF_MEMORY, "__pLaunchConditionImplList instance must not be null.");
530 __pLaunchConditionImplList->Construct();
532 __pNotificationImplList = new (std::nothrow) ArrayList;
533 SysTryReturnVoidResult(NID_APP, __pNotificationImplList != null, E_OUT_OF_MEMORY, "__pNotificationImplList instance must not be null.");
534 __pNotificationImplList->Construct();
536 __pAppFeatureImplList = new (std::nothrow) ArrayList;
537 SysTryReturnVoidResult(NID_APP, __pAppFeatureImplList != null, E_OUT_OF_MEMORY, "__pAppFeatureImplList instance must not be null.");
538 __pAppFeatureImplList->Construct();
540 __pDataControlImplList = new (std::nothrow) ArrayList;
541 SysTryReturnVoidResult(NID_APP, __pDataControlImplList != null, E_OUT_OF_MEMORY, "__pDataControlImplList instance must not be null.");
542 __pDataControlImplList->Construct();
544 __pAppControlImplList = new (std::nothrow) ArrayList;
545 SysTryReturnVoidResult(NID_APP, __pAppControlImplList != null, E_OUT_OF_MEMORY, "__pAppControlImplList instance must not be null.");
546 __pAppControlImplList->Construct();
548 __pAppCategoryList = new (std::nothrow) ArrayList;
549 SysTryReturnVoidResult(NID_APP, __pAppCategoryList != null, E_OUT_OF_MEMORY, "__pAppCategoryList instance must not be null.");
550 __pAppCategoryList->Construct();
552 __pNameList = new (std::nothrow) HashMap;
553 SysTryReturnVoidResult(NID_APP, __pNameList != null, E_OUT_OF_MEMORY, "__pNameList instance must not be null.");
554 __pNameList->Construct();
558 _PackageAppInfoImpl::~_PackageAppInfoImpl(void)
560 __pLaunchConditionImplList->RemoveAll(true);
561 delete __pLaunchConditionImplList;
563 __pNotificationImplList->RemoveAll(true);
564 delete __pNotificationImplList;
566 __pAppFeatureImplList->RemoveAll(true);
567 delete __pAppFeatureImplList;
569 __pDataControlImplList->RemoveAll(true);
570 delete __pDataControlImplList;
572 __pAppControlImplList->RemoveAll(true);
573 delete __pAppControlImplList;
575 __pAppCategoryList->RemoveAll(true);
576 delete __pAppCategoryList;
578 __pNameList->RemoveAll(true);
581 if (__pAppInfoHandle)
583 pkgmgrinfo_appinfo_destroy_appinfo(__pAppInfoHandle);
588 _PackageAppInfoImpl::GetName(void) const
594 _PackageAppInfoImpl::SetName(const String& name)
601 _PackageAppInfoImpl::GetType(void) const
607 _PackageAppInfoImpl::SetType(const String& type)
614 _PackageAppInfoImpl::GetDefault(void) const
620 _PackageAppInfoImpl::SetDefault(const String& defaultApp)
622 __default = defaultApp;
627 _PackageAppInfoImpl::GetLaunchConditionListN(void) const
629 result r = E_SUCCESS;
631 DbStatement* pStmt = null;
632 DbEnumerator* pEnum = null;
635 ArrayList* pList = null;
637 query.Format(1024, L"SELECT * FROM LaunchCondition WHERE ID = %d", GetUniqueId());
639 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
640 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
642 pStmt = db.CreateStatementN(query);
643 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
644 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
646 pEnum = db.ExecuteStatementN(*pStmt);
649 pList = new (std::nothrow) ArrayList;
650 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
653 while (pEnum->MoveNext() == E_SUCCESS)
655 _LaunchConditionInfoImpl* pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl;
656 SysTryReturn(NID_APP, pLaunchConditionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
661 pEnum->GetStringAt(1, name);
662 pEnum->GetStringAt(2, value);
664 pLaunchConditionImpl->SetName(name);
665 pLaunchConditionImpl->SetValue(value);
667 pList->Add(*pLaunchConditionImpl);
678 _PackageAppInfoImpl::GetLaunchConditionList(void) const
680 return __pLaunchConditionImplList;
684 _PackageAppInfoImpl::AddLaunchCondition(const _LaunchConditionInfoImpl& launchConditionImpl)
686 result r = E_SUCCESS;
687 r = __pLaunchConditionImplList->Add(launchConditionImpl);
688 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pLaunchConditionImplList->Add() is failed.");
694 _PackageAppInfoImpl::GetNotificationListN(void) const
696 result r = E_SUCCESS;
698 DbStatement* pStmt = null;
699 DbEnumerator* pEnum = null;
702 ArrayList* pList = null;
704 query.Format(1024, L"SELECT * FROM Notification WHERE ID = %d", GetUniqueId());
706 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
707 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
709 pStmt = db.CreateStatementN(query);
710 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
711 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
713 pEnum = db.ExecuteStatementN(*pStmt);
716 pList = new (std::nothrow) ArrayList;
717 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
720 while (pEnum->MoveNext() == E_SUCCESS)
722 _NotificationInfoImpl* pNotificationImpl = new (std::nothrow) _NotificationInfoImpl;
723 SysTryReturn(NID_APP, pNotificationImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
728 pEnum->GetStringAt(1, name);
729 pEnum->GetStringAt(2, value);
731 pNotificationImpl->SetName(name);
732 pNotificationImpl->SetValue(value);
734 pList->Add(*pNotificationImpl);
745 _PackageAppInfoImpl::GetNotificationList(void) const
747 return __pNotificationImplList;
751 _PackageAppInfoImpl::AddNotification(const _NotificationInfoImpl& notificationImpl)
753 result r = E_SUCCESS;
754 r = __pNotificationImplList->Add(notificationImpl);
755 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pNotificationImplList->Add() is failed.");
761 _PackageAppInfoImpl::GetAppFeatureListN(void) const
763 result r = E_SUCCESS;
765 DbStatement* pStmt = null;
766 DbEnumerator* pEnum = null;
769 ArrayList* pList = null;
771 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
773 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
774 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
776 pStmt = db.CreateStatementN(query);
777 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
778 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
780 pEnum = db.ExecuteStatementN(*pStmt);
783 pList = new (std::nothrow) ArrayList;
784 SysTryReturn(NID_APP, pList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
787 while (pEnum->MoveNext() == E_SUCCESS)
789 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
790 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
795 pEnum->GetStringAt(1, name);
796 pEnum->GetStringAt(2, value);
798 pAppFeatureImpl->SetName(name);
799 pAppFeatureImpl->SetValue(value);
801 pList->Add(*pAppFeatureImpl);
812 _PackageAppInfoImpl::GetAppFeatureList(void) const
814 return __pAppFeatureImplList;
817 HashMapT<String, _AppFeatureInfoImpl*>*
818 _PackageAppInfoImpl::GetAppFeatureMapN(void) const
820 result r = E_SUCCESS;
822 DbEnumerator* pEnum = null;
825 HashMapT<String, _AppFeatureInfoImpl*>* pMap = null;
827 query.Format(1024, L"SELECT * FROM AppFeature WHERE ID = %d", GetUniqueId());
829 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
830 SysTryReturn(NID_APP, r == E_SUCCESS, null, r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
832 const DbStatement* pStmt = db.CreateStatementN(query);
833 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
834 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
836 pEnum = db.ExecuteStatementN(*pStmt);
839 pMap = new (std::nothrow) HashMapT<String, _AppFeatureInfoImpl*>;
840 SysTryReturn(NID_APP, pMap != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
846 while (pEnum->MoveNext() == E_SUCCESS)
848 _AppFeatureInfoImpl* pAppFeatureImpl = new (std::nothrow) _AppFeatureInfoImpl;
849 SysTryReturn(NID_APP, pAppFeatureImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
851 pEnum->GetStringAt(1, name);
852 pEnum->GetStringAt(2, value);
854 pAppFeatureImpl->SetName(name);
855 pAppFeatureImpl->SetValue(value);
857 pMap->Add(name, pAppFeatureImpl);
868 _PackageAppInfoImpl::AddAppFeature(const _AppFeatureInfoImpl& appFeatureImpl)
870 result r = E_SUCCESS;
871 r = __pAppFeatureImplList->Add(appFeatureImpl);
872 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppFeatureImplList->Add() is failed.");
878 _PackageAppInfoImpl::GetDataControlListN(void) const
884 _PackageAppInfoImpl::GetDataControlList(void) const
886 return __pDataControlImplList;
890 _PackageAppInfoImpl::AddDataControl(_DataControlInfoImpl* pDataControl)
892 result r = E_SUCCESS;
893 r = __pDataControlImplList->Add(*pDataControl);
894 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pDataControlImplList->Add() is failed.");
900 _PackageAppInfoImpl::GetAppControlListN(void) const
906 _PackageAppInfoImpl::GetAppControlList(void) const
908 return __pAppControlImplList;
912 _PackageAppInfoImpl::AddAppControl(_AppControlInfoImpl* pAppControl)
914 result r = E_SUCCESS;
915 r = __pAppControlImplList->Add(*pAppControl);
916 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pAppControlImplList->Add() is failed.");
922 _PackageAppInfoImpl::GetPackageName(void) const
924 return __packageName;
928 _PackageAppInfoImpl::SetPackageName(const String& packageName)
930 __packageName = packageName;
935 _PackageAppInfoImpl::GetMainmenuIcon(void) const
937 return __mainmenuIcon;
941 _PackageAppInfoImpl::SetMainmenuIcon(const String& mainmenuIcon)
943 __mainmenuIcon = mainmenuIcon;
948 _PackageAppInfoImpl::GetSettingIcon(void) const
950 return __settingIcon;
954 _PackageAppInfoImpl::SetSettingIcon(const String& setting)
956 __settingIcon = setting;
961 _PackageAppInfoImpl::GetQuickpanelIcon(void) const
963 return __quickpanelIcon;
967 _PackageAppInfoImpl::SetQuickpanelIcon(const String& quickpanelIcon)
969 __quickpanelIcon = quickpanelIcon;
974 _PackageAppInfoImpl::IsMainmenuVisible(void) const
976 return __launchingIconVisible;
980 _PackageAppInfoImpl::SetMainmenuVisible(bool visible)
982 __launchingIconVisible = visible;
987 _PackageAppInfoImpl::AddName(const String& language, const String& name)
989 result r = E_SUCCESS;
990 r = __pNameList->Add(language, name);
996 _PackageAppInfoImpl::GetNameList(void) const
1002 _PackageAppInfoImpl::GetUniqueId(void) const
1004 result r = E_SUCCESS;
1006 DbStatement* pStmt = null;
1007 DbEnumerator* pEnum = null;
1011 query.Format(1024, L"SELECT UNIQUE_ID FROM AppInfo WHERE APP_NAME = '%ls' and ID = %d", __name.GetPointer(), __pkgId);
1013 r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
1014 SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
1016 pStmt = _PackageManagerImpl::CreateStatementN(db, query);
1017 SysTryCatch(NID_APP, pStmt != null, GetLastResult(),
1018 GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
1020 pEnum = _PackageManagerImpl::ExecuteStatementN(db, pStmt);
1023 if (pEnum->MoveNext() == E_SUCCESS)
1025 pEnum->GetIntAt(0, uniqueId);
1032 r = E_OBJ_NOT_FOUND;
1041 _PackageAppInfoImpl::GetPkgId(void) const
1047 _PackageAppInfoImpl::SetUniqueId(int id)
1054 _PackageAppInfoImpl::SetPkgId(int id)
1061 _PackageAppInfoImpl::GetAppFeature(void) const
1063 return __appFeature;
1067 _PackageAppInfoImpl::SetAppFeature(int feature)
1069 __appFeature = feature;
1073 _LaunchConditionInfoImpl::_LaunchConditionInfoImpl(void)
1078 _LaunchConditionInfoImpl::~_LaunchConditionInfoImpl(void)
1084 _LaunchConditionInfoImpl::GetName(void) const
1090 _LaunchConditionInfoImpl::SetName(const String& name)
1097 _LaunchConditionInfoImpl::GetValue(void) const
1103 _LaunchConditionInfoImpl::SetValue(const String& value)
1109 _NotificationInfoImpl::_NotificationInfoImpl(void)
1114 _NotificationInfoImpl::~_NotificationInfoImpl(void)
1120 _NotificationInfoImpl::GetName(void) const
1126 _NotificationInfoImpl::SetName(const String& name)
1133 _NotificationInfoImpl::GetValue(void) const
1139 _NotificationInfoImpl::SetValue(const String& value)
1145 _AppFeatureInfoImpl::_AppFeatureInfoImpl(void)
1150 _AppFeatureInfoImpl::~_AppFeatureInfoImpl(void)
1156 _AppFeatureInfoImpl::GetName(void) const
1162 _AppFeatureInfoImpl::SetName(const String& name)
1169 _AppFeatureInfoImpl::GetValue(void) const
1175 _AppFeatureInfoImpl::SetValue(const String& value)
1181 _DataControlTypeImpl::_DataControlTypeImpl(void)
1186 _DataControlTypeImpl::~_DataControlTypeImpl(void)
1192 _DataControlTypeImpl::GetType(void) const
1198 _DataControlTypeImpl::SetType(const String& type)
1205 _DataControlTypeImpl::GetAccess(void) const
1211 _DataControlTypeImpl::SetAccess(const String& access)
1217 _DataControlInfoImpl::_DataControlInfoImpl(void)
1218 : __pControlTypeList(null)
1220 __pControlTypeList = new (std::nothrow) ArrayList;
1221 SysTryReturnVoidResult(NID_APP, __pControlTypeList != null, E_OUT_OF_MEMORY, "__pControlTypeList instance must not be null.");
1222 __pControlTypeList->Construct();
1225 _DataControlInfoImpl::~_DataControlInfoImpl(void)
1227 __pControlTypeList->RemoveAll(true);
1228 delete __pControlTypeList;
1232 _DataControlInfoImpl::GetProviderId(void) const
1234 return __providerId;
1238 _DataControlInfoImpl::SetProviderId(const String& providerId)
1240 __providerId = providerId;
1245 _DataControlInfoImpl::GetControlTypeList(void) const
1247 return __pControlTypeList;
1251 _DataControlInfoImpl::AddControlType(_DataControlTypeImpl* pControlType)
1253 __pControlTypeList->Add(*pControlType);
1257 _AppControlResolutionInfoImpl::_AppControlResolutionInfoImpl(void)
1258 : __pUriScheme(null)
1264 _AppControlResolutionInfoImpl::~_AppControlResolutionInfoImpl(void)
1266 delete __pUriScheme;
1271 _AppControlResolutionInfoImpl::GetUriScheme(void) const
1273 return __pUriScheme;
1277 _AppControlResolutionInfoImpl::SetUriScheme(String* pUriScheme)
1279 __pUriScheme = pUriScheme;
1284 _AppControlResolutionInfoImpl::GetMimeType(void) const
1290 _AppControlResolutionInfoImpl::SetMimeType(String* pMimeType)
1292 __pMimeType = pMimeType;
1296 _AppControlCapabilityInfoImpl::_AppControlCapabilityInfoImpl(void)
1299 ,__pResolutionList(null)
1301 __pResolutionList = new (std::nothrow) ArrayList;
1302 SysTryReturnVoidResult(NID_APP, __pResolutionList != null, E_OUT_OF_MEMORY, "__pResolutionList instance must not be null.");
1303 __pResolutionList->Construct();
1306 _AppControlCapabilityInfoImpl::~_AppControlCapabilityInfoImpl(void)
1308 __pResolutionList->RemoveAll(true);
1309 delete __pResolutionList;
1313 _AppControlCapabilityInfoImpl::GetUniqueId(void) const
1319 _AppControlCapabilityInfoImpl::SetUniqueId(int uniqueId)
1321 __uniqueId = uniqueId;
1326 _AppControlCapabilityInfoImpl::GetAppControlId(void) const
1328 return __appControlId;
1332 _AppControlCapabilityInfoImpl::SetAppControlId(int appControlId)
1334 __appControlId = appControlId;
1339 _AppControlCapabilityInfoImpl::GetOperationId(void) const
1341 return __operationId;
1345 _AppControlCapabilityInfoImpl::SetOperationId(const String& operationId)
1347 __operationId = operationId;
1352 _AppControlCapabilityInfoImpl::GetResolutionList(void) const
1354 return __pResolutionList;
1358 _AppControlCapabilityInfoImpl::AddResolution(_AppControlResolutionInfoImpl* pResolutionImpl)
1360 result r = E_SUCCESS;
1361 r = __pResolutionList->Add(*pResolutionImpl);
1362 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pResolutionList->Add() is failed.");
1367 _AppControlInfoImpl::_AppControlInfoImpl(void)
1369 ,__pCapabilityList(null)
1371 __pCapabilityList = new (std::nothrow) ArrayList;
1372 SysTryReturnVoidResult(NID_APP, __pCapabilityList != null, E_OUT_OF_MEMORY, "__pCapabilityList instance must not be null.");
1373 __pCapabilityList->Construct();
1376 _AppControlInfoImpl::~_AppControlInfoImpl(void)
1378 __pCapabilityList->RemoveAll(true);
1379 delete __pCapabilityList;
1383 _AppControlInfoImpl::GetUniqueId(void) const
1389 _AppControlInfoImpl::SetUniqueId(int uniqueId)
1391 __uniqueId = uniqueId;
1396 _AppControlInfoImpl::GetProviderId(void) const
1398 return __providerId;
1402 _AppControlInfoImpl::SetProviderId(const String& providerId)
1404 __providerId = providerId;
1409 _AppControlInfoImpl::GetCategory(void) const
1415 _AppControlInfoImpl::SetCategory(const String& category)
1417 __category = category;
1422 _AppControlInfoImpl::GetCapabilityList(void) const
1424 return __pCapabilityList;
1428 _AppControlInfoImpl::AddCapability(_AppControlCapabilityInfoImpl* pCapability)
1430 result r = E_SUCCESS;
1431 r = __pCapabilityList->Add(*pCapability);
1432 SysTryReturnResult(NID_APP, !IsFailed(r), r, "__pCapabilityList->Add() is failed.");
1437 } } } // Tizen::App::Package