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