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;
+ char *real_appid;
if (appid == NULL || handle == NULL) {
LOGE("invalid parameter");
if (ret != PMINFO_R_OK)
return ret;
+ real_appid = __get_real_appid(appid);
+ if (real_appid == NULL) {
+ LOGE("Out of memory");
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return PMINFO_R_ERROR;
+ }
+
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);
+ free(real_appid);
return PMINFO_R_ERROR;
}
PMINFO_APPINFO_PROP_APP_DISABLE, false);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
+ free(real_appid);
return PMINFO_R_ERROR;
}
PMINFO_APPINFO_PROP_PKG_DISABLE, false);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
+ free(real_appid);
return PMINFO_R_ERROR;
}
- 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;
}
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_get_light_user_switch_mode(
+ pkgmgrinfo_appinfo_h handle, char **mode)
+{
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info == NULL || mode == NULL) {
+ _LOGE("Invalid parameter");
+ return PMINFO_R_EINVAL;
+ }
+
+ if (info->app_info == NULL || info->app_info->light_user_switch_mode == NULL)
+ return PMINFO_R_ERROR;
+
+ *mode = info->app_info->light_user_switch_mode;
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");