From: Junghyun Yeon Date: Mon, 26 Dec 2016 10:06:58 +0000 (+0900) Subject: Change behavior of appinfo X-Git-Tag: accepted/tizen/common/20170110.085156^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F69%2F107069%2F7;p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git Change behavior of appinfo - When app disable filter has applied, code will check app is disabled for certain user or not. - Remove disable_for_user app filter and related values Related changes: [pkgmgr-tool] : https://review.tizen.org/gerrit/107098 [slp-pkgmgr] : https://review.tizen.org/gerrit/107263 [pkgmgr-server] : https://review.tizen.org/gerrit/107264 Change-Id: I887a92dbde508075a31732610502d4d401ca75e3 Signed-off-by: Junghyun Yeon --- diff --git a/include/pkgmgr-info.h b/include/pkgmgr-info.h index 9432f0f..b8b6c85 100644 --- a/include/pkgmgr-info.h +++ b/include/pkgmgr-info.h @@ -146,8 +146,6 @@ extern "C" { /** String property for filtering based on app info*/ #define PMINFO_APPINFO_PROP_APP_METADATA_VALUE "PMINFO_APPINFO_PROP_APP_METADATA_VALUE" - /** Integer property for filtering app disabled by user*/ -#define PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER "PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER_VALUE" /** Integer property for filtering app support mode */ #define PMINFO_APPINFO_PROP_APP_SUPPORT_MODE "PMINFO_APPINFO_PROP_APP_SUPPORT_MODE" diff --git a/src/pkgmgrinfo_appinfo.c b/src/pkgmgrinfo_appinfo.c index af41227..edf146a 100644 --- a/src/pkgmgrinfo_appinfo.c +++ b/src/pkgmgrinfo_appinfo.c @@ -397,35 +397,43 @@ static GList *__get_background_category(const char *value) } -static void __get_splash_screen_display(sqlite3 *db, const char *appid, uid_t uid, char **value) +static int __get_appinfo_for_uid(sqlite3 *db, application_x *info, uid_t uid) { static const char query_raw[] = - "SELECT is_splash_screen_enabled FROM package_app_info_for_uid " - "WHERE app_id='%s' AND uid='%d'"; + "SELECT is_splash_screen_enabled, is_disabled " + "FROM package_app_info_for_uid WHERE app_id='%s' AND uid='%d'"; int ret; char *query; + char *is_disabled = NULL; sqlite3_stmt *stmt; - query = sqlite3_mprintf(query_raw, appid, uid); + query = sqlite3_mprintf(query_raw, info->appid, uid); if (query == NULL) { LOGE("out of memory"); - return; + return PMINFO_R_ERROR; } ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); sqlite3_free(query); if (ret != SQLITE_OK) { LOGE("sqlite3_prepare_v2() failed: %s", sqlite3_errmsg(db)); - return; + return PMINFO_R_ERROR; } while (sqlite3_step(stmt) == SQLITE_ROW) { - if (*value) - free(*value); - _save_column_str(stmt, 0, value); + if (info->splash_screen_display) + free(info->splash_screen_display); + _save_column_str(stmt, 0, &info->splash_screen_display); + if (strcasecmp(info->is_disabled, "false") == 0) { + _save_column_str(stmt, 1, &is_disabled); + if (strcasecmp(is_disabled, "true") == 0) + ret = PMINFO_R_ERROR; + free(is_disabled); + } } sqlite3_finalize(stmt); + return ret; } static void __free_applications(gpointer data) @@ -663,9 +671,14 @@ static int _appinfo_get_applications(uid_t db_uid, uid_t uid, info->for_all_users = strdup((db_uid != GLOBAL_USER) ? "false" : "true"); - if (db_uid == GLOBAL_USER) - __get_splash_screen_display(db, info->appid, db_uid, - &info->splash_screen_display); + if (db_uid == GLOBAL_USER) { + ret = __get_appinfo_for_uid(db, info, uid); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_basic_free_application(info); + info = NULL; + continue; + } + } info->background_category = __get_background_category( bg_category_str); @@ -1296,9 +1309,10 @@ static int _appinfo_get_filtered_foreach_appinfo(uid_t uid, return PMINFO_R_ERROR; } - if (__check_disable_filter_exist(filter) == false) + if (__check_disable_filter_exist(filter) == false) { pkgmgrinfo_appinfo_filter_add_bool(filter, PMINFO_APPINFO_PROP_APP_DISABLE, false); + } ret = _appinfo_get_applications(uid, uid, locale, filter, flag, list); if (ret == PMINFO_R_OK && uid != GLOBAL_USER) @@ -1356,15 +1370,6 @@ API int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle, return PMINFO_R_ERROR; } - if (uid == GLOBAL_USER) { - if (pkgmgrinfo_appinfo_filter_add_int(filter, - PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER, - (int)getuid())) { - pkgmgrinfo_appinfo_filter_destroy(filter); - return PMINFO_R_ERROR; - } - } - comp_str = __appcomponent_str(component); if (comp_str) { @@ -1412,15 +1417,6 @@ API int pkgmgrinfo_appinfo_get_usr_installed_list_full( return PMINFO_R_ERROR; } - if (uid == GLOBAL_USER) { - if (pkgmgrinfo_appinfo_filter_add_int(filter, - PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER, - (int)getuid())) { - pkgmgrinfo_appinfo_filter_destroy(filter); - return PMINFO_R_ERROR; - } - } - ret = _appinfo_get_filtered_foreach_appinfo(uid, filter, flag, app_func, user_data); diff --git a/src/pkgmgrinfo_private.c b/src/pkgmgrinfo_private.c index c407939..7e26eb0 100644 --- a/src/pkgmgrinfo_private.c +++ b/src/pkgmgrinfo_private.c @@ -106,7 +106,6 @@ struct _appinfo_int_map_t { }; static struct _appinfo_int_map_t appinfo_int_prop_map[] = { - {E_PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER, PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER}, {E_PMINFO_APPINFO_PROP_APP_SUPPORT_MODE, PMINFO_APPINFO_PROP_APP_SUPPORT_MODE} }; @@ -392,11 +391,6 @@ int __get_filter_condition(gpointer data, char **condition, GList **params) case E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE: snprintf(buf, MAX_QUERY_LEN, "ai.app_support_disable=? COLLATE NOCASE"); break; - case E_PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER: - snprintf(buf, MAX_QUERY_LEN, "ai.app_id NOT IN " - "(SELECT app_id from package_app_info_for_uid WHERE uid=? " \ - "AND is_disabled='true' COLLATE NOCASE)"); - break; case E_PMINFO_APPINFO_PROP_APP_SUPPORT_MODE: snprintf(buf, sizeof(buf), "ai.app_support_mode=?"); break; diff --git a/src/pkgmgrinfo_private.h b/src/pkgmgrinfo_private.h index 9200838..b86d19e 100644 --- a/src/pkgmgrinfo_private.h +++ b/src/pkgmgrinfo_private.h @@ -154,7 +154,6 @@ typedef enum _pkgmgrinfo_appinfo_filter_prop_bool { typedef enum _pkgmgrinfo_appinfo_filter_prop_int { /*Currently No Fields*/ E_PMINFO_APPINFO_PROP_APP_MIN_INT = 601, - E_PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER = E_PMINFO_APPINFO_PROP_APP_MIN_INT, E_PMINFO_APPINFO_PROP_APP_SUPPORT_MODE, E_PMINFO_APPINFO_PROP_APP_MAX_INT = E_PMINFO_APPINFO_PROP_APP_SUPPORT_MODE } pkgmgrinfo_appinfo_filter_prop_int;