implement new api for preload-system
[platform/core/appfw/pkgmgr-info.git] / include / pkgmgr-info.h
1 /*
2  * pkgmgr-info
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7  * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23
24
25
26
27 /**
28  * @file                pkgmgr-info.h
29  * @author              Sewook Park <sewook7.park@samsung.com>
30  * @author              Shobhit Srivastava <shobhit.s@samsung.com>
31  * @version             0.1
32  * @brief               This file declares API of pkgmgr-info library
33  *
34  * @addtogroup          APPLICATION_FRAMEWORK
35  * @{
36  *
37  * @defgroup            PackageManagerInfo
38  * @section             Header Header file to include:
39  * @code
40  * #include             <pkgmgr-info.h>
41  * @endcode
42  *
43  * @}
44  */
45
46 #ifndef __PKG_INFO_H__
47 #define __PKG_INFO_H__
48
49 #include <errno.h>
50 #include <stdbool.h>
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56
57 /**
58  * @mainpage
59  *
60  * This is package information library
61  *
62  * Package Information Library is used to get package related information.\n
63  * It uses the package manifest information database to get any package related information\n
64  * It also provides API to set information in the package info database\n
65  *
66  */
67
68 /**
69  * @file        pkgmgr-info.h
70  * @brief       Package Information Library Header File
71  *
72  * Generated by    Sewook Park <sewook7.park@samsung.com>
73  */
74
75
76 /**
77  * @brief A handle to insert certificate information
78  */
79 typedef void* pkgmgrinfo_instcertinfo_h;
80
81 /**
82  * @brief Certificate Types to be used for setting information
83  */
84 typedef enum {
85         PMINFO_SET_AUTHOR_ROOT_CERT = 0,                /**< Author Root Certificate*/
86         PMINFO_SET_AUTHOR_INTERMEDIATE_CERT = 1,                /**< Author Intermediate Certificate*/
87         PMINFO_SET_AUTHOR_SIGNER_CERT = 2,              /**< Author Signer Certificate*/
88         PMINFO_SET_DISTRIBUTOR_ROOT_CERT = 3,           /**< Distributor Root Certificate*/
89         PMINFO_SET_DISTRIBUTOR_INTERMEDIATE_CERT = 4,           /**< Distributor Intermediate Certificate*/
90         PMINFO_SET_DISTRIBUTOR_SIGNER_CERT = 5,         /**< Distributor Signer Certificate*/
91         PMINFO_SET_DISTRIBUTOR2_ROOT_CERT = 6,          /**< End Entity Root Certificate*/
92         PMINFO_SET_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,          /**< End Entity Intermediate Certificate*/
93         PMINFO_SET_DISTRIBUTOR2_SIGNER_CERT = 8,                /**< End Entity Signer Certificate*/
94 }pkgmgrinfo_instcert_type;
95
96 typedef enum {
97         PMINFO_CERT_COMPARE_MATCH,
98         PMINFO_CERT_COMPARE_MISMATCH,
99         PMINFO_CERT_COMPARE_LHS_NO_CERT,
100         PMINFO_CERT_COMPARE_RHS_NO_CERT,
101         PMINFO_CERT_COMPARE_BOTH_NO_CERT,
102         PMINFO_CERT_COMPARE_ERROR,
103 } pkgmgrinfo_cert_compare_result_type_e;
104
105 /**
106  * @brief API return values
107  */
108 enum {
109         PMINFO_R_EINVAL = -2,           /**< Invalid argument */
110         PMINFO_R_ERROR = -1,            /**< General error */
111         PMINFO_R_OK = 0                 /**< General success */
112 };
113
114 /**
115  * @brief Value to be used when filtering based on install location
116  */
117 #define PMINFO_PKGINFO_INSTALL_LOCATION_AUTO            "LOCATION_AUTO"
118
119 /**
120  * @brief Value to be used when filtering based on install location
121  */
122 #define PMINFO_PKGINFO_INSTALL_LOCATION_INTERNAL        "LOCATION_INTERNAL"
123
124 /**
125  * @brief Value to be used when filtering based on install location
126  */
127 #define PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL        "LOCATION_EXTERNAL"
128
129 /**
130  * @brief Value to be used when filtering based on app-component
131  */
132 #define PMINFO_APPINFO_UI_APP                           "UI_APP"
133
134 /**
135  * @brief Value to be used when filtering based on app-component
136  */
137 #define PMINFO_APPINFO_SVC_APP                          "SVC_APP"
138
139 typedef enum {
140         PMINFO_HWACCELERATION_NOT_USE_GL = 0,           /**< Don't use hardware acceleration*/
141         PMINFO_HWACCELERATION_USE_GL = 1,               /**< Use hardware acceleration*/
142         PMINFO_HWACCELERATION_USE_SYSTEM_SETTING = 2            /**< Follow system setting for hardware acceleration */
143 }pkgmgrinfo_app_hwacceleration;
144
145 typedef enum {
146         PMINFO_RECENTIMAGE_USE_ICON = 0,                /**<Use icon for recent image*/
147         PMINFO_RECENTIMAGE_USE_CAPTURE = 1,             /**< Use capture for recent image*/
148         PMINFO_RECENTIMAGE_USE_NOTHING = 2              /**< Don't use recent image */
149 }pkgmgrinfo_app_recentimage;
150
151 /**
152  * @brief A handle to get package information
153  */
154 typedef void* pkgmgrinfo_pkginfo_h;
155
156 /**
157  * @brief A handle to get application information
158  */
159 typedef void* pkgmgrinfo_appinfo_h;
160
161 /**
162  * @brief A handle to get certificate information
163  */
164 typedef void* pkgmgrinfo_certinfo_h;
165
166 /**
167  * @brief A handle to insert package information
168  */
169 typedef void* pkgmgrinfo_pkgdbinfo_h;
170
171 /**
172  * @brief A handle to filter package information
173  */
174 typedef void* pkgmgrinfo_pkginfo_filter_h;
175
176 /**
177  * @brief A handle to filter application information
178  */
179 typedef void* pkgmgrinfo_appinfo_filter_h;
180
181 /**
182  * @brief A handle to filter application metadata  information
183  */
184 typedef void* pkgmgrinfo_appinfo_metadata_filter_h;
185
186 /**
187  * @brief A handle to get appcontrol information
188  */
189 typedef void* pkgmgrinfo_appcontrol_h;
190
191 /**
192  * @fn int (*pkgmgrinfo_pkg_list_cb ) (const pkgmgrinfo_pkginfo_h handle, void *user_data)
193  *
194  * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
195  *
196  * @param[in] handle the pkginfo handle
197  * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_get_list(), pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
198  *
199  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
200  *
201  * @see  pkgmgrinfo_pkginfo_get_list()
202  * @see  pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
203  */
204 typedef int (*pkgmgrinfo_pkg_list_cb ) (const pkgmgrinfo_pkginfo_h handle,
205                                                         void *user_data);
206
207 /**
208  * @fn int (*pkgmgrinfo_app_list_cb ) (const pkgmgrinfo_appinfo_h handle, void *user_data)
209  *
210  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
211  *
212  * @param[in] handle the appinfo handle
213  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_get_list(), pkgmgrinfo_appinfo_filter_foreach_appinfo(), pkgmgrinfo_appinfo_metadata_filter_foreach()
214  *
215  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
216  *
217  * @see  pkgmgrinfo_appinfo_get_list()
218  * @see  pkgmgrinfo_appinfo_filter_foreach_appinfo()
219  * @see  pkgmgrinfo_appinfo_metadata_filter_foreach()
220  */
221 typedef int (*pkgmgrinfo_app_list_cb ) (const pkgmgrinfo_appinfo_h handle,
222                                                         void *user_data);
223
224 /**
225  * @fn int (*pkgmgrinfo_app_category_list_cb ) (const char *category_name, void *user_data)
226  *
227  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
228  *
229  * @param[in] category_name the name of the category
230  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
231  *
232  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
233  *
234  * @see  pkgmgrinfo_appinfo_foreach_category()
235  */
236 typedef int (*pkgmgrinfo_app_category_list_cb ) (const char *category_name,
237                                                         void *user_data);
238
239 /**
240  * @fn int (*pkgmgrinfo_app_permission_list_cb ) (const char *permission_type, void *user_data)
241  *
242  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_category()
243  *
244  * @param[in] permission_name the name of the permission
245  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_category()
246  *
247  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
248  *
249  * @see  pkgmgrinfo_appinfo_foreach_category()
250  */
251 typedef int (*pkgmgrinfo_app_permission_list_cb ) (const char *permission_type,
252                                                         void *user_data);
253
254 /**
255  * @fn int (*pkgmgrinfo_pkg_privilege_list_cb ) (const char *privilege_name, void *user_data)
256  *
257  * @brief Specifies the type of function passed to pkgmgrinfo_pkginfo_foreach_privilege()
258  *
259  * @param[in] privilege_name the name of the privilege
260  * @param[in] user_data user data passed to pkgmgrinfo_pkginfo_foreach_privilege()
261  *
262  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
263  *
264  * @see  pkgmgrinfo_pkginfo_foreach_privilege()
265  */
266 typedef int (*pkgmgrinfo_pkg_privilege_list_cb ) (const char *privilege_name,
267                                                         void *user_data);
268
269 /**
270  * @fn int (*pkgmgrinfo_app_metadata_list_cb ) (const char *metadata_key, const char *metadata_value, void *user_data)
271  *
272  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_metadata()
273  *
274  * @param[in] metadata_name the name of the metadata
275  * @param[in] metadata_value the value of the metadata
276  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_metadata()
277  *
278  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
279  *
280  * @see  pkgmgrinfo_appinfo_foreach_metadata()
281  */
282 typedef int (*pkgmgrinfo_app_metadata_list_cb ) (const char *metadata_key,
283                                                         const char *metadata_value, void *user_data);
284
285 /**
286  * @fn int (*pkgmgrinfo_app_control_list_cb ) (pkgmgrinfo_appcontrol_h handle, void *user_data)
287  *
288  * @brief Specifies the type of function passed to pkgmgrinfo_appinfo_foreach_appcontrol()
289  *
290  * @param[in] handle the appcontrol handle to be used to get operation, uri and mime info
291  * @param[in] user_data user data passed to pkgmgrinfo_appinfo_foreach_appcontrol()
292  *
293  * @return 0 if success, negative value(<0) if fail. Callback is not called if return value is negative.\n
294  *
295  * @see  pkgmgrinfo_appinfo_foreach_appcontrol()
296  */
297 typedef int (*pkgmgrinfo_app_control_list_cb ) (pkgmgrinfo_appcontrol_h handle,
298                                                         void *user_data);
299
300 /**
301  * @brief Install Location Types
302  */
303 typedef enum {
304         PMINFO_INSTALL_LOCATION_AUTO = 0,               /**< Auto*/
305         PMINFO_INSTALL_LOCATION_INTERNAL_ONLY,          /**< Internal Installation*/
306         PMINFO_INSTALL_LOCATION_PREFER_EXTERNAL,                /**< External Installation*/
307 }pkgmgrinfo_install_location;
308
309 /**
310  * @brief Application Component Types
311  */
312 typedef enum {
313         PMINFO_ALL_APP = 0,     /**< All Application*/
314         PMINFO_UI_APP,          /**< UI Application*/
315         PMINFO_SVC_APP,         /**< Service Application*/
316 }pkgmgrinfo_app_component;
317
318 /**
319  * @brief Application Storage Types
320  */
321 typedef enum {
322         PMINFO_INTERNAL_STORAGE = 0,            /**< Internal Storage*/
323         PMINFO_EXTERNAL_STORAGE = 1,            /**< External Storage*/
324 }pkgmgrinfo_installed_storage;
325
326 /**
327  * @brief Certificate Types to be used for getting information
328  */
329 typedef enum {
330         PMINFO_AUTHOR_ROOT_CERT = 0,            /**< Author Root Certificate*/
331         PMINFO_AUTHOR_INTERMEDIATE_CERT = 1,            /**< Author Intermediate Certificate*/
332         PMINFO_AUTHOR_SIGNER_CERT = 2,          /**< Author Signer Certificate*/
333         PMINFO_DISTRIBUTOR_ROOT_CERT = 3,               /**< Distributor Root Certificate*/
334         PMINFO_DISTRIBUTOR_INTERMEDIATE_CERT = 4,               /**< Distributor Intermediate Certificate*/
335         PMINFO_DISTRIBUTOR_SIGNER_CERT = 5,             /**< Distributor Signer Certificate*/
336         PMINFO_DISTRIBUTOR2_ROOT_CERT = 6,              /**< End Entity Root Certificate*/
337         PMINFO_DISTRIBUTOR2_INTERMEDIATE_CERT = 7,              /**< End Entity Intermediate Certificate*/
338         PMINFO_DISTRIBUTOR2_SIGNER_CERT = 8,            /**< End Entity Signer Certificate*/
339 }pkgmgrinfo_cert_type;
340
341 /**
342  * @brief Install Location Types to be used when setting data in DB
343  */
344 typedef enum {
345         INSTALL_INTERNAL = 0,           /**< Internal Installation*/
346         INSTALL_EXTERNAL,               /**< External Installation*/
347 } INSTALL_LOCATION;
348
349  /**
350   * @brief permission Types
351   */
352  typedef enum {
353          PMINFO_PERMISSION_NORMAL = 0,           /**< permission normal*/
354          PMINFO_PERMISSION_SIGNATURE,    /**< permission type is signature*/
355          PMINFO_PERMISSION_PRIVILEGE,    /**< permission type is privilege*/
356  }pkgmgrinfo_permission_type;
357
358
359  /** String property for filtering based on package info*/
360 #define PMINFO_PKGINFO_PROP_PACKAGE_ID          "PMINFO_PKGINFO_PROP_PACKAGE_ID"
361  /** String property for filtering based on package info*/
362 #define PMINFO_PKGINFO_PROP_PACKAGE_TYPE        "PMINFO_PKGINFO_PROP_PACKAGE_TYPE"
363  /** String property for filtering based on package info*/
364 #define PMINFO_PKGINFO_PROP_PACKAGE_VERSION     "PMINFO_PKGINFO_PROP_PACKAGE_VERSION"
365  /** String property for filtering based on package info*/
366 #define PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION            "PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION"
367   /** String property for filtering based on package info*/
368 #define PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE           "PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE"
369  /** String property for filtering based on package info*/
370 #define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME         "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME"
371  /** String property for filtering based on package info*/
372 #define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL                "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL"
373  /** String property for filtering based on package info*/
374 #define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF         "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF"
375
376  /** Boolean property for filtering based on package info*/
377 #define PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE           "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"
378  /** Boolean property for filtering based on package info*/
379 #define PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD             "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"
380  /** Boolean property for filtering based on package info*/
381 #define PMINFO_PKGINFO_PROP_PACKAGE_READONLY            "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"
382   /** Boolean property for filtering based on package info*/
383 #define PMINFO_PKGINFO_PROP_PACKAGE_UPDATE              "PMINFO_PKGINFO_PROP_PACKAGE_UPDATE"
384   /** Boolean property for filtering based on package info*/
385 #define PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING          "PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING"
386    /** Boolean property for filtering based on package info*/
387 #define PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING           "PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING"
388
389  /** Integer property for filtering based on package info*/
390 #define PMINFO_PKGINFO_PROP_PACKAGE_SIZE                "PMINFO_PKGINFO_PROP_PACKAGE_SIZE"
391
392  /** String property for filtering based on app info*/
393 #define PMINFO_APPINFO_PROP_APP_ID              "PMINFO_APPINFO_PROP_APP_ID"
394  /** String property for filtering based on app info*/
395 #define PMINFO_APPINFO_PROP_APP_COMPONENT               "PMINFO_APPINFO_PROP_APP_COMPONENT"
396  /** String property for filtering based on app info*/
397 #define PMINFO_APPINFO_PROP_APP_EXEC            "PMINFO_APPINFO_PROP_APP_EXEC"
398  /** String property for filtering based on app info*/
399 #define PMINFO_APPINFO_PROP_APP_ICON            "PMINFO_APPINFO_PROP_APP_ICON"
400  /** String property for filtering based on app info*/
401 #define PMINFO_APPINFO_PROP_APP_TYPE            "PMINFO_APPINFO_PROP_APP_TYPE"
402  /** String property for filtering based on app info*/
403 #define PMINFO_APPINFO_PROP_APP_OPERATION       "PMINFO_APPINFO_PROP_APP_OPERATION"
404  /** String property for filtering based on app info*/
405 #define PMINFO_APPINFO_PROP_APP_URI                     "PMINFO_APPINFO_PROP_APP_URI"
406  /** String property for filtering based on app info*/
407 #define PMINFO_APPINFO_PROP_APP_MIME            "PMINFO_APPINFO_PROP_APP_MIME"
408  /** String property for filtering based on app info*/
409 #define PMINFO_APPINFO_PROP_APP_CATEGORY        "PMINFO_APPINFO_PROP_APP_CATEGORY"
410  /** String property for filtering based on app info*/
411 #define PMINFO_APPINFO_PROP_APP_HWACCELERATION  "PMINFO_APPINFO_PROP_APP_HWACCELERATION"
412
413  /** Boolean property for filtering based on app info*/
414 #define PMINFO_APPINFO_PROP_APP_NODISPLAY               "PMINFO_APPINFO_PROP_APP_NODISPLAY"
415  /** Boolean property for filtering based on app info*/
416 #define PMINFO_APPINFO_PROP_APP_MULTIPLE                "PMINFO_APPINFO_PROP_APP_MULTIPLE"
417  /** Boolean property for filtering based on app info*/
418 #define PMINFO_APPINFO_PROP_APP_ONBOOT                  "PMINFO_APPINFO_PROP_APP_ONBOOT"
419  /** Boolean property for filtering based on app info*/
420 #define PMINFO_APPINFO_PROP_APP_AUTORESTART     "PMINFO_APPINFO_PROP_APP_AUTORESTART"
421  /** Boolean property for filtering based on app info*/
422 #define PMINFO_APPINFO_PROP_APP_TASKMANAGE      "PMINFO_APPINFO_PROP_APP_TASKMANAGE"
423  /** Boolean property for filtering based on app info*/
424 #define PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION "PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION"
425
426  /** will be updated*/
427  /** string property for filtering based on pkg info*/
428 #define PMINFO_PKGINFO_PROP_RANGE_BASIC "PMINFO_PKGINFO_PROP_RANGE_BASIC"
429
430 /**
431  * @fn  int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
432  * @brief       This API gets list of installed packages
433  *
434  * @par         This API is for package-manager client application
435  * @par Sync (or) Async : Synchronous API
436  * @param[in]   pkg_list_cb     iteration function for list
437  * @param[in]   user_data       user data to be passed to callback function
438  * @return      0 if success, error code(<0) if fail
439  * @retval      PMINFO_R_OK     success
440  * @retval      PMINFO_R_EINVAL invalid argument
441  * @retval      PMINFO_R_ERROR  internal error
442  * @pre         None
443  * @post        None
444  * @code
445 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
446 {
447         char *pkgid1 = NULL;
448         char *pkgid2 = NULL;
449         pkgid1 = (char *)user_data;
450         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid2);
451         if (strcmp(pkgid1, pkgid2) == 0) {
452                 return -1;
453         } else {
454                 return 0;
455         }
456 }
457
458 static int list_pkgs()
459 {
460         int ret = 0;
461         char *name = "helloworld";
462         ret = pkgmgrinfo_pkginfo_get_list(pkg_list_cb, (void *)name);
463         if (ret != PMINFO_R_OK) {
464                 return -1;
465         }
466         return 0;
467 }
468  * @endcode
469  */
470 int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
471
472 /**
473  * @fn int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
474  * @brief       This API creates the package information handle from db
475  *
476  * @par         This API is for package-manager client application
477  * @par Sync (or) Async : Synchronous API
478  *
479  * @param[in]   pkgid   pointer to package ID
480  * @param[out] handle           pointer to the package info handle.
481  * @return      0 if success, error code(<0) if fail
482  * @retval      PMINFO_R_OK     success
483  * @retval      PMINFO_R_EINVAL invalid argument
484  * @retval      PMINFO_R_ERROR  internal error
485  * @pre         None
486  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
487  * @see         pkgmgrinfo_pkginfo_get_pkgid()
488  * @see         pkgmgrinfo_pkginfo_is_removable()
489  * @code
490 static int get_pkg_type(const char *pkgid)
491 {
492         int ret = 0;
493         char *type = NULL;
494         pkgmgrinfo_pkginfo_h handle;
495         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
496         if (ret != PMINFO_R_OK)
497                 return -1;
498         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
499         if (ret != PMINFO_R_OK) {
500                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
501                 return -1;
502         }
503         printf("pkgtype: %s\n", type);
504         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
505         return 0;
506 }
507  * @endcode
508  */
509 int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
510
511 /**
512  * @fn int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name)
513  * @brief       This API gets the package name from the package ID
514  *
515  * @par         This API is for package-manager client application
516  * @par Sync (or) Async : Synchronous API
517  *
518  * @param[in]   handle  pointer to package info handle
519  * @param[out]  pkg_name        pointer to hold package name
520  * @return      0 if success, error code(<0) if fail
521  * @retval      PMINFO_R_OK     success
522  * @retval      PMINFO_R_EINVAL invalid argument
523  * @retval      PMINFO_R_ERROR  internal error
524  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
525  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
526  * @see         pkgmgrinfo_pkginfo_get_type()
527  * @see         pkgmgrinfo_pkginfo_is_removable()
528  * @code
529 static int get_pkg_name(const char *pkgid)
530 {
531         int ret = 0;
532         char *pkgname = NULL;
533         pkgmgrinfo_pkginfo_h handle;
534         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
535         if (ret != PMINFO_R_OK)
536                 return -1;
537         ret = pkgmgrinfo_pkginfo_get_pkgname(handle, &pkgname);
538         if (ret != PMINFO_R_OK) {
539                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
540                 return -1;
541         }
542         printf("pkgname: %s\n", pkgname);
543         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
544         return 0;
545 }
546  * @endcode
547  */
548 int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name);
549
550 /**
551  * @fn int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid)
552  * @brief       This API gets the package id from the package ID
553  *
554  * @par         This API is for package-manager client application
555  * @par Sync (or) Async : Synchronous API
556  *
557  * @param[in]   handle  pointer to package info handle
558  * @param[out]  pkgid   pointer to hold package id
559  * @return      0 if success, error code(<0) if fail
560  * @retval      PMINFO_R_OK     success
561  * @retval      PMINFO_R_EINVAL invalid argument
562  * @retval      PMINFO_R_ERROR  internal error
563  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
564  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
565  * @see         pkgmgrinfo_pkginfo_get_type()
566  * @see         pkgmgrinfo_pkginfo_is_removable()
567  * @code
568 static int get_pkgid(const char *pkgid)
569 {
570         int ret = 0;
571         char *pkg_id = NULL;
572         pkgmgrinfo_pkginfo_h handle;
573         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
574         if (ret != PMINFO_R_OK)
575                 return -1;
576         ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkg_id);
577         if (ret != PMINFO_R_OK) {
578                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
579                 return -1;
580         }
581         printf("pkg id: %s\n", pkg_id);
582         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
583         return 0;
584 }
585  * @endcode
586  */
587 int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid);
588
589 /**
590  * @fn int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type)
591  * @brief       This API gets the package type from the package ID
592  *
593  * @par         This API is for package-manager client application
594  * @par Sync (or) Async : Synchronous API
595  *
596  * @param[in]   handle  pointer to package info handle
597  * @param[out] type             pointer to hold package type
598  * @return      0 if success, error code(<0) if fail
599  * @retval      PMINFO_R_OK     success
600  * @retval      PMINFO_R_EINVAL invalid argument
601  * @retval      PMINFO_R_ERROR  internal error
602  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
603  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
604  * @see         pkgmgrinfo_pkginfo_get_pkgid()
605  * @see         pkgmgrinfo_pkginfo_is_removable()
606  * @code
607 static int get_pkg_type(const char *pkgid)
608 {
609         int ret = 0;
610         char *type = NULL;
611         pkgmgrinfo_pkginfo_h handle;
612         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
613         if (ret != PMINFO_R_OK)
614                 return -1;
615         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
616         if (ret != PMINFO_R_OK) {
617                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
618                 return -1;
619         }
620         printf("pkgtype: %s\n", type);
621         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
622         return 0;
623 }
624  * @endcode
625  */
626 int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type);
627
628 /**
629  * @fn int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version)
630  * @brief       This API gets the package version from the package ID
631  *
632  * @par         This API is for package-manager client application
633  * @par Sync (or) Async : Synchronous API
634  *
635  * @param[in]   handle  pointer to package info handle
636  * @param[out] version          pointer to hold package version
637  * @return      0 if success, error code(<0) if fail
638  * @retval      PMINFO_R_OK     success
639  * @retval      PMINFO_R_EINVAL invalid argument
640  * @retval      PMINFO_R_ERROR  internal error
641  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
642  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
643  * @see         pkgmgrinfo_pkginfo_get_pkgid()
644  * @see         pkgmgrinfo_pkginfo_is_removable()
645  * @code
646 static int get_pkg_version(const char *pkgid)
647 {
648         int ret = 0;
649         char *version = NULL;
650         pkgmgrinfo_pkginfo_h handle;
651         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
652         if (ret != PMINFO_R_OK)
653                 return -1;
654         ret = pkgmgrinfo_pkginfo_get_version(handle, &version);
655         if (ret != PMINFO_R_OK) {
656                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
657                 return -1;
658         }
659         printf("pkg version: %s\n", version);
660         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
661         return 0;
662 }
663  * @endcode
664  */
665 int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version);
666
667 /**
668  * @fn int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
669  * @brief       This API gets the package install location from the package ID
670  *
671  * @par         This API is for package-manager client application
672  * @par Sync (or) Async : Synchronous API
673  *
674  * @param[in] handle    pointer to package info handle
675  * @param[out] location         pointer to hold package install location
676  * @return      0 if success, error code(<0) if fail
677  * @retval      PMINFO_R_OK     success
678  * @retval      PMINFO_R_EINVAL invalid argument
679  * @retval      PMINFO_R_ERROR  internal error
680  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
681  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
682  * @see         pkgmgrinfo_pkginfo_get_pkgid()
683  * @see         pkgmgrinfo_pkginfo_is_removable()
684  * @code
685 static int get_pkg_install_location(const char *pkgid)
686 {
687         int ret = 0;
688         pkgmgrinfo_install_location location;
689         pkgmgrinfo_pkginfo_h handle;
690         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
691         if (ret != PMINFO_R_OK)
692                 return -1;
693         ret = pkgmgrinfo_pkginfo_get_install_location(handle, &location);
694         if (ret != PMINFO_R_OK) {
695                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
696                 return -1;
697         }
698         printf("pkg install location: %d\n", location);
699         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
700         return 0;
701 }
702  * @endcode
703  */
704 int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location);
705
706 /**
707  * @fn int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size)
708  * @brief       This API gets the package size from the package ID. size will be 0 if package install location is internal-only.
709  size will be 0 if package install location is prefer-external but size is not specified in manifest file.Application should check
710  the return value of pkgmgrinfo_pkginfo_get_install_location() and use it to distinguish the above cases.
711  *
712  * @par         This API is for package-manager client application
713  * @par Sync (or) Async : Synchronous API
714  *
715  * @param[in]   handle  pointer to package info handle
716  * @param[out] size             pointer to hold package size
717  * @return      0 if success, error code(<0) if fail
718  * @retval      PMINFO_R_OK     success
719  * @retval      PMINFO_R_EINVAL invalid argument
720  * @retval      PMINFO_R_ERROR  internal error
721  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
722  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
723  * @see         pkgmgrinfo_pkginfo_get_pkgid()
724  * @see         pkgmgrinfo_pkginfo_is_removable()
725  * @code
726 static int get_pkg_size(const char *pkgid)
727 {
728         int ret = 0;
729         int size = 0;
730         pkgmgrinfo_pkginfo_h handle;
731         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
732         if (ret != PMINFO_R_OK)
733                 return -1;
734         ret = pkgmgrinfo_pkginfo_get_package_size(handle, &size);
735         if (ret != PMINFO_R_OK) {
736                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
737                 return -1;
738         }
739         printf("pkgsize: %d\n", size);
740         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
741         return 0;
742 }
743  * @endcode
744  */
745 int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size);
746
747 /**
748  * @fn int pkgmgrinfo_pkginfo_get_total_size(pkgmgrinfo_pkginfo_h handle, int *size)
749  * @brief       This API gets the installed package total size on the target.
750  *
751  * @par         This API is for package-manager client application
752  * @par Sync (or) Async : Synchronous API
753  *
754  * @param[in]   handle  pointer to package info handle
755  * @param[out] size             pointer to hold package total size
756  * @return      0 if success, error code(<0) if fail
757  * @retval      PMINFO_R_OK     success
758  * @retval      PMINFO_R_EINVAL invalid argument
759  * @retval      PMINFO_R_ERROR  internal error
760  * @code
761 static int get_pkg_total_size(const char *pkgid)
762 {
763         int ret = 0;
764         int size = 0;
765         pkgmgrinfo_pkginfo_h handle;
766         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
767         if (ret != PMINFO_R_OK)
768                 return -1;
769         ret = pkgmgrinfo_pkginfo_get_total_size(handle, &size);
770         if (ret != PMINFO_R_OK) {
771                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
772                 return -1;
773         }
774         printf("pkg total size: %d\n", size);
775         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
776         return 0;
777 }
778  * @endcode
779  */
780  int pkgmgrinfo_pkginfo_get_total_size(pkgmgrinfo_pkginfo_h handle, int *size);
781
782 /**
783  * @fn int pkgmgrinfo_pkginfo_get_data_size(pkgmgrinfo_pkginfo_h handle, int *size)
784  * @brief       This API gets the installed package data size on the target.
785  *
786  * @par         This API is for package-manager client application
787  * @par Sync (or) Async : Synchronous API
788  *
789  * @param[in]   handle  pointer to package info handle
790  * @param[out] size             pointer to hold package data size
791  * @return      0 if success, error code(<0) if fail
792  * @retval      PMINFO_R_OK     success
793  * @retval      PMINFO_R_EINVAL invalid argument
794  * @retval      PMINFO_R_ERROR  internal error
795  * @code
796 static int get_pkg_data_size(const char *pkgid)
797 {
798         int ret = 0;
799         int size = 0;
800         pkgmgrinfo_pkginfo_h handle;
801         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
802         if (ret != PMINFO_R_OK)
803                 return -1;
804         ret = pkgmgrinfo_pkginfo_get_data_size(handle, &size);
805         if (ret != PMINFO_R_OK) {
806                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
807                 return -1;
808         }
809         printf("pkg data size: %d\n", size);
810         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
811         return 0;
812 }
813  * @endcode
814  */
815  int pkgmgrinfo_pkginfo_get_data_size(pkgmgrinfo_pkginfo_h handle, int *size);
816
817 /**
818  * @fn int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon)
819  * @brief       This API gets the package icon from the package ID
820  *
821  * @par         This API is for package-manager client application
822  * @par Sync (or) Async : Synchronous API
823  *
824  * @param[in]   handle  pointer to package info handle
825  * @param[out] icon             pointer to hold package icon
826  * @return      0 if success, error code(<0) if fail
827  * @retval      PMINFO_R_OK     success
828  * @retval      PMINFO_R_EINVAL invalid argument
829  * @retval      PMINFO_R_ERROR  internal error
830  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
831  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
832  * @see         pkgmgrinfo_pkginfo_get_pkgid()
833  * @see         pkgmgrinfo_pkginfo_is_removable()
834  * @code
835 static int get_pkg_icon(const char *pkgid)
836 {
837         int ret = 0;
838         char *icon = NULL;
839         pkgmgrinfo_pkginfo_h handle;
840         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
841         if (ret != PMINFO_R_OK)
842                 return -1;
843         ret = pkgmgrinfo_pkginfo_get_icon(handle, &icon);
844         if (ret != PMINFO_R_OK) {
845                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
846                 return -1;
847         }
848         printf("pkg icon: %s\n", icon);
849         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
850         return 0;
851 }
852  * @endcode
853  */
854 int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon);
855
856 /**
857  * @fn int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
858  * @brief       This API gets the package label from the package ID
859  *
860  * @par         This API is for package-manager client application
861  * @par Sync (or) Async : Synchronous API
862  *
863  * @param[in]   handle  pointer to package info handle
864  * @param[out] label            pointer to hold package label
865  * @return      0 if success, error code(<0) if fail
866  * @retval      PMINFO_R_OK     success
867  * @retval      PMINFO_R_EINVAL invalid argument
868  * @retval      PMINFO_R_ERROR  internal error
869  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
870  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
871  * @see         pkgmgrinfo_pkginfo_get_pkgid()
872  * @see         pkgmgrinfo_pkginfo_is_removable()
873  * @code
874 static int get_pkg_label(const char *pkgid)
875 {
876         int ret = 0;
877         char *label = NULL;
878         pkgmgrinfo_pkginfo_h handle;
879         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
880         if (ret != PMINFO_R_OK)
881                 return -1;
882         ret = pkgmgrinfo_pkginfo_get_label(handle, &label);
883         if (ret != PMINFO_R_OK) {
884                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
885                 return -1;
886         }
887         printf("pkg label: %s\n", label);
888         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
889         return 0;
890 }
891  * @endcode
892  */
893 int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label);
894
895 /**
896  * @fn int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description)
897  * @brief       This API gets the package description from the package ID
898  *
899  * @par         This API is for package-manager client application
900  * @par Sync (or) Async : Synchronous API
901  *
902  * @param[in]   handle  pointer to package info handle
903  * @param[out] description              pointer to hold package description
904  * @return      0 if success, error code(<0) if fail
905  * @retval      PMINFO_R_OK     success
906  * @retval      PMINFO_R_EINVAL invalid argument
907  * @retval      PMINFO_R_ERROR  internal error
908  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
909  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
910  * @see         pkgmgrinfo_pkginfo_get_pkgid()
911  * @see         pkgmgrinfo_pkginfo_is_removable()
912  * @code
913 static int get_pkg_description(const char *pkgid)
914 {
915         int ret = 0;
916         char *description = NULL;
917         pkgmgrinfo_pkginfo_h handle;
918         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
919         if (ret != PMINFO_R_OK)
920                 return -1;
921         ret = pkgmgrinfo_pkginfo_get_description(handle, &description);
922         if (ret != PMINFO_R_OK) {
923                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
924                 return -1;
925         }
926         printf("pkg description: %s\n", description);
927         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
928         return 0;
929 }
930  * @endcode
931  */
932 int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description);
933
934 /**
935  * @fn int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name)
936  * @brief       This API gets the package's author name from the package ID
937  *
938  * @par         This API is for package-manager client application
939  * @par Sync (or) Async : Synchronous API
940  *
941  * @param[in]   handle  pointer to package info handle
942  * @param[out] author_name              pointer to hold package author name
943  * @return      0 if success, error code(<0) if fail
944  * @retval      PMINFO_R_OK     success
945  * @retval      PMINFO_R_EINVAL invalid argument
946  * @retval      PMINFO_R_ERROR  internal error
947  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
948  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
949  * @see         pkgmgrinfo_pkginfo_get_pkgid()
950  * @see         pkgmgrinfo_pkginfo_is_removable()
951  * @code
952 static int get_pkg_author_name(const char *pkgid)
953 {
954         int ret = 0;
955         char *author_name = NULL;
956         pkgmgrinfo_pkginfo_h handle;
957         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
958         if (ret != PMINFO_R_OK)
959                 return -1;
960         ret = pkgmgrinfo_pkginfo_get_author_name(handle, &author_name);
961         if (ret != PMINFO_R_OK) {
962                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
963                 return -1;
964         }
965         printf("pkg author name: %s\n", author_name);
966         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
967         return 0;
968 }
969  * @endcode
970  */
971 int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name);
972
973 /**
974  * @fn int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email)
975  * @brief       This API gets the package's author email from the package ID
976  *
977  * @par         This API is for package-manager client application
978  * @par Sync (or) Async : Synchronous API
979  *
980  * @param[in]   handle  pointer to package info handle
981  * @param[out] author_email             pointer to hold package author email
982  * @return      0 if success, error code(<0) if fail
983  * @retval      PMINFO_R_OK     success
984  * @retval      PMINFO_R_EINVAL invalid argument
985  * @retval      PMINFO_R_ERROR  internal error
986  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
987  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
988  * @see         pkgmgrinfo_pkginfo_get_pkgid()
989  * @see         pkgmgrinfo_pkginfo_is_removable()
990  * @code
991 static int get_pkg_author_email(const char *pkgid)
992 {
993         int ret = 0;
994         char *author_email = NULL;
995         pkgmgrinfo_pkginfo_h handle;
996         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
997         if (ret != PMINFO_R_OK)
998                 return -1;
999         ret = pkgmgrinfo_pkginfo_get_author_email(handle, &author_email);
1000         if (ret != PMINFO_R_OK) {
1001                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1002                 return -1;
1003         }
1004         printf("pkg author email: %s\n", author_email);
1005         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1006         return 0;
1007 }
1008  * @endcode
1009  */
1010 int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email);
1011
1012 /**
1013  * @fn int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href)
1014  * @brief       This API gets the package's author href from the package ID
1015  *
1016  * @par         This API is for package-manager client application
1017  * @par Sync (or) Async : Synchronous API
1018  *
1019  * @param[in]   handle  pointer to package info handle
1020  * @param[out] author_href              pointer to hold package author href
1021  * @return      0 if success, error code(<0) if fail
1022  * @retval      PMINFO_R_OK     success
1023  * @retval      PMINFO_R_EINVAL invalid argument
1024  * @retval      PMINFO_R_ERROR  internal error
1025  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1026  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1027  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1028  * @see         pkgmgrinfo_pkginfo_is_removable()
1029  * @code
1030 static int get_pkg_author_href(const char *pkgid)
1031 {
1032         int ret = 0;
1033         char *author_href = NULL;
1034         pkgmgrinfo_pkginfo_h handle;
1035         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1036         if (ret != PMINFO_R_OK)
1037                 return -1;
1038         ret = pkgmgrinfo_pkginfo_get_author_href(handle, &author_href);
1039         if (ret != PMINFO_R_OK) {
1040                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1041                 return -1;
1042         }
1043         printf("pkg author href: %s\n", author_href);
1044         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1045         return 0;
1046 }
1047  * @endcode
1048  */
1049 int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href);
1050
1051 /**
1052  * @fn int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage)
1053  * @brief       This API gets the package installed storagae value from the package ID
1054  *
1055  * @par         This API is for package-manager client application
1056  * @par Sync (or) Async : Synchronous API
1057  *
1058  * @param[in]   handle  pointer to package info handle
1059  * @param[out] storage          pointer to hold package installed storage
1060  * @return      0 if success, error code(<0) if fail
1061  * @retval      PMINFO_R_OK     success
1062  * @retval      PMINFO_R_EINVAL invalid argument
1063  * @retval      PMINFO_R_ERROR  internal error
1064  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1065  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1066  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1067  * @see         pkgmgrinfo_pkginfo_is_removable()
1068  * @code
1069 static int get_pkg_installed_storage(const char *pkgid)
1070 {
1071         int ret = 0;
1072         pkgmgrinfo_installed_storage storage;
1073         pkgmgrinfo_pkginfo_h handle;
1074         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1075         if (ret != PMINFO_R_OK)
1076                 return -1;
1077         ret = pkgmgrinfo_pkginfo_get_installed_storage(handle, &storage);
1078         if (ret != PMINFO_R_OK) {
1079                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1080                 return -1;
1081         }
1082         printf("pkg installed storage: %d\n", storage);
1083         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1084         return 0;
1085 }
1086  * @endcode
1087  */
1088 int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage);
1089
1090 /**
1091  * @fn int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time)
1092  * @brief       This API gets the installed time of package from the package ID
1093  *
1094  * @par         This API is for package-manager client application
1095  * @par Sync (or) Async : Synchronous API
1096  *
1097  * @param[in]   handle  pointer to package info handle
1098  * @param[out] installed_time           pointer to hold installed time of package
1099  * @return      0 if success, error code(<0) if fail
1100  * @retval      PMINFO_R_OK     success
1101  * @retval      PMINFO_R_EINVAL invalid argument
1102  * @retval      PMINFO_R_ERROR  internal error
1103  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1104  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1105  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1106  * @see         pkgmgrinfo_pkginfo_is_removable()
1107  * @code
1108 static int get_pkg_installed_time(const char *pkgid)
1109 {
1110         int ret = 0;
1111         int installed_time = 0;
1112         pkgmgrinfo_pkginfo_h handle;
1113         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1114         if (ret != PMINFO_R_OK)
1115                 return -1;
1116         ret = pkgmgrinfo_pkginfo_get_installed_time(handle, &installed_time);
1117         if (ret != PMINFO_R_OK) {
1118                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1119                 return -1;
1120         }
1121         printf("installed_time: %d\n", installed_time);
1122         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1123         return 0;
1124 }
1125  * @endcode
1126  */
1127 int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time);
1128
1129 /**
1130  * @fn int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid)
1131  * @brief       This API gets the store client id of package from the package ID
1132  *
1133  * @par         This API is for package-manager client application
1134  * @par Sync (or) Async : Synchronous API
1135  *
1136  * @param[in]   handle  pointer to package info handle
1137  * @param[out] storeclientid            pointer to hold store client id of package
1138  * @return      0 if success, error code(<0) if fail
1139  * @retval      PMINFO_R_OK     success
1140  * @retval      PMINFO_R_EINVAL invalid argument
1141  * @retval      PMINFO_R_ERROR  internal error
1142  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1143  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1144  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1145  * @see         pkgmgrinfo_pkginfo_is_removable()
1146  * @code
1147 static int get_pkg_storeclientid(const char *pkgid)
1148 {
1149         int ret = 0;
1150         char *storeclientid = 0;
1151         pkgmgrinfo_pkginfo_h handle;
1152         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1153         if (ret != PMINFO_R_OK)
1154                 return -1;
1155         ret = pkgmgrinfo_pkginfo_get_storeclientid(handle, &storeclientid);
1156         if (ret != PMINFO_R_OK) {
1157                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1158                 return -1;
1159         }
1160         printf(store client id: %s\n", storeclientid);
1161         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1162         return 0;
1163 }
1164  * @endcode
1165  */
1166 int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid);
1167
1168 /**
1169  * @fn int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid)
1170  * @brief       This API gets the main app id of package from the package ID
1171  *
1172  * @par         This API is for package-manager client application
1173  * @par Sync (or) Async : Synchronous API
1174  *
1175  * @param[in]   handle  pointer to package info handle
1176  * @param[out] mainappid                pointer to hold main app id of package
1177  * @return      0 if success, error code(<0) if fail
1178  * @retval      PMINFO_R_OK     success
1179  * @retval      PMINFO_R_EINVAL invalid argument
1180  * @retval      PMINFO_R_ERROR  internal error
1181  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1182  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1183  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1184  * @see         pkgmgrinfo_pkginfo_is_removable()
1185  * @code
1186 static int get_pkg_mainappid(const char *pkgid)
1187 {
1188         int ret = 0;
1189         char *mainappid = 0;
1190         pkgmgrinfo_pkginfo_h handle;
1191         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1192         if (ret != PMINFO_R_OK)
1193                 return -1;
1194         ret = pkgmgrinfo_pkginfo_get_mainappid(handle, &mainappid);
1195         if (ret != PMINFO_R_OK) {
1196                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1197                 return -1;
1198         }
1199         printf(main app id: %s\n", mainappid);
1200         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1201         return 0;
1202 }
1203  * @endcode
1204  */
1205 int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid);
1206
1207 /**
1208  * @fn int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url)
1209  * @brief       This API gets the url of package from the package ID
1210  *
1211  * @par         This API is for package-manager client application
1212  * @par Sync (or) Async : Synchronous API
1213  *
1214  * @param[in]   handle  pointer to package info handle
1215  * @param[out] url              pointer to hold url of package
1216  * @return      0 if success, error code(<0) if fail
1217  * @retval      PMINFO_R_OK     success
1218  * @retval      PMINFO_R_EINVAL invalid argument
1219  * @retval      PMINFO_R_ERROR  internal error
1220  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1221  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1222  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1223  * @see         pkgmgrinfo_pkginfo_is_removable()
1224  * @code
1225 static int get_pkg_url(const char *pkgid)
1226 {
1227         int ret = 0;
1228         char *url = 0;
1229         pkgmgrinfo_pkginfo_h handle;
1230         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1231         if (ret != PMINFO_R_OK)
1232                 return -1;
1233         ret = pkgmgrinfo_pkginfo_get_url(handle, &url);
1234         if (ret != PMINFO_R_OK) {
1235                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1236                 return -1;
1237         }
1238         printf("url : %s\n", url);
1239         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1240         return 0;
1241 }
1242  * @endcode
1243  */
1244 int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url);
1245
1246
1247 /**
1248  * @fn int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path)
1249  * @brief       This API gets the root path of package
1250  *
1251  * @par Sync (or) Async : Synchronous API
1252  *
1253  * @param[in] handle            pointer to package info handle
1254  * @param[out] path             pointer to hold root path of package
1255  * @return      0 if success, error code(<0) if fail
1256  * @retval      PMINFO_R_OK     success
1257  * @retval      PMINFO_R_EINVAL invalid argument
1258  * @retval      PMINFO_R_ERROR  internal error
1259  * @code
1260 static int get_root_path(const char *pkgid)
1261 {
1262         int ret = 0;
1263         char *path = 0;
1264         pkgmgrinfo_pkginfo_h handle;
1265         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1266         if (ret != PMINFO_R_OK)
1267                 return -1;
1268
1269         ret = pkgmgrinfo_pkginfo_get_root_path(handle, &path);
1270         if (ret != PMINFO_R_OK) {
1271                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1272                 return -1;
1273         }
1274         printf("path : %s\n", path);
1275         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1276
1277         return 0;
1278 }
1279  * @endcode
1280  */
1281 int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path);
1282
1283
1284 /**
1285  * @fn int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path)
1286  * @brief       This API gets the csc path of package
1287  *
1288  * @par Sync (or) Async : Synchronous API
1289  *
1290  * @param[in] handle            pointer to package info handle
1291  * @param[out] path             pointer to hold csc path of package
1292  * @return      0 if success, error code(<0) if fail
1293  * @retval      PMINFO_R_OK     success
1294  * @retval      PMINFO_R_EINVAL invalid argument
1295  * @retval      PMINFO_R_ERROR  internal error
1296  * @code
1297 static int get_csc_path(const char *pkgid)
1298 {
1299         int ret = 0;
1300         char *path = 0;
1301         pkgmgrinfo_pkginfo_h handle;
1302         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1303         if (ret != PMINFO_R_OK)
1304                 return -1;
1305
1306         ret = pkgmgrinfo_pkginfo_get_csc_path(handle, &path);
1307         if (ret != PMINFO_R_OK) {
1308                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1309                 return -1;
1310         }
1311         printf("path : %s\n", path);
1312         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1313
1314         return 0;
1315 }
1316  * @endcode
1317  */
1318 int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path);
1319
1320 /**
1321  * @fn int pkgmgrinfo_pkginfo_compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1322  * @brief       This API compare the cert information from given package id
1323  *
1324  * @par         This API is for package-manager client application
1325  * @par Sync (or) Async : Synchronous API
1326  *
1327  * @param[in]   lhs_package_id  pointer to first package ID
1328  * @param[in]   rhs_package_id  pointer to second package ID
1329  * @param[out] compare_result           pointer to the compare result.
1330  * @return      0 if success, error code(<0) if fail
1331  * @retval      PMINFO_R_OK     success
1332  * @retval      PMINFO_R_EINVAL invalid argument
1333  * @retval      PMINFO_R_ERROR  internal error
1334  * @pre         None
1335  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1336  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1337  * @see         pkgmgrinfo_pkginfo_is_removable()
1338  * @code
1339 static int compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1340 {
1341         int ret = 0;
1342         pkgmgrinfo_cert_compare_result_type_e result;
1343
1344         ret = pkgmgrinfo_pkginfo_compare_pkg_cert_info(lhs_package_id, rhs_package_id, &result);
1345         if (ret != PMINFO_R_OK) {
1346                 return -1;
1347         }
1348         printf("result: %d\n", result);
1349         return 0;
1350 }
1351  * @endcode
1352  */
1353 int pkgmgrinfo_pkginfo_compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result);
1354
1355 /**
1356  * @fn int pkgmgrinfo_pkginfo_compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1357  * @brief       This API compare the cert information from given app id
1358  *
1359  * @par         This API is for package-manager client application
1360  * @par Sync (or) Async : Synchronous API
1361  *
1362  * @param[in]   lhs_app_id      pointer to first app ID
1363  * @param[in]   rhs_app_id      pointer to second app ID
1364  * @param[out] compare_result           pointer to the compare result.
1365  * @return      0 if success, error code(<0) if fail
1366  * @retval      PMINFO_R_OK     success
1367  * @retval      PMINFO_R_EINVAL invalid argument
1368  * @retval      PMINFO_R_ERROR  internal error
1369  * @pre         None
1370  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1371  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1372  * @see         pkgmgrinfo_pkginfo_is_removable()
1373  * @code
1374 static int compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1375 {
1376         int ret = 0;
1377         pkgmgrinfo_cert_compare_result_type_e result;
1378
1379         ret = pkgmgrinfo_pkginfo_compare_app_cert_info(lhs_app_id, rhs_app_id, &result);
1380         if (ret != PMINFO_R_OK) {
1381                 return -1;
1382         }
1383         printf("result: %d\n", result);
1384         return 0;
1385 }
1386  * @endcode
1387  */
1388 int pkgmgrinfo_pkginfo_compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result);
1389
1390 /**
1391  * @fn int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable)
1392  * @brief       This API gets the package 'removable' value from the package ID
1393  *
1394  * @par         This API is for package-manager client application
1395  * @par Sync (or) Async : Synchronous API
1396  *
1397  * @param[in]   handle  pointer to package info handle
1398  * @param[out] removable                pointer to hold package removable value
1399  * @return      0 if success, error code(<0) if fail
1400  * @retval      PMINFO_R_OK     success
1401  * @retval      PMINFO_R_EINVAL invalid argument
1402  * @retval      PMINFO_R_ERROR  internal error
1403  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1404  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1405  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1406  * @see         pkgmgrinfo_pkginfo_is_readonly()
1407  * @code
1408 static int get_pkg_removable(const char *pkgid)
1409 {
1410         int ret = 0;
1411         bool removable;
1412         pkgmgrinfo_pkginfo_h handle;
1413         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1414         if (ret != PMINFO_R_OK)
1415                 return -1;
1416         ret = pkgmgrinfo_pkginfo_is_removable(handle, &removable);
1417         if (ret != PMINFO_R_OK) {
1418                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1419                 return -1;
1420         }
1421         printf("pkg removable: %d\n", removable);
1422         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1423         return 0;
1424 }
1425  * @endcode
1426  */
1427 int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable);
1428
1429 /**
1430  * @fn int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable)
1431  * @brief       This API check that the package can move internal storage to external storage or external storage to internal storage from the package ID
1432  *
1433  * @par         This API is for package-manager client application
1434  * @par Sync (or) Async : Synchronous API
1435  *
1436  * @param[in]   handle  pointer to package info handle
1437  * @param[out] movable          pointer to hold package movable state
1438  * @return      0 if success, error code(<0) if fail
1439  * @retval      PMINFO_R_OK     success
1440  * @retval      PMINFO_R_EINVAL invalid argument
1441  * @retval      PMINFO_R_ERROR  internal error
1442  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1443  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1444  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1445  * @code
1446 static int get_pkg_movable(const char *pkgid)
1447 {
1448         int ret = 0;
1449         bool movable;
1450         pkgmgrinfo_pkginfo_h handle;
1451         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1452         if (ret != PMINFO_R_OK)
1453                 return -1;
1454         ret = pkgmgrinfo_pkginfo_is_movable(handle, &movable);
1455         if (ret != PMINFO_R_OK) {
1456                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1457                 return -1;
1458         }
1459         printf("pkg movable: %d\n", movable);
1460         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1461         return 0;
1462 }
1463  * @endcode
1464  */
1465 int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable);
1466
1467 /**
1468  * @fn int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload)
1469  * @brief       This API gets the package 'preload' value from the package ID
1470  *
1471  * @par         This API is for package-manager client application
1472  * @par Sync (or) Async : Synchronous API
1473  *
1474  * @param[in]   handle  pointer to package info handle
1475  * @param[out] preload          pointer to hold package preload value
1476  * @return      0 if success, error code(<0) if fail
1477  * @retval      PMINFO_R_OK     success
1478  * @retval      PMINFO_R_EINVAL invalid argument
1479  * @retval      PMINFO_R_ERROR  internal error
1480  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1481  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1482  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1483  * @see         pkgmgrinfo_pkginfo_is_readonly()
1484  * @code
1485 static int get_pkg_preload(const char *pkgid)
1486 {
1487         int ret = 0;
1488         bool preload;
1489         pkgmgrinfo_pkginfo_h handle;
1490         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1491         if (ret != PMINFO_R_OK)
1492                 return -1;
1493         ret = pkgmgrinfo_pkginfo_is_preload(handle, &preload);
1494         if (ret != PMINFO_R_OK) {
1495                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1496                 return -1;
1497         }
1498         printf("pkg preload: %d\n", preload);
1499         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1500         return 0;
1501 }
1502  * @endcode
1503  */
1504 int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload);
1505
1506 /**
1507  * @fn int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
1508  * @brief       This API gets the value for given handle is system or not
1509  *
1510  * @par         This API is for package-manager client application
1511  * @par Sync (or) Async : Synchronous API
1512  *
1513  * @param[in]   handle  pointer to package info handle
1514  * @param[out] system           pointer to hold  system is or not
1515  * @return      0 if success, error code(<0) if fail
1516  * @retval      PMINFO_R_OK     success
1517  * @retval      PMINFO_R_EINVAL invalid argument
1518  * @retval      PMINFO_R_ERROR  internal error
1519  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1520  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1521  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1522  * @see         pkgmgrinfo_pkginfo_is_readonly()
1523  * @code
1524 static int get_pkg_system(const char *pkgid)
1525 {
1526         int ret = 0;
1527         bool system = false;
1528         pkgmgrinfo_pkginfo_h handle = NULL;
1529         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1530         if (ret != PMINFO_R_OK)
1531                 return -1;
1532         ret = pkgmgrinfo_pkginfo_is_system(handle, &system);
1533         if (ret != PMINFO_R_OK) {
1534                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1535                 return -1;
1536         }
1537         printf("pkg system: %d\n", system);
1538         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1539         return 0;
1540 }
1541  * @endcode
1542  */
1543 int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system);
1544
1545 /**
1546  * @fn int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
1547  * @brief       This API gets the package 'readonly' value from the package ID
1548  *
1549  * @par         This API is for package-manager client application
1550  * @par Sync (or) Async : Synchronous API
1551  *
1552  * @param[in]   handle  pointer to package info handle
1553  * @param[out] readonly pointer to hold package readonly value
1554  * @return      0 if success, error code(<0) if fail
1555  * @retval      PMINFO_R_OK     success
1556  * @retval      PMINFO_R_EINVAL invalid argument
1557  * @retval      PMINFO_R_ERROR  internal error
1558  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1559  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1560  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1561  * @see         pkgmgrinfo_pkginfo_is_removable()
1562  * @code
1563 static int get_pkg_readonly(const char *pkgid)
1564 {
1565         int ret = 0;
1566         bool readonly;
1567         pkgmgrinfo_pkginfo_h handle;
1568         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1569         if (ret != PMINFO_R_OK)
1570                 return -1;
1571         ret = pkgmgrinfo_pkginfo_is_readonly(handle, &readonly);
1572         if (ret != PMINFO_R_OK) {
1573                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1574                 return -1;
1575         }
1576         printf("pkg readonly: %d\n", readonly);
1577         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1578         return 0;
1579 }
1580  * @endcode
1581  */
1582 int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly);
1583
1584
1585 /**
1586  * @fn int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update)
1587  * @brief       This API gets the package 'upate' value from the package ID
1588  *
1589  * @par         This API is for package-manager client application
1590  * @par Sync (or) Async : Synchronous API
1591  *
1592  * @param[in]   handle  pointer to package info handle
1593  * @param[out] update   pointer to hold package update value
1594  * @return      0 if success, error code(<0) if fail
1595  * @retval      PMINFO_R_OK     success
1596  * @retval      PMINFO_R_EINVAL invalid argument
1597  * @retval      PMINFO_R_ERROR  internal error
1598  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1599  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1600  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1601  * @code
1602 static int get_pkg_update(const char *pkgid)
1603 {
1604         int ret = 0;
1605         bool update;
1606         pkgmgrinfo_pkginfo_h handle;
1607         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1608         if (ret != PMINFO_R_OK)
1609                 return -1;
1610         ret = pkgmgrinfo_pkginfo_is_update(handle, &update);
1611         if (ret != PMINFO_R_OK) {
1612                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1613                 return -1;
1614         }
1615         printf("pkg update: %d\n", update);
1616         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1617         return 0;
1618 }
1619  * @endcode
1620  */
1621 int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update);
1622
1623 /**
1624  * @fn int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible)
1625  * @brief       This API gets the package 'accessible' value from the package ID
1626  *
1627  * @par         This API is for package-manager client application
1628  * @par Sync (or) Async : Synchronous API
1629  *
1630  * @param[in]   handle  pointer to package info handle
1631  * @param[out] accessible       pointer to hold package accessible value
1632  * @return      0 if success, error code(<0) if fail
1633  * @retval      PMINFO_R_OK     success
1634  * @retval      PMINFO_R_EINVAL invalid argument
1635  * @retval      PMINFO_R_ERROR  internal error
1636  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1637  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1638  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1639  * @see         pkgmgrinfo_pkginfo_is_readonly()
1640  * @code
1641 static int get_pkg_accessible(const char *pkgid)
1642 {
1643         int ret = 0;
1644         bool accessible;
1645         pkgmgrinfo_pkginfo_h handle;
1646         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1647         if (ret != PMINFO_R_OK)
1648                 return -1;
1649         ret = pkgmgrinfo_pkginfo_is_accessible(handle, &accessible);
1650         if (ret != PMINFO_R_OK) {
1651                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1652                 return -1;
1653         }
1654         printf("pkg accessible: %d\n", accessible);
1655         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1656         return 0;
1657 }
1658  * @endcode
1659  */
1660 int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible);
1661
1662 /**
1663  * @fn int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle)
1664  * @brief       This API destroys the package information handle freeing up all the resources
1665  *
1666  * @par         This API is for package-manager client application
1667  * @par Sync (or) Async : Synchronous API
1668  *
1669  * @param[in]   handle  pointer to the package info handle
1670  * @return      0 if success, error code(<0) if fail
1671  * @retval      PMINFO_R_OK     success
1672  * @retval      PMINFO_R_EINVAL invalid argument
1673  * @retval      PMINFO_R_ERROR  internal error
1674  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1675  * @post                None
1676  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1677  * @see         pkgmgrinfo_pkginfo_is_removable()
1678  * @code
1679 static int get_pkg_type(const char *pkgid)
1680 {
1681         int ret = 0;
1682         char *type = NULL;
1683         pkgmgrinfo_pkginfo_h handle;
1684         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1685         if (ret != PMINFO_R_OK)
1686                 return -1;
1687         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
1688         if (ret != PMINFO_R_OK) {
1689                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1690                 return -1;
1691         }
1692         printf("pkgtype: %s\n", type);
1693         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1694         return 0;
1695 }
1696  * @endcode
1697  */
1698 int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle);
1699
1700 /**
1701  * @fn int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle)
1702  * @brief       This API creates the package information filter handle from db.  All filter properties will be ANDed.
1703  The query will search the entire package information collected from the manifest file of all the installed packages
1704  *
1705  * @par         This API is for package-manager client application
1706  * @par Sync (or) Async : Synchronous API
1707  *
1708  * @param[out] handle           pointer to the package info filter handle.
1709  * @return      0 if success, error code(<0) if fail
1710  * @retval      PMINFO_R_OK     success
1711  * @retval      PMINFO_R_EINVAL invalid argument
1712  * @retval      PMINFO_R_ERROR  internal error
1713  * @pre         None
1714  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1715  * @see         pkgmgrinfo_pkginfo_filter_count()
1716  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1717  * @code
1718 static int get_rpm_pkg_count()
1719 {
1720         int ret = 0;
1721         int count = 0;
1722         pkgmgrinfo_pkginfo_filter_h handle;
1723         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1724         if (ret != PMINFO_R_OK)
1725                 return -1;
1726         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1727         if (ret != PMINFO_R_OK) {
1728                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1729                 return -1;
1730         }
1731         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1732         if (ret != PMINFO_R_OK) {
1733                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1734                 return -1;
1735         }
1736         printf("No of rpm pkgs: %d\n", count);
1737         pkgmgrinfo_pkginfo_filter_destroy(handle);
1738         return 0;
1739 }
1740  * @endcode
1741  */
1742 int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle);
1743
1744 /**
1745  * @fn int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle)
1746  * @brief       This API destroys the package information filter handle freeing up all the resources
1747  *
1748  * @par         This API is for package-manager client application
1749  * @par Sync (or) Async : Synchronous API
1750  *
1751  * @param[in] handle            pointer to the package info filter handle.
1752  * @return      0 if success, error code(<0) if fail
1753  * @retval      PMINFO_R_OK     success
1754  * @retval      PMINFO_R_EINVAL invalid argument
1755  * @retval      PMINFO_R_ERROR  internal error
1756  * @pre         pkgmgrinfo_pkginfo_filter_create()
1757  * @post                None
1758  * @see         pkgmgrinfo_pkginfo_filter_count()
1759  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1760  * @code
1761 static int get_rpm_pkg_count()
1762 {
1763         int ret = 0;
1764         int count = 0;
1765         pkgmgrinfo_pkginfo_filter_h handle;
1766         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1767         if (ret != PMINFO_R_OK)
1768                 return -1;
1769         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1770         if (ret != PMINFO_R_OK) {
1771                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1772                 return -1;
1773         }
1774         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1775         if (ret != PMINFO_R_OK) {
1776                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1777                 return -1;
1778         }
1779         printf("No of rpm pkgs: %d\n", count);
1780         pkgmgrinfo_pkginfo_filter_destroy(handle);
1781         return 0;
1782 }
1783  * @endcode
1784  */
1785 int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle);
1786
1787 /**
1788  * @fn int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const bool value)
1789  * @brief       This API adds a boolean filter property to the filter handle
1790  *
1791  * @par         This API is for package-manager client application
1792  * @par Sync (or) Async : Synchronous API
1793  *
1794  * @param[in] handle            pointer to the package info filter handle.
1795  * @param[in] property          boolean property name.
1796  * @param[in] value             value corresponding to the property.
1797  * @return      0 if success, error code(<0) if fail
1798  * @retval      PMINFO_R_OK     success
1799  * @retval      PMINFO_R_EINVAL invalid argument
1800  * @retval      PMINFO_R_ERROR  internal error
1801  * @pre         pkgmgrinfo_pkginfo_filter_create()
1802  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1803  * @see         pkgmgrinfo_pkginfo_filter_count()
1804  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1805  * @code
1806 static int get_preload_pkg_count()
1807 {
1808         int ret = 0;
1809         int count = 0;
1810         pkgmgrinfo_pkginfo_filter_h handle;
1811         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1812         if (ret != PMINFO_R_OK)
1813                 return -1;
1814         ret = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD, 1);
1815         if (ret != PMINFO_R_OK) {
1816                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1817                 return -1;
1818         }
1819         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1820         if (ret != PMINFO_R_OK) {
1821                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1822                 return -1;
1823         }
1824         printf("No of preload pkgs: %d\n", count);
1825         pkgmgrinfo_pkginfo_filter_destroy(handle);
1826         return 0;
1827 }
1828  * @endcode
1829  */
1830 int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle,
1831                 const char *property, const bool value);
1832
1833 /**
1834  * @fn int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const int value)
1835  * @brief       This API adds an integer filter property to the filter handle
1836  *
1837  * @par         This API is for package-manager client application
1838  * @par Sync (or) Async : Synchronous API
1839  *
1840  * @param[in] handle            pointer to the package info filter handle.
1841  * @param[in] property          integer property name.
1842  * @param[in] value             value corresponding to the property.
1843  * @return      0 if success, error code(<0) if fail
1844  * @retval      PMINFO_R_OK     success
1845  * @retval      PMINFO_R_EINVAL invalid argument
1846  * @retval      PMINFO_R_ERROR  internal error
1847  * @pre         pkgmgrinfo_pkginfo_filter_create()
1848  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1849  * @see         pkgmgrinfo_pkginfo_filter_count()
1850  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1851  * @code
1852 static int get_pkg_count()
1853 {
1854         int ret = 0;
1855         int count = 0;
1856         pkgmgrinfo_pkginfo_filter_h handle;
1857         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1858         if (ret != PMINFO_R_OK)
1859                 return -1;
1860         ret = pkgmgrinfo_pkginfo_filter_add_int(handle, PMINFO_PKGINFO_PROP_PACKAGE_SIZE, 10);
1861         if (ret != PMINFO_R_OK) {
1862                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1863                 return -1;
1864         }
1865         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1866         if (ret != PMINFO_R_OK) {
1867                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1868                 return -1;
1869         }
1870         printf("No of preload pkgs: %d\n", count);
1871         pkgmgrinfo_pkginfo_filter_destroy(handle);
1872         return 0;
1873 }
1874  * @endcode
1875  */
1876 int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle,
1877                 const char *property, const int value);
1878
1879 /**
1880  * @fn int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const char *value)
1881  * @brief       This API adds a string filter property to the filter handle
1882  *
1883  * @par         This API is for package-manager client application
1884  * @par Sync (or) Async : Synchronous API
1885  *
1886  * @param[in] handle            pointer to the package info filter handle.
1887  * @param[in] property          string property name.
1888  * @param[in] value             value corresponding to the property.
1889  * @return      0 if success, error code(<0) if fail
1890  * @retval      PMINFO_R_OK     success
1891  * @retval      PMINFO_R_EINVAL invalid argument
1892  * @retval      PMINFO_R_ERROR  internal error
1893  * @pre         pkgmgrinfo_pkginfo_filter_create()
1894  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1895  * @see         pkgmgrinfo_pkginfo_filter_count()
1896  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1897  * @code
1898 static int get_rpm_pkg_count()
1899 {
1900         int ret = 0;
1901         int count = 0;
1902         pkgmgrinfo_pkginfo_filter_h handle;
1903         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1904         if (ret != PMINFO_R_OK)
1905                 return -1;
1906         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1907         if (ret != PMINFO_R_OK) {
1908                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1909                 return -1;
1910         }
1911         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1912         if (ret != PMINFO_R_OK) {
1913                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1914                 return -1;
1915         }
1916         printf("No of rpm pkgs: %d\n", count);
1917         pkgmgrinfo_pkginfo_filter_destroy(handle);
1918         return 0;
1919 }
1920  * @endcode
1921  */
1922 int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle,
1923                 const char *property, const char *value);
1924
1925 /**
1926  * @fn int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle, pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data)
1927  * @brief       This API executes the user supplied callback function for each package that satisfy the filter conditions
1928  *
1929  * @par         This API is for package-manager client application
1930  * @par Sync (or) Async : Synchronous API
1931  *
1932  * @param[in] handle            pointer to the package info filter handle.
1933  * @param[in] pkg_cb            callback function.
1934  * @param[in] user_data         user data to be passed to the callback function
1935  * @return      0 if success, error code(<0) if fail
1936  * @retval      PMINFO_R_OK     success
1937  * @retval      PMINFO_R_EINVAL invalid argument
1938  * @retval      PMINFO_R_ERROR  internal error
1939  * @pre         pkgmgrinfo_pkginfo_filter_create()
1940  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1941  * @see         pkgmgrinfo_pkginfo_filter_count()
1942  * @code
1943 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
1944 {
1945         char *pkgid = NULL;
1946         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
1947         printf("pkg id : %s\n", pkgid);
1948         return 0;
1949 }
1950
1951 static int get_rpm_pkg_list()
1952 {
1953         int ret = 0;
1954         pkgmgrinfo_pkginfo_filter_h handle;
1955         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1956         if (ret != PMINFO_R_OK)
1957                 return -1;
1958         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1959         if (ret != PMINFO_R_OK) {
1960                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1961                 return -1;
1962         }
1963         ret = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(handle, pkg_list_cb, NULL);
1964         if (ret != PMINFO_R_OK) {
1965                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1966                 return -1;
1967         }
1968         pkgmgrinfo_pkginfo_filter_destroy(handle);
1969         return 0;
1970 }
1971  * @endcode
1972  */
1973 int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
1974                 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data);
1975
1976 /**
1977  * @fn int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count)
1978  * @brief       This API counts the package that satisfy the filter conditions
1979  *
1980  * @par         This API is for package-manager client application
1981  * @par Sync (or) Async : Synchronous API
1982  *
1983  * @param[in] handle            pointer to the package info filter handle.
1984  * @param[in] count             pointer to store the count value.
1985  * @return      0 if success, error code(<0) if fail
1986  * @retval      PMINFO_R_OK     success
1987  * @retval      PMINFO_R_EINVAL invalid argument
1988  * @retval      PMINFO_R_ERROR  internal error
1989  * @pre         pkgmgrinfo_pkginfo_filter_create()
1990  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1991  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1992  * @code
1993 static int get_rpm_pkg_count()
1994 {
1995         int ret = 0;
1996         int count = 0;
1997         pkgmgrinfo_pkginfo_filter_h handle;
1998         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1999         if (ret != PMINFO_R_OK)
2000                 return -1;
2001         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
2002         if (ret != PMINFO_R_OK) {
2003                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2004                 return -1;
2005         }
2006         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
2007         if (ret != PMINFO_R_OK) {
2008                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2009                 return -1;
2010         }
2011         printf("No of rpm pkgs: %d\n", count);
2012         pkgmgrinfo_pkginfo_filter_destroy(handle);
2013         return 0;
2014 }
2015  * @endcode
2016  */
2017 int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count);
2018
2019 /**
2020  * @fn  int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
2021                         pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
2022  * @brief       This API gets the list of privilege for a particular package
2023  *
2024  * @par         This API is for package-manager client application
2025  * @par Sync (or) Async : Synchronous API
2026  * @param[in]   handle          pointer to the package info handle.
2027  * @param[in]   privilege_func          callback function for list
2028  * @param[in] user_data user data to be passed to callback function
2029  * @return      0 if success, error code(<0) if fail
2030  * @retval      PMINFO_R_OK     success
2031  * @retval      PMINFO_R_EINVAL invalid argument
2032  * @retval      PMINFO_R_ERROR  internal error
2033  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2034  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2035  * @code
2036 int privilege_func(const char *name, void *user_data)
2037 {
2038         if (strcmp(name, (char *)user_data) == 0)
2039                 return -1;
2040         else
2041                 return 0;
2042 }
2043
2044 static int list_privilege(const char *package, char *privilege)
2045 {
2046         int ret = 0;
2047         pkgmgrinfo_pkginfo_h handle;
2048         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
2049         if (ret != PMINFO_R_OK)
2050                 return -1;
2051         ret = pkgmgrinfo_pkginfo_foreach_privilege(handle, privilege_func, (void *)privilege);
2052         if (ret != PMINFO_R_OK) {
2053                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2054                 return -1;
2055         }
2056         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2057         return 0;
2058 }
2059  * @endcode
2060  */
2061 int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
2062                         pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
2063
2064 /**
2065  * @fn  int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
2066  pkgmgrinfo_app_list_cb app_func, void *user_data)
2067  * @brief       This API gets list of installed applications for a particular package
2068  *
2069  * @par         This API is for package-manager client application
2070  * @par Sync (or) Async : Synchronous API
2071  * @param[in]   handle          package info handle
2072  * @param[in]   component       application component
2073  * @param[in]   app_func                iteration function for list
2074  * @param[in] user_data user data to be passed to callback function
2075  * @return      0 if success, error code(<0) if fail
2076  * @retval      PMINFO_R_OK     success
2077  * @retval      PMINFO_R_EINVAL invalid argument
2078  * @retval      PMINFO_R_ERROR  internal error
2079  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2080  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2081  * @code
2082 int app_func(pkgmgrinfo_appinfo_h handle, void *user_data)
2083 {
2084         char *appid = NULL;
2085         pkgmgrinfo_appinfo_get_appid(handle, &appid);
2086         printf("appid : %s\n", appid);
2087         return 0;
2088 }
2089
2090 static int list_apps(const char *pkgid)
2091 {
2092         int ret = 0;
2093         pkgmgrinfo_pkginfo_h handle;
2094         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2095         if (ret != PMINFO_R_OK)
2096                 return -1;
2097         ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, NULL);
2098         if (ret != PMINFO_R_OK) {
2099                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2100                 return -1;
2101         }
2102         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2103         return 0;
2104 }
2105  * @endcode
2106  */
2107 int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
2108                                                         pkgmgrinfo_app_list_cb app_func, void *user_data);
2109 /**
2110  * @fn  int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2111  * @brief       This API gets list of installed applications from all packages with  minimum informaion.
2112  *
2113  * @par         This API is for package-manager client application
2114  * @par Sync (or) Async : Synchronous API
2115  * @param[in]   app_func                iteration function for list
2116  * @param[in] user_data user data to be passed to callback function
2117  * @return      0 if success, error code(<0) if fail
2118  * @retval      PMINFO_R_OK     success
2119  * @retval      PMINFO_R_EINVAL invalid argument
2120  * @retval      PMINFO_R_ERROR  internal error
2121  * @pre         None
2122  * @post                None
2123  * @code
2124 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
2125 {
2126         char *pkgid1 = NULL;
2127         char *pkgid2 = NULL;
2128         pkgid1 = (char *)user_data;
2129         pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
2130         if (strcmp(pkgid1, pkgid2) == 0) {
2131                 return -1;
2132         } else {
2133                 return 0;
2134         }
2135 }
2136
2137 static int list_apps()
2138 {
2139         int ret = 0;
2140         char *name = "helloworld";
2141         ret = pkgmgrinfo_appinfo_get_install_list(app_list_cb, (void *)name);
2142         if (ret != PMINFO_R_OK) {
2143                 return -1;
2144         }
2145         return 0;
2146 }
2147  * @endcode
2148  */
2149 int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2150
2151 /**
2152  * @fn  int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2153  * @brief       This API gets list of installed applications from all packages.
2154  *
2155  * @par         This API is for package-manager client application
2156  * @par Sync (or) Async : Synchronous API
2157  * @param[in]   app_func                iteration function for list
2158  * @param[in] user_data user data to be passed to callback function
2159  * @return      0 if success, error code(<0) if fail
2160  * @retval      PMINFO_R_OK     success
2161  * @retval      PMINFO_R_EINVAL invalid argument
2162  * @retval      PMINFO_R_ERROR  internal error
2163  * @pre         None
2164  * @post                None
2165  * @code
2166 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
2167 {
2168         char *pkgid1 = NULL;
2169         char *pkgid2 = NULL;
2170         pkgid1 = (char *)user_data;
2171         pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
2172         if (strcmp(pkgid1, pkgid2) == 0) {
2173                 return -1;
2174         } else {
2175                 return 0;
2176         }
2177 }
2178
2179 static int list_apps()
2180 {
2181         int ret = 0;
2182         char *name = "helloworld";
2183         ret = pkgmgrinfo_appinfo_get_installed_list(app_list_cb, (void *)name);
2184         if (ret != PMINFO_R_OK) {
2185                 return -1;
2186         }
2187         return 0;
2188 }
2189  * @endcode
2190  */
2191 int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2192
2193 /**
2194  * @fn int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
2195  * @brief       This API creates the application information handle from db
2196  *
2197  * @par         This API is for package-manager client application
2198  * @par Sync (or) Async : Synchronous API
2199  *
2200  * @param[in]   appid   pointer to appid
2201  * @param[out] handle           pointer to the application info handle.
2202  * @return      0 if success, error code(<0) if fail
2203  * @retval      PMINFO_R_OK     success
2204  * @retval      PMINFO_R_EINVAL invalid argument
2205  * @retval      PMINFO_R_ERROR  internal error
2206  * @pre         None
2207  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2208  * @see         pkgmgrinfo_appinfo_get_pkgid()
2209  * @see         pkgmgrinfo_appinfo_is_multiple()
2210  * @code
2211 static int get_app_type(const char *appid)
2212 {
2213         int ret = 0;
2214         char *type = NULL;
2215         pkgmgrinfo_appinfo_h handle;
2216         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2217         if (ret != PMINFO_R_OK)
2218                 return -1;
2219         ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
2220         if (ret != PMINFO_R_OK) {
2221                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2222                 return -1;
2223         }
2224         printf("apptype: %s\n", type);
2225         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2226         return 0;
2227 }
2228  * @endcode
2229  */
2230 int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
2231
2232 /**
2233  * @fn int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
2234  * @brief       This API gets the application ID
2235  *
2236  * @par         This API is for package-manager client application
2237  * @par Sync (or) Async : Synchronous API
2238  *
2239  * @param[in] handle            pointer to the application info handle.
2240  * @param[out] appid            pointer to hold appid
2241  * @return      0 if success, error code(<0) if fail
2242  * @retval      PMINFO_R_OK     success
2243  * @retval      PMINFO_R_EINVAL invalid argument
2244  * @retval      PMINFO_R_ERROR  internal error
2245  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2246  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2247  * @see         pkgmgrinfo_appinfo_get_pkgid()
2248  * @see         pkgmgrinfo_appinfo_is_multiple()
2249  * @code
2250 static int get_app_id(const char *appid)
2251 {
2252         int ret = 0;
2253         char *app_id = NULL;
2254         pkgmgrinfo_appinfo_h handle;
2255         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2256         if (ret != PMINFO_R_OK)
2257                 return -1;
2258         ret = pkgmgrinfo_appinfo_get_appid(handle, &app_id);
2259         if (ret != PMINFO_R_OK) {
2260                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2261                 return -1;
2262         }
2263         printf("app id: %s\n", app_id);
2264         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2265         return 0;
2266 }
2267  * @endcode
2268  */
2269 int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h  handle, char **appid);
2270
2271 /**
2272  * @fn int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name)
2273  * @brief       This API gets the package name of the application
2274  *
2275  * @par         This API is for package-manager client application
2276  * @par Sync (or) Async : Synchronous API
2277  *
2278  * @param[in] handle            pointer to the application info handle.
2279  * @param[out] pkg_name         pointer to hold package name
2280  * @return      0 if success, error code(<0) if fail
2281  * @retval      PMINFO_R_OK     success
2282  * @retval      PMINFO_R_EINVAL invalid argument
2283  * @retval      PMINFO_R_ERROR  internal error
2284  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2285  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2286  * @see         pkgmgrinfo_appinfo_get_appid()
2287  * @see         pkgmgrinfo_appinfo_is_multiple()
2288  * @code
2289 static int get_app_pkgname(const char *appid)
2290 {
2291         int ret = 0;
2292         char *pkgname = NULL;
2293         pkgmgrinfo_appinfo_h handle;
2294         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2295         if (ret != PMINFO_R_OK)
2296                 return -1;
2297         ret = pkgmgrinfo_appinfo_get_pkgname(handle, &pkgname);
2298         if (ret != PMINFO_R_OK) {
2299                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2300                 return -1;
2301         }
2302         printf("pkg name: %s\n", pkgname);
2303         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2304         return 0;
2305 }
2306  * @endcode
2307  */
2308 int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h  handle, char **pkg_name);
2309
2310 /**
2311  * @fn int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
2312  * @brief       This API gets the package id of the application
2313  *
2314  * @par         This API is for package-manager client application
2315  * @par Sync (or) Async : Synchronous API
2316  *
2317  * @param[in] handle            pointer to the application info handle.
2318  * @param[out] pkgid            pointer to hold package id
2319  * @return      0 if success, error code(<0) if fail
2320  * @retval      PMINFO_R_OK     success
2321  * @retval      PMINFO_R_EINVAL invalid argument
2322  * @retval      PMINFO_R_ERROR  internal error
2323  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2324  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2325  * @see         pkgmgrinfo_appinfo_get_appid()
2326  * @see         pkgmgrinfo_appinfo_is_multiple()
2327  * @code
2328 static int get_app_pkgid(const char *appid)
2329 {
2330         int ret = 0;
2331         char *pkgid = NULL;
2332         pkgmgrinfo_appinfo_h handle;
2333         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2334         if (ret != PMINFO_R_OK)
2335                 return -1;
2336         ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
2337         if (ret != PMINFO_R_OK) {
2338                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2339                 return -1;
2340         }
2341         printf("pkg id: %s\n", pkgid);
2342         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2343         return 0;
2344 }
2345  * @endcode
2346  */
2347 int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h  handle, char **pkgid);
2348
2349 /**
2350  * @fn int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec)
2351  * @brief       This API gets the executable name of the application
2352  *
2353  * @par         This API is for package-manager client application
2354  * @par Sync (or) Async : Synchronous API
2355  *
2356  * @param[in] handle            pointer to the application info handle.
2357  * @param[out] exec             pointer to hold app exec name
2358  * @return      0 if success, error code(<0) if fail
2359  * @retval      PMINFO_R_OK     success
2360  * @retval      PMINFO_R_EINVAL invalid argument
2361  * @retval      PMINFO_R_ERROR  internal error
2362  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2363  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2364  * @see         pkgmgrinfo_appinfo_get_appid()
2365  * @see         pkgmgrinfo_appinfo_is_multiple()
2366  * @code
2367 static int get_app_exec(const char *appid)
2368 {
2369         int ret = 0;
2370         char *exec = NULL;
2371         pkgmgrinfo_appinfo_h handle;
2372         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2373         if (ret != PMINFO_R_OK)
2374                 return -1;
2375         ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
2376         if (ret != PMINFO_R_OK) {
2377                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2378                 return -1;
2379         }
2380         printf("exec name: %s\n", exec);
2381         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2382         return 0;
2383 }
2384  * @endcode
2385  */
2386 int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h  handle, char **exec);
2387
2388 /**
2389  * @fn int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
2390  * @brief       This API gets the icon name of the application
2391  *
2392  * @par         This API is for package-manager client application
2393  * @par Sync (or) Async : Synchronous API
2394  *
2395  * @param[in] handle            pointer to the application info handle.
2396  * @param[out] icon             pointer to hold app icon name
2397  * @return      0 if success, error code(<0) if fail
2398  * @retval      PMINFO_R_OK     success
2399  * @retval      PMINFO_R_EINVAL invalid argument
2400  * @retval      PMINFO_R_ERROR  internal error
2401  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2402  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2403  * @see         pkgmgrinfo_appinfo_get_appid()
2404  * @see         pkgmgrinfo_appinfo_is_multiple()
2405  * @code
2406 static int get_app_icon(const char *appid)
2407 {
2408         int ret = 0;
2409         char *icon = NULL;
2410         pkgmgrinfo_appinfo_h handle;
2411         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2412         if (ret != PMINFO_R_OK)
2413                 return -1;
2414         ret = pkgmgrinfo_appinfo_get_icon(handle, &icon);
2415         if (ret != PMINFO_R_OK) {
2416                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2417                 return -1;
2418         }
2419         printf("icon name: %s\n", icon);
2420         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2421         return 0;
2422 }
2423  * @endcode
2424  */
2425 int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
2426
2427 /**
2428  * @fn int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
2429  * @brief       This API gets the label of the application
2430  *
2431  * @par         This API is for package-manager client application
2432  * @par Sync (or) Async : Synchronous API
2433  *
2434  * @param[in] handle            pointer to the application info handle.
2435  * @param[out] label            pointer to hold app label
2436  * @return      0 if success, error code(<0) if fail
2437  * @retval      PMINFO_R_OK     success
2438  * @retval      PMINFO_R_EINVAL invalid argument
2439  * @retval      PMINFO_R_ERROR  internal error
2440  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2441  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2442  * @see         pkgmgrinfo_appinfo_get_appid()
2443  * @see         pkgmgrinfo_appinfo_is_multiple()
2444  * @code
2445 static int get_app_label(const char *appid)
2446 {
2447         int ret = 0;
2448         char *label = NULL;
2449         pkgmgrinfo_appinfo_h handle;
2450         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2451         if (ret != PMINFO_R_OK)
2452                 return -1;
2453         ret = pkgmgrinfo_appinfo_get_label(handle, &label);
2454         if (ret != PMINFO_R_OK) {
2455                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2456                 return -1;
2457         }
2458         printf("label : %s\n", label);
2459         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2460         return 0;
2461 }
2462  * @endcode
2463  */
2464 int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h  handle, char **label);
2465
2466 /**
2467  * @fn int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
2468  * @brief       This API gets the component of the application
2469  *
2470  * @par         This API is for package-manager client application
2471  * @par Sync (or) Async : Synchronous API
2472  *
2473  * @param[in] handle            pointer to the application info handle.
2474  * @param[out] component                pointer to hold app component
2475  * @return      0 if success, error code(<0) if fail
2476  * @retval      PMINFO_R_OK     success
2477  * @retval      PMINFO_R_EINVAL invalid argument
2478  * @retval      PMINFO_R_ERROR  internal error
2479  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2480  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2481  * @see         pkgmgrinfo_appinfo_get_appid()
2482  * @see         pkgmgrinfo_appinfo_is_multiple()
2483  * @code
2484 static int get_app_component(const char *appid)
2485 {
2486         int ret = 0;
2487         pkgmgrinfo_app_component component;
2488         pkgmgrinfo_appinfo_h handle;
2489         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2490         if (ret != PMINFO_R_OK)
2491                 return -1;
2492         ret = pkgmgrinfo_appinfo_get_component(handle, &component);
2493         if (ret != PMINFO_R_OK) {
2494                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2495                 return -1;
2496         }
2497         printf("component : %s\n", component);
2498         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2499         return 0;
2500 }
2501  * @endcode
2502  */
2503 int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_component *component);
2504
2505 /**
2506  * @fn int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
2507  * @brief       This API gets the apptype of the application
2508  *
2509  * @par         This API is for package-manager client application
2510  * @par Sync (or) Async : Synchronous API
2511  *
2512  * @param[in] handle            pointer to the application info handle.
2513  * @param[out] app_type         pointer to hold apptype
2514  * @return      0 if success, error code(<0) if fail
2515  * @retval      PMINFO_R_OK     success
2516  * @retval      PMINFO_R_EINVAL invalid argument
2517  * @retval      PMINFO_R_ERROR  internal error
2518  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2519  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2520  * @see         pkgmgrinfo_appinfo_get_appid()
2521  * @see         pkgmgrinfo_appinfo_is_multiple()
2522  * @code
2523 static int get_app_type(const char *appid)
2524 {
2525         int ret = 0;
2526         char *apptype = NULL;
2527         pkgmgrinfo_appinfo_h handle;
2528         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2529         if (ret != PMINFO_R_OK)
2530                 return -1;
2531         ret = pkgmgrinfo_appinfo_get_apptype(handle, &apptype);
2532         if (ret != PMINFO_R_OK) {
2533                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2534                 return -1;
2535         }
2536         printf("apptype : %s\n", apptype);
2537         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2538         return 0;
2539 }
2540  * @endcode
2541  */
2542 int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h  handle, char **app_type);
2543
2544 /**
2545  * @fn int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
2546                                                                                 int *operation_count, char ***operation)
2547  * @brief       This API gets the list of operation of the application
2548  *
2549  * @par         This API is for package-manager client application
2550  * @par Sync (or) Async : Synchronous API
2551  *
2552  * @param[in] handle            pointer to the appcontrol handle.
2553  * @param[out] operation_count          pointer to hold number of operations
2554  * @param[out] operation                pointer to hold list of operations
2555  * @return      0 if success, error code(<0) if fail
2556  * @retval      PMINFO_R_OK     success
2557  * @retval      PMINFO_R_EINVAL invalid argument
2558  * @retval      PMINFO_R_ERROR  internal error
2559  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2560  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2561  * @see         pkgmgrinfo_appinfo_get_uri()
2562  * @see         pkgmgrinfo_appinfo_get_mime()
2563  * @code
2564 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2565 {
2566         int oc = 0;
2567         int i = 0;
2568         char **operation;
2569         pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
2570         for (i = 0; i < oc; i++) {
2571                 if (strcmp(operation[i], (char *)user_data) == 0)
2572                         return -1;
2573                 else
2574                         return 0;
2575         }
2576 }
2577
2578 static int check_operation(const char *appid, char *operation)
2579 {
2580         int ret = 0;
2581         pkgmgrinfo_appinfo_h handle;
2582         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2583         if (ret != PMINFO_R_OK)
2584                 return -1;
2585         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
2586         if (ret != PMINFO_R_OK) {
2587                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2588                 return -1;
2589         }
2590         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2591         return 0;
2592 }
2593  * @endcode
2594  */
2595 int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
2596                                                                                 int *operation_count, char ***operation);
2597
2598 /**
2599  * @fn int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
2600                                                                                 int *uri_count, char ***uri)
2601  * @brief       This API gets the list of uri of the application
2602  *
2603  * @par         This API is for package-manager client application
2604  * @par Sync (or) Async : Synchronous API
2605  *
2606  * @param[in] handle            pointer to the appcontrol handle.
2607  * @param[out] uri_count                pointer to hold number of uris
2608  * @param[out] uri              pointer to hold list of uris
2609  * @return      0 if success, error code(<0) if fail
2610  * @retval      PMINFO_R_OK     success
2611  * @retval      PMINFO_R_EINVAL invalid argument
2612  * @retval      PMINFO_R_ERROR  internal error
2613  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2614  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2615  * @see         pkgmgrinfo_appinfo_get_operation()
2616  * @see         pkgmgrinfo_appinfo_get_mime()
2617  * @code
2618 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2619 {
2620         int uc = 0;
2621         int i = 0;
2622         char **uri;
2623         pkgmgrinfo_appinfo_get_uri(handle, &uc, &uri);
2624         for (i = 0; i < uc; i++) {
2625                 if (strcmp(uri[i], (char *)user_data) == 0)
2626                         return -1;
2627                 else
2628                         return 0;
2629         }
2630 }
2631
2632 static int check_uri(const char *appid, char *uri)
2633 {
2634         int ret = 0;
2635         pkgmgrinfo_appinfo_h handle;
2636         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2637         if (ret != PMINFO_R_OK)
2638                 return -1;
2639         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)uri);
2640         if (ret != PMINFO_R_OK) {
2641                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2642                 return -1;
2643         }
2644         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2645         return 0;
2646 }
2647  * @endcode
2648  */
2649 int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
2650                                                                                 int *uri_count, char ***uri);
2651
2652 /**
2653  * @fn int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
2654                                                                                 int *mime_count, char ***mime)
2655  * @brief       This API gets the list of mime of the application
2656  *
2657  * @par         This API is for package-manager client application
2658  * @par Sync (or) Async : Synchronous API
2659  *
2660  * @param[in] handle            pointer to the appcontrol handle.
2661  * @param[out] mime_count               pointer to hold number of mimes
2662  * @param[out] mime             pointer to hold list of mimes
2663  * @return      0 if success, error code(<0) if fail
2664  * @retval      PMINFO_R_OK     success
2665  * @retval      PMINFO_R_EINVAL invalid argument
2666  * @retval      PMINFO_R_ERROR  internal error
2667  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2668  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2669  * @see         pkgmgrinfo_appinfo_get_uri()
2670  * @see         pkgmgrinfo_appinfo_get_operation()
2671  * @code
2672 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2673 {
2674         int mc = 0;
2675         int i = 0;
2676         char **mime;
2677         pkgmgrinfo_appinfo_get_operation(handle, &mc, &mime);
2678         for (i = 0; i < mc; i++) {
2679                 if (strcmp(mime[i], (char *)user_data) == 0)
2680                         return -1;
2681                 else
2682                         return 0;
2683         }
2684 }
2685
2686 static int check_mime(const char *appid, char *mime)
2687 {
2688         int ret = 0;
2689         pkgmgrinfo_appinfo_h handle;
2690         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2691         if (ret != PMINFO_R_OK)
2692                 return -1;
2693         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)mime);
2694         if (ret != PMINFO_R_OK) {
2695                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2696                 return -1;
2697         }
2698         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2699         return 0;
2700 }
2701  * @endcode
2702  */
2703 int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
2704                                                                                 int *mime_count, char ***mime);
2705
2706 /**
2707  * @fn int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
2708                                                                                 int *subapp_count, char ***subapp)
2709  * @brief       This API gets the list of subapp of the application
2710  *
2711  * @par         This API is for package-manager client application
2712  * @par Sync (or) Async : Synchronous API
2713  *
2714  * @param[in] handle            pointer to the appcontrol handle.
2715  * @param[out] subapp_count             pointer to hold number of subapp
2716  * @param[out] subapp           pointer to hold list of subapp
2717  * @return      0 if success, error code(<0) if fail
2718  * @retval      PMINFO_R_OK     success
2719  * @retval      PMINFO_R_EINVAL invalid argument
2720  * @retval      PMINFO_R_ERROR  internal error
2721  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2722  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2723  * @see         pkgmgrinfo_appinfo_get_uri()
2724  * @see         pkgmgrinfo_appinfo_get_operation()
2725  * @code
2726 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2727 {
2728         int sc = 0;
2729         int i = 0;
2730         char **subapp = NULL;
2731         pkgmgrinfo_appinfo_get_subapp(handle, &sc, &subapp);
2732         for (i = 0; i < sc; i++) {
2733                 if (strcmp(subapp[i], (char *)user_data) == 0)
2734                         return -1;
2735                 else
2736                         return 0;
2737         }
2738 }
2739
2740 static int check_subapp(const char *appid, char *subapp)
2741 {
2742         int ret = 0;
2743         pkgmgrinfo_appinfo_h handle = NULL;
2744         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2745         if (ret != PMINFO_R_OK)
2746                 return -1;
2747         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)subapp);
2748         if (ret != PMINFO_R_OK) {
2749                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2750                 return -1;
2751         }
2752         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2753         return 0;
2754 }
2755  * @endcode
2756  */
2757 int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
2758                                                 int *subapp_count, char ***subapp);
2759
2760 /**
2761  * @fn int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
2762  * @brief       This API gets the notification icon of the application
2763  *
2764  * @par         This API is for package-manager client application
2765  * @par Sync (or) Async : Synchronous API
2766  *
2767  * @param[in] handle            pointer to the application info handle.
2768  * @param[out] path             pointer to hold notification icon
2769  * @return      0 if success, error code(<0) if fail
2770  * @retval      PMINFO_R_OK     success
2771  * @retval      PMINFO_R_EINVAL invalid argument
2772  * @retval      PMINFO_R_ERROR  internal error
2773  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2774  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2775  * @see         pkgmgrinfo_appinfo_get_appid()
2776  * @see         pkgmgrinfo_appinfo_is_multiple()
2777  * @code
2778 static int get_app_notification_icon(const char *appid)
2779 {
2780         int ret = 0;
2781         char *notification_icon = NULL;
2782         pkgmgrinfo_appinfo_h handle;
2783         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2784         if (ret != PMINFO_R_OK)
2785                 return -1;
2786         ret = pkgmgrinfo_appinfo_get_notification_icon(handle, &notification_icon);
2787         if (ret != PMINFO_R_OK) {
2788                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2789                 return -1;
2790         }
2791         printf("notification icon : %s\n", notification_icon);
2792         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2793         return 0;
2794 }
2795  * @endcode
2796  */
2797 int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
2798
2799 /**
2800  * @fn int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon)
2801  * @brief       This API gets the setting icon of the application
2802  *
2803  * @par         This API is for package-manager client application
2804  * @par Sync (or) Async : Synchronous API
2805  *
2806  * @param[in] handle            pointer to the application info handle.
2807  * @param[out] path             pointer to hold setting icon
2808  * @return      0 if success, error code(<0) if fail
2809  * @retval      PMINFO_R_OK     success
2810  * @retval      PMINFO_R_EINVAL invalid argument
2811  * @retval      PMINFO_R_ERROR  internal error
2812  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2813  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2814  * @see         pkgmgrinfo_appinfo_get_appid()
2815  * @see         pkgmgrinfo_appinfo_is_multiple()
2816  * @code
2817 static int get_app_setting_icon(const char *appid)
2818 {
2819         int ret = 0;
2820         char *setting_icon = NULL;
2821         pkgmgrinfo_appinfo_h handle;
2822         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2823         if (ret != PMINFO_R_OK)
2824                 return -1;
2825         ret = pkgmgrinfo_appinfo_get_setting_icon(handle, &setting_icon);
2826         if (ret != PMINFO_R_OK) {
2827                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2828                 return -1;
2829         }
2830         printf("setting icon : %s\n", setting_icon);
2831         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2832         return 0;
2833 }
2834  * @endcode
2835  */
2836 int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
2837
2838 /**
2839  * @fn int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
2840  * @brief       This API gets the type of recent image on app-tray
2841  *
2842  * @par         This API is for package-manager client application
2843  * @par Sync (or) Async : Synchronous API
2844  *
2845  * @param[in] handle            pointer to the application info handle.
2846  * @param[out] type             pointer to hold image type
2847  * @return      0 if success, error code(<0) if fail
2848  * @retval      PMINFO_R_OK     success
2849  * @retval      PMINFO_R_EINVAL invalid argument
2850  * @retval      PMINFO_R_ERROR  internal error
2851  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2852  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2853  * @see         pkgmgrinfo_appinfo_get_appid()
2854  * @see         pkgmgrinfo_appinfo_is_multiple()
2855  * @code
2856 static int get_app_recent_image_type(const char *appid)
2857 {
2858         int ret = 0;
2859         pkgmgrinfo_app_recentimage type;
2860         pkgmgrinfo_appinfo_h handle;
2861         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2862         if (ret != PMINFO_R_OK)
2863                 return -1;
2864         ret = pkgmgrinfo_appinfo_get_recent_image_type(handle, &type);
2865         if (ret != PMINFO_R_OK) {
2866                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2867                 return -1;
2868         }
2869         printf("recent image type: %d\n", type);
2870         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2871         return 0;
2872 }
2873  * @endcode
2874  */
2875 int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_recentimage *type);
2876
2877
2878 /**
2879  * @fn int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h  handle, char **preview_img)
2880  * @brief       This API gets the preview image of application
2881  *
2882  * @par Sync (or) Async : Synchronous API
2883  *
2884  * @param[in] handle            pointer to the application info handle.
2885  * @param[out] preview_img              pointer to hold preview image path
2886  * @return      0 if success, error code(<0) if fail
2887  * @retval      PMINFO_R_OK     success
2888  * @retval      PMINFO_R_EINVAL invalid argument
2889  * @retval      PMINFO_R_ERROR  internal error
2890  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2891  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2892  * @see         pkgmgrinfo_appinfo_get_appid()
2893  * @code
2894 static int get_app_previewimage(const char *appid)
2895 {
2896         int ret = 0;
2897         char *preview = NULL;
2898         pkgmgrinfo_appinfo_h handle = NULL;
2899         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2900         if (ret != PMINFO_R_OK)
2901                 return -1;
2902         ret = pkgmgrinfo_appinfo_get_preview_image(handle, &preview);
2903         if (ret != PMINFO_R_OK) {
2904                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2905                 return -1;
2906         }
2907         printf("preview image path : %s\n", preview);
2908         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2909         return 0;
2910 }
2911  * @endcode
2912  */
2913 int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h  handle, char **preview_img);
2914
2915
2916 /**
2917  * @fn int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
2918  * @brief       This API gets the package permission type of the application
2919  *
2920  * @par         This API is for package-manager client application
2921  * @par Sync (or) Async : Synchronous API
2922  *
2923  * @param[in] handle            pointer to the application info handle.
2924  * @param[out] permission               pointer to hold package permission
2925  * @return      0 if success, error code(<0) if fail
2926  * @retval      PMINFO_R_OK     success
2927  * @retval      PMINFO_R_EINVAL invalid argument
2928  * @retval      PMINFO_R_ERROR  internal error
2929  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2930  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2931  * @see         pkgmgrinfo_appinfo_get_appid()
2932  * @code
2933 static int get_app_permission(const char *appid)
2934 {
2935         int ret = 0;
2936         pkgmgrinfo_permission_type permission = 0;
2937         pkgmgrinfo_appinfo_h handle;
2938
2939         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2940         if (ret != PMINFO_R_OK)
2941                 return -1;
2942         ret = pkgmgrinfo_appinfo_get_permission_type(handle, &permission);
2943         if (ret != PMINFO_R_OK) {
2944                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2945                 return -1;
2946         }
2947         printf("permission type: %d\n", permission);
2948         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2949         return 0;
2950 }
2951  * @endcode
2952  */
2953 int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission);
2954
2955 /**
2956  * @fn int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
2957  * @brief       This API gets the component_type
2958  *
2959  * @par         This API is for package-manager client application
2960  * @par Sync (or) Async : Synchronous API
2961  *
2962  * @param[in] handle            pointer to the application info handle.
2963  * @param[out] component_type           pointer to hold component_type
2964  * @return      0 if success, error code(<0) if fail
2965  * @retval      PMINFO_R_OK     success
2966  * @retval      PMINFO_R_EINVAL invalid argument
2967  * @retval      PMINFO_R_ERROR  internal error
2968  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2969  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
2970  * @see         pkgmgrinfo_appinfo_get_pkgid()
2971  * @see         pkgmgrinfo_appinfo_is_multiple()
2972  * @code
2973 static int get_component_type(const char *appid)
2974 {
2975         int ret = 0;
2976         char *component_type = NULL;
2977         pkgmgrinfo_appinfo_h handle;
2978         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2979         if (ret != PMINFO_R_OK)
2980                 return -1;
2981         ret = pkgmgrinfo_appinfo_get_component_type(handle, &component_type);
2982         if (ret != PMINFO_R_OK) {
2983                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2984                 return -1;
2985         }
2986         printf("component_type: %s\n", component_type);
2987         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2988         return 0;
2989 }
2990  * @endcode
2991  */
2992 int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h  handle, char **component_type);
2993
2994 /**
2995  * @fn int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
2996  * @brief       This API gets the application 'hwacceleration' value from the app ID
2997  *
2998  * @par         This API is for package-manager client application
2999  * @par Sync (or) Async : Synchronous API
3000  *
3001  * @param[in]   handle  pointer to application info handle
3002  * @param[out] hwacceleration           pointer to hold package hwacceleration value
3003  * @return      0 if success, error code(<0) if fail
3004  * @retval      PMINFO_R_OK     success
3005  * @retval      PMINFO_R_EINVAL invalid argument
3006  * @retval      PMINFO_R_ERROR  internal error
3007  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3008  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3009  * @see         pkgmgrinfo_appinfo_get_appid()
3010  * @see         pkgmgrinfo_appinfo_is_multiple()
3011  * @code
3012 static int get_app_hwacceleration(const char *appid)
3013 {
3014         int ret = 0;
3015         pkgmgrinfo_app_hwacceleration hwacceleration;
3016         pkgmgrinfo_appinfo_h handle;
3017         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3018         if (ret != PMINFO_R_OK)
3019                 return -1;
3020         ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacceleration);
3021         if (ret != PMINFO_R_OK) {
3022                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3023                 return -1;
3024         }
3025         printf("app hwacceleration: %d\n", hwacceleration);
3026         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3027         return 0;
3028 }
3029  * @endcode
3030  */
3031 int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_hwacceleration *hwacceleration);
3032
3033 /**
3034  * @fn int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img)
3035  * @brief       This API gets the application's landscape & portrait effect images
3036  *
3037  * @par         This API is for package-manager client application
3038  * @par Sync (or) Async : Synchronous API
3039  *
3040  * @param[in]   handle  pointer to application info handle
3041  * @param[out]  portrait_img contains portrait mode effect image
3042  * @param[out]  landscape_img contains landscape mode effect image
3043  * @return      0 if success, error code(<0) if fail
3044  * @retval      PMINFO_R_OK     success
3045  * @retval      PMINFO_R_EINVAL invalid argument
3046  * @retval      PMINFO_R_ERROR  internal error
3047  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3048  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3049  * @see         pkgmgrinfo_appinfo_get_appid()
3050  * @see         pkgmgrinfo_appinfo_is_nodisplay()
3051  * @code
3052 static int get_app_effectimages(const char *appid)
3053 {
3054         int ret = 0;
3055         char *portraitimg = NULL;
3056         char *landscapeimg = NULL;
3057         pkgmgrinfo_appinfo_h handle;
3058         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3059         if (ret != PMINFO_R_OK)
3060                 return -1;
3061         ret = pkgmgrinfo_appinfo_get_effectimage(handle, &portraitimg, &landscapeimg);
3062         if (ret != PMINFO_R_OK) {
3063                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3064                 return -1;
3065         }
3066         printf("app effect image portrait: %s, app effect image landscape : %s\n", portraitimg, landscapeimg);
3067         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3068         return 0;
3069 }
3070  * @endcode
3071  */
3072 int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img);
3073
3074 /**
3075  * @fn int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h handle, char **submode_mainid)
3076  * @brief       This API gets the submode_mainid of the application
3077  *
3078  * @par         This API is for package-manager client application
3079  * @par Sync (or) Async : Synchronous API
3080  *
3081  * @param[in] handle            pointer to the application info handle.
3082  * @param[out] submode_mainid           pointer to hold package name
3083  * @return      0 if success, error code(<0) if fail
3084  * @retval      PMINFO_R_OK     success
3085  * @retval      PMINFO_R_EINVAL invalid argument
3086  * @retval      PMINFO_R_ERROR  internal error
3087  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3088  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3089  * @see         pkgmgrinfo_appinfo_get_appid()
3090  * @see         pkgmgrinfo_appinfo_is_multiple()
3091  * @code
3092 static int get_app_submode_mainid(const char *appid)
3093 {
3094         int ret = 0;
3095         char *submode_mainid = NULL;
3096         pkgmgrinfo_appinfo_h handle = NULL;
3097         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3098         if (ret != PMINFO_R_OK)
3099                 return -1;
3100         ret = pkgmgrinfo_appinfo_get_submode_mainid(handle, &submode_mainid);
3101         if (ret != PMINFO_R_OK) {
3102                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3103                 return -1;
3104         }
3105         printf("submode_mainid: %s\n", submode_mainid);
3106         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3107         return 0;
3108 }
3109  * @endcode
3110  */
3111 int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char **submode_mainid);
3112
3113 /**
3114  * @fn  int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
3115                         pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
3116  * @brief       This API gets the list of permission for a particular application
3117  *
3118  * @par         This API is for package-manager client application
3119  * @par Sync (or) Async : Synchronous API
3120  * @param[in]   handle          pointer to the application info handle.
3121  * @param[in]   permission_func         callback function for list
3122  * @param[in] user_data user data to be passed to callback function
3123  * @return      0 if success, error code(<0) if fail
3124  * @retval      PMINFO_R_OK     success
3125  * @retval      PMINFO_R_EINVAL invalid argument
3126  * @retval      PMINFO_R_ERROR  internal error
3127  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3128  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3129  * @code
3130 int permission_func(const char *name, void *user_data)
3131 {
3132         if (strcmp(name, (char *)user_data) == 0)
3133                 return -1;
3134         else
3135                 return 0;
3136 }
3137
3138 static int list_permission(const char *appid, char *permission)
3139 {
3140         int ret = 0;
3141         pkgmgrinfo_appinfo_h handle;
3142         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3143         if (ret != PMINFO_R_OK)
3144                 return -1;
3145         ret = pkgmgrinfo_appinfo_foreach_permission(handle, permission_func, (void *)permission);
3146         if (ret != PMINFO_R_OK) {
3147                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3148                 return -1;
3149         }
3150         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3151         return 0;
3152 }
3153  * @endcode
3154  */
3155 int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
3156                         pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
3157
3158 /**
3159  * @fn  int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
3160                         pkgmgrinfo_app_category_list_cb category_func, void *user_data);
3161  * @brief       This API gets the list of category for a particular application
3162  *
3163  * @par         This API is for package-manager client application
3164  * @par Sync (or) Async : Synchronous API
3165  * @param[in]   handle          pointer to the application info handle.
3166  * @param[in]   category_func           callback function for list
3167  * @param[in] user_data user data to be passed to callback function
3168  * @return      0 if success, error code(<0) if fail
3169  * @retval      PMINFO_R_OK     success
3170  * @retval      PMINFO_R_EINVAL invalid argument
3171  * @retval      PMINFO_R_ERROR  internal error
3172  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3173  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3174  * @code
3175 int category_func(const char *name, void *user_data)
3176 {
3177         if (strcmp(name, (char *)user_data) == 0)
3178                 return -1;
3179         else
3180                 return 0;
3181 }
3182
3183 static int list_category(const char *appid, char *category)
3184 {
3185         int ret = 0;
3186         pkgmgrinfo_appinfo_h handle;
3187         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3188         if (ret != PMINFO_R_OK)
3189                 return -1;
3190         ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)category);
3191         if (ret != PMINFO_R_OK) {
3192                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3193                 return -1;
3194         }
3195         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3196         return 0;
3197 }
3198  * @endcode
3199  */
3200 int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
3201                         pkgmgrinfo_app_category_list_cb category_func, void *user_data);
3202
3203 /**
3204  * @fn  int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
3205                         pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
3206  * @brief       This API gets the list of metadata for a particular application
3207  *
3208  * @par         This API is for package-manager client application
3209  * @par Sync (or) Async : Synchronous API
3210  * @param[in]   handle          pointer to the application info handle.
3211  * @param[in]   metadata_func           callback function for list
3212  * @param[in] user_data user data to be passed to callback function
3213  * @return      0 if success, error code(<0) if fail
3214  * @retval      PMINFO_R_OK     success
3215  * @retval      PMINFO_R_EINVAL invalid argument
3216  * @retval      PMINFO_R_ERROR  internal error
3217  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3218  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3219  * @code
3220 int metadata_func(const char *key, const char *value, void *user_data)
3221 {
3222         if (strcmp(key, (char *)user_data) == 0) {
3223                 printf("Value is %s\n", value);
3224                 return -1;
3225         }
3226         else
3227                 return 0;
3228 }
3229
3230 static int list_metadata(const char *appid, char *key)
3231 {
3232         int ret = 0;
3233         pkgmgrinfo_appinfo_h handle;
3234         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3235         if (ret != PMINFO_R_OK)
3236                 return -1;
3237         ret = pkgmgrinfo_appinfo_foreach_metadata(handle, metadata_func, (void *)key);
3238         if (ret != PMINFO_R_OK) {
3239                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3240                 return -1;
3241         }
3242         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3243         return 0;
3244 }
3245  * @endcode
3246  */
3247 int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
3248                         pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
3249
3250
3251 /**
3252  * @fn  int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
3253                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
3254  * @brief       This API gets the list of app-control for a particular application
3255  *
3256  * @par         This API is for package-manager client application
3257  * @par Sync (or) Async : Synchronous API
3258  * @param[in]   handle          pointer to the application info handle.
3259  * @param[in]   appcontrol_func         callback function for list
3260  * @param[in] user_data user data to be passed to callback function
3261  * @return      0 if success, error code(<0) if fail
3262  * @retval      PMINFO_R_OK     success
3263  * @retval      PMINFO_R_EINVAL invalid argument
3264  * @retval      PMINFO_R_ERROR  internal error
3265  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3266  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3267  * @code
3268 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
3269 {
3270         int oc = 0;
3271         int i = 0;
3272         char **operation;
3273         pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
3274         for (i = 0; i < oc; i++) {
3275                 if (strcmp(operation[i], (char *)user_data) == 0)
3276                         return -1;
3277                 else
3278                         return 0;
3279         }
3280 }
3281
3282 static int check_operation(const char *appid, char *operation)
3283 {
3284         int ret = 0;
3285         pkgmgrinfo_appinfo_h handle;
3286         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3287         if (ret != PMINFO_R_OK)
3288                 return -1;
3289         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
3290         if (ret != PMINFO_R_OK) {
3291                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3292                 return -1;
3293         }
3294         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3295         return 0;
3296 }
3297  * @endcode
3298  */
3299 int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
3300                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
3301
3302 /**
3303  * @fn int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay)
3304  * @brief       This API gets the application 'nodisplay' value from the app ID
3305  *
3306  * @par         This API is for package-manager client application
3307  * @par Sync (or) Async : Synchronous API
3308  *
3309  * @param[in]   handle  pointer to application info handle
3310  * @param[out] nodisplay                pointer to hold package nodisplay value
3311  * @return      0 if success, error code(<0) if fail
3312  * @retval      PMINFO_R_OK     success
3313  * @retval      PMINFO_R_EINVAL invalid argument
3314  * @retval      PMINFO_R_ERROR  internal error
3315  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3316  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3317  * @see         pkgmgrinfo_appinfo_get_appid()
3318  * @see         pkgmgrinfo_appinfo_is_multiple()
3319  * @code
3320 static int get_app_nodisplay(const char *appid)
3321 {
3322         int ret = 0;
3323         bool nodisplay;
3324         pkgmgrinfo_appinfo_h handle;
3325         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3326         if (ret != PMINFO_R_OK)
3327                 return -1;
3328         ret = pkgmgrinfo_appinfo_is_nodisplay(handle, &nodisplay);
3329         if (ret != PMINFO_R_OK) {
3330                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3331                 return -1;
3332         }
3333         printf("app nodisplay: %d\n", nodisplay);
3334         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3335         return 0;
3336 }
3337  * @endcode
3338  */
3339 int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h  handle, bool *nodisplay);
3340
3341 /**
3342  * @fn int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multiple)
3343  * @brief       This API gets the application 'multiple' value from the app ID
3344  *
3345  * @par         This API is for package-manager client application
3346  * @par Sync (or) Async : Synchronous API
3347  *
3348  * @param[in]   handle  pointer to application info handle
3349  * @param[out] multiple         pointer to hold package multiple value
3350  * @return      0 if success, error code(<0) if fail
3351  * @retval      PMINFO_R_OK     success
3352  * @retval      PMINFO_R_EINVAL invalid argument
3353  * @retval      PMINFO_R_ERROR  internal error
3354  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3355  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3356  * @see         pkgmgrinfo_appinfo_get_appid()
3357  * @see         pkgmgrinfo_appinfo_is_nodisplay()
3358  * @code
3359 static int get_app_multiple(const char *appid)
3360 {
3361         int ret = 0;
3362         bool multiple;
3363         pkgmgrinfo_appinfo_h handle;
3364         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3365         if (ret != PMINFO_R_OK)
3366                 return -1;
3367         ret = pkgmgrinfo_appinfo_is_multiple(handle, &multiple);
3368         if (ret != PMINFO_R_OK) {
3369                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3370                 return -1;
3371         }
3372         printf("app multiple: %d\n", multiple);
3373         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3374         return 0;
3375 }
3376  * @endcode
3377  */
3378 int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h  handle, bool *multiple);
3379
3380 /**
3381  * @fn int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
3382  * @brief       This API gets the application 'indicatordisplay' value. If true, indicator will be displayed during
3383  *              application launching effect. If fales, indicator will be hidden during application launching effect
3384  *
3385  * @par         This API is for package-manager client application
3386  * @par Sync (or) Async : Synchronous API
3387  *
3388  * @param[in]   handle  pointer to application info handle
3389  * @param[out]  indicator_disp contains indicator display status for application launching effect
3390  * @return      0 if success, error code(<0) if fail
3391  * @retval      PMINFO_R_OK     success
3392  * @retval      PMINFO_R_EINVAL invalid argument
3393  * @retval      PMINFO_R_ERROR  internal error
3394  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3395  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3396  * @see         pkgmgrinfo_appinfo_get_appid()
3397  * @see         pkgmgrinfo_appinfo_is_nodisplay()
3398  * @code
3399 static int get_app_indicator_display(const char *appid)
3400 {
3401         int ret = 0;
3402         bool indicator_disp;
3403         pkgmgrinfo_appinfo_h handle;
3404         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3405         if (ret != PMINFO_R_OK)
3406                 return -1;
3407         ret = pkgmgrinfo_appinfo_is_indicator_display_allowed(handle, &indicator_disp);
3408         if (ret != PMINFO_R_OK){
3409                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3410                 return -1;
3411         }
3412         printf("app indicator disp : %d\n", indicator_disp);
3413         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3414         return 0;
3415 }
3416  * @endcode
3417  */
3418 int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp);
3419
3420 /**
3421  * @fn int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h handle, bool *taskmanage)
3422  * @brief       This API gets the application 'taskmanage' value from the app ID
3423  *
3424  * @par         This API is for package-manager client application
3425  * @par Sync (or) Async : Synchronous API
3426  *
3427  * @param[in]   handle  pointer to application info handle
3428  * @param[out] taskmanage               pointer to hold package taskmanage value
3429  * @return      0 if success, error code(<0) if fail
3430  * @retval      PMINFO_R_OK     success
3431  * @retval      PMINFO_R_EINVAL invalid argument
3432  * @retval      PMINFO_R_ERROR  internal error
3433  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3434  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3435  * @see         pkgmgrinfo_appinfo_get_appid()
3436  * @see         pkgmgrinfo_appinfo_is_multiple()
3437  * @code
3438 static int get_app_taskmanage(const char *appid)
3439 {
3440         int ret = 0;
3441         bool taskmanage;
3442         pkgmgrinfo_appinfo_h handle;
3443         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3444         if (ret != PMINFO_R_OK)
3445                 return -1;
3446         ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &taskmanage);
3447         if (ret != PMINFO_R_OK) {
3448                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3449                 return -1;
3450         }
3451         printf("app taskmanage: %d\n", taskmanage);
3452         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3453         return 0;
3454 }
3455  * @endcode
3456  */
3457 int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h  handle, bool *taskmanage);
3458
3459 /**
3460  * @fn int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h handle, bool *enabled)
3461  * @brief       This API gets the application 'taskmanage' value from the app ID
3462  *
3463  * @par         This API is for package-manager client application
3464  * @par Sync (or) Async : Synchronous API
3465  *
3466  * @param[in]   handle  pointer to application info handle
3467  * @param[out] enabled          pointer to hold package enabled value
3468  * @return      0 if success, error code(<0) if fail
3469  * @retval      PMINFO_R_OK     success
3470  * @retval      PMINFO_R_EINVAL invalid argument
3471  * @retval      PMINFO_R_ERROR  internal error
3472  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3473  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3474  * @see         pkgmgrinfo_appinfo_get_appid()
3475  * @see         pkgmgrinfo_appinfo_is_multiple()
3476  * @code
3477 static int get_app_enabled(const char *appid)
3478 {
3479         int ret = 0;
3480         bool enabled;
3481         pkgmgrinfo_appinfo_h handle;
3482         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3483         if (ret != PMINFO_R_OK)
3484                 return -1;
3485         ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &enabled);
3486         if (ret != PMINFO_R_OK) {
3487                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3488                 return -1;
3489         }
3490         printf("app enabled: %d\n", enabled);
3491         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3492         return 0;
3493 }
3494  * @endcode
3495  */
3496 int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h  handle, bool *enabled);
3497
3498 /**
3499  * @fn int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h handle, bool *onboot)
3500  * @brief       This API gets the application 'onboot' value from the app ID
3501  *
3502  * @par         This API is for package-manager client application
3503  * @par Sync (or) Async : Synchronous API
3504  *
3505  * @param[in]   handle  pointer to application info handle
3506  * @param[out] onboot           pointer to hold package onboot value
3507  * @return      0 if success, error code(<0) if fail
3508  * @retval      PMINFO_R_OK     success
3509  * @retval      PMINFO_R_EINVAL invalid argument
3510  * @retval      PMINFO_R_ERROR  internal error
3511  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3512  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3513  * @see         pkgmgrinfo_appinfo_get_appid()
3514  * @see         pkgmgrinfo_appinfo_is_multiple()
3515  * @code
3516 static int get_app_onboot(const char *appid)
3517 {
3518         int ret = 0;
3519         bool onboot;
3520         pkgmgrinfo_appinfo_h handle;
3521         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3522         if (ret != PMINFO_R_OK)
3523                 return -1;
3524         ret = pkgmgrinfo_appinfo_is_onboot(handle, &onboot);
3525         if (ret != PMINFO_R_OK) {
3526                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3527                 return -1;
3528         }
3529         printf("app onboot: %d\n", onboot);
3530         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3531         return 0;
3532 }
3533  * @endcode
3534  */
3535 int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h  handle, bool *onboot);
3536
3537 /**
3538  * @fn int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h handle, bool *autorestart)
3539  * @brief       This API gets the application 'autorestart' value from the app ID
3540  *
3541  * @par         This API is for package-manager client application
3542  * @par Sync (or) Async : Synchronous API
3543  *
3544  * @param[in]   handle  pointer to application info handle
3545  * @param[out] autorestart              pointer to hold package autorestart value
3546  * @return      0 if success, error code(<0) if fail
3547  * @retval      PMINFO_R_OK     success
3548  * @retval      PMINFO_R_EINVAL invalid argument
3549  * @retval      PMINFO_R_ERROR  internal error
3550  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3551  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3552  * @see         pkgmgrinfo_appinfo_get_appid()
3553  * @see         pkgmgrinfo_appinfo_is_multiple()
3554  * @code
3555 static int get_app_autorestart(const char *appid)
3556 {
3557         int ret = 0;
3558         bool autorestart;
3559         pkgmgrinfo_appinfo_h handle;
3560         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3561         if (ret != PMINFO_R_OK)
3562                 return -1;
3563         ret = pkgmgrinfo_appinfo_is_autorestart(handle, &autorestart);
3564         if (ret != PMINFO_R_OK) {
3565                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3566                 return -1;
3567         }
3568         printf("app autorestart: %d\n", autorestart);
3569         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3570         return 0;
3571 }
3572  * @endcode
3573  */
3574 int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h  handle, bool *autorestart);
3575
3576 /**
3577  * @fn int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainapp)
3578  * @brief       This API gets the value for given application is main app or not from handle
3579  *
3580  * @par         This API is for package-manager client application
3581  * @par Sync (or) Async : Synchronous API
3582  *
3583  * @param[in]   handle  pointer to application info handle
3584  * @param[out] mainapp          pointer to hold package mainapp is or not
3585  * @return      0 if success, error code(<0) if fail
3586  * @retval      PMINFO_R_OK     success
3587  * @retval      PMINFO_R_EINVAL invalid argument
3588  * @retval      PMINFO_R_ERROR  internal error
3589  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3590  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3591  * @see         pkgmgrinfo_appinfo_get_appid()
3592  * @see         pkgmgrinfo_appinfo_is_multiple()
3593  * @code
3594 static int get_app_mainapp(const char *appid)
3595 {
3596         int ret = 0;
3597         bool mainapp;
3598         pkgmgrinfo_appinfo_h handle;
3599         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3600         if (ret != PMINFO_R_OK)
3601                 return -1;
3602         ret = pkgmgrinfo_appinfo_is_mainapp(handle, &mainapp);
3603         if (ret != PMINFO_R_OK) {
3604                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3605                 return -1;
3606         }
3607         printf("mainapp: %d\n", mainapp);
3608         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3609         return 0;
3610 }
3611  * @endcode
3612  */
3613 int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainapp);
3614
3615
3616 /**
3617  * @fn int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload)
3618  * @brief       This API gets the value for given application is preload or not from handle
3619  *
3620  * @par         This API is for package-manager client application
3621  * @par Sync (or) Async : Synchronous API
3622  *
3623  * @param[in]   handle  pointer to application info handle
3624  * @param[out] preload          pointer to hold preload is or not
3625  * @return      0 if success, error code(<0) if fail
3626  * @retval      PMINFO_R_OK     success
3627  * @retval      PMINFO_R_EINVAL invalid argument
3628  * @retval      PMINFO_R_ERROR  internal error
3629  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3630  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3631  * @see         pkgmgrinfo_appinfo_get_appid()
3632  * @see         pkgmgrinfo_appinfo_is_multiple()
3633  * @code
3634 static int get_app_preload(const char *appid)
3635 {
3636         int ret = 0;
3637         bool preload = 0;
3638         pkgmgrinfo_appinfo_h handle = NULL;
3639         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3640         if (ret != PMINFO_R_OK)
3641                 return -1;
3642         ret = pkgmgrinfo_appinfo_is_preload(handle, &preload);
3643         if (ret != PMINFO_R_OK) {
3644                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3645                 return -1;
3646         }
3647         printf("preload: %d\n", preload);
3648         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3649         return 0;
3650 }
3651  * @endcode
3652  */
3653 int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload);
3654
3655 /**
3656  * @fn int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode)
3657  * @brief       This API gets the value for given application is submode or not from handle
3658  *
3659  * @par         This API is for package-manager client application
3660  * @par Sync (or) Async : Synchronous API
3661  *
3662  * @param[in]   handle  pointer to application info handle
3663  * @param[out] submode          pointer to hold submode is or not
3664  * @return      0 if success, error code(<0) if fail
3665  * @retval      PMINFO_R_OK     success
3666  * @retval      PMINFO_R_EINVAL invalid argument
3667  * @retval      PMINFO_R_ERROR  internal error
3668  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3669  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3670  * @see         pkgmgrinfo_appinfo_get_appid()
3671  * @see         pkgmgrinfo_appinfo_is_multiple()
3672  * @code
3673 static int get_app_submode(const char *appid)
3674 {
3675         int ret = 0;
3676         bool submode = 0;
3677         pkgmgrinfo_appinfo_h handle = NULL;
3678         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3679         if (ret != PMINFO_R_OK)
3680                 return -1;
3681         ret = pkgmgrinfo_appinfo_is_submode(handle, &submode);
3682         if (ret != PMINFO_R_OK) {
3683                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3684                 return -1;
3685         }
3686         printf("submode: %d\n", submode);
3687         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3688         return 0;
3689 }
3690  * @endcode
3691  */
3692 int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode);
3693
3694 /**
3695  * @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
3696  * @brief       This API destroys the application information handle freeing up all the resources
3697  *
3698  * @par         This API is for package-manager client application
3699  * @par Sync (or) Async : Synchronous API
3700  *
3701  * @param[in] handle            pointer to the application info handle.
3702  * @return      0 if success, error code(<0) if fail
3703  * @retval      PMINFO_R_OK     success
3704  * @retval      PMINFO_R_EINVAL invalid argument
3705  * @retval      PMINFO_R_ERROR  internal error
3706  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3707  * @post                None
3708  * @see         pkgmgrinfo_appinfo_get_pkgid()
3709  * @see         pkgmgrinfo_appinfo_is_multiple()
3710  * @code
3711 static int get_app_type(const char *appid)
3712 {
3713         int ret = 0;
3714         char *type = NULL;
3715         pkgmgrinfo_appinfo_h handle;
3716         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3717         if (ret != PMINFO_R_OK)
3718                 return -1;
3719         ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
3720         if (ret != PMINFO_R_OK) {
3721                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3722                 return -1;
3723         }
3724         printf("apptype: %s\n", type);
3725         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3726         return 0;
3727 }
3728  * @endcode
3729  */
3730 int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h  handle);
3731
3732 /**
3733  * @fn int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle)
3734  * @brief       This API creates the application information filter handle from db.  All filter properties will be ANDed.
3735  The query will search the entire application information collected from the manifest file of all the installed packages
3736  *
3737  * @par         This API is for package-manager client application
3738  * @par Sync (or) Async : Synchronous API
3739  *
3740  * @param[out] handle           pointer to the application info filter handle.
3741  * @return      0 if success, error code(<0) if fail
3742  * @retval      PMINFO_R_OK     success
3743  * @retval      PMINFO_R_EINVAL invalid argument
3744  * @retval      PMINFO_R_ERROR  internal error
3745  * @pre         None
3746  * @post                pkgmgrinfo_appinfo_filter_destroy()
3747  * @see         pkgmgrinfo_appinfo_filter_count()
3748  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3749  * @code
3750 static int get_capp_count()
3751 {
3752         int ret = 0;
3753         int count = 0;
3754         pkgmgrinfo_appinfo_filter_h handle;
3755         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3756         if (ret != PMINFO_R_OK)
3757                 return -1;
3758         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
3759         if (ret != PMINFO_R_OK) {
3760                 pkgmgrinfo_appinfo_filter_destroy(handle);
3761                 return -1;
3762         }
3763         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3764         if (ret != PMINFO_R_OK) {
3765                 pkgmgrinfo_appinfo_filter_destroy(handle);
3766                 return -1;
3767         }
3768         printf("No of capp: %d\n", count);
3769         pkgmgrinfo_appinfo_filter_destroy(handle);
3770         return 0;
3771 }
3772  * @endcode
3773  */
3774 int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle);
3775
3776 /**
3777  * @fn int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle)
3778  * @brief       This API destroys the application information filter handle freeing up all the resources
3779  *
3780  * @par         This API is for package-manager client application
3781  * @par Sync (or) Async : Synchronous API
3782  *
3783  * @param[in] handle            pointer to the application info filter handle.
3784  * @return      0 if success, error code(<0) if fail
3785  * @retval      PMINFO_R_OK     success
3786  * @retval      PMINFO_R_EINVAL invalid argument
3787  * @retval      PMINFO_R_ERROR  internal error
3788  * @pre         pkgmgrinfo_appinfo_filter_create()
3789  * @post                None
3790  * @see         pkgmgrinfo_appinfo_filter_count()
3791  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3792  * @code
3793 static int get_capp_count()
3794 {
3795         int ret = 0;
3796         int count = 0;
3797         pkgmgrinfo_appinfo_filter_h handle;
3798         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3799         if (ret != PMINFO_R_OK)
3800                 return -1;
3801         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
3802         if (ret != PMINFO_R_OK) {
3803                 pkgmgrinfo_appinfo_filter_destroy(handle);
3804                 return -1;
3805         }
3806         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3807         if (ret != PMINFO_R_OK) {
3808                 pkgmgrinfo_appinfo_filter_destroy(handle);
3809                 return -1;
3810         }
3811         printf("No of capp: %d\n", count);
3812         pkgmgrinfo_appinfo_filter_destroy(handle);
3813         return 0;
3814 }
3815  * @endcode
3816  */
3817 int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle);
3818
3819 /**
3820  * @fn int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle, const char *property, const bool value)
3821  * @brief       This API adds a boolean filter property to the filter handle
3822  *
3823  * @par         This API is for package-manager client application
3824  * @par Sync (or) Async : Synchronous API
3825  *
3826  * @param[in] handle            pointer to the application info filter handle.
3827  * @param[in] property          boolean property name.
3828  * @param[in] value             value corresponding to the property.
3829  * @return      0 if success, error code(<0) if fail
3830  * @retval      PMINFO_R_OK     success
3831  * @retval      PMINFO_R_EINVAL invalid argument
3832  * @retval      PMINFO_R_ERROR  internal error
3833  * @pre         pkgmgrinfo_appinfo_filter_create()
3834  * @post                pkgmgrinfo_appinfo_filter_destroy()
3835  * @see         pkgmgrinfo_appinfo_filter_count()
3836  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3837  * @code
3838 static int get_taskmanageable_app_count()
3839 {
3840         int ret = 0;
3841         int count = 0;
3842         pkgmgrinfo_appinfo_filter_h handle;
3843         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3844         if (ret != PMINFO_R_OK)
3845                 return -1;
3846         ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_TASKMANAGE, 1);
3847         if (ret != PMINFO_R_OK) {
3848                 pkgmgrinfo_appinfo_filter_destroy(handle);
3849                 return -1;
3850         }
3851         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3852         if (ret != PMINFO_R_OK) {
3853                 pkgmgrinfo_appinfo_filter_destroy(handle);
3854                 return -1;
3855         }
3856         printf("No of taskmanageable apps: %d\n", count);
3857         pkgmgrinfo_appinfo_filter_destroy(handle);
3858         return 0;
3859 }
3860  * @endcode
3861  */
3862 int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
3863                 const char *property, const bool value);
3864
3865 /**
3866  * @fn int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle, const char *property, const int value)
3867  * @brief       This API adds an integer filter property to the filter handle
3868  *
3869  * @par         This API is for package-manager client application
3870  * @par Sync (or) Async : Synchronous API
3871  *
3872  * @param[in] handle            pointer to the application info filter handle.
3873  * @param[in] property          integer property name.
3874  * @param[in] value             value corresponding to the property.
3875  * @return      0 if success, error code(<0) if fail
3876  * @retval      PMINFO_R_OK     success
3877  * @retval      PMINFO_R_EINVAL invalid argument
3878  * @retval      PMINFO_R_ERROR  internal error
3879  * @pre         pkgmgrinfo_appinfo_filter_create()
3880  * @post                pkgmgrinfo_appinfo_filter_destroy()
3881  * @see         pkgmgrinfo_appinfo_filter_count()
3882  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3883  * @code
3884 static int get_taskmanageable_app_count()
3885 {
3886         int ret = 0;
3887         int count = 0;
3888         pkgmgrinfo_appinfo_filter_h handle;
3889         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3890         if (ret != PMINFO_R_OK)
3891                 return -1;
3892         ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_XXX, 10);
3893         if (ret != PMINFO_R_OK) {
3894                 pkgmgrinfo_appinfo_filter_destroy(handle);
3895                 return -1;
3896         }
3897         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3898         if (ret != PMINFO_R_OK) {
3899                 pkgmgrinfo_appinfo_filter_destroy(handle);
3900                 return -1;
3901         }
3902         printf("No of apps: %d\n", count);
3903         pkgmgrinfo_appinfo_filter_destroy(handle);
3904         return 0;
3905 }
3906  * @endcode
3907  */
3908 int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
3909                 const char *property, const int value);
3910
3911 /**
3912  * @fn int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle, const char *property, const char *value)
3913  * @brief       This API adds a string filter property to the filter handle
3914  *
3915  * @par         This API is for package-manager client application
3916  * @par Sync (or) Async : Synchronous API
3917  *
3918  * @param[in] handle            pointer to the application info filter handle.
3919  * @param[in] property          string property name.
3920  * @param[in] value             value corresponding to the property.
3921  * @return      0 if success, error code(<0) if fail
3922  * @retval      PMINFO_R_OK     success
3923  * @retval      PMINFO_R_EINVAL invalid argument
3924  * @retval      PMINFO_R_ERROR  internal error
3925  * @pre         pkgmgrinfo_appinfo_filter_create()
3926  * @post                pkgmgrinfo_appinfo_filter_destroy()
3927  * @see         pkgmgrinfo_appinfo_filter_count()
3928  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3929  * @code
3930 static int get_capp_count()
3931 {
3932         int ret = 0;
3933         int count = 0;
3934         pkgmgrinfo_appinfo_filter_h handle;
3935         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3936         if (ret != PMINFO_R_OK)
3937                 return -1;
3938         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
3939         if (ret != PMINFO_R_OK) {
3940                 pkgmgrinfo_appinfo_filter_destroy(handle);
3941                 return -1;
3942         }
3943         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3944         if (ret != PMINFO_R_OK) {
3945                 pkgmgrinfo_appinfo_filter_destroy(handle);
3946                 return -1;
3947         }
3948         printf("No of capp: %d\n", count);
3949         pkgmgrinfo_appinfo_filter_destroy(handle);
3950         return 0;
3951 }
3952  * @endcode
3953  */
3954 int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
3955                 const char *property, const char *value);
3956
3957 /**
3958  * @fn int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle, pkgmgrinfo_app_list_cb app_cb, void *user_data)
3959  * @brief       This API executes the user supplied callback function for each application that satisfy the filter conditions
3960  *
3961  * @par         This API is for package-manager client application
3962  * @par Sync (or) Async : Synchronous API
3963  *
3964  * @param[in] handle            pointer to the application info filter handle.
3965  * @param[in] app_cb            callback function.
3966  * @param[in] user_data         user data to be passed to the callback function
3967  * @return      0 if success, error code(<0) if fail
3968  * @retval      PMINFO_R_OK     success
3969  * @retval      PMINFO_R_EINVAL invalid argument
3970  * @retval      PMINFO_R_ERROR  internal error
3971  * @pre         pkgmgrinfo_appinfo_filter_create()
3972  * @post                pkgmgrinfo_appinfo_filter_destroy()
3973  * @see         pkgmgrinfo_appinfo_filter_count()
3974  * @code
3975 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
3976 {
3977         char *appid = NULL;
3978         pkgmgrinfo_appinfo_get_appid(handle, &appid);
3979         printf("appid : %s\n", appid);
3980         return 0;
3981 }
3982
3983 static int get_capp_list()
3984 {
3985         int ret = 0;
3986         pkgmgrinfo_appinfo_filter_h handle;
3987         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3988         if (ret != PMINFO_R_OK)
3989                 return -1;
3990         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
3991         if (ret != PMINFO_R_OK) {
3992                 pkgmgrinfo_appinfo_filter_destroy(handle);
3993                 return -1;
3994         }
3995         ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, app_list_cb, NULL);
3996         if (ret != PMINFO_R_OK) {
3997                 pkgmgrinfo_appinfo_filter_destroy(handle);
3998                 return -1;
3999         }
4000         pkgmgrinfo_appinfo_filter_destroy(handle);
4001         return 0;
4002 }
4003  * @endcode
4004  */
4005 int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
4006                 pkgmgrinfo_app_list_cb app_cb, void *user_data);
4007
4008 /**
4009  * @fn int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count)
4010  * @brief       This API counts the application that satisfy the filter conditions
4011  *
4012  * @par         This API is for package-manager client application
4013  * @par Sync (or) Async : Synchronous API
4014  *
4015  * @param[in] handle            pointer to the application info filter handle.
4016  * @param[in] count             pointer to store count value
4017  * @return      0 if success, error code(<0) if fail
4018  * @retval      PMINFO_R_OK     success
4019  * @retval      PMINFO_R_EINVAL invalid argument
4020  * @retval      PMINFO_R_ERROR  internal error
4021  * @pre         pkgmgrinfo_appinfo_filter_create()
4022  * @post                pkgmgrinfo_appinfo_filter_destroy()
4023  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
4024  * @code
4025 static int get_capp_count()
4026 {
4027         int ret = 0;
4028         int count = 0;
4029         pkgmgrinfo_appinfo_filter_h handle;
4030         ret = pkgmgrinfo_appinfo_filter_create(&handle);
4031         if (ret != PMINFO_R_OK)
4032                 return -1;
4033         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
4034         if (ret != PMINFO_R_OK) {
4035                 pkgmgrinfo_appinfo_filter_destroy(handle);
4036                 return -1;
4037         }
4038         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
4039         if (ret != PMINFO_R_OK) {
4040                 pkgmgrinfo_appinfo_filter_destroy(handle);
4041                 return -1;
4042         }
4043         printf("No of capp: %d\n", count);
4044         pkgmgrinfo_appinfo_filter_destroy(handle);
4045         return 0;
4046 }
4047  * @endcode
4048  */
4049 int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count);
4050
4051 /**
4052  * @fn int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle)
4053  * @brief       This API creates the application's metadata  information filter handle from db.
4054  *
4055  * @par         This API is for package-manager client application
4056  * @par Sync (or) Async : Synchronous API
4057  *
4058  * @param[out] handle           pointer to the application metadata info filter handle.
4059  * @return      0 if success, error code(<0) if fail
4060  * @retval      PMINFO_R_OK     success
4061  * @retval      PMINFO_R_EINVAL invalid argument
4062  * @retval      PMINFO_R_ERROR  internal error
4063  * @pre         None
4064  * @post                pkgmgrinfo_appinfo_metadata_filter_destroy()
4065  * @see         pkgmgrinfo_appinfo_metadata_filter_foreach()
4066  * @code
4067 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
4068 {
4069         char *appid = NULL;
4070         pkgmgrinfo_appinfo_get_appid(handle, &appid);
4071         printf("appid : %s\n", appid);
4072         return 0;
4073 }
4074
4075 static int get_app_list(const char *mkey, const char *mvalue)
4076 {
4077         int ret = 0;
4078         pkgmgrinfo_appinfo_metadata_filter_h handle;
4079         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
4080         if (ret != PMINFO_R_OK)
4081                 return -1;
4082         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
4083         if (ret != PMINFO_R_OK) {
4084                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4085                 return -1;
4086         }
4087         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
4088         if (ret != PMINFO_R_OK) {
4089                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4090                 return -1;
4091         }
4092         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4093         return 0;
4094 }
4095  * @endcode
4096  */
4097 int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle);
4098
4099 /**
4100  * @fn int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle)
4101  * @brief       This API destroys the application's metadata  information filter handle.
4102  *
4103  * @par         This API is for package-manager client application
4104  * @par Sync (or) Async : Synchronous API
4105  *
4106  * @param[in] handle            pointer to the application metadata info filter handle.
4107  * @return      0 if success, error code(<0) if fail
4108  * @retval      PMINFO_R_OK     success
4109  * @retval      PMINFO_R_EINVAL invalid argument
4110  * @retval      PMINFO_R_ERROR  internal error
4111  * @pre         pkgmgrinfo_appinfo_metadata_filter_create()
4112  * @post                None
4113  * @see         pkgmgrinfo_appinfo_metadata_filter_foreach()
4114  * @code
4115 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
4116 {
4117         char *appid = NULL;
4118         pkgmgrinfo_appinfo_get_appid(handle, &appid);
4119         printf("appid : %s\n", appid);
4120         return 0;
4121 }
4122
4123 static int get_app_list(const char *mkey, const char *mvalue)
4124 {
4125         int ret = 0;
4126         pkgmgrinfo_appinfo_metadata_filter_h handle;
4127         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
4128         if (ret != PMINFO_R_OK)
4129                 return -1;
4130         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
4131         if (ret != PMINFO_R_OK) {
4132                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4133                 return -1;
4134         }
4135         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
4136         if (ret != PMINFO_R_OK) {
4137                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4138                 return -1;
4139         }
4140         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4141         return 0;
4142 }
4143  * @endcode
4144  */
4145 int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle);
4146
4147 /**
4148  * @fn int pkgmgrinfo_appinfo_metadata_filter_add(pkgmgrinfo_appinfo_metadata_filter_h handle, const char *key, const char *value)
4149  * @brief       This API adds filter condition for the query API.  The query will search the entire application metadata  information collected from
4150  * the manifest file of all the installed packages. You can specify value as NULL to search based on key only.
4151  *
4152  * @par         This API is for package-manager client application
4153  * @par Sync (or) Async : Synchronous API
4154  *
4155  * @param[in] handle            pointer to the application metadata info filter handle.
4156  * @param[in] key                       pointer to metadata key
4157  * @param[in] value                     pointer to metadata value
4158  * @return      0 if success, error code(<0) if fail
4159  * @retval      PMINFO_R_OK     success
4160  * @retval      PMINFO_R_EINVAL invalid argument
4161  * @retval      PMINFO_R_ERROR  internal error
4162  * @pre         pkgmgrinfo_appinfo_metadata_filter_create()
4163  * @post                pkgmgrinfo_appinfo_metadata_filter_foreach(), pkgmgrinfo_appinfo_metadata_filter_destroy()
4164  * @see         pkgmgrinfo_appinfo_metadata_filter_foreach()
4165  * @code
4166 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
4167 {
4168         char *appid = NULL;
4169         pkgmgrinfo_appinfo_get_appid(handle, &appid);
4170         printf("appid : %s\n", appid);
4171         return 0;
4172 }
4173
4174 static int get_app_list(const char *mkey, const char *mvalue)
4175 {
4176         int ret = 0;
4177         pkgmgrinfo_appinfo_metadata_filter_h handle;
4178         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
4179         if (ret != PMINFO_R_OK)
4180                 return -1;
4181         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
4182         if (ret != PMINFO_R_OK) {
4183                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4184                 return -1;
4185         }
4186         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
4187         if (ret != PMINFO_R_OK) {
4188                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4189                 return -1;
4190         }
4191         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4192         return 0;
4193 }
4194  * @endcode
4195  */
4196 int pkgmgrinfo_appinfo_metadata_filter_add(pkgmgrinfo_appinfo_metadata_filter_h handle,
4197                 const char *key, const char *value);
4198
4199 /**
4200  * @fn int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle, pkgmgrinfo_app_list_cb app_cb, void *user_data)
4201  * @brief       This API executes the filter query. The query will search the entire application metadata  information collected from
4202  * the manifest file of all the installed packages. For each application returned by the query, the callback will be called. If callback returns
4203  * negative value, no more callbacks will be called and API will return.
4204  *
4205  * @par         This API is for package-manager client application
4206  * @par Sync (or) Async : Synchronous API
4207  *
4208  * @param[in] handle            pointer to the application metadata info filter handle.
4209  * @param[in] app_cb            function pointer to callback
4210  * @param[in] user_data         pointer to user data
4211  * @return      0 if success, error code(<0) if fail
4212  * @retval      PMINFO_R_OK     success
4213  * @retval      PMINFO_R_EINVAL invalid argument
4214  * @retval      PMINFO_R_ERROR  internal error
4215  * @pre         pkgmgrinfo_appinfo_metadata_filter_create()
4216  * @post                pkgmgrinfo_appinfo_metadata_filter_destroy()
4217  * @code
4218 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
4219 {
4220         char *appid = NULL;
4221         pkgmgrinfo_appinfo_get_appid(handle, &appid);
4222         printf("appid : %s\n", appid);
4223         return 0;
4224 }
4225
4226 static int get_app_list(const char *mkey, const char *mvalue)
4227 {
4228         int ret = 0;
4229         pkgmgrinfo_appinfo_metadata_filter_h handle;
4230         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
4231         if (ret != PMINFO_R_OK)
4232                 return -1;
4233         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
4234         if (ret != PMINFO_R_OK) {
4235                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4236                 return -1;
4237         }
4238         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
4239         if (ret != PMINFO_R_OK) {
4240                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4241                 return -1;
4242         }
4243         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4244         return 0;
4245 }
4246  * @endcode
4247  */
4248 int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle,
4249                 pkgmgrinfo_app_list_cb app_cb, void *user_data);
4250
4251 /**
4252  * @fn int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle)
4253  * @brief       This API creates the package cert information handle to get data from db.
4254  *
4255  * @par         This API is for package-manager client application
4256  * @par Sync (or) Async : Synchronous API
4257  *
4258  * @param[out] handle           pointer to the package cert handle.
4259  * @return      0 if success, error code(<0) if fail
4260  * @retval      PMINFO_R_OK     success
4261  * @retval      PMINFO_R_EINVAL invalid argument
4262  * @retval      PMINFO_R_ERROR  internal error
4263  * @pre         None
4264  * @post                pkgmgrinfo_pkginfo_destroy_certinfo()
4265  * @see         pkgmgrinfo_pkginfo_get_cert_value()
4266  * @see         pkgmgrinfo_pkginfo_load_certinfo()
4267  * @code
4268 static int get_cert_info(const char *pkgid)
4269 {
4270         int ret = 0;
4271         pkgmgrinfo_certinfo_h handle;
4272         char *auth_cert = NULL;
4273         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
4274         if (ret != PMINFO_R_OK)
4275                 return -1;
4276         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
4277         if (ret != PMINFO_R_OK) {
4278                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4279                 return -1;
4280         }
4281         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
4282         if (ret != PMINFO_R_OK) {
4283                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4284                 return -1;
4285         }
4286         printf("Author root certificate: %s\n", auth_root);
4287         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4288         return 0;
4289 }
4290  * @endcode
4291  */
4292 int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle);
4293
4294 /**
4295  * @fn int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle)
4296  * @brief       This API loads the package cert information handle with data from db.
4297  *
4298  * @par         This API is for package-manager client application
4299  * @par Sync (or) Async : Synchronous API
4300  *
4301  * @param[in] pkgid             pointer to the package ID.
4302  * @param[in] handle            pointer to the package cert handle.
4303  * @return      0 if success, error code(<0) if fail
4304  * @retval      PMINFO_R_OK     success
4305  * @retval      PMINFO_R_EINVAL invalid argument
4306  * @retval      PMINFO_R_ERROR  internal error
4307  * @pre         pkgmgrinfo_pkginfo_create_certinfo()
4308  * @post                pkgmgrinfo_pkginfo_destroy_certinfo()
4309  * @see         pkgmgrinfo_pkginfo_get_cert_value()
4310  * @code
4311 static int get_cert_info(const char *pkgid)
4312 {
4313         int ret = 0;
4314         pkgmgrinfo_certinfo_h handle;
4315         char *auth_cert = NULL;
4316         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
4317         if (ret != PMINFO_R_OK)
4318                 return -1;
4319         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
4320         if (ret != PMINFO_R_OK) {
4321                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4322                 return -1;
4323         }
4324         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
4325         if (ret != PMINFO_R_OK) {
4326                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4327                 return -1;
4328         }
4329         printf("Author root certificate: %s\n", auth_root);
4330         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4331         return 0;
4332 }
4333  * @endcode
4334  */
4335 int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle);
4336
4337 /**
4338  * @fn int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value)
4339  * @brief       This API gets the package cert information from the handle
4340  *
4341  * @par         This API is for package-manager client application
4342  * @par Sync (or) Async : Synchronous API
4343  *
4344  * @param[in] handle            pointer to the package cert handle.
4345  * @param[in] cert_type         certificate type
4346  * @param[out] cert_value       pointer to hold certificate value
4347  * @return      0 if success, error code(<0) if fail
4348  * @retval      PMINFO_R_OK     success
4349  * @retval      PMINFO_R_EINVAL invalid argument
4350  * @retval      PMINFO_R_ERROR  internal error
4351  * @pre         pkgmgrinfo_pkginfo_create_certinfo()
4352  * @post                pkgmgrinfo_pkginfo_destroy_certinfo()
4353  * @see         pkgmgrinfo_pkginfo_load_certinfo()
4354  * @code
4355 static int get_cert_info(const char *pkgid)
4356 {
4357         int ret = 0;
4358         pkgmgrinfo_certinfo_h handle;
4359         char *auth_cert = NULL;
4360         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
4361         if (ret != PMINFO_R_OK)
4362                 return -1;
4363         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
4364         if (ret != PMINFO_R_OK) {
4365                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4366                 return -1;
4367         }
4368         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
4369         if (ret != PMINFO_R_OK) {
4370                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4371                 return -1;
4372         }
4373         printf("Author root certificate: %s\n", auth_root);
4374         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4375         return 0;
4376 }
4377  * @endcode
4378  */
4379 int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value);
4380
4381 /**
4382  * @fn int pkgmgrinfo_pkginfo_destroy_certinfo(pkgmgrinfo_certinfo_h handle)
4383  * @brief       This API destroys the package cert information handle freeing up all the resources
4384  *
4385  * @par         This API is for package-manager client application
4386  * @par Sync (or) Async : Synchronous API
4387  *
4388  * @param[in] handle            pointer to the package cert handle.
4389  * @return      0 if success, error code(<0) if fail
4390  * @retval      PMINFO_R_OK     success
4391  * @retval      PMINFO_R_EINVAL invalid argument
4392  * @retval      PMINFO_R_ERROR  internal error
4393  * @pre         pkgmgrinfo_pkginfo_create_certinfo()
4394  * @post                None
4395  * @see         pkgmgrinfo_pkginfo_load_certinfo()
4396  * @code
4397 static int get_cert_info(const char *pkgid)
4398 {
4399         int ret = 0;
4400         pkgmgrinfo_certinfo_h handle;
4401         char *auth_cert = NULL;
4402         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
4403         if (ret != PMINFO_R_OK)
4404                 return -1;
4405         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
4406         if (ret != PMINFO_R_OK) {
4407                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4408                 return -1;
4409         }
4410         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
4411         if (ret != PMINFO_R_OK) {
4412                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4413                 return -1;
4414         }
4415         printf("Author root certificate: %s\n", auth_root);
4416         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4417         return 0;
4418 }
4419  * @endcode
4420  */
4421 int pkgmgrinfo_pkginfo_destroy_certinfo(pkgmgrinfo_certinfo_h handle);
4422
4423 /**
4424  * @fn int pkgmgrinfo_delete_certinfo(const char *pkgid)
4425  * @brief       This API deletes the package cert information from DB
4426  *
4427  * @par         This API is for package-manager client application
4428  * @par Sync (or) Async : Synchronous API
4429  *
4430  * @param[in] pkgid             pointer to the package ID.
4431  * @return      0 if success, error code(<0) if fail
4432  * @retval      PMINFO_R_OK     success
4433  * @retval      PMINFO_R_EINVAL invalid argument
4434  * @retval      PMINFO_R_ERROR  internal error
4435  * @pre         None
4436  * @post                None
4437  * @code
4438 static int delete_cert_info(const char *pkgid)
4439 {
4440         int ret = 0;
4441         ret = pkgmgrinfo_delete_certinfo(pkgid);
4442         if (ret != PMINFO_R_OK)
4443                 return -1;
4444         return 0;
4445 }
4446  * @endcode
4447  */
4448  int pkgmgrinfo_delete_certinfo(const char *pkgid);
4449
4450 /**
4451  * @fn int pkgmgrinfo_create_pkgdbinfo(const char *pkgid, pkgmgrinfo_pkgdbinfo_h *handle)
4452  * @brief       This API creates the package db information handle to set data in db.
4453  *
4454  * @par         This API is for package-manager client application
4455  * @par Sync (or) Async : Synchronous API
4456  *
4457  * @param[in] pkgid     pointer to the package ID.
4458  * @param[out] handle           pointer to the package db info handle.
4459  * @return      0 if success, error code(<0) if fail
4460  * @retval      PMINFO_R_OK     success
4461  * @retval      PMINFO_R_EINVAL invalid argument
4462  * @retval      PMINFO_R_ERROR  internal error
4463  * @pre         None
4464  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4465  * @see         pkgmgrinfo_save_pkgdbinfo()
4466  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4467  * @code
4468 static int set_pkg_in_db(const char *pkgid)
4469 {
4470         int ret = 0;
4471         pkgmgrinfo_pkgdbinfo_h handle;
4472         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4473         if (ret != PMINFO_R_OK)
4474                 return -1;
4475         ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
4476         if (ret != PMINFO_R_OK) {
4477                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4478                 return -1;
4479         }
4480         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4481         if (ret != PMINFO_R_OK) {
4482                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4483                 return -1;
4484         }
4485         pkgmgrinfo_destroy_pkgdbinfo(handle);
4486         return 0;
4487 }
4488  * @endcode
4489  */
4490 int pkgmgrinfo_create_pkgdbinfo(const char *pkgid, pkgmgrinfo_pkgdbinfo_h *handle);
4491
4492 /**
4493  * @fn int pkgmgrinfo_set_type_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *type)
4494  * @brief       This API sets the package type in db handle
4495  *
4496  * @par         This API is for package-manager client application
4497  * @par Sync (or) Async : Synchronous API
4498  *
4499  * @param[in] handle    pointer to the pkgdbinfo handle.
4500  * @param[in] type              pointer to the package type.
4501  * @return      0 if success, error code(<0) if fail
4502  * @retval      PMINFO_R_OK     success
4503  * @retval      PMINFO_R_EINVAL invalid argument
4504  * @retval      PMINFO_R_ERROR  internal error
4505  * @pre         pkgmgrinfo_create_pkgdbinfo()
4506  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4507  * @see         pkgmgrinfo_save_pkgdbinfo()
4508  * @see         pkgmgrinfo_set_version_to_pkgdbinfo()
4509  * @code
4510 static int set_pkg_type_in_db(const char *pkgid)
4511 {
4512         int ret = 0;
4513         pkgmgrinfo_pkgdbinfo_h handle;
4514         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4515         if (ret != PMINFO_R_OK)
4516                 return -1;
4517         ret = pkgmgrinfo_set_type_to_pkgdbinfo(handle, "wgt");
4518         if (ret != PMINFO_R_OK) {
4519                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4520                 return -1;
4521         }
4522         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4523         if (ret != PMINFO_R_OK) {
4524                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4525                 return -1;
4526         }
4527         pkgmgrinfo_destroy_pkgdbinfo(handle);
4528         return 0;
4529 }
4530  * @endcode
4531  */
4532 int pkgmgrinfo_set_type_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *type);
4533
4534 /**
4535  * @fn int pkgmgrinfo_set_version_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *version)
4536  * @brief       This API sets the package version in db handle
4537  *
4538  * @par         This API is for package-manager client application
4539  * @par Sync (or) Async : Synchronous API
4540  *
4541  * @param[in] handle    pointer to the pkgdbinfo handle.
4542  * @param[in] version           pointer to the package version
4543  * @return      0 if success, error code(<0) if fail
4544  * @retval      PMINFO_R_OK     success
4545  * @retval      PMINFO_R_EINVAL invalid argument
4546  * @retval      PMINFO_R_ERROR  internal error
4547  * @pre         pkgmgrinfo_create_pkgdbinfo()
4548  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4549  * @see         pkgmgrinfo_save_pkgdbinfo()
4550  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4551  * @code
4552 static int set_pkg_version_in_db(const char *pkgid)
4553 {
4554         int ret = 0;
4555         pkgmgrinfo_pkgdbinfo_h handle;
4556         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4557         if (ret != PMINFO_R_OK)
4558                 return -1;
4559         ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
4560         if (ret != PMINFO_R_OK) {
4561                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4562                 return -1;
4563         }
4564         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4565         if (ret != PMINFO_R_OK) {
4566                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4567                 return -1;
4568         }
4569         pkgmgrinfo_destroy_pkgdbinfo(handle);
4570         return 0;
4571 }
4572  * @endcode
4573  */
4574 int pkgmgrinfo_set_version_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *version);
4575
4576 /**
4577  * @fn int pkgmgrinfo_set_install_location_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
4578  * @brief       This API sets the package install location in db handle
4579  *
4580  * @par         This API is for package-manager client application
4581  * @par Sync (or) Async : Synchronous API
4582  *
4583  * @param[in] handle    pointer to the pkgdbinfo handle.
4584  * @param[in] location  package install location
4585  * @return      0 if success, error code(<0) if fail
4586  * @retval      PMINFO_R_OK     success
4587  * @retval      PMINFO_R_EINVAL invalid argument
4588  * @retval      PMINFO_R_ERROR  internal error
4589  * @pre         pkgmgrinfo_create_pkgdbinfo()
4590  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4591  * @see         pkgmgrinfo_save_pkgdbinfo()
4592  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4593  * @code
4594 static int set_pkg_install_location_in_db(const char *pkgid)
4595 {
4596         int ret = 0;
4597         pkgmgrinfo_pkgdbinfo_h handle;
4598         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4599         if (ret != PMINFO_R_OK)
4600                 return -1;
4601         ret = pkgmgrinfo_set_install_location_to_pkgdbinfo(handle, INSTALL_INTERNAL);
4602         if (ret != PMINFO_R_OK) {
4603                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4604                 return -1;
4605         }
4606         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4607         if (ret != PMINFO_R_OK) {
4608                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4609                 return -1;
4610         }
4611         pkgmgrinfo_destroy_pkgdbinfo(handle);
4612         return 0;
4613 }
4614  * @endcode
4615  */
4616 int pkgmgrinfo_set_install_location_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location);
4617
4618 /**
4619  * @fn int pkgmgrinfo_set_size_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *size)
4620  * @brief       This API sets the package size in db handle
4621  *
4622  * @par         This API is for package-manager client application
4623  * @par Sync (or) Async : Synchronous API
4624  *
4625  * @param[in] handle    pointer to the pkgdbinfo handle.
4626  * @param[in] size              pointer to the package size
4627  * @return      0 if success, error code(<0) if fail
4628  * @retval      PMINFO_R_OK     success
4629  * @retval      PMINFO_R_EINVAL invalid argument
4630  * @retval      PMINFO_R_ERROR  internal error
4631  * @pre         pkgmgrinfo_create_pkgdbinfo()
4632  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4633  * @see         pkgmgrinfo_save_pkgdbinfo()
4634  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4635  * @code
4636 static int set_pkg_size_in_db(const char *pkgid)
4637 {
4638         int ret = 0;
4639         pkgmgrinfo_pkgdbinfo_h handle;
4640         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4641         if (ret != PMINFO_R_OK)
4642                 return -1;
4643         ret = pkgmgrinfo_set_size_to_pkgdbinfo(handle, "15");
4644         if (ret != PMINFO_R_OK) {
4645                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4646                 return -1;
4647         }
4648         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4649         if (ret != PMINFO_R_OK) {
4650                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4651                 return -1;
4652         }
4653         pkgmgrinfo_destroy_pkgdbinfo(handle);
4654         return 0;
4655 }
4656  * @endcode
4657  */
4658 int pkgmgrinfo_set_size_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *size);
4659
4660 /**
4661  * @fn int pkgmgrinfo_set_label_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *label, const char *locale)
4662  * @brief       This API sets the package label in db handle
4663  *
4664  * @par         This API is for package-manager client application
4665  * @par Sync (or) Async : Synchronous API
4666  *
4667  * @param[in] handle    pointer to the pkgdbinfo handle.
4668  * @param[in] label             pointer to the package label
4669  * @param[in] locale    pointer to the locale
4670  * @return      0 if success, error code(<0) if fail
4671  * @retval      PMINFO_R_OK     success
4672  * @retval      PMINFO_R_EINVAL invalid argument
4673  * @retval      PMINFO_R_ERROR  internal error
4674  * @pre         pkgmgrinfo_create_pkgdbinfo()
4675  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4676  * @see         pkgmgrinfo_save_pkgdbinfo()
4677  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4678  * @code
4679 static int set_pkg_label_in_db(const char *pkgid)
4680 {
4681         int ret = 0;
4682         pkgmgrinfo_pkgdbinfo_h handle;
4683         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4684         if (ret != PMINFO_R_OK)
4685                 return -1;
4686         ret = pkgmgrinfo_set_label_to_pkgdbinfo(handle, "helloworld", "en-us");
4687         if (ret != PMINFO_R_OK) {
4688                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4689                 return -1;
4690         }
4691         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4692         if (ret != PMINFO_R_OK) {
4693                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4694                 return -1;
4695         }
4696         pkgmgrinfo_destroy_pkgdbinfo(handle);
4697         return 0;
4698 }
4699  * @endcode
4700  */
4701 int pkgmgrinfo_set_label_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *label, const char *locale);
4702
4703 /**
4704  * @fn int pkgmgrinfo_set_icon_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *icon, const char *locale)
4705  * @brief       This API sets the package icon in db handle
4706  *
4707  * @par         This API is for package-manager client application
4708  * @par Sync (or) Async : Synchronous API
4709  *
4710  * @param[in] handle    pointer to the pkgdbinfo handle.
4711  * @param[in] icon              pointer to the package icon
4712  * @param[in] locale    pointer to the locale
4713  * @return      0 if success, error code(<0) if fail
4714  * @retval      PMINFO_R_OK     success
4715  * @retval      PMINFO_R_EINVAL invalid argument
4716  * @retval      PMINFO_R_ERROR  internal error
4717  * @pre         pkgmgrinfo_create_pkgdbinfo()
4718  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4719  * @see         pkgmgrinfo_save_pkgdbinfo()
4720  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4721  * @code
4722 static int set_pkg_icon_in_db(const char *pkgid)
4723 {
4724         int ret = 0;
4725         pkgmgrinfo_pkgdbinfo_h handle;
4726         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4727         if (ret != PMINFO_R_OK)
4728                 return -1;
4729         ret = pkgmgrinfo_set_icon_to_pkgdbinfo(handle, "helloworld.png", "en-us");
4730         if (ret != PMINFO_R_OK) {
4731                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4732                 return -1;
4733         }
4734         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4735         if (ret != PMINFO_R_OK) {
4736                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4737                 return -1;
4738         }
4739         pkgmgrinfo_destroy_pkgdbinfo(handle);
4740         return 0;
4741 }
4742  * @endcode
4743  */
4744 int pkgmgrinfo_set_icon_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *icon, const char *locale);
4745
4746 /**
4747  * @fn int pkgmgrinfo_set_description_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *description, const char *locale)
4748  * @brief       This API sets the package description in db handle
4749  *
4750  * @par         This API is for package-manager client application
4751  * @par Sync (or) Async : Synchronous API
4752  *
4753  * @param[in] handle    pointer to the pkgdbinfo handle.
4754  * @param[in] description               pointer to the package description
4755  * @param[in] locale    pointer to the locale
4756  * @return      0 if success, error code(<0) if fail
4757  * @retval      PMINFO_R_OK     success
4758  * @retval      PMINFO_R_EINVAL invalid argument
4759  * @retval      PMINFO_R_ERROR  internal error
4760  * @pre         pkgmgrinfo_create_pkgdbinfo()
4761  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4762  * @see         pkgmgrinfo_save_pkgdbinfo()
4763  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4764  * @code
4765 static int set_pkg_description_in_db(const char *pkgid)
4766 {
4767         int ret = 0;
4768         pkgmgrinfo_pkgdbinfo_h handle;
4769         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4770         if (ret != PMINFO_R_OK)
4771                 return -1;
4772         ret = pkgmgrinfo_set_description_to_pkgdbinfo(handle, "helloworld application", "en-us");
4773         if (ret != PMINFO_R_OK) {
4774                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4775                 return -1;
4776         }
4777         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4778         if (ret != PMINFO_R_OK) {
4779                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4780                 return -1;
4781         }
4782         pkgmgrinfo_destroy_pkgdbinfo(handle);
4783         return 0;
4784 }
4785  * @endcode
4786  */
4787 int pkgmgrinfo_set_description_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *description, const char *locale);
4788
4789 /**
4790  * @fn int pkgmgrinfo_set_author_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *author_name,
4791  const char *author_email, const char *author_href, const char *locale)
4792  * @brief       This API sets the package author info in db handle
4793  *
4794  * @par         This API is for package-manager client application
4795  * @par Sync (or) Async : Synchronous API
4796  *
4797  * @param[in] handle    pointer to the pkgdbinfo handle.
4798  * @param[in] author_name               pointer to the package author name
4799  * @param[in] author_email              pointer to the package author email
4800  * @param[in] author_href               pointer to the package author href
4801  * @param[in] locale    pointer to the locale
4802  * @return      0 if success, error code(<0) if fail
4803  * @retval      PMINFO_R_OK     success
4804  * @retval      PMINFO_R_EINVAL invalid argument
4805  * @retval      PMINFO_R_ERROR  internal error
4806  * @pre         pkgmgrinfo_create_pkgdbinfo()
4807  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4808  * @see         pkgmgrinfo_save_pkgdbinfo()
4809  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4810  * @code
4811 static int set_pkg_author_in_db(const char *pkgid)
4812 {
4813         int ret = 0;
4814         pkgmgrinfo_pkgdbinfo_h handle;
4815         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4816         if (ret != PMINFO_R_OK)
4817                 return -1;
4818         ret = pkgmgrinfo_set_author_to_pkgdbinfo(handle, "John", "john@samsung.com", "www.samsung.com", "en-us");
4819         if (ret != PMINFO_R_OK) {
4820                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4821                 return -1;
4822         }
4823         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4824         if (ret != PMINFO_R_OK) {
4825                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4826                 return -1;
4827         }
4828         pkgmgrinfo_destroy_pkgdbinfo(handle);
4829         return 0;
4830 }
4831  * @endcode
4832  */
4833 int pkgmgrinfo_set_author_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *author_name,
4834                         const char *author_email, const char *author_href, const char *locale);
4835
4836 /**
4837  * @fn int pkgmgrinfo_set_removable_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int removable)
4838  * @brief       This API sets the package 'removable' value in db handle
4839  *
4840  * @par         This API is for package-manager client application
4841  * @par Sync (or) Async : Synchronous API
4842  *
4843  * @param[in] handle    pointer to the pkgdbinfo handle.
4844  * @param[in] removable         package removable value
4845  * @return      0 if success, error code(<0) if fail
4846  * @retval      PMINFO_R_OK     success
4847  * @retval      PMINFO_R_EINVAL invalid argument
4848  * @retval      PMINFO_R_ERROR  internal error
4849  * @pre         pkgmgrinfo_create_pkgdbinfo()
4850  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4851  * @see         pkgmgrinfo_save_pkgdbinfo()
4852  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4853  * @code
4854 static int set_pkg_removable_in_db(const char *pkgid)
4855 {
4856         int ret = 0;
4857         pkgmgrinfo_pkgdbinfo_h handle;
4858         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4859         if (ret != PMINFO_R_OK)
4860                 return -1;
4861         ret = pkgmgrinfo_set_removable_to_pkgdbinfo(handle, 1);
4862         if (ret != PMINFO_R_OK) {
4863                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4864                 return -1;
4865         }
4866         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4867         if (ret != PMINFO_R_OK) {
4868                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4869                 return -1;
4870         }
4871         pkgmgrinfo_destroy_pkgdbinfo(handle);
4872         return 0;
4873 }
4874  * @endcode
4875  */
4876 int pkgmgrinfo_set_removable_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int removable);
4877
4878 /**
4879  * @fn int pkgmgrinfo_set_preload_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int preload)
4880  * @brief       This API sets the package 'preload' value in db handle
4881  *
4882  * @par         This API is for package-manager client application
4883  * @par Sync (or) Async : Synchronous API
4884  *
4885  * @param[in] handle    pointer to the pkgdbinfo handle.
4886  * @param[in] preload           package preload value
4887  * @return      0 if success, error code(<0) if fail
4888  * @retval      PMINFO_R_OK     success
4889  * @retval      PMINFO_R_EINVAL invalid argument
4890  * @retval      PMINFO_R_ERROR  internal error
4891  * @pre         pkgmgrinfo_create_pkgdbinfo()
4892  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4893  * @see         pkgmgrinfo_save_pkgdbinfo()
4894  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4895  * @code
4896 static int set_pkg_preload_in_db(const char *pkgid)
4897 {
4898         int ret = 0;
4899         pkgmgrinfo_pkgdbinfo_h handle;
4900         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4901         if (ret != PMINFO_R_OK)
4902                 return -1;
4903         ret = pkgmgrinfo_set_preload_to_pkgdbinfo(handle, 1);
4904         if (ret != PMINFO_R_OK) {
4905                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4906                 return -1;
4907         }
4908         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4909         if (ret != PMINFO_R_OK) {
4910                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4911                 return -1;
4912         }
4913         pkgmgrinfo_destroy_pkgdbinfo(handle);
4914         return 0;
4915 }
4916  * @endcode
4917  */
4918 int pkgmgrinfo_set_preload_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int preload);
4919
4920 /**
4921  * @fn int pkgmgrinfo_set_installed_storage_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
4922  * @brief       This API sets the package 'installed_storage' value in db handle
4923  *
4924  * @par         This API is for package-manager client application
4925  * @par Sync (or) Async : Synchronous API
4926  *
4927  * @param[in] handle    pointer to the pkgdbinfo handle.
4928  * @param[in] location          installed_storage value
4929  * @return      0 if success, error code(<0) if fail
4930  * @retval      PMINFO_R_OK     success
4931  * @retval      PMINFO_R_EINVAL invalid argument
4932  * @retval      PMINFO_R_ERROR  internal error
4933  * @pre         pkgmgrinfo_create_pkgdbinfo()
4934  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4935  * @see         pkgmgrinfo_save_pkgdbinfo()
4936  * @code
4937 static int set_pkg_installed_storage_in_db(const char *pkgid)
4938 {
4939         int ret = 0;
4940         pkgmgrinfo_pkgdbinfo_h handle;
4941         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4942         if (ret != PMINFO_R_OK)
4943                 return -1;
4944         ret = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_INTERNAL);
4945         if (ret != PMINFO_R_OK) {
4946                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4947                 return -1;
4948         }
4949         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4950         if (ret != PMINFO_R_OK) {
4951                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4952                 return -1;
4953         }
4954         pkgmgrinfo_destroy_pkgdbinfo(handle);
4955         return 0;
4956 }
4957  * @endcode
4958  */
4959 int pkgmgrinfo_set_installed_storage_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location);
4960
4961 /**
4962  * @fn int pkgmgrinfo_save_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
4963  * @brief       This API saves all the information from the handle to the DB.
4964  *
4965  * @par         This API is for package-manager client application
4966  * @par Sync (or) Async : Synchronous API
4967  *
4968  * @param[in] handle            pointer to the package db info handle.
4969  * @return      0 if success, error code(<0) if fail
4970  * @retval      PMINFO_R_OK     success
4971  * @retval      PMINFO_R_EINVAL invalid argument
4972  * @retval      PMINFO_R_ERROR  internal error
4973  * @pre         pkgmgrinfo_create_pkgdbinfo()
4974  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4975  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4976  * @code
4977 static int set_pkg_in_db(const char *pkgid)
4978 {
4979         int ret = 0;
4980         pkgmgrinfo_pkgdbinfo_h handle;
4981         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4982         if (ret != PMINFO_R_OK)
4983                 return -1;
4984         ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
4985         if (ret != PMINFO_R_OK) {
4986                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4987                 return -1;
4988         }
4989         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4990         if (ret != PMINFO_R_OK) {
4991                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4992                 return -1;
4993         }
4994         pkgmgrinfo_destroy_pkgdbinfo(handle);
4995         return 0;
4996 }
4997  * @endcode
4998  */
4999 int pkgmgrinfo_save_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle);
5000
5001 /**
5002  * @fn int pkgmgrinfo_destroy_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
5003  * @brief       This API destroys the package db information handle freeing up all the resources
5004  *
5005  * @par         This API is for package-manager client application
5006  * @par Sync (or) Async : Synchronous API
5007  *
5008  * @param[in] handle            pointer to the package db info handle.
5009  * @return      0 if success, error code(<0) if fail
5010  * @retval      PMINFO_R_OK     success
5011  * @retval      PMINFO_R_EINVAL invalid argument
5012  * @retval      PMINFO_R_ERROR  internal error
5013  * @pre         pkgmgrinfo_create_pkgdbinfo()
5014  * @post                None
5015  * @see         pkgmgrinfo_save_pkgdbinfo()
5016  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
5017  * @code
5018 static int set_pkg_in_db(const char *pkgid)
5019 {
5020         int ret = 0;
5021         pkgmgrinfo_pkgdbinfo_h handle;
5022         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
5023         if (ret != PMINFO_R_OK)
5024                 return -1;
5025         ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
5026         if (ret != PMINFO_R_OK) {
5027                 pkgmgrinfo_destroy_pkgdbinfo(handle);
5028                 return -1;
5029         }
5030         ret = pkgmgrinfo_save_pkgdbinfo(handle);
5031         if (ret != PMINFO_R_OK) {
5032                 pkgmgrinfo_destroy_pkgdbinfo(handle);
5033                 return -1;
5034         }
5035         pkgmgrinfo_destroy_pkgdbinfo(handle);
5036         return 0;
5037 }
5038  * @endcode
5039  */
5040 int pkgmgrinfo_destroy_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle);
5041
5042
5043 /**
5044  * @fn int pkgmgrinfo_create_certinfo_set_handle(pkgmgrinfo_instcertinfo_h *handle)
5045  * @brief       This API creates the package cert information handle to set data in db.
5046  *
5047  * @par         This API is for package-manager client application
5048  * @par Sync (or) Async : Synchronous API
5049  *
5050  * @param[out] handle           pointer to the package cert handle.
5051  * @return      0 if success, error code(<0) if fail
5052  * @retval      PMINFO_R_OK     success
5053  * @retval      PMINFO_R_EINVAL invalid argument
5054  * @retval      PMINFO_R_ERROR  internal error
5055  * @pre         None
5056  * @post                pkgmgrinfo_destroy_certinfo_set_handle()
5057  * @see         pkgmgrinfo_set_cert_value()
5058  * @see         pkgmgrinfo_save_certinfo()
5059  * @code
5060 static int set_cert_in_db(const char *pkgid)
5061 {
5062         int ret = 0;
5063         pkgmgrinfo_instcertinfo_h handle;
5064         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
5065         if (ret != PMINFO_R_OK)
5066                 return -1;
5067         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
5068         if (ret != PMINFO_R_OK) {
5069                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5070                 return -1;
5071         }
5072         ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle);
5073         if (ret != PMINFO_R_OK) {
5074                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5075                 return -1;
5076         }
5077         pkgmgrinfo_destroy_certinfo_set_handle(handle);
5078         return 0;
5079 }
5080  * @endcode
5081  */
5082 int pkgmgrinfo_create_certinfo_set_handle(pkgmgrinfo_instcertinfo_h *handle);
5083
5084 /**
5085  * @fn int pkgmgrinfo_set_cert_value(pkgmgrinfo_instcertinfo_h handle, pkgmgrinfo_instcert_type cert_type, char *cert_value)
5086  * @brief       This API sets the package cert information in the handle.
5087  *
5088  * @par         This API is for package-manager client application
5089  * @par Sync (or) Async : Synchronous API
5090  *
5091  * @param[in] handle            pointer to the package cert handle.
5092  * @param[in] cert_type         certificate type.
5093  * @param[in] cert_value        certificate value.
5094  * @return      0 if success, error code(<0) if fail
5095  * @retval      PMINFO_R_OK     success
5096  * @retval      PMINFO_R_EINVAL invalid argument
5097  * @retval      PMINFO_R_ERROR  internal error
5098  * @pre         pkgmgrinfo_create_certinfo_set_handle()
5099  * @post                pkgmgrinfo_destroy_certinfo_set_handle()
5100  * @see         pkgmgrinfo_save_certinfo()
5101  * @code
5102 static int set_cert_in_db(const char *pkgid)
5103 {
5104         int ret = 0;
5105         pkgmgrinfo_instcertinfo_h handle;
5106         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
5107         if (ret != PMINFO_R_OK)
5108                 return -1;
5109         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
5110         if (ret != PMINFO_R_OK) {
5111                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5112                 return -1;
5113         }
5114         ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle);
5115         if (ret != PMINFO_R_OK) {
5116                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5117                 return -1;
5118         }
5119         pkgmgrinfo_destroy_certinfo_set_handle(handle);
5120         return 0;
5121 }
5122  * @endcode
5123  */
5124 int pkgmgrinfo_set_cert_value(pkgmgrinfo_instcertinfo_h handle, pkgmgrinfo_instcert_type cert_type, char *cert_value);
5125
5126 /**
5127  * @fn int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle)
5128  * @brief       This API saves the package cert information in the DB.
5129  *
5130  * @par         This API is for package-manager client application
5131  * @par Sync (or) Async : Synchronous API
5132  *
5133  * @param[in] pkgid             pointer to the package ID.
5134  * @param[in] handle            pointer to the package cert handle.
5135  * @return      0 if success, error code(<0) if fail
5136  * @retval      PMINFO_R_OK     success
5137  * @retval      PMINFO_R_EINVAL invalid argument
5138  * @retval      PMINFO_R_ERROR  internal error
5139  * @pre         pkgmgrinfo_create_certinfo_set_handle()
5140  * @post                pkgmgrinfo_destroy_certinfo_set_handle()
5141  * @see         pkgmgrinfo_save_certinfo()
5142  * @code
5143 static int set_cert_in_db(const char *pkgid)
5144 {
5145         int ret = 0;
5146         pkgmgrinfo_instcertinfo_h handle;
5147         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
5148         if (ret != PMINFO_R_OK)
5149                 return -1;
5150         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
5151         if (ret != PMINFO_R_OK) {
5152                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5153                 return -1;
5154         }
5155         ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle);
5156         if (ret != PMINFO_R_OK) {
5157                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5158                 return -1;
5159         }
5160         pkgmgrinfo_destroy_certinfo_set_handle(handle);
5161         return 0;
5162 }
5163  * @endcode
5164  */
5165 int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle);
5166
5167 /**
5168  * @fn int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle)
5169  * @brief       This API destroys the package cert information handle freeing up all the resources.
5170  *
5171  * @par         This API is for package-manager client application
5172  * @par Sync (or) Async : Synchronous API
5173  *
5174  * @param[in] handle            pointer to the package cert handle.
5175  * @return      0 if success, error code(<0) if fail
5176  * @retval      PMINFO_R_OK     success
5177  * @retval      PMINFO_R_EINVAL invalid argument
5178  * @retval      PMINFO_R_ERROR  internal error
5179  * @pre         pkgmgrinfo_create_certinfo_set_handle()
5180  * @post                None
5181  * @see         pkgmgrinfo_save_certinfo()
5182  * @code
5183 static int set_cert_in_db(const char *pkgid)
5184 {
5185         int ret = 0;
5186         pkgmgrinfo_instcertinfo_h handle;
5187         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
5188         if (ret != PMINFO_R_OK)
5189                 return -1;
5190         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
5191         if (ret != PMINFO_R_OK) {
5192                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5193                 return -1;
5194         }
5195         ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle);
5196         if (ret != PMINFO_R_OK) {
5197                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5198                 return -1;
5199         }
5200         pkgmgrinfo_destroy_certinfo_set_handle(handle);
5201         return 0;
5202 }
5203  * @endcode
5204  */
5205 int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle);
5206
5207 /**
5208  * @fn int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access)
5209  * @brief       This API gets the datacontrol info
5210  *
5211  * @par         This API is for package-manager client application
5212  * @par Sync (or) Async : Synchronous API
5213  *
5214  * @param[in] providerid                pointer to the providerid of dataconltrol.
5215  * @param[in] type                      pointer to the type of dataconltrol.
5216  * @param[out] appid                    pointer to hold appid, need to free after using
5217  * @param[out] access                   pointer to hold access, need to free after using
5218  * @return      0 if success, error code(<0) if fail
5219  * @retval      PMINFO_R_OK     success
5220  * @retval      PMINFO_R_EINVAL invalid argument
5221  * @retval      PMINFO_R_ERROR  internal error
5222  * @endcode
5223  */
5224 int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access);
5225
5226 /**
5227  * @fn int pkgmgrinfo_appinfo_is_guestmode_appstatus(pkgmgrinfo_appinfo_h handle, bool *status)
5228  * @brief       This API gets the application 'guest mode visibility' value from the DB
5229  *
5230  * @par         This API is for package-manager client application
5231  * @par Sync (or) Async : Synchronous API
5232  *
5233  * @param[in]   handle  pointer to application info handle
5234  * @param[out] status           pointer to hold app guest mode visibility value
5235  * @return      0 if success, error code(<0) if fail
5236  * @retval      PMINFO_R_OK     success
5237  * @retval      PMINFO_R_EINVAL invalid argument
5238  * @retval      PMINFO_R_ERROR  internal error
5239  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5240  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5241  * @see         pkgmgrinfo_appinfo_get_appid()
5242  * @see         pkgmgrinfo_appinfo_is_multiple()
5243  * @code
5244 static int get_app_guestmode_visibility(const char *appid)
5245 {
5246         int ret = 0;
5247         bool status;
5248         pkgmgrinfo_appinfo_h handle;
5249         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5250         if (ret != PMINFO_R_OK)
5251                 return -1;
5252         ret = pkgmgrinfo_appinfo_is_guestmode_visibility(handle, &status);
5253         if (ret != PMINFO_R_OK) {
5254                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5255                 return -1;
5256         }
5257         printf("app guest mode visibility: %d\n", status);
5258         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5259         return 0;
5260 }
5261  * @endcode
5262  */
5263  int pkgmgrinfo_appinfo_is_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool *status);
5264
5265 /**
5266  * @fn int pkgmgrinfo_appinfo_set_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool status)
5267  * @brief       This API sets the application 'guest mode visibility' value in the DB
5268  *
5269  * @par         This API is for package-manager client application
5270  * @par Sync (or) Async : Synchronous API
5271  *
5272  * @param[in]   handle  pointer to application info handle
5273  * @param[out] status   app guest mode visibility value
5274  * @return      0 if success, error code(<0) if fail
5275  * @retval      PMINFO_R_OK     success
5276  * @retval      PMINFO_R_EINVAL invalid argument
5277  * @retval      PMINFO_R_ERROR  internal error
5278  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5279  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5280  * @see         pkgmgrinfo_appinfo_get_appid()
5281  * @see         pkgmgrinfo_appinfo_is_multiple()
5282  * @code
5283 static int set_app_guestmode_visibility(const char *appid, bool value)
5284 {
5285         int ret = 0;
5286         pkgmgrinfo_appinfo_h handle;
5287         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5288         if (ret != PMINFO_R_OK)
5289                 return -1;
5290         ret = pkgmgrinfo_appinfo_set_guestmode_visibility(handle, value);
5291         if (ret != PMINFO_R_OK) {
5292                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5293                 return -1;
5294         }
5295         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5296         return 0;
5297 }
5298  * @endcode
5299  */
5300  int pkgmgrinfo_appinfo_set_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool status);
5301
5302
5303 /** @} */
5304 #ifdef __cplusplus
5305 }
5306 #endif
5307 #endif                          /* __PKG_INFO_H__ */
5308 /**
5309  * @}
5310  * @}
5311  */
5312