fix queries to send all appinfo to AMD 54/61954/3 accepted/tizen/common/20160317.155404 accepted/tizen/ivi/20160315.001446 accepted/tizen/mobile/20160315.001359 accepted/tizen/tv/20160315.001409 accepted/tizen/wearable/20160315.001424 submit/tizen/20160314.031145
authorJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 11 Mar 2016 10:35:03 +0000 (19:35 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 14 Mar 2016 03:05:57 +0000 (20:05 -0700)
Change-Id: I2385dc8828b7066fb2fdfefebfbd64657d107cb4
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
include/pkgmgr-info.h
include/pkgmgrinfo_basic.h
src/pkgmgrinfo_appinfo.c
src/pkgmgrinfo_basic.c

index e5c4a02..1fa977d 100644 (file)
@@ -4321,6 +4321,42 @@ static int get_app_support_disable(const char *appid)
 int pkgmgrinfo_appinfo_is_support_disable(pkgmgrinfo_appinfo_h handle, bool *support_disable);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_is_disabled(pkgmgrinfo_appinfo_h handle, bool *disabled)
+ * @brief      This API gets the application 'is_disable' 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] disabled        pointer to hold application is_disabled value
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @pre                pkgmgrinfo_appinfo_get_appinfo()
+ * @post       pkgmgrinfo_appinfo_destroy_appinfo()
+ * @code
+static int get_app_is_disable(const char *appid)
+{
+       int ret = 0;
+       bool is_disable;
+       pkgmgrinfo_appinfo_h handle = NULL;
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_appinfo_is_disabled(handle, &is_disable);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return -1;
+       }
+       printf("app is_disable: %d\n", is_disable);
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_disabled(pkgmgrinfo_appinfo_h handle, bool *disabled);
+
+/**
  * @fn int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global)
  * @brief      This API gets whethere the given application is global application or user application
  *
index 0cd0059..c14a553 100644 (file)
@@ -141,6 +141,8 @@ typedef struct application_x {
        char *root_path;        /*set from package_x*/
        char *api_version;      /*set from package_x*/
        char *for_all_users; /**< Flag that indicates if the package is available for everyone or for current user only, no xml part*/
+       char *is_disabled; /**< Flag that indicates if the application is disabled or not, no xml part*/
+
        GList *label;   /*element*/
        GList *icon;    /*element*/
        GList *image;   /*element*/
index d43f019..27e9534 100644 (file)
@@ -806,10 +806,11 @@ int _appinfo_get_applist(uid_t uid, const char *locale, GHashTable **appinfo_tab
                        "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_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());
+                       "app_effective_appid, (CASE WHEN A.app_disable='true' THEN 'true' "
+                       "ELSE (CASE WHEN (SELECT app_id FROM package_app_disable_for_user "
+                       "WHERE app_id=A.app_id AND uid='%d') IS NULL "
+                       "THEN 'false' ELSE 'true' END) END) AS app_disable "
+                       "FROM package_app_info A", (int)getuid());
 
        if (query == NULL) {
                _LOGE("Out of memory");
@@ -858,7 +859,9 @@ 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);
+               _save_column_str(stmt, idx++, &appinfo->is_disabled);
 
                appinfo->background_category = __get_background_category(bg_category_str);
                free(bg_category_str);
@@ -2587,6 +2590,20 @@ API int pkgmgrinfo_appinfo_is_support_disable(pkgmgrinfo_appinfo_h handle,
        return PMINFO_R_OK;
 }
 
+API int pkgmgrinfo_appinfo_is_disabled(pkgmgrinfo_appinfo_h handle, bool *disabled)
+{
+       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
+       retvm_if(disabled == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
+       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+       if (info->app_info == NULL || info->app_info->is_disabled == NULL)
+               return PMINFO_R_ERROR;
+
+       *disabled = _get_bool_value(info->app_info->is_disabled);
+
+       return PMINFO_R_OK;
+}
+
 API int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global)
 {
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
index 502bd92..85f8144 100644 (file)
@@ -299,6 +299,8 @@ static void __ps_free_application(gpointer data)
                free((void *)application->for_all_users);
        if (application->effective_appid)
                free((void *)application->effective_appid);
+       if (application->is_disabled)
+               free((void *)application->is_disabled);
 
        /*Free Label*/
        g_list_free_full(application->label, __ps_free_label);