From 8622192da3a5db832c862174fff2136f89a5d3dc Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 6 Dec 2016 21:16:07 +0900 Subject: [PATCH] Implement support ambient feature - Add inserting support ambient value into db. - Add api getting support ambient. - Change naming: ambient_support -> support_ambient Change-Id: I7a7e1c7bdfdab71852ab954bf2868917a9634f79 Signed-off-by: Sangyoon Jang --- include/pkgmgr-info.h | 16 ++++++++++++++++ include/pkgmgrinfo_basic.h | 2 +- parser/src/pkgmgr_parser_db.c | 7 ++++--- src/pkgmgrinfo_appinfo.c | 22 +++++++++++++++++++++- src/pkgmgrinfo_basic.c | 4 ++-- 5 files changed, 44 insertions(+), 7 deletions(-) diff --git a/include/pkgmgr-info.h b/include/pkgmgr-info.h index 684317f..9432f0f 100644 --- a/include/pkgmgr-info.h +++ b/include/pkgmgr-info.h @@ -4775,6 +4775,22 @@ int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global); int pkgmgrinfo_appinfo_get_splash_screen_display(pkgmgrinfo_appinfo_h handle, bool *splash_screen_display); /** + * @fn int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle, bool *support_ambient) + * @brief This API gets the application 'support_ambient' value from the app ID + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to application info handle + * @param[out] support_ambient pointer to hold package support_ambient value + * @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 + */ +int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle, bool *support_ambient); + +/** * @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle) * @brief This API destroys the application information handle freeing up all the resources * diff --git a/include/pkgmgrinfo_basic.h b/include/pkgmgrinfo_basic.h index cd4023c..6be5fff 100644 --- a/include/pkgmgrinfo_basic.h +++ b/include/pkgmgrinfo_basic.h @@ -145,7 +145,7 @@ typedef struct application_x { char *support_disable; /*set from package_x*/ char *ui_gadget; /*attr, default: "false"*/ char *launch_mode; /*attr, default: "single"*/ - char *ambient_support; /*attr, default: "false"*/ + char *support_ambient; /*attr, default: "false"*/ char *alias_appid; /*attr*/ char *effective_appid; /*attr*/ char *package_type; /*set from package_x*/ diff --git a/parser/src/pkgmgr_parser_db.c b/parser/src/pkgmgr_parser_db.c index 11a5e35..52aee54 100644 --- a/parser/src/pkgmgr_parser_db.c +++ b/parser/src/pkgmgr_parser_db.c @@ -170,6 +170,7 @@ sqlite3 *pkgmgr_cert_db; "app_package_system TEXT NOT NULL, " \ "app_removable TEXT NOT NULL DEFAULT 'false', " \ "app_package_installed_time TEXT, " \ + "app_support_ambient TEXT NOT NULL DEFAULT 'false', " \ "component_type TEXT, " \ "package TEXT NOT NULL, " \ "app_tep_name TEXT, " \ @@ -1264,7 +1265,7 @@ static int __insert_application_info(manifest_x *mfx) "app_launch_mode, app_ui_gadget, app_support_mode, app_support_disable, component_type, package, " \ "app_tep_name, app_zip_mount_file, app_background_category, app_package_type, app_root_path, " \ "app_api_version, app_effective_appid, app_splash_screen_display, app_package_system, app_removable, " \ - "app_package_installed_time) " \ + "app_package_installed_time, app_support_ambient) " \ "VALUES(" \ "%Q, %Q, %Q, LOWER(%Q), %Q, " \ "LOWER(%Q), LOWER(%Q), LOWER(%Q), LOWER(%Q), LOWER(%Q), " \ @@ -1274,7 +1275,7 @@ static int __insert_application_info(manifest_x *mfx) "COALESCE(%Q, 'caller'), LOWER(%Q), %Q, LOWER(%Q), %Q, %Q, " \ "%Q, %Q, %d, %Q, %Q, " \ "%Q, %Q, LOWER(%Q), LOWER(%Q), LOWER(%Q), " \ - "%Q)", \ + "%Q, LOWER(%Q))", \ app->appid, app->component_type, app->exec, __get_bool(app->nodisplay, false), app->type, __get_bool(app->onboot, false), __get_bool(app->multiple, false), __get_bool(app->autorestart, false), __get_bool(app->taskmanage, false), __get_bool(app->enabled, true), app->hwacceleration, app->screenreader, app->mainapp, app->recentimage, app->launchcondition, @@ -1283,7 +1284,7 @@ static int __insert_application_info(manifest_x *mfx) __get_bool(mfx->preload, false), __get_bool(app->submode, false), app->submode_mainid, mfx->installed_storage, __get_bool(app->process_pool, false), app->launch_mode, __get_bool(app->ui_gadget, false), mfx->support_mode, __get_bool(mfx->support_disable, false), app->component_type, mfx->package, mfx->tep_name, mfx->zip_mount_file, background_value, type, mfx->root_path, mfx->api_version, - effective_appid, __get_bool(app->splash_screen_display, false), __get_bool(mfx->system, false), __get_bool(mfx->removable, true), mfx->installed_time); + effective_appid, __get_bool(app->splash_screen_display, false), __get_bool(mfx->system, false), __get_bool(mfx->removable, true), mfx->installed_time, __get_bool(app->support_ambient, false)); ret = __exec_query(query); if (ret == -1) { diff --git a/src/pkgmgrinfo_appinfo.c b/src/pkgmgrinfo_appinfo.c index ed618ac..7f32a20 100644 --- a/src/pkgmgrinfo_appinfo.c +++ b/src/pkgmgrinfo_appinfo.c @@ -498,7 +498,8 @@ static int _appinfo_get_applications(uid_t db_uid, uid_t uid, "ai.app_splash_screen_display, ai.app_tep_name, " "ai.app_zip_mount_file, ai.component_type, ai.package, " "ai.app_external_path, ai.app_package_system, ai.app_removable, " - "ai.app_package_installed_time, ai.app_support_mode"; + "ai.app_package_installed_time, ai.app_support_mode, " + "ai.app_support_ambient"; static const char query_label[] = ", COALESCE(" "(SELECT app_label FROM package_app_localized_info WHERE ai.app_id=app_id AND app_locale=?), " @@ -633,6 +634,7 @@ static int _appinfo_get_applications(uid_t db_uid, uid_t uid, _save_column_str(stmt, idx++, &info->removable); _save_column_str(stmt, idx++, &info->package_installed_time); _save_column_str(stmt, idx++, &info->support_mode); + _save_column_str(stmt, idx++, &info->support_ambient); info->for_all_users = strdup((uid != GLOBAL_USER) ? "false" : "true"); @@ -2738,6 +2740,24 @@ API int pkgmgrinfo_appinfo_get_splash_screen_display(pkgmgrinfo_appinfo_h handle return PMINFO_R_OK; } +API int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle, + bool *support_ambient) +{ + pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle; + + if (info == NULL || support_ambient == NULL) { + _LOGE("Invalid parameter"); + return PMINFO_R_EINVAL; + } + + if (info->app_info == NULL || info->app_info->support_ambient) + return PMINFO_R_ERROR; + + *support_ambient = _get_bool_value(info->app_info->support_ambient); + + 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"); diff --git a/src/pkgmgrinfo_basic.c b/src/pkgmgrinfo_basic.c index b306af0..ae4e390 100644 --- a/src/pkgmgrinfo_basic.c +++ b/src/pkgmgrinfo_basic.c @@ -336,8 +336,8 @@ static void __ps_free_application(gpointer data) free((void *)application->effectimage_type); if (application->package_type) free((void *)application->package_type); - if (application->ambient_support) - free((void *)application->ambient_support); + if (application->support_ambient) + free((void *)application->support_ambient); if (application->alias_appid) free((void *)application->alias_appid); if (application->external_path) -- 2.7.4