When the multiple instance launch is supported, the application ID can
be "<appid>::<instance_id>". This patch checks whether the application ID
has the instance Id or not. If it has the instance ID, the library tries
to find the application info using the real application ID.
Change-Id: I4d72dada5815f359073de860b354cb7bee994b9d
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
appid, _getuid(), handle);
}
appid, _getuid(), handle);
}
+static char *__get_real_appid(const char *appid)
+{
+ char *str;
+ char *saveptr;
+ char *token;
+
+ str = strdup(appid);
+ if (str == NULL)
+ return NULL;
+
+ token = strtok_r(str, "::", &saveptr);
+ if (token == NULL)
+ return str;
+
+ LOGD("Real appid = %s", token);
+ token = strdup(token);
+ free(str);
+ return token;
+}
+
API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
pkgmgrinfo_appinfo_h *handle)
{
int ret;
pkgmgrinfo_appinfo_filter_h filter;
API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
pkgmgrinfo_appinfo_h *handle)
{
int ret;
pkgmgrinfo_appinfo_filter_h filter;
if (appid == NULL || handle == NULL) {
LOGE("invalid parameter");
if (appid == NULL || handle == NULL) {
LOGE("invalid parameter");
if (ret != PMINFO_R_OK)
return ret;
if (ret != PMINFO_R_OK)
return ret;
+ real_appid = __get_real_appid(appid);
+ if (real_appid == NULL) {
+ LOGE("Out of memory");
+ return PMINFO_R_ERROR;
+ }
+
ret = pkgmgrinfo_appinfo_filter_add_string(filter,
ret = pkgmgrinfo_appinfo_filter_add_string(filter,
- PMINFO_APPINFO_PROP_APP_ID, appid);
+ PMINFO_APPINFO_PROP_APP_ID, real_appid);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
PMINFO_APPINFO_PROP_APP_DISABLE, false);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
PMINFO_APPINFO_PROP_APP_DISABLE, false);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
PMINFO_APPINFO_PROP_PKG_DISABLE, false);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
PMINFO_APPINFO_PROP_PKG_DISABLE, false);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
- ret = _pkgmgrinfo_get_appinfo(appid, uid, filter, handle);
+ ret = _pkgmgrinfo_get_appinfo(real_appid, uid, filter, handle);
+ free(real_appid);
pkgmgrinfo_appinfo_filter_destroy(filter);
return ret;
}
pkgmgrinfo_appinfo_filter_destroy(filter);
return ret;
}