Remove unnecessary handle and related functions 72/248572/2
authorJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 30 Nov 2020 06:17:52 +0000 (15:17 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 30 Nov 2020 08:41:15 +0000 (17:41 +0900)
- Remove type which is no longer used.
- Remove functions which is related with type above.
- Remove unimplemented declaration.

Change-Id: I5597b6b393d007e5071be9350b378fb5076c81c3
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
include/pkgmgr-info.h
include/pkgmgrinfo_type.h
src/pkgmgrinfo_appinfo.c

index 8fac17b..b2f349c 100644 (file)
@@ -2686,49 +2686,6 @@ int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_
                                                        pkgmgrinfo_app_list_cb app_func, void *user_data, uid_t uid);
 
 /**
- * @fn int pkgmgrinfo_appinfo_get_applist_for_amd(pkgmgrinfo_app_list_cb app_func, void *user_data);
- * @brief      This API gets list of installed applications from all packages with  minimum informaion.
- *
- * @par                This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- * @param[in]  app_func                iteration function for list
- * @param[in] user_data        user data to be passed to callback function
- * @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
- * @pre                None
- * @post               None
- * @code
-int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
-{
-       char *pkgid1 = NULL;
-       char *pkgid2 = NULL;
-       pkgid1 = (char *)user_data;
-       pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
-       if (strcmp(pkgid1, pkgid2) == 0) {
-               return -1;
-       } else {
-               return 0;
-       }
-}
-
-static int list_apps()
-{
-       int ret = 0;
-       char *name = "helloworld";
-       ret = pkgmgrinfo_appinfo_get_applist_for_amd(app_list_cb, (void *)name);
-       if (ret != PMINFO_R_OK) {
-               return -1;
-       }
-       return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_usr_applist_for_amd(pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data);
-int pkgmgrinfo_appinfo_get_applist_for_amd(pkgmgrinfo_app_list_cb app_func, void *user_data);
-
-/**
  * @fn int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
  * @brief      This API gets list of installed applications from all packages.
  *
@@ -3315,222 +3272,6 @@ static int get_app_type(const char *appid)
 int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h  handle, char **app_type);
 
 /**
- * @fn int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
-                                                                               int *operation_count, char ***operation)
- * @brief      This API gets the list of operation of the application
- *
- * @par                This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle           pointer to the appcontrol handle.
- * @param[out] operation_count         pointer to hold number of operations
- * @param[out] operation               pointer to hold list of operations
- * @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
- * @pre                pkgmgrinfo_appinfo_get_appinfo()
- * @post               pkgmgrinfo_appinfo_destroy_appinfo()
- * @see                pkgmgrinfo_appinfo_get_uri()
- * @see                pkgmgrinfo_appinfo_get_mime()
- * @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
-{
-       int oc = 0;
-       int i = 0;
-       char **operation;
-       pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
-       for (i = 0; i < oc; i++) {
-               if (strcmp(operation[i], (char *)user_data) == 0)
-                       return -1;
-               else
-                       return 0;
-       }
-}
-
-static int check_operation(const char *appid, char *operation)
-{
-       int ret = 0;
-       pkgmgrinfo_appinfo_h handle;
-       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
-       if (ret != PMINFO_R_OK)
-               return -1;
-       ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
-       if (ret != PMINFO_R_OK) {
-               pkgmgrinfo_appinfo_destroy_appinfo(handle);
-               return -1;
-       }
-       pkgmgrinfo_appinfo_destroy_appinfo(handle);
-       return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
-                                                                               int *operation_count, char ***operation);
-
-/**
- * @fn int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
-                                                                               int *uri_count, char ***uri)
- * @brief      This API gets the list of uri of the application
- *
- * @par                This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle           pointer to the appcontrol handle.
- * @param[out] uri_count               pointer to hold number of uris
- * @param[out] uri             pointer to hold list of uris
- * @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
- * @pre                pkgmgrinfo_appinfo_get_appinfo()
- * @post               pkgmgrinfo_appinfo_destroy_appinfo()
- * @see                pkgmgrinfo_appinfo_get_operation()
- * @see                pkgmgrinfo_appinfo_get_mime()
- * @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
-{
-       int uc = 0;
-       int i = 0;
-       char **uri;
-       pkgmgrinfo_appinfo_get_uri(handle, &uc, &uri);
-       for (i = 0; i < uc; i++) {
-               if (strcmp(uri[i], (char *)user_data) == 0)
-                       return -1;
-               else
-                       return 0;
-       }
-}
-
-static int check_uri(const char *appid, char *uri)
-{
-       int ret = 0;
-       pkgmgrinfo_appinfo_h handle;
-       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
-       if (ret != PMINFO_R_OK)
-               return -1;
-       ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)uri);
-       if (ret != PMINFO_R_OK) {
-               pkgmgrinfo_appinfo_destroy_appinfo(handle);
-               return -1;
-       }
-       pkgmgrinfo_appinfo_destroy_appinfo(handle);
-       return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
-                                                                               int *uri_count, char ***uri);
-
-/**
- * @fn int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
-                                                                               int *mime_count, char ***mime)
- * @brief      This API gets the list of mime of the application
- *
- * @par                This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle           pointer to the appcontrol handle.
- * @param[out] mime_count              pointer to hold number of mimes
- * @param[out] mime            pointer to hold list of mimes
- * @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
- * @pre                pkgmgrinfo_appinfo_get_appinfo()
- * @post               pkgmgrinfo_appinfo_destroy_appinfo()
- * @see                pkgmgrinfo_appinfo_get_uri()
- * @see                pkgmgrinfo_appinfo_get_operation()
- * @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
-{
-       int mc = 0;
-       int i = 0;
-       char **mime;
-       pkgmgrinfo_appinfo_get_operation(handle, &mc, &mime);
-       for (i = 0; i < mc; i++) {
-               if (strcmp(mime[i], (char *)user_data) == 0)
-                       return -1;
-               else
-                       return 0;
-       }
-}
-
-static int check_mime(const char *appid, char *mime)
-{
-       int ret = 0;
-       pkgmgrinfo_appinfo_h handle;
-       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
-       if (ret != PMINFO_R_OK)
-               return -1;
-       ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)mime);
-       if (ret != PMINFO_R_OK) {
-               pkgmgrinfo_appinfo_destroy_appinfo(handle);
-               return -1;
-       }
-       pkgmgrinfo_appinfo_destroy_appinfo(handle);
-       return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
-                                                                               int *mime_count, char ***mime);
-
-/**
- * @fn int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
-                                                                               int *subapp_count, char ***subapp)
- * @brief      This API gets the list of subapp of the application
- *
- * @par                This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] handle           pointer to the appcontrol handle.
- * @param[out] subapp_count            pointer to hold number of subapp
- * @param[out] subapp          pointer to hold list of subapp
- * @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
- * @pre                pkgmgrinfo_appinfo_get_appinfo()
- * @post               pkgmgrinfo_appinfo_destroy_appinfo()
- * @see                pkgmgrinfo_appinfo_get_uri()
- * @see                pkgmgrinfo_appinfo_get_operation()
- * @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
-{
-       int sc = 0;
-       int i = 0;
-       char **subapp = NULL;
-       pkgmgrinfo_appinfo_get_subapp(handle, &sc, &subapp);
-       for (i = 0; i < sc; i++) {
-               if (strcmp(subapp[i], (char *)user_data) == 0)
-                       return -1;
-               else
-                       return 0;
-       }
-}
-
-static int check_subapp(const char *appid, char *subapp)
-{
-       int ret = 0;
-       pkgmgrinfo_appinfo_h handle = NULL;
-       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
-       if (ret != PMINFO_R_OK)
-               return -1;
-       ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)subapp);
-       if (ret != PMINFO_R_OK) {
-               pkgmgrinfo_appinfo_destroy_appinfo(handle);
-               return -1;
-       }
-       pkgmgrinfo_appinfo_destroy_appinfo(handle);
-       return 0;
-}
- * @endcode
- */
-int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
-                                               int *subapp_count, char ***subapp);
-
-/**
  * @fn int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
  * @brief      This API gets the notification icon of the application
  *
@@ -4448,18 +4189,15 @@ int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
  * @pre                pkgmgrinfo_appinfo_get_appinfo()
  * @post               pkgmgrinfo_appinfo_destroy_appinfo()
  * @code
-int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
+int appcontrol_func(const char *operation, const char *uri, const char *mime, void *user_data)
 {
-       int oc = 0;
        int i = 0;
        char **operation;
-       pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
-       for (i = 0; i < oc; i++) {
-               if (strcmp(operation[i], (char *)user_data) == 0)
-                       return -1;
-               else
-                       return 0;
-       }
+       char *compare_data = (char *)user_data;
+       if (strcmp(operation, compare_data) == 0)
+               return -1;
+       else
+         return 0;
 }
 
 static int check_operation(const char *appid, char *operation)
@@ -6244,25 +5982,6 @@ static int set_cert_in_db(const char *pkgid)
 int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle);
 
 /**
- * @fn int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access)
- * @brief      This API gets the datacontrol info
- *
- * @par                This API is for package-manager client application
- * @par Sync (or) Async : Synchronous API
- *
- * @param[in] providerid               pointer to the providerid of dataconltrol.
- * @param[in] type                     pointer to the type of dataconltrol.
- * @param[out] appid                   pointer to hold appid, need to free after using
- * @param[out] access                  pointer to hold access, need to free after using
- * @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
- * @endcode
- */
-int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access);
-
-/**
  * @fn int pkgmgrinfo_appinfo_is_guestmode_appstatus(pkgmgrinfo_appinfo_h handle, bool *status)
  * @brief      This API gets the application 'guest mode visibility' value from the DB
  *
index f65ad48..39a8d0a 100644 (file)
@@ -215,11 +215,6 @@ typedef void *pkgmgrinfo_appinfo_filter_h;
 typedef void *pkgmgrinfo_appinfo_metadata_filter_h;
 
 /**
- * @brief A handle to get appcontrol information
- */
-typedef void *pkgmgrinfo_appcontrol_h;
-
-/**
  * @brief A handle to get package archive information
  */
 typedef void *pkgmgrinfo_archiveinfo_h;
@@ -379,11 +374,13 @@ typedef int (*pkgmgrinfo_app_metadata_list_cb) (const char *metadata_key,
                                                        const char *metadata_value, void *user_data);
 
 /**
- * @fn int (*pkgmgrinfo_app_control_list_cb) (pkgmgrinfo_appcontrol_h handle, void *user_data)
+ * @fn int (*pkgmgrinfo_app_control_list_cb) (const char *operation, const char *uri, const char *mime, void *user_data);
  *
  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_appcontrol()
  *
- * @param[in] handle the appcontrol handle to be used to get operation, uri and mime info
+ * @param[in] operation The operation of the app-control
+ * @param[in] uri       The URI of the app-control
+ * @param[in] mime      The MIME-Type of the app-control
  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_appcontrol()
  *
  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
index c928104..ebcc31b 100644 (file)
@@ -1800,54 +1800,6 @@ API int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_t
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
-                                       int *operation_count, char ***operation)
-{
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(operation == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       retvm_if(operation_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
-       *operation_count = data->operation_count;
-       *operation = data->operation;
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
-                                       int *uri_count, char ***uri)
-{
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(uri == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       retvm_if(uri_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
-       *uri_count = data->uri_count;
-       *uri = data->uri;
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
-                                       int *mime_count, char ***mime)
-{
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(mime == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       retvm_if(mime_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
-       *mime_count = data->mime_count;
-       *mime = data->mime;
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
-                                       int *subapp_count, char ***subapp)
-{
-       retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
-       retvm_if(subapp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       retvm_if(subapp_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
-       pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
-       *subapp_count = data->subapp_count;
-       *subapp = data->subapp;
-       return PMINFO_R_OK;
-}
-
 API int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
 {
        char *val;