Add effective appid field for appinfo table 35/61935/3 accepted/tizen/ivi/20160313.114536 accepted/tizen/mobile/20160313.113430 accepted/tizen/tv/20160313.113752 accepted/tizen/wearable/20160313.114151 submit/tizen/20160312.053538
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 11 Mar 2016 08:21:08 +0000 (17:21 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 11 Mar 2016 08:54:10 +0000 (17:54 +0900)
Change-Id: Ia78887808b76a3932bfb524067b7d6768c68b816
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
parser/pkgmgr_parser_db.c
src/pkgmgrinfo_appinfo.c
src/pkgmgrinfo_basic.c

index 4c010ab..b4da7f9 100644 (file)
@@ -170,6 +170,7 @@ sqlite3 *pkgmgr_cert_db;
                                                "app_background_category INTEGER DEFAULT 0, " \
                                                "app_root_path text, " \
                                                "app_api_version text, " \
+                                               "app_effective_appid text, " \
                                                "FOREIGN KEY(package) " \
                                                "REFERENCES package_info(package) " \
                                                "ON DELETE CASCADE)"
@@ -1145,6 +1146,25 @@ static int __convert_background_category(GList *category_list)
        return ret;
 }
 
+static const char *__find_effective_appid(GList *metadata_list)
+{
+       GList *tmp_list;
+       metadata_x *md;
+
+       for (tmp_list = metadata_list; tmp_list; tmp_list = tmp_list->next) {
+               md = (metadata_x *)tmp_list->data;
+               if (md == NULL || md->key == NULL)
+                       continue;
+
+               if (strcmp(md->key, "http://tizen.org/metadata/effective-appid") == 0) {
+                       if (md->value)
+                               return md->value;
+               }
+       }
+
+       return NULL;
+}
+
 /* _PRODUCT_LAUNCHING_ENHANCED_
 *  app->indicatordisplay, app->portraitimg, app->landscapeimg, app->guestmode_appstatus
 */
@@ -1156,6 +1176,7 @@ static int __insert_application_info(manifest_x *mfx)
        int background_value = 0;
        char query[MAX_QUERY_LEN] = {'\0'};
        char *type = NULL;
+       const char *effective_appid;
 
        if (mfx->type)
                type = strdup(mfx->type);
@@ -1173,6 +1194,8 @@ static int __insert_application_info(manifest_x *mfx)
                        background_value = 0;
                }
 
+               effective_appid = __find_effective_appid(app->metadata);
+
                snprintf(query, MAX_QUERY_LEN,
                        "insert into package_app_info(" \
                        "app_id, app_component, app_exec, app_nodisplay, app_type, " \
@@ -1181,7 +1204,8 @@ static int __insert_application_info(manifest_x *mfx)
                        "app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, app_permissiontype, " \
                        "app_preload, app_submode, app_submode_mainid, app_installed_storage, app_process_pool, " \
                        "app_launch_mode, app_ui_gadget, app_support_disable, component_type, package, " \
-                       "app_tep_name, app_background_category, app_package_type, app_root_path, app_api_version) " \
+                       "app_tep_name, app_background_category, app_package_type, app_root_path, app_api_version, " \
+                       "app_effective_appid) " \
                        "values(" \
                        "'%s', '%s', '%s', '%s', '%s', " \
                        "'%s', '%s', '%s', '%s', '%s', " \
@@ -1189,7 +1213,8 @@ static int __insert_application_info(manifest_x *mfx)
                        "'%s', '%s', '%s', '%s', '%s', " \
                        "'%s', '%s', '%s', '%s', '%s', " \
                        "'%s', '%s', '%s', '%s', '%s', " \
-                       "'%s', '%d', '%s', '%s', '%s')", \
+                       "'%s', '%d', '%s', '%s', '%s', " \
+                       "'%s')", \
                        app->appid, app->component_type, app->exec, app->nodisplay, app->type,
                        app->onboot, app->multiple, app->autorestart, app->taskmanage, app->enabled,
                        app->hwacceleration, app->screenreader, app->mainapp, __get_str(app->recentimage), app->launchcondition,
@@ -1197,7 +1222,8 @@ static int __insert_application_info(manifest_x *mfx)
                        app->guestmode_visibility, app->permission_type,
                        mfx->preload, app->submode, __get_str(app->submode_mainid), mfx->installed_storage, app->process_pool,
                        app->launch_mode, app->ui_gadget, mfx->support_disable, app->component_type, mfx->package,
-                       __get_str(mfx->tep_name), background_value, type, mfx->root_path, __get_str(mfx->api_version));
+                       __get_str(mfx->tep_name), background_value, type, mfx->root_path, __get_str(mfx->api_version),
+                       __get_str(effective_appid));
 
                ret = __exec_query(query);
                if (ret == -1) {
index 5003e2f..d43f019 100644 (file)
@@ -595,7 +595,7 @@ static int _appinfo_get_application(sqlite3 *db, const char *appid,
                "app_support_disable, "
                "component_type, package, app_process_pool, app_installed_storage, "
                "app_background_category, app_package_type, "
-               "app_root_path, app_api_version "
+               "app_root_path, app_api_version, app_effective_appid "
                "FROM package_app_info WHERE app_id='%s' "
                "AND (app_disable='%s' "
                "%s app_id %s IN "
@@ -670,6 +670,7 @@ static int _appinfo_get_application(sqlite3 *db, const char *appid,
        _save_column_str(stmt, idx++, &info->package_type);
        _save_column_str(stmt, idx++, &info->root_path);
        _save_column_str(stmt, idx++, &info->api_version);
+       _save_column_str(stmt, idx++, &info->effective_appid);
 
        info->background_category = __get_background_category(bg_category_str);
        free(bg_category_str);
@@ -804,7 +805,8 @@ int _appinfo_get_applist(uid_t uid, const char *locale, GHashTable **appinfo_tab
                        "app_hwacceleration, app_permissiontype, app_preload, "
                        "app_installed_storage, app_process_pool, app_launch_mode, "
                        "app_package_type, component_type, package, app_tep_name, "
-                       "app_background_category, app_root_path, app_api_version "
+                       "app_background_category, app_root_path, app_api_version, "
+                       "app_effective_appid "
                        "FROM package_app_info WHERE app_disable='false' AND app_id NOT IN "
                        "(SELECT app_id FROM package_app_disable_for_user WHERE uid='%d')",
                        (int)getuid());
@@ -856,6 +858,7 @@ int _appinfo_get_applist(uid_t uid, const char *locale, GHashTable **appinfo_tab
                _save_column_str(stmt, idx++, &bg_category_str);
                _save_column_str(stmt, idx++, &appinfo->root_path);
                _save_column_str(stmt, idx++, &appinfo->api_version);
+               _save_column_str(stmt, idx++, &appinfo->effective_appid);
 
                appinfo->background_category = __get_background_category(bg_category_str);
                free(bg_category_str);
@@ -1168,6 +1171,8 @@ static int _appinfo_copy_appinfo(application_x **application, application_x *dat
                app_info->launch_mode = strdup(data->launch_mode);
        if (data->package_type != NULL)
                app_info->package_type = strdup(data->package_type);
+       if (data->effective_appid != NULL)
+               app_info->effective_appid = strdup(data->effective_appid);
 
        /* GList */
        ret = 0;
index 60af65a..502bd92 100644 (file)
@@ -297,6 +297,8 @@ static void __ps_free_application(gpointer data)
                free((void *)application->api_version);
        if (application->for_all_users)
                free((void *)application->for_all_users);
+       if (application->effective_appid)
+               free((void *)application->effective_appid);
 
        /*Free Label*/
        g_list_free_full(application->label, __ps_free_label);