int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label);
/**
+ * @fn int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
+ * @brief This API gets exactly matched label by given appid and locale
+ *
+ * @par This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] appid pointer to appid
+ * @param[in] locale pointer to locale
+ * @param[out] label pointer to hold app label
+ * @return 0 if success, error code(<0) if fail
+ * @retval PMINFO_R_OK success
+ * @retval PMINFO_R_EINVAL invalid argument
+ * @retval PMINFO_R_ERROR internal error
+ * @code
+static int get_localed_label(const char *appid, const char *locale)
+{
+ int ret = 0;
+ char *label = NULL;
+
+ ret = pkgmgrinfo_appinfo_get_localed_label(appid, locale, &label);
+ if (ret != PMINFO_R_OK)
+ return -1;
+
+ printf("localed label: %s\n", label);
+
+ free(label);
+
+ return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label);
+int pkgmgrinfo_appinfo_usr_get_localed_label(const char *appid, const char *locale, uid_t uid, char **label);
+
+/**
* @fn int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
* @brief This API gets the component of the application
*
return PMINFO_R_OK;
}
+static char *_get_localed_label(const char *appid, const char *locale, uid_t uid)
+{
+ char *result = NULL;
+ char *query = NULL;
+ sqlite3_stmt *stmt = NULL;
+ sqlite3 *db = NULL;
+ char *val;
+ char *manifest_db;
+
+ manifest_db = getUserPkgParserDBPathUID(uid);
+ if (manifest_db == NULL) {
+ _LOGE("Failed to get manifest db path");
+ goto err;
+ }
+
+ if (sqlite3_open_v2(manifest_db, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
+ _LOGE("DB open fail\n");
+ goto err;
+ }
+
+ query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", appid, locale);
+ if (query == NULL) {
+ _LOGE("Out of memory");
+ goto err;
+ }
+
+ if (sqlite3_prepare_v2(db, query, -1, &stmt, NULL) != SQLITE_OK) {
+ _LOGE("prepare_v2 fail\n");
+ goto err;
+ }
+
+ if (sqlite3_step(stmt) == SQLITE_ROW) {
+ val = (char *)sqlite3_column_text(stmt, 0);
+ if (val != NULL)
+ result = strdup(val);
+ }
+
+err:
+ sqlite3_finalize(stmt);
+ sqlite3_free(query);
+ sqlite3_close(db);
+
+ return result;
+}
+
+API int pkgmgrinfo_appinfo_usr_get_localed_label(const char *appid, const char *locale, uid_t uid, char **label)
+{
+ char *val;
+ int ret;
+
+ retvm_if(appid == NULL || locale == NULL || label == NULL, PMINFO_R_EINVAL, "Argument is NULL");
+
+ val = _get_localed_label(appid, locale, uid);
+ if (val == NULL)
+ val = _get_localed_label(appid, DEFAULT_LOCALE, uid);
+
+ if (val == NULL) {
+ ret = PMINFO_R_ERROR;
+ } else {
+ *label = val;
+ ret = PMINFO_R_OK;
+ }
+
+ return ret;
+}
+
+API int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
+{
+ return pkgmgrinfo_appinfo_usr_get_localed_label(appid, locale, GLOBAL_USER, label);
+}
API int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
{