2 // Tizen Web Device API
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.
20 #include <JSWebAPIErrorFactory.h>
21 #include <GlobalContextManager.h>
22 #include <PlatformException.h>
24 // to get package name by appid
25 #include <app_manager.h>
27 // To get cert information from package
28 #include <package_manager.h>
29 #include <package_info.h>
31 // To get app size and installed time
32 #include <pkgmgr-info.h>
34 // To use ecore_thread
37 #include "PackageManager.h"
38 #include "PackageInformation.h"
39 #include "JSPackageInformation.h"
41 #include <TimeTracer.h>
45 using namespace WrtDeviceApis::Commons;
46 using namespace WrtDeviceApis::CommonsJavaScript;
47 using namespace DeviceAPI::Common;
53 int package_manager_client_destroy(package_manager_request_h request);
60 PackageInfoCallbackData::PackageInfoCallbackData(JSContextRef globalCtx):
61 CallbackUserData(globalCtx)
63 m_exceptionCode = WrtDeviceApis::Commons::ExceptionCodes::None;
66 PackageInfoCallbackData::~PackageInfoCallbackData()
68 // TODO: Should I clear pkgInfos?
71 vector<PackageInformation> PackageInfoCallbackData::getPackageInfoList()
77 void PackageInfoCallbackData::addPackageInfo(PackageInformation pkgInfo)
79 m_pkgInfos.push_back(pkgInfo);
83 void PackageInfoCallbackData::setExceptionCode(ExceptionCodes::Enumeration exceptionCode)
85 m_exceptionCode = exceptionCode;
88 ExceptionCodes::Enumeration PackageInfoCallbackData::getExceptionCode() const
90 return m_exceptionCode;
93 PackageInfoEventCallback::PackageInfoEventCallback(CallbackUserData* oninstalled, CallbackUserData* onupdated, CallbackUserData* onuninstalled)
95 m_oninstalled = oninstalled;
96 m_onupdated = onupdated;
97 m_onuninstalled = onuninstalled;
101 PackageInfoEventCallback::~PackageInfoEventCallback()
104 delete m_oninstalled;
110 delete m_onuninstalled;
113 CallbackUserData* PackageInfoEventCallback::getOnInstalled()
115 return m_oninstalled;
118 CallbackUserData* PackageInfoEventCallback::getOnUpdated()
123 CallbackUserData* PackageInfoEventCallback::getOnUninstalled()
125 return m_onuninstalled;
128 pkgmgr_client** PackageInfoEventCallback::getEventHandler()
133 void PackageInfoEventCallback::setEventHandler(pkgmgr_client **handler)
135 m_handle_p = handler;
138 PackageInstallEventCallback::PackageInstallEventCallback(JSContextRef globalCtx, CallbackUserData* onprogress, CallbackUserData* oncomplete, CallbackUserData* onerror)
140 m_context = globalCtx;
141 m_onprogress = onprogress;
142 m_oncomplete = oncomplete;
145 m_request_handle = NULL;
148 PackageInstallEventCallback::~PackageInstallEventCallback()
150 if (m_request_handle != NULL) {
151 //package_manager_request_destroy(m_request_handle);
152 package_manager_client_destroy(m_request_handle);
165 CallbackUserData* PackageInstallEventCallback::getOnProgress()
170 CallbackUserData* PackageInstallEventCallback::getOnComplete()
175 CallbackUserData* PackageInstallEventCallback::getOnError()
180 JSContextRef PackageInstallEventCallback::getContext()
185 void PackageInstallEventCallback::setHandle(package_manager_request_h handle)
187 m_request_handle = handle;
190 package_manager_request_h PackageInstallEventCallback::getHandle()
192 return m_request_handle;
195 static int get_current_pkg_id(char** pkg_id)
199 string appId = PackageManager::getInstance()->getCurrentAppId();
201 int ret = app_manager_get_app_info(appId.c_str(), &handle);
202 if (ret != APP_MANAGER_ERROR_NONE) {
203 LoggerE("Fail to get appinfo");
207 ret = app_info_get_package(handle, pkg_id);
208 if ((ret != APP_MANAGER_ERROR_NONE) || (*pkg_id == NULL)) {
209 LoggerE("Fail to get pkg_id");
210 app_info_destroy(handle);
214 ret = app_info_destroy(handle);
215 if (ret != APP_MANAGER_ERROR_NONE) {
216 LoggerE("Fail to get destory appinfo");
223 static bool app_callback(package_info_app_component_type_e comp_type, const char *app_id, void *user_data)
225 PackageInformation* pkgInfo = (PackageInformation*)user_data;
226 pkgInfo->m_appIds.push_back(app_id);
230 static PackageInformation* create_pkg_info(pkgmgrinfo_pkginfo_h handle)
232 PackageInformation *pkgInfo = new PackageInformation();
236 char* iconPath = NULL;
237 char* version = NULL;
238 int lastModified = 0;
241 char* description = NULL;
242 vector<string> appIds;
245 ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &id);
246 if ((ret != PMINFO_R_OK) || (id == NULL)) {
247 LoggerE("Fail to get id. return NULL.");
254 ret = pkgmgrinfo_pkginfo_get_label(handle, &name);
255 if ((ret != PMINFO_R_OK) || (name == NULL)) {
256 LoggerE("Fail to get labe");
258 pkgInfo->m_name = name;
261 ret = pkgmgrinfo_pkginfo_get_icon(handle, &iconPath);
262 if ((ret != PMINFO_R_OK) || (iconPath == NULL)) {
263 LoggerE("Fail to get iconPath");
265 pkgInfo->m_iconPath = iconPath;
268 ret = pkgmgrinfo_pkginfo_get_version(handle, &version);
269 if ((ret != PMINFO_R_OK) || (version == NULL)) {
270 LoggerE("Fail to get version");
272 pkgInfo->m_version = version;
275 ret = pkgmgrinfo_pkginfo_get_installed_time(handle, &lastModified);
276 if (ret != PMINFO_R_OK) {
277 LoggerE("Fail to get lastModified");
279 pkgInfo->m_lastModified = lastModified;
282 ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
283 if ((ret != PMINFO_R_OK) || (type == NULL)) {
284 LoggerE("Fail to get type");
286 pkgInfo->m_type = type;
289 ret = pkgmgrinfo_pkginfo_get_author_name(handle, &author);
290 if ((ret != PMINFO_R_OK) || (author == NULL)) {
291 LoggerE("Fail to get author");
293 pkgInfo->m_author = author;
296 ret = pkgmgrinfo_pkginfo_get_description(handle, &description);
297 if ((ret != PMINFO_R_OK) || (description == NULL)) {
298 LoggerE("Fail to get description");
300 pkgInfo->m_description = description;
303 package_info_h package_info;
305 ret = package_manager_get_package_info(id, &package_info);
306 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
307 LoggerE("Cannot create package info");
312 ret = package_info_foreach_app_from_package(package_info, PACKAGE_INFO_ALLAPP, app_callback, (void*)pkgInfo);
313 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
314 LoggerE("failed while getting appids");
317 ret = package_info_destroy(package_info);
318 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
319 LoggerE("Cannot destroy package info");
322 // REMARK: data size and total size is set at first access time
324 // REMARK: do not destroy handle. because handle is comes from outside!!
328 static gboolean getCompleteCB(void *data)
330 PackageInfoCallbackData *callback = (PackageInfoCallbackData *)data;
331 JSContextRef context = callback->getContext();
333 if (callback->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) {
334 vector<PackageInformation> pkgInfoList = callback->getPackageInfoList();
336 JSObjectRef jsResult = JSCreateArrayObject(context, 0, NULL);
337 if (jsResult == NULL) {
338 JSValueRef error = JSWebAPIErrorFactory::makeErrorObject(callback->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "platform exception");
339 callback->callErrorCallback(error);
343 for (size_t i = 0; i < pkgInfoList.size(); ++i) {
344 JSValueRef tmpVal = JSPackageInformation::createJSObject(context, &pkgInfoList[i]);
345 if (!JSSetArrayElement(context, jsResult, i, tmpVal)) {
346 JSValueRef error = JSWebAPIErrorFactory::makeErrorObject(callback->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "platform exception");
347 callback->callErrorCallback(error);
352 callback->callSuccessCallback(jsResult);
354 JSValueRef error = JSWebAPIErrorFactory::makeErrorObject(callback->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "platform exception");
355 callback->callErrorCallback(error);
363 static int get_package_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
365 PackageInfoCallbackData *callback = (PackageInfoCallbackData *)user_data;
366 PackageInformation* pkgInfo = create_pkg_info(handle);
367 if (pkgInfo != NULL) {
368 callback->addPackageInfo(*pkgInfo);
371 LoggerE("Fail to get pkgInfo");
376 static void getThreadCB(void *data, Ecore_Thread *thread)
378 PackageInfoCallbackData *callback = (PackageInfoCallbackData *)data;
380 int ret = pkgmgrinfo_pkginfo_get_list(get_package_list_cb, data);
381 if (ret != PMINFO_R_OK) {
382 LoggerE("Fail to get package info");
383 callback->setExceptionCode(WrtDeviceApis::Commons::ExceptionCodes::PlatformException);
386 // the operation of ecore_thread_run() is not normal. (the finish callback is not called from main thread.)
387 // so, add complete callback to gmainloop explicitly.
388 g_idle_add(getCompleteCB, data);
392 static void package_event_cb(app_manger_event_type_e event_type, const char *package, void *user_data)
394 PackageInfoEventCallback *eventCB = (PackageInfoEventCallback *)user_data;
397 case APP_MANAGER_EVENT_INSTALLED: {
398 pkgmgrinfo_pkginfo_h handle;
399 int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
400 if (ret != PMINFO_R_OK) {
401 LoggerE("fail to find pkg info with given pkg");
402 // Do not throw exception. No one can handle exception because this code is called from async callback.
403 //throw NotFoundException("Can't find given package");
407 PackageInformation* pkgInfo = create_pkg_info(handle);
408 pkgmgrinfo_appinfo_destroy_appinfo(handle);
410 if (pkgInfo == NULL) {
411 LoggerE("Fail to get pkg info. skip callback call");
413 CallbackUserData *callback = eventCB->getOnInstalled();
415 callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
420 case APP_MANAGER_EVENT_UNINSTALLED: {
421 CallbackUserData *callback = eventCB->getOnUninstalled();
423 Converter converter(callback->getContext());
424 callback->callSuccessCallback(converter.toJSValueRef(package));
428 case APP_MANAGER_EVENT_UPDATED: {
429 pkgmgrinfo_pkginfo_h handle;
430 int ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
431 if (ret != PMINFO_R_OK) {
432 // Do not throw exception. No one can handle exception because this code is called from async callback.
433 //throw NotFoundException("Can't find given package");
437 PackageInformation* pkgInfo = create_pkg_info(handle);
438 pkgmgrinfo_appinfo_destroy_appinfo(handle);
440 if (pkgInfo == NULL) {
441 LoggerE("Fail to get pkg info. skip callback call");
443 CallbackUserData *callback = eventCB->getOnUpdated();
445 callback->callSuccessCallback(JSPackageInformation::createJSObject(callback->getContext(), pkgInfo));
451 LoggerE("Fail!! Unknown event type is entered : " << event_type);
458 static int app_list_changed_cb_broker(int id, const char *type, const char *package, const char *key, const char *val, const void *msg, void *data)
460 static app_manger_event_type_e event_type;
462 if (!strcasecmp(key, "start"))
465 if (!strcasecmp(val, "install"))
467 event_type = APP_MANAGER_EVENT_INSTALLED;
469 else if (!strcasecmp(val, "uninstall"))
471 event_type = APP_MANAGER_EVENT_UNINSTALLED;
473 else if (!strcasecmp(val, "update"))
475 event_type = APP_MANAGER_EVENT_UPDATED;
478 else if (!strcasecmp(key, "end") && !strcasecmp(val, "ok"))
483 package_event_cb(event_type, package, data);
485 // Check whether handler is freed in the callback function or not.
486 // if freed, return error code to avoid iteration of callback function. (core platform side)
487 PackageInfoEventCallback * callback = (PackageInfoEventCallback *)data;
488 pkgmgr_client ** handler_p = callback->getEventHandler();
489 if (*handler_p == NULL) {
490 LoggerE("handler is NULL");
493 LoggerE("handler is not NULL");
501 void install_request_cb(int id, const char *type, const char *package,
502 package_manager_event_type_e event_type,
503 package_manager_event_state_e event_state,
505 package_manager_error_e error,
508 PackageInstallEventCallback *callback = (PackageInstallEventCallback *)user_data;
509 JSContextRef context = callback->getContext();;
511 switch (event_state) {
512 case PACAKGE_MANAGER_EVENT_STATE_COMPLETED: {
513 if (callback->getOnComplete()) {
514 Converter converter(context);
515 callback->getOnComplete()->callSuccessCallback(converter.toJSValueRef(package));
518 LoggerD("destroy client handle");
519 // this api is not supported from platform.
520 //package_manager_request_destroy(callback->getHandle());
521 package_manager_client_destroy(callback->getHandle());
522 callback->setHandle(NULL);
524 //clean-up callback object
529 case PACAKGE_MANAGER_EVENT_STATE_FAILED: {
530 JSValueRef jsError = NULL;
531 if (error == PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE) {
532 jsError = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::NOT_FOUND_ERROR,"given package is not found");
534 jsError = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR,"platform exception");
537 if (callback->getOnError()) {
538 callback->getOnError()->callSuccessCallback(jsError);
541 LoggerD("destroy client handle");
542 // this api is not supported from platform.
543 //package_manager_request_destroy(callback->getHandle());
544 package_manager_client_destroy(callback->getHandle());
545 callback->setHandle(NULL);
547 //clean-up callback object
552 case PACAKGE_MANAGER_EVENT_STATE_STARTED:
553 case PACAKGE_MANAGER_EVENT_STATE_PROCESSING: {
554 if (callback->getOnProgress() && package && package[0]!='\0') {
555 Converter converter(context);
556 JSValueRef args[2] = {converter.toJSValueRef(package), converter.toJSValueRef(progress)};
557 callback->getOnProgress()->callSuccessCallback(2, args);
562 JSValueRef error = JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR,"platform exception");
563 if (callback->getOnError()) {
564 callback->getOnError()->callSuccessCallback(error);
566 LoggerD("destroy client handle");
567 // this api is not supported from platform.
568 //package_manager_request_destroy(callback->getHandle());
569 package_manager_client_destroy(callback->getHandle());
570 callback->setHandle(NULL);
572 //clean-up callback object
580 static string ltrim(const string s)
584 for (i = str.begin(); i != str.end(); i++) {
589 if (i == str.end()) {
592 str.erase(str.begin(), i);
598 static string convertUriToPath(const string str)
601 string schema ("file://");
602 string _str = ltrim(str);
604 string _schema = _str.substr(0,schema.size());
605 if(_schema == schema) {
606 result = _str.substr(schema.size());
614 void PackageManager::install(string pkgPath, PackageInstallEventCallback* callback)
618 package_manager_request_h request_h;
619 JSContextRef globalCtx = callback->getContext();
620 CallbackUserData* errCallback = callback->getOnError();
622 ret = package_manager_request_create(&request_h);
623 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
626 JSWebAPIErrorFactory::makeErrorObject(globalCtx, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Platform Error");
627 errCallback->callSuccessCallback(error);
633 ret = package_manager_request_install(request_h, convertUriToPath(pkgPath).c_str(), &id);
634 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
637 JSWebAPIErrorFactory::makeErrorObject(globalCtx, JSWebAPIErrorFactory::NOT_FOUND_ERROR, "Not proper file");
638 errCallback->callSuccessCallback(error);
644 callback->setHandle(request_h);
646 ret = package_manager_request_set_event_cb(request_h, install_request_cb, callback);
647 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
650 JSWebAPIErrorFactory::makeErrorObject(globalCtx, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Platform Error");
651 errCallback->callSuccessCallback(error);
658 void PackageManager::uninstall(string pkgPath, PackageInstallEventCallback* callback)
662 package_manager_request_h request_h;
663 JSContextRef globalCtx = callback->getContext();
664 CallbackUserData* errCallback = callback->getOnError();
666 ret = package_manager_request_create(&request_h);
667 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
670 JSWebAPIErrorFactory::makeErrorObject(globalCtx, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Platform Error");
671 errCallback->callSuccessCallback(error);
673 //clean-up callback object
678 ret = package_manager_request_uninstall(request_h, pkgPath.c_str(), &id);
679 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
682 JSWebAPIErrorFactory::makeErrorObject(globalCtx, JSWebAPIErrorFactory::NOT_FOUND_ERROR, "Not proper file");
683 // TODO: how can I handle about uninstallable package???
684 errCallback->callSuccessCallback(error);
686 //clean-up callback object
691 callback->setHandle(request_h);
693 ret = package_manager_request_set_event_cb(request_h, install_request_cb, callback);
694 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
697 JSWebAPIErrorFactory::makeErrorObject(globalCtx, JSWebAPIErrorFactory::UNKNOWN_ERROR, "Platform Error");
698 errCallback->callSuccessCallback(error);
700 //clean-up callback object
707 PackageInformation* PackageManager::getPackageInfo(string pkgId)
709 if (pkgId.empty() || !pkgId.compare("null")) {
712 TIME_TRACER_ITEM_BEGIN("(getPackageInfo) get_current_pkg_id", 0);
713 int ret = get_current_pkg_id(&pkg_id);
714 TIME_TRACER_ITEM_END("(getPackageInfo) get_current_pkg_id", 0);
715 if((ret != APP_MANAGER_ERROR_NONE) || (pkg_id == NULL)) {
716 LoggerE("Can not get app id from current pid");
717 throw NotFoundException("Can't find given package");
723 pkgmgrinfo_pkginfo_h handle;
724 TIME_TRACER_ITEM_BEGIN("(getPackageInfo) pkgmgrinfo_pkginfo_get_pkginfo", 0);
725 int ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgId.c_str(), &handle);
726 TIME_TRACER_ITEM_END("(getPackageInfo) pkgmgrinfo_pkginfo_get_pkginfo", 0);
727 if (ret != PMINFO_R_OK) {
728 throw NotFoundException("Can't find given package");
731 TIME_TRACER_ITEM_BEGIN("(getPackageInfo) create_pkg_info", 0);
732 PackageInformation* pkgInfo = create_pkg_info(handle);
733 TIME_TRACER_ITEM_END("(getPackageInfo) create_pkg_info", 0);
734 pkgmgrinfo_appinfo_destroy_appinfo(handle);
736 if (pkgInfo == NULL) {
737 throw UnknownException("Can't get pkg info from given package");
744 void PackageManager::getPackagesInfo(PackageInfoCallbackData *user_data)
746 // getting info of all package from other thread. the result callback will be called on main thread
747 ecore_thread_run(getThreadCB, NULL, NULL, user_data);
751 void PackageManager::setPackageInfoEventListener(PackageInfoEventCallback * eventCB)
753 if (m_manager_handle == NULL) {
754 TIME_TRACER_ITEM_BEGIN("(setPackageInfoEventListener) pkgmgr_client_new", 0);
755 m_manager_handle = pkgmgr_client_new(PC_LISTENING);
756 TIME_TRACER_ITEM_END("(setPackageInfoEventListener) pkgmgr_client_new", 0);
757 if (m_manager_handle == NULL) {
758 throw UnknownException("Fail to create package manager handle");
762 eventCB->setEventHandler(&m_manager_handle);
764 TIME_TRACER_ITEM_BEGIN("(setPackageInfoEventListener) pkgmgr_client_listen_status", 0);
765 pkgmgr_client_listen_status(m_manager_handle, app_list_changed_cb_broker, eventCB);
766 TIME_TRACER_ITEM_END("(setPackageInfoEventListener) pkgmgr_client_listen_status", 0);
769 void PackageManager::unsetPackageInfoEventListener()
771 if (m_manager_handle == NULL) {
772 LoggerE("no package manager handle registered");
776 TIME_TRACER_ITEM_BEGIN("(unsetPackageInfoEventListener) pkgmgr_client_free", 0);
777 pkgmgr_client_free(m_manager_handle);
778 TIME_TRACER_ITEM_END("(unsetPackageInfoEventListener) pkgmgr_client_free", 0);
779 m_manager_handle = NULL;
782 PackageManager* PackageManager::getInstance()
784 static PackageManager instance;
788 void PackageManager::setCurrentAppId(string appId)
790 m_curr_app_id = appId;
793 string PackageManager::getCurrentAppId() const
795 return m_curr_app_id;
798 PackageManager::PackageManager()
802 PackageManager::~PackageManager()
804 if (m_manager_handle != NULL) {
805 pkgmgr_client_free(m_manager_handle);
806 m_manager_handle = NULL;
814 void PackageManager::move(string pkgPath, string target, PackageInstallEventCallback* callback)
817 package_manager_move_type_e type = PACAKGE_MANAGER_REQUEST_MOVE_TO_INTERNAL;
819 if (target.compare("INTERNAL") == 0) {
820 type = PACAKGE_MANAGER_REQUEST_MOVE_TO_INTERNAL;
822 type = PACAKGE_MANAGER_REQUEST_MOVE_TO_EXTERNAL;
824 // compare current storage and target storage
826 package_manager_request_h request_h;
828 ret = package_manager_request_create(&request_h);
829 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
830 ThrowMsg(PlatformException, "Unknow exception is occured!!");
833 ret = package_manager_request_move(request_h, pkgPath.c_str(), type);
834 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
835 ThrowMsg(PlatformException, "Unknow exception is occured!!");
838 callback->setHandle(request_h);
840 ret = package_manager_request_set_event_cb(request_h, install_request_cb, callback);
841 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
842 ThrowMsg(PlatformException, "Unknow exception is occured!!");
846 bool PackageManager::isInstalled(string pkgId)
848 package_info_h handle;
851 ret = package_manager_get_package_info(pkgId.c_str(), &handle);
852 if (ret == PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE) {
854 } else if (ret == PACKAGE_MANAGER_ERROR_NONE) {
855 // TODO: Should I exception handling while destory handle? what should I do for that time?
856 package_info_destroy(handle);
859 ThrowMsg(PlatformException, "Unknow exception is occured!!");
863 string PackageManager::getPackageIdFromAppId(string appId)
869 ret = package_manager_get_package_id_by_app_id(appId.c_str(), &pkg_id);
870 if (ret != PACKAGE_MANAGER_ERROR_NONE) {
871 ThrowMsg(NotFoundException, "Not found pkg");