When the sdcard is removed, the app2sd can't acess the app2sd file.
And this can cause the failure to get pkginfo and appinfo.
Change-Id: I7c2eae676bee659e0b2a410728bfac70d9fa7e9d
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
{
int ret = 0;
pkgmgrinfo_pkginfo_h handle;
{
int ret = 0;
pkgmgrinfo_pkginfo_h handle;
+ pkgmgrinfo_appinfo_filter_h filter;
- ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle);
+ ret = pkgmgrinfo_pkginfo_get_usr_all_pkginfo(pkgid, uid, &handle);
if (ret < 0) {
_E("failed to get pkginfo");
return APP2EXT_ERROR_PKGMGR_ERROR;
}
if (ret < 0) {
_E("failed to get pkginfo");
return APP2EXT_ERROR_PKGMGR_ERROR;
}
- ret = pkgmgrinfo_appinfo_get_usr_list(handle,
- PMINFO_ALL_APP, _app2sd_application_handler, &uid, uid);
+ pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+
+ ret = pkgmgrinfo_appinfo_filter_create(&filter);
+ if (ret < 0) {
+ _E("failed to create appinfo filter");
+ return APP2EXT_ERROR_PKGMGR_ERROR;
+ }
+
+ ret = pkgmgrinfo_appinfo_filter_add_string(filter,
+ PMINFO_APPINFO_PROP_APP_PACKAGE, pkgid);
- _E("failed to get appinfo");
+ _E("failed to add pkgid to filter");
+ pkgmgrinfo_appinfo_filter_destroy(filter);
return APP2EXT_ERROR_PKGMGR_ERROR;
}
return APP2EXT_ERROR_PKGMGR_ERROR;
}
- ret = pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+ ret = pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_APP_CHECK_STORAGE, false);
- _E("failed to destroy pkginfo");
+ _E("failed to add check_storage to filter");
+ pkgmgrinfo_appinfo_filter_destroy(filter);
return APP2EXT_ERROR_PKGMGR_ERROR;
}
return APP2EXT_ERROR_PKGMGR_ERROR;
}
+ ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(filter,
+ _app2sd_application_handler, &uid, uid);
+ if (ret < 0) {
+ _E("failed to get filtered foreach appinfo");
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return APP2EXT_ERROR_PKGMGR_ERROR;
+ }
+
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+
return APP2EXT_SUCCESS;
}
return APP2EXT_SUCCESS;
}