0d82e129252f03feb8f38468890af699624b762e
[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 ) (const char *operation, const char *uri, const char *mime,
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  /** String property for filtering based on app info*/
429 #define PMINFO_APPINFO_PROP_APP_PACKAGE         "PMINFO_APPINFO_PROP_APP_PACKAGE"
430
431  /** Boolean property for filtering based on app info*/
432 #define PMINFO_APPINFO_PROP_APP_NODISPLAY               "PMINFO_APPINFO_PROP_APP_NODISPLAY"
433  /** Boolean property for filtering based on app info*/
434 #define PMINFO_APPINFO_PROP_APP_MULTIPLE                "PMINFO_APPINFO_PROP_APP_MULTIPLE"
435  /** Boolean property for filtering based on app info*/
436 #define PMINFO_APPINFO_PROP_APP_ONBOOT                  "PMINFO_APPINFO_PROP_APP_ONBOOT"
437  /** Boolean property for filtering based on app info*/
438 #define PMINFO_APPINFO_PROP_APP_AUTORESTART     "PMINFO_APPINFO_PROP_APP_AUTORESTART"
439  /** Boolean property for filtering based on app info*/
440 #define PMINFO_APPINFO_PROP_APP_TASKMANAGE      "PMINFO_APPINFO_PROP_APP_TASKMANAGE"
441  /** Boolean property for filtering based on app info*/
442 #define PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION "PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION"
443
444  /** will be updated*/
445  /** string property for filtering based on pkg info*/
446 #define PMINFO_PKGINFO_PROP_RANGE_BASIC "PMINFO_PKGINFO_PROP_RANGE_BASIC"
447
448 /* For multiuser support */
449 const char *getIconPath(uid_t uid);
450 const char *getUserPkgParserDBPath(void);
451 const char *getUserPkgParserDBPathUID(uid_t uid);
452 const char *getUserPkgCertDBPath(void);
453 const char *getUserPkgCertDBPathUID(uid_t uid);
454 const char *getUserDesktopPath(uid_t uid);
455 const char *getUserManifestPath(uid_t uid);
456
457 /**
458  * @fn  int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
459  * @fn  int pkgmgrinfo_pkginfo_get_usr_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data, uid_t uid)
460  * @brief       This API gets list of installed packages
461  *
462  * @par         This API is for package-manager client application
463  * @par Sync (or) Async : Synchronous API
464  * @param[in]   pkg_list_cb     iteration function for list
465  * @param[in]   user_data       user data to be passed to callback function
466  * @param[in]   uid     the addressee user id of the instruction
467  * @return      0 if success, error code(<0) if fail
468  * @retval      PMINFO_R_OK     success
469  * @retval      PMINFO_R_EINVAL invalid argument
470  * @retval      PMINFO_R_ERROR  internal error
471  * @pre         None
472  * @post        None
473  * @code
474 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
475 {
476         char *pkgid1 = NULL;
477         char *pkgid2 = NULL;
478         pkgid1 = (char *)user_data;
479         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid2);
480         if (strcmp(pkgid1, pkgid2) == 0) {
481                 return -1;
482         } else {
483                 return 0;
484         }
485 }
486
487 static int list_pkgs()
488 {
489         int ret = 0;
490         char *name = "helloworld";
491         ret = pkgmgrinfo_pkginfo_get_list(pkg_list_cb, (void *)name);
492         if (ret != PMINFO_R_OK) {
493                 return -1;
494         }
495         return 0;
496 }
497  * @endcode
498  */
499 int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
500 int pkgmgrinfo_pkginfo_get_usr_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data, uid_t uid);
501 /**
502  * @fn int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
503  * @brief       This API creates the package information handle from db
504  *
505  * @par         This API is for package-manager client application
506  * @par Sync (or) Async : Synchronous API
507  *
508  * @param[in]   pkgid   pointer to package ID
509  * @param[in]   uid     the addressee user id of the instruction
510  * @param[out] handle           pointer to the package info handle.
511  * @return      0 if success, error code(<0) if fail
512  * @retval      PMINFO_R_OK     success
513  * @retval      PMINFO_R_EINVAL invalid argument
514  * @retval      PMINFO_R_ERROR  internal error
515  * @pre         None
516  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
517  * @see         pkgmgrinfo_pkginfo_get_pkgid()
518  * @see         pkgmgrinfo_pkginfo_is_removable()
519  * @code
520 static int get_pkg_type(const char *pkgid)
521 {
522         int ret = 0;
523         char *type = NULL;
524         pkgmgrinfo_pkginfo_h handle;
525         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
526         if (ret != PMINFO_R_OK)
527                 return -1;
528         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
529         if (ret != PMINFO_R_OK) {
530                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
531                 return -1;
532         }
533         printf("pkgtype: %s\n", type);
534         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
535         return 0;
536 }
537  * @endcode
538  */
539 int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
540 int pkgmgrinfo_pkginfo_get_usr_pkginfo(const char *pkgid, uid_t uid, pkgmgrinfo_pkginfo_h *handle);
541
542 /**
543  * @fn int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name)
544  * @brief       This API gets the package name from the package ID
545  *
546  * @par         This API is for package-manager client application
547  * @par Sync (or) Async : Synchronous API
548  *
549  * @param[in]   handle  pointer to package info handle
550  * @param[out]  pkg_name        pointer to hold package name
551  * @return      0 if success, error code(<0) if fail
552  * @retval      PMINFO_R_OK     success
553  * @retval      PMINFO_R_EINVAL invalid argument
554  * @retval      PMINFO_R_ERROR  internal error
555  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
556  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
557  * @see         pkgmgrinfo_pkginfo_get_type()
558  * @see         pkgmgrinfo_pkginfo_is_removable()
559  * @code
560 static int get_pkg_name(const char *pkgid)
561 {
562         int ret = 0;
563         char *pkgname = NULL;
564         pkgmgrinfo_pkginfo_h handle;
565         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
566         if (ret != PMINFO_R_OK)
567                 return -1;
568         ret = pkgmgrinfo_pkginfo_get_pkgname(handle, &pkgname);
569         if (ret != PMINFO_R_OK) {
570                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
571                 return -1;
572         }
573         printf("pkgname: %s\n", pkgname);
574         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
575         return 0;
576 }
577  * @endcode
578  */
579 int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name);
580
581 /**
582  * @fn int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid)
583  * @brief       This API gets the package id from the package ID
584  *
585  * @par         This API is for package-manager client application
586  * @par Sync (or) Async : Synchronous API
587  *
588  * @param[in]   handle  pointer to package info handle
589  * @param[out]  pkgid   pointer to hold package id
590  * @return      0 if success, error code(<0) if fail
591  * @retval      PMINFO_R_OK     success
592  * @retval      PMINFO_R_EINVAL invalid argument
593  * @retval      PMINFO_R_ERROR  internal error
594  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
595  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
596  * @see         pkgmgrinfo_pkginfo_get_type()
597  * @see         pkgmgrinfo_pkginfo_is_removable()
598  * @code
599 static int get_pkgid(const char *pkgid)
600 {
601         int ret = 0;
602         char *pkg_id = NULL;
603         pkgmgrinfo_pkginfo_h handle;
604         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
605         if (ret != PMINFO_R_OK)
606                 return -1;
607         ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkg_id);
608         if (ret != PMINFO_R_OK) {
609                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
610                 return -1;
611         }
612         printf("pkg id: %s\n", pkg_id);
613         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
614         return 0;
615 }
616  * @endcode
617  */
618 int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid);
619
620 /**
621  * @fn int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type)
622  * @brief       This API gets the package type from the package ID
623  *
624  * @par         This API is for package-manager client application
625  * @par Sync (or) Async : Synchronous API
626  *
627  * @param[in]   handle  pointer to package info handle
628  * @param[out] type             pointer to hold package type
629  * @return      0 if success, error code(<0) if fail
630  * @retval      PMINFO_R_OK     success
631  * @retval      PMINFO_R_EINVAL invalid argument
632  * @retval      PMINFO_R_ERROR  internal error
633  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
634  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
635  * @see         pkgmgrinfo_pkginfo_get_pkgid()
636  * @see         pkgmgrinfo_pkginfo_is_removable()
637  * @code
638 static int get_pkg_type(const char *pkgid)
639 {
640         int ret = 0;
641         char *type = NULL;
642         pkgmgrinfo_pkginfo_h handle;
643         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
644         if (ret != PMINFO_R_OK)
645                 return -1;
646         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
647         if (ret != PMINFO_R_OK) {
648                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
649                 return -1;
650         }
651         printf("pkgtype: %s\n", type);
652         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
653         return 0;
654 }
655  * @endcode
656  */
657 int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type);
658
659 /**
660  * @fn int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version)
661  * @brief       This API gets the package version from the package ID
662  *
663  * @par         This API is for package-manager client application
664  * @par Sync (or) Async : Synchronous API
665  *
666  * @param[in]   handle  pointer to package info handle
667  * @param[out] version          pointer to hold package version
668  * @return      0 if success, error code(<0) if fail
669  * @retval      PMINFO_R_OK     success
670  * @retval      PMINFO_R_EINVAL invalid argument
671  * @retval      PMINFO_R_ERROR  internal error
672  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
673  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
674  * @see         pkgmgrinfo_pkginfo_get_pkgid()
675  * @see         pkgmgrinfo_pkginfo_is_removable()
676  * @code
677 static int get_pkg_version(const char *pkgid)
678 {
679         int ret = 0;
680         char *version = NULL;
681         pkgmgrinfo_pkginfo_h handle;
682         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
683         if (ret != PMINFO_R_OK)
684                 return -1;
685         ret = pkgmgrinfo_pkginfo_get_version(handle, &version);
686         if (ret != PMINFO_R_OK) {
687                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
688                 return -1;
689         }
690         printf("pkg version: %s\n", version);
691         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
692         return 0;
693 }
694  * @endcode
695  */
696 int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version);
697
698 /**
699  * @fn int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
700  * @brief       This API gets the package install location from the package ID
701  *
702  * @par         This API is for package-manager client application
703  * @par Sync (or) Async : Synchronous API
704  *
705  * @param[in] handle    pointer to package info handle
706  * @param[out] location         pointer to hold package install location
707  * @return      0 if success, error code(<0) if fail
708  * @retval      PMINFO_R_OK     success
709  * @retval      PMINFO_R_EINVAL invalid argument
710  * @retval      PMINFO_R_ERROR  internal error
711  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
712  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
713  * @see         pkgmgrinfo_pkginfo_get_pkgid()
714  * @see         pkgmgrinfo_pkginfo_is_removable()
715  * @code
716 static int get_pkg_install_location(const char *pkgid)
717 {
718         int ret = 0;
719         pkgmgrinfo_install_location location;
720         pkgmgrinfo_pkginfo_h handle;
721         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
722         if (ret != PMINFO_R_OK)
723                 return -1;
724         ret = pkgmgrinfo_pkginfo_get_install_location(handle, &location);
725         if (ret != PMINFO_R_OK) {
726                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
727                 return -1;
728         }
729         printf("pkg install location: %d\n", location);
730         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
731         return 0;
732 }
733  * @endcode
734  */
735 int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location);
736
737 /**
738  * @fn int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size)
739  * @brief       This API gets the package size from the package ID. size will be 0 if package install location is internal-only.
740  size will be 0 if package install location is prefer-external but size is not specified in manifest file.Application should check
741  the return value of pkgmgrinfo_pkginfo_get_install_location() and use it to distinguish the above cases.
742  *
743  * @par         This API is for package-manager client application
744  * @par Sync (or) Async : Synchronous API
745  *
746  * @param[in]   handle  pointer to package info handle
747  * @param[out] size             pointer to hold package size
748  * @return      0 if success, error code(<0) if fail
749  * @retval      PMINFO_R_OK     success
750  * @retval      PMINFO_R_EINVAL invalid argument
751  * @retval      PMINFO_R_ERROR  internal error
752  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
753  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
754  * @see         pkgmgrinfo_pkginfo_get_pkgid()
755  * @see         pkgmgrinfo_pkginfo_is_removable()
756  * @code
757 static int get_pkg_size(const char *pkgid)
758 {
759         int ret = 0;
760         int size = 0;
761         pkgmgrinfo_pkginfo_h handle;
762         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
763         if (ret != PMINFO_R_OK)
764                 return -1;
765         ret = pkgmgrinfo_pkginfo_get_package_size(handle, &size);
766         if (ret != PMINFO_R_OK) {
767                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
768                 return -1;
769         }
770         printf("pkgsize: %d\n", size);
771         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
772         return 0;
773 }
774  * @endcode
775  */
776 int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size);
777
778 /**
779  * @fn int pkgmgrinfo_pkginfo_get_total_size(pkgmgrinfo_pkginfo_h handle, int *size)
780  * @brief       This API gets the installed package total size on the target.
781  *
782  * @par         This API is for package-manager client application
783  * @par Sync (or) Async : Synchronous API
784  *
785  * @param[in]   handle  pointer to package info handle
786  * @param[out] size             pointer to hold package total size
787  * @return      0 if success, error code(<0) if fail
788  * @retval      PMINFO_R_OK     success
789  * @retval      PMINFO_R_EINVAL invalid argument
790  * @retval      PMINFO_R_ERROR  internal error
791  * @code
792 static int get_pkg_total_size(const char *pkgid)
793 {
794         int ret = 0;
795         int size = 0;
796         pkgmgrinfo_pkginfo_h handle;
797         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
798         if (ret != PMINFO_R_OK)
799                 return -1;
800         ret = pkgmgrinfo_pkginfo_get_total_size(handle, &size);
801         if (ret != PMINFO_R_OK) {
802                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
803                 return -1;
804         }
805         printf("pkg total size: %d\n", size);
806         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
807         return 0;
808 }
809  * @endcode
810  */
811  int pkgmgrinfo_pkginfo_get_total_size(pkgmgrinfo_pkginfo_h handle, int *size);
812
813 /**
814  * @fn int pkgmgrinfo_pkginfo_get_data_size(pkgmgrinfo_pkginfo_h handle, int *size)
815  * @brief       This API gets the installed package data size on the target.
816  *
817  * @par         This API is for package-manager client application
818  * @par Sync (or) Async : Synchronous API
819  *
820  * @param[in]   handle  pointer to package info handle
821  * @param[out] size             pointer to hold package data size
822  * @return      0 if success, error code(<0) if fail
823  * @retval      PMINFO_R_OK     success
824  * @retval      PMINFO_R_EINVAL invalid argument
825  * @retval      PMINFO_R_ERROR  internal error
826  * @code
827 static int get_pkg_data_size(const char *pkgid)
828 {
829         int ret = 0;
830         int size = 0;
831         pkgmgrinfo_pkginfo_h handle;
832         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
833         if (ret != PMINFO_R_OK)
834                 return -1;
835         ret = pkgmgrinfo_pkginfo_get_data_size(handle, &size);
836         if (ret != PMINFO_R_OK) {
837                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
838                 return -1;
839         }
840         printf("pkg data size: %d\n", size);
841         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
842         return 0;
843 }
844  * @endcode
845  */
846  int pkgmgrinfo_pkginfo_get_data_size(pkgmgrinfo_pkginfo_h handle, int *size);
847
848 /**
849  * @fn int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon)
850  * @brief       This API gets the package icon from the package ID
851  *
852  * @par         This API is for package-manager client application
853  * @par Sync (or) Async : Synchronous API
854  *
855  * @param[in]   handle  pointer to package info handle
856  * @param[out] icon             pointer to hold package icon
857  * @return      0 if success, error code(<0) if fail
858  * @retval      PMINFO_R_OK     success
859  * @retval      PMINFO_R_EINVAL invalid argument
860  * @retval      PMINFO_R_ERROR  internal error
861  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
862  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
863  * @see         pkgmgrinfo_pkginfo_get_pkgid()
864  * @see         pkgmgrinfo_pkginfo_is_removable()
865  * @code
866 static int get_pkg_icon(const char *pkgid)
867 {
868         int ret = 0;
869         char *icon = NULL;
870         pkgmgrinfo_pkginfo_h handle;
871         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
872         if (ret != PMINFO_R_OK)
873                 return -1;
874         ret = pkgmgrinfo_pkginfo_get_icon(handle, &icon);
875         if (ret != PMINFO_R_OK) {
876                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
877                 return -1;
878         }
879         printf("pkg icon: %s\n", icon);
880         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
881         return 0;
882 }
883  * @endcode
884  */
885 int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon);
886
887 /**
888  * @fn int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
889  * @brief       This API gets the package label from the package ID
890  *
891  * @par         This API is for package-manager client application
892  * @par Sync (or) Async : Synchronous API
893  *
894  * @param[in]   handle  pointer to package info handle
895  * @param[out] label            pointer to hold package label
896  * @return      0 if success, error code(<0) if fail
897  * @retval      PMINFO_R_OK     success
898  * @retval      PMINFO_R_EINVAL invalid argument
899  * @retval      PMINFO_R_ERROR  internal error
900  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
901  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
902  * @see         pkgmgrinfo_pkginfo_get_pkgid()
903  * @see         pkgmgrinfo_pkginfo_is_removable()
904  * @code
905 static int get_pkg_label(const char *pkgid)
906 {
907         int ret = 0;
908         char *label = NULL;
909         pkgmgrinfo_pkginfo_h handle;
910         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
911         if (ret != PMINFO_R_OK)
912                 return -1;
913         ret = pkgmgrinfo_pkginfo_get_label(handle, &label);
914         if (ret != PMINFO_R_OK) {
915                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
916                 return -1;
917         }
918         printf("pkg label: %s\n", label);
919         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
920         return 0;
921 }
922  * @endcode
923  */
924 int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label);
925
926 /**
927  * @fn int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description)
928  * @brief       This API gets the package description from the package ID
929  *
930  * @par         This API is for package-manager client application
931  * @par Sync (or) Async : Synchronous API
932  *
933  * @param[in]   handle  pointer to package info handle
934  * @param[out] description              pointer to hold package description
935  * @return      0 if success, error code(<0) if fail
936  * @retval      PMINFO_R_OK     success
937  * @retval      PMINFO_R_EINVAL invalid argument
938  * @retval      PMINFO_R_ERROR  internal error
939  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
940  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
941  * @see         pkgmgrinfo_pkginfo_get_pkgid()
942  * @see         pkgmgrinfo_pkginfo_is_removable()
943  * @code
944 static int get_pkg_description(const char *pkgid)
945 {
946         int ret = 0;
947         char *description = NULL;
948         pkgmgrinfo_pkginfo_h handle;
949         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
950         if (ret != PMINFO_R_OK)
951                 return -1;
952         ret = pkgmgrinfo_pkginfo_get_description(handle, &description);
953         if (ret != PMINFO_R_OK) {
954                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
955                 return -1;
956         }
957         printf("pkg description: %s\n", description);
958         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
959         return 0;
960 }
961  * @endcode
962  */
963 int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description);
964
965 /**
966  * @fn int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name)
967  * @brief       This API gets the package's author name from the package ID
968  *
969  * @par         This API is for package-manager client application
970  * @par Sync (or) Async : Synchronous API
971  *
972  * @param[in]   handle  pointer to package info handle
973  * @param[out] author_name              pointer to hold package author name
974  * @return      0 if success, error code(<0) if fail
975  * @retval      PMINFO_R_OK     success
976  * @retval      PMINFO_R_EINVAL invalid argument
977  * @retval      PMINFO_R_ERROR  internal error
978  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
979  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
980  * @see         pkgmgrinfo_pkginfo_get_pkgid()
981  * @see         pkgmgrinfo_pkginfo_is_removable()
982  * @code
983 static int get_pkg_author_name(const char *pkgid)
984 {
985         int ret = 0;
986         char *author_name = NULL;
987         pkgmgrinfo_pkginfo_h handle;
988         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
989         if (ret != PMINFO_R_OK)
990                 return -1;
991         ret = pkgmgrinfo_pkginfo_get_author_name(handle, &author_name);
992         if (ret != PMINFO_R_OK) {
993                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
994                 return -1;
995         }
996         printf("pkg author name: %s\n", author_name);
997         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
998         return 0;
999 }
1000  * @endcode
1001  */
1002 int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name);
1003
1004 /**
1005  * @fn int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email)
1006  * @brief       This API gets the package's author email from the package ID
1007  *
1008  * @par         This API is for package-manager client application
1009  * @par Sync (or) Async : Synchronous API
1010  *
1011  * @param[in]   handle  pointer to package info handle
1012  * @param[out] author_email             pointer to hold package author email
1013  * @return      0 if success, error code(<0) if fail
1014  * @retval      PMINFO_R_OK     success
1015  * @retval      PMINFO_R_EINVAL invalid argument
1016  * @retval      PMINFO_R_ERROR  internal error
1017  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1018  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1019  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1020  * @see         pkgmgrinfo_pkginfo_is_removable()
1021  * @code
1022 static int get_pkg_author_email(const char *pkgid)
1023 {
1024         int ret = 0;
1025         char *author_email = NULL;
1026         pkgmgrinfo_pkginfo_h handle;
1027         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1028         if (ret != PMINFO_R_OK)
1029                 return -1;
1030         ret = pkgmgrinfo_pkginfo_get_author_email(handle, &author_email);
1031         if (ret != PMINFO_R_OK) {
1032                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1033                 return -1;
1034         }
1035         printf("pkg author email: %s\n", author_email);
1036         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1037         return 0;
1038 }
1039  * @endcode
1040  */
1041 int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email);
1042
1043 /**
1044  * @fn int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href)
1045  * @brief       This API gets the package's author href from the package ID
1046  *
1047  * @par         This API is for package-manager client application
1048  * @par Sync (or) Async : Synchronous API
1049  *
1050  * @param[in]   handle  pointer to package info handle
1051  * @param[out] author_href              pointer to hold package author href
1052  * @return      0 if success, error code(<0) if fail
1053  * @retval      PMINFO_R_OK     success
1054  * @retval      PMINFO_R_EINVAL invalid argument
1055  * @retval      PMINFO_R_ERROR  internal error
1056  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1057  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1058  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1059  * @see         pkgmgrinfo_pkginfo_is_removable()
1060  * @code
1061 static int get_pkg_author_href(const char *pkgid)
1062 {
1063         int ret = 0;
1064         char *author_href = NULL;
1065         pkgmgrinfo_pkginfo_h handle;
1066         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1067         if (ret != PMINFO_R_OK)
1068                 return -1;
1069         ret = pkgmgrinfo_pkginfo_get_author_href(handle, &author_href);
1070         if (ret != PMINFO_R_OK) {
1071                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1072                 return -1;
1073         }
1074         printf("pkg author href: %s\n", author_href);
1075         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1076         return 0;
1077 }
1078  * @endcode
1079  */
1080 int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href);
1081
1082 /**
1083  * @fn int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage)
1084  * @brief       This API gets the package installed storagae value from the package ID
1085  *
1086  * @par         This API is for package-manager client application
1087  * @par Sync (or) Async : Synchronous API
1088  *
1089  * @param[in]   handle  pointer to package info handle
1090  * @param[out] storage          pointer to hold package installed storage
1091  * @return      0 if success, error code(<0) if fail
1092  * @retval      PMINFO_R_OK     success
1093  * @retval      PMINFO_R_EINVAL invalid argument
1094  * @retval      PMINFO_R_ERROR  internal error
1095  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1096  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1097  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1098  * @see         pkgmgrinfo_pkginfo_is_removable()
1099  * @code
1100 static int get_pkg_installed_storage(const char *pkgid)
1101 {
1102         int ret = 0;
1103         pkgmgrinfo_installed_storage storage;
1104         pkgmgrinfo_pkginfo_h handle;
1105         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1106         if (ret != PMINFO_R_OK)
1107                 return -1;
1108         ret = pkgmgrinfo_pkginfo_get_installed_storage(handle, &storage);
1109         if (ret != PMINFO_R_OK) {
1110                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1111                 return -1;
1112         }
1113         printf("pkg installed storage: %d\n", storage);
1114         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1115         return 0;
1116 }
1117  * @endcode
1118  */
1119 int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage);
1120
1121 /**
1122  * @fn int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time)
1123  * @brief       This API gets the installed time of package from the package ID
1124  *
1125  * @par         This API is for package-manager client application
1126  * @par Sync (or) Async : Synchronous API
1127  *
1128  * @param[in]   handle  pointer to package info handle
1129  * @param[out] installed_time           pointer to hold installed time of package
1130  * @return      0 if success, error code(<0) if fail
1131  * @retval      PMINFO_R_OK     success
1132  * @retval      PMINFO_R_EINVAL invalid argument
1133  * @retval      PMINFO_R_ERROR  internal error
1134  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1135  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1136  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1137  * @see         pkgmgrinfo_pkginfo_is_removable()
1138  * @code
1139 static int get_pkg_installed_time(const char *pkgid)
1140 {
1141         int ret = 0;
1142         int installed_time = 0;
1143         pkgmgrinfo_pkginfo_h handle;
1144         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1145         if (ret != PMINFO_R_OK)
1146                 return -1;
1147         ret = pkgmgrinfo_pkginfo_get_installed_time(handle, &installed_time);
1148         if (ret != PMINFO_R_OK) {
1149                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1150                 return -1;
1151         }
1152         printf("installed_time: %d\n", installed_time);
1153         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1154         return 0;
1155 }
1156  * @endcode
1157  */
1158 int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time);
1159
1160 /**
1161  * @fn int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
1162  * @brief       This API gets the launch mode of package from the package ID
1163  *
1164  * @par         This API is for package-manager client application
1165  * @par Sync (or) Async : Synchronous API
1166  *
1167  * @param[in]   handle  pointer to package info handle
1168  * @param[out] mode             pointer to hold launch mode of package
1169  * @return      0 if success, error code(<0) if fail
1170  * @retval      PMINFO_R_OK     success
1171  * @retval      PMINFO_R_EINVAL invalid argument
1172  * @retval      PMINFO_R_ERROR  internal error
1173  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1174  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1175  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1176  * @see         pkgmgrinfo_pkginfo_is_removable()
1177  * @code
1178 static int get_pkg_launch_mode(const char *pkgid)
1179 {
1180         int ret = 0;
1181         char *launch_mode = NULL;
1182         pkgmgrinfo_pkginfo_h handle;
1183         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1184         if (ret != PMINFO_R_OK)
1185                 return -1;
1186         ret = pkgmgrinfo_pkginfo_get_launch_mode(handle, &mode);
1187         if (ret != PMINFO_R_OK) {
1188                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1189                 return -1;
1190         }
1191         printf("launch mode: %s\n", mode);
1192         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1193         return 0;
1194 }
1195  * @endcode
1196  */
1197 int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode);
1198
1199 /**
1200  * @fn int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid)
1201  * @brief       This API gets the store client id of package from the package ID
1202  *
1203  * @par         This API is for package-manager client application
1204  * @par Sync (or) Async : Synchronous API
1205  *
1206  * @param[in]   handle  pointer to package info handle
1207  * @param[out] storeclientid            pointer to hold store client id of package
1208  * @return      0 if success, error code(<0) if fail
1209  * @retval      PMINFO_R_OK     success
1210  * @retval      PMINFO_R_EINVAL invalid argument
1211  * @retval      PMINFO_R_ERROR  internal error
1212  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1213  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1214  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1215  * @see         pkgmgrinfo_pkginfo_is_removable()
1216  * @code
1217 static int get_pkg_storeclientid(const char *pkgid)
1218 {
1219         int ret = 0;
1220         char *storeclientid = 0;
1221         pkgmgrinfo_pkginfo_h handle;
1222         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1223         if (ret != PMINFO_R_OK)
1224                 return -1;
1225         ret = pkgmgrinfo_pkginfo_get_storeclientid(handle, &storeclientid);
1226         if (ret != PMINFO_R_OK) {
1227                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1228                 return -1;
1229         }
1230         printf(store client id: %s\n", storeclientid);
1231         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1232         return 0;
1233 }
1234  * @endcode
1235  */
1236 int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid);
1237
1238 /**
1239  * @fn int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid)
1240  * @brief       This API gets the main app id of package from the package ID
1241  *
1242  * @par         This API is for package-manager client application
1243  * @par Sync (or) Async : Synchronous API
1244  *
1245  * @param[in]   handle  pointer to package info handle
1246  * @param[out] mainappid                pointer to hold main app id of package
1247  * @return      0 if success, error code(<0) if fail
1248  * @retval      PMINFO_R_OK     success
1249  * @retval      PMINFO_R_EINVAL invalid argument
1250  * @retval      PMINFO_R_ERROR  internal error
1251  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1252  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1253  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1254  * @see         pkgmgrinfo_pkginfo_is_removable()
1255  * @code
1256 static int get_pkg_mainappid(const char *pkgid)
1257 {
1258         int ret = 0;
1259         char *mainappid = 0;
1260         pkgmgrinfo_pkginfo_h handle;
1261         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1262         if (ret != PMINFO_R_OK)
1263                 return -1;
1264         ret = pkgmgrinfo_pkginfo_get_mainappid(handle, &mainappid);
1265         if (ret != PMINFO_R_OK) {
1266                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1267                 return -1;
1268         }
1269         printf(main app id: %s\n", mainappid);
1270         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1271         return 0;
1272 }
1273  * @endcode
1274  */
1275 int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid);
1276
1277 /**
1278  * @fn int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url)
1279  * @brief       This API gets the url of package from the package ID
1280  *
1281  * @par         This API is for package-manager client application
1282  * @par Sync (or) Async : Synchronous API
1283  *
1284  * @param[in]   handle  pointer to package info handle
1285  * @param[out] url              pointer to hold url of package
1286  * @return      0 if success, error code(<0) if fail
1287  * @retval      PMINFO_R_OK     success
1288  * @retval      PMINFO_R_EINVAL invalid argument
1289  * @retval      PMINFO_R_ERROR  internal error
1290  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1291  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1292  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1293  * @see         pkgmgrinfo_pkginfo_is_removable()
1294  * @code
1295 static int get_pkg_url(const char *pkgid)
1296 {
1297         int ret = 0;
1298         char *url = 0;
1299         pkgmgrinfo_pkginfo_h handle;
1300         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1301         if (ret != PMINFO_R_OK)
1302                 return -1;
1303         ret = pkgmgrinfo_pkginfo_get_url(handle, &url);
1304         if (ret != PMINFO_R_OK) {
1305                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1306                 return -1;
1307         }
1308         printf("url : %s\n", url);
1309         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1310         return 0;
1311 }
1312  * @endcode
1313  */
1314 int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url);
1315
1316
1317 /**
1318  * @fn int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path)
1319  * @brief       This API gets the root path of package
1320  *
1321  * @par Sync (or) Async : Synchronous API
1322  *
1323  * @param[in] handle            pointer to package info handle
1324  * @param[out] path             pointer to hold root path of package
1325  * @return      0 if success, error code(<0) if fail
1326  * @retval      PMINFO_R_OK     success
1327  * @retval      PMINFO_R_EINVAL invalid argument
1328  * @retval      PMINFO_R_ERROR  internal error
1329  * @code
1330 static int get_root_path(const char *pkgid)
1331 {
1332         int ret = 0;
1333         char *path = 0;
1334         pkgmgrinfo_pkginfo_h handle;
1335         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1336         if (ret != PMINFO_R_OK)
1337                 return -1;
1338
1339         ret = pkgmgrinfo_pkginfo_get_root_path(handle, &path);
1340         if (ret != PMINFO_R_OK) {
1341                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1342                 return -1;
1343         }
1344         printf("path : %s\n", path);
1345         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1346
1347         return 0;
1348 }
1349  * @endcode
1350  */
1351 int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path);
1352
1353
1354 /**
1355  * @fn int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path)
1356  * @brief       This API gets the csc path of package
1357  *
1358  * @par Sync (or) Async : Synchronous API
1359  *
1360  * @param[in] handle            pointer to package info handle
1361  * @param[out] path             pointer to hold csc path of package
1362  * @return      0 if success, error code(<0) if fail
1363  * @retval      PMINFO_R_OK     success
1364  * @retval      PMINFO_R_EINVAL invalid argument
1365  * @retval      PMINFO_R_ERROR  internal error
1366  * @code
1367 static int get_csc_path(const char *pkgid)
1368 {
1369         int ret = 0;
1370         char *path = 0;
1371         pkgmgrinfo_pkginfo_h handle;
1372         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1373         if (ret != PMINFO_R_OK)
1374                 return -1;
1375
1376         ret = pkgmgrinfo_pkginfo_get_csc_path(handle, &path);
1377         if (ret != PMINFO_R_OK) {
1378                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1379                 return -1;
1380         }
1381         printf("path : %s\n", path);
1382         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1383
1384         return 0;
1385 }
1386  * @endcode
1387  */
1388 int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path);
1389
1390 /**
1391  * @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)
1392  * @brief       This API compare the cert information from given package id
1393  *
1394  * @par         This API is for package-manager client application
1395  * @par Sync (or) Async : Synchronous API
1396  *
1397  * @param[in]   lhs_package_id  pointer to first package ID
1398  * @param[in]   rhs_package_id  pointer to second package ID
1399  * @param[out] compare_result           pointer to the compare result.
1400  * @return      0 if success, error code(<0) if fail
1401  * @retval      PMINFO_R_OK     success
1402  * @retval      PMINFO_R_EINVAL invalid argument
1403  * @retval      PMINFO_R_ERROR  internal error
1404  * @pre         None
1405  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1406  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1407  * @see         pkgmgrinfo_pkginfo_is_removable()
1408  * @code
1409 static int compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1410 {
1411         int ret = 0;
1412         pkgmgrinfo_cert_compare_result_type_e result;
1413
1414         ret = pkgmgrinfo_pkginfo_compare_pkg_cert_info(lhs_package_id, rhs_package_id, &result);
1415         if (ret != PMINFO_R_OK) {
1416                 return -1;
1417         }
1418         printf("result: %d\n", result);
1419         return 0;
1420 }
1421  * @endcode
1422  */
1423 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);
1424 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);
1425 /**
1426  * @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)
1427  * @brief       This API compare the cert information from given app id
1428  *
1429  * @par         This API is for package-manager client application
1430  * @par Sync (or) Async : Synchronous API
1431  *
1432  * @param[in]   lhs_app_id      pointer to first app ID
1433  * @param[in]   rhs_app_id      pointer to second app ID
1434  * @param[out] compare_result           pointer to the compare result.
1435  * @return      0 if success, error code(<0) if fail
1436  * @retval      PMINFO_R_OK     success
1437  * @retval      PMINFO_R_EINVAL invalid argument
1438  * @retval      PMINFO_R_ERROR  internal error
1439  * @pre         None
1440  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1441  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1442  * @see         pkgmgrinfo_pkginfo_is_removable()
1443  * @code
1444 static int compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1445 {
1446         int ret = 0;
1447         pkgmgrinfo_cert_compare_result_type_e result;
1448
1449         ret = pkgmgrinfo_pkginfo_compare_app_cert_info(lhs_app_id, rhs_app_id, &result);
1450         if (ret != PMINFO_R_OK) {
1451                 return -1;
1452         }
1453         printf("result: %d\n", result);
1454         return 0;
1455 }
1456  * @endcode
1457  */
1458 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);
1459 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);
1460 /**
1461  * @fn int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable)
1462  * @brief       This API gets the package 'removable' value from the package ID
1463  *
1464  * @par         This API is for package-manager client application
1465  * @par Sync (or) Async : Synchronous API
1466  *
1467  * @param[in]   handle  pointer to package info handle
1468  * @param[out] removable                pointer to hold package removable value
1469  * @return      0 if success, error code(<0) if fail
1470  * @retval      PMINFO_R_OK     success
1471  * @retval      PMINFO_R_EINVAL invalid argument
1472  * @retval      PMINFO_R_ERROR  internal error
1473  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1474  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1475  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1476  * @see         pkgmgrinfo_pkginfo_is_readonly()
1477  * @code
1478 static int get_pkg_removable(const char *pkgid)
1479 {
1480         int ret = 0;
1481         bool removable;
1482         pkgmgrinfo_pkginfo_h handle;
1483         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1484         if (ret != PMINFO_R_OK)
1485                 return -1;
1486         ret = pkgmgrinfo_pkginfo_is_removable(handle, &removable);
1487         if (ret != PMINFO_R_OK) {
1488                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1489                 return -1;
1490         }
1491         printf("pkg removable: %d\n", removable);
1492         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1493         return 0;
1494 }
1495  * @endcode
1496  */
1497 int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable);
1498
1499 /**
1500  * @fn int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable)
1501  * @brief       This API check that the package can move internal storage to external storage or external storage to internal storage from the package ID
1502  *
1503  * @par         This API is for package-manager client application
1504  * @par Sync (or) Async : Synchronous API
1505  *
1506  * @param[in]   handle  pointer to package info handle
1507  * @param[out] movable          pointer to hold package movable state
1508  * @return      0 if success, error code(<0) if fail
1509  * @retval      PMINFO_R_OK     success
1510  * @retval      PMINFO_R_EINVAL invalid argument
1511  * @retval      PMINFO_R_ERROR  internal error
1512  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1513  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1514  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1515  * @code
1516 static int get_pkg_movable(const char *pkgid)
1517 {
1518         int ret = 0;
1519         bool movable;
1520         pkgmgrinfo_pkginfo_h handle;
1521         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1522         if (ret != PMINFO_R_OK)
1523                 return -1;
1524         ret = pkgmgrinfo_pkginfo_is_movable(handle, &movable);
1525         if (ret != PMINFO_R_OK) {
1526                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1527                 return -1;
1528         }
1529         printf("pkg movable: %d\n", movable);
1530         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1531         return 0;
1532 }
1533  * @endcode
1534  */
1535 int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable);
1536
1537 /**
1538  * @fn int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload)
1539  * @brief       This API gets the package 'preload' value from the package ID
1540  *
1541  * @par         This API is for package-manager client application
1542  * @par Sync (or) Async : Synchronous API
1543  *
1544  * @param[in]   handle  pointer to package info handle
1545  * @param[out] preload          pointer to hold package preload value
1546  * @return      0 if success, error code(<0) if fail
1547  * @retval      PMINFO_R_OK     success
1548  * @retval      PMINFO_R_EINVAL invalid argument
1549  * @retval      PMINFO_R_ERROR  internal error
1550  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1551  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1552  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1553  * @see         pkgmgrinfo_pkginfo_is_readonly()
1554  * @code
1555 static int get_pkg_preload(const char *pkgid)
1556 {
1557         int ret = 0;
1558         bool preload;
1559         pkgmgrinfo_pkginfo_h handle;
1560         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1561         if (ret != PMINFO_R_OK)
1562                 return -1;
1563         ret = pkgmgrinfo_pkginfo_is_preload(handle, &preload);
1564         if (ret != PMINFO_R_OK) {
1565                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1566                 return -1;
1567         }
1568         printf("pkg preload: %d\n", preload);
1569         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1570         return 0;
1571 }
1572  * @endcode
1573  */
1574 int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload);
1575
1576 /**
1577  * @fn int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
1578  * @brief       This API gets the value for given handle is system or not
1579  *
1580  * @par         This API is for package-manager client application
1581  * @par Sync (or) Async : Synchronous API
1582  *
1583  * @param[in]   handle  pointer to package info handle
1584  * @param[out] system           pointer to hold  system is or not
1585  * @return      0 if success, error code(<0) if fail
1586  * @retval      PMINFO_R_OK     success
1587  * @retval      PMINFO_R_EINVAL invalid argument
1588  * @retval      PMINFO_R_ERROR  internal error
1589  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1590  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1591  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1592  * @see         pkgmgrinfo_pkginfo_is_readonly()
1593  * @code
1594 static int get_pkg_system(const char *pkgid)
1595 {
1596         int ret = 0;
1597         bool system = false;
1598         pkgmgrinfo_pkginfo_h handle = NULL;
1599         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1600         if (ret != PMINFO_R_OK)
1601                 return -1;
1602         ret = pkgmgrinfo_pkginfo_is_system(handle, &system);
1603         if (ret != PMINFO_R_OK) {
1604                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1605                 return -1;
1606         }
1607         printf("pkg system: %d\n", system);
1608         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1609         return 0;
1610 }
1611  * @endcode
1612  */
1613 int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system);
1614
1615 /**
1616  * @fn int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
1617  * @brief       This API gets the package 'readonly' value from the package ID
1618  *
1619  * @par         This API is for package-manager client application
1620  * @par Sync (or) Async : Synchronous API
1621  *
1622  * @param[in]   handle  pointer to package info handle
1623  * @param[out] readonly pointer to hold package readonly value
1624  * @return      0 if success, error code(<0) if fail
1625  * @retval      PMINFO_R_OK     success
1626  * @retval      PMINFO_R_EINVAL invalid argument
1627  * @retval      PMINFO_R_ERROR  internal error
1628  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1629  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1630  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1631  * @see         pkgmgrinfo_pkginfo_is_removable()
1632  * @code
1633 static int get_pkg_readonly(const char *pkgid)
1634 {
1635         int ret = 0;
1636         bool readonly;
1637         pkgmgrinfo_pkginfo_h handle;
1638         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1639         if (ret != PMINFO_R_OK)
1640                 return -1;
1641         ret = pkgmgrinfo_pkginfo_is_readonly(handle, &readonly);
1642         if (ret != PMINFO_R_OK) {
1643                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1644                 return -1;
1645         }
1646         printf("pkg readonly: %d\n", readonly);
1647         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1648         return 0;
1649 }
1650  * @endcode
1651  */
1652 int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly);
1653
1654
1655 /**
1656  * @fn int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update)
1657  * @brief       This API gets the package 'upate' value from the package ID
1658  *
1659  * @par         This API is for package-manager client application
1660  * @par Sync (or) Async : Synchronous API
1661  *
1662  * @param[in]   handle  pointer to package info handle
1663  * @param[out] update   pointer to hold package update value
1664  * @return      0 if success, error code(<0) if fail
1665  * @retval      PMINFO_R_OK     success
1666  * @retval      PMINFO_R_EINVAL invalid argument
1667  * @retval      PMINFO_R_ERROR  internal error
1668  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1669  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1670  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1671  * @code
1672 static int get_pkg_update(const char *pkgid)
1673 {
1674         int ret = 0;
1675         bool update;
1676         pkgmgrinfo_pkginfo_h handle;
1677         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1678         if (ret != PMINFO_R_OK)
1679                 return -1;
1680         ret = pkgmgrinfo_pkginfo_is_update(handle, &update);
1681         if (ret != PMINFO_R_OK) {
1682                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1683                 return -1;
1684         }
1685         printf("pkg update: %d\n", update);
1686         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1687         return 0;
1688 }
1689  * @endcode
1690  */
1691 int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update);
1692
1693
1694 /**
1695  * @fn int pkgmgrinfo_pkginfo_is_global(uid_t uid, const char *pkgid)
1696  * @brief       This API gets the package 'uid' value from the view table of user database
1697  *
1698  * @par         This API is for package-manager client application
1699  * @par Sync (or) Async : Synchronous API
1700  *
1701  * @param[in]   uid     uid of the user to determine the database
1702  * @param[in]   pkgid   id of the current package
1703  * @return      1 if it a global package, 0 else
1704  */
1705
1706 int pkgmgrinfo_pkginfo_is_global(uid_t uid, const char *pkgid);
1707
1708
1709 /**
1710  * @fn int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible)
1711  * @brief       This API gets the package 'accessible' value from the package ID
1712  *
1713  * @par         This API is for package-manager client application
1714  * @par Sync (or) Async : Synchronous API
1715  *
1716  * @param[in]   handle  pointer to package info handle
1717  * @param[out] accessible       pointer to hold package accessible value
1718  * @return      0 if success, error code(<0) if fail
1719  * @retval      PMINFO_R_OK     success
1720  * @retval      PMINFO_R_EINVAL invalid argument
1721  * @retval      PMINFO_R_ERROR  internal error
1722  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1723  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1724  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1725  * @see         pkgmgrinfo_pkginfo_is_readonly()
1726  * @code
1727 static int get_pkg_accessible(const char *pkgid)
1728 {
1729         int ret = 0;
1730         bool accessible;
1731         pkgmgrinfo_pkginfo_h handle;
1732         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1733         if (ret != PMINFO_R_OK)
1734                 return -1;
1735         ret = pkgmgrinfo_pkginfo_is_accessible(handle, &accessible);
1736         if (ret != PMINFO_R_OK) {
1737                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1738                 return -1;
1739         }
1740         printf("pkg accessible: %d\n", accessible);
1741         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1742         return 0;
1743 }
1744  * @endcode
1745  */
1746 int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible);
1747
1748 /**
1749  * @fn int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle)
1750  * @brief       This API destroys the package information handle freeing up all the resources
1751  *
1752  * @par         This API is for package-manager client application
1753  * @par Sync (or) Async : Synchronous API
1754  *
1755  * @param[in]   handle  pointer to the package info handle
1756  * @return      0 if success, error code(<0) if fail
1757  * @retval      PMINFO_R_OK     success
1758  * @retval      PMINFO_R_EINVAL invalid argument
1759  * @retval      PMINFO_R_ERROR  internal error
1760  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1761  * @post                None
1762  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1763  * @see         pkgmgrinfo_pkginfo_is_removable()
1764  * @code
1765 static int get_pkg_type(const char *pkgid)
1766 {
1767         int ret = 0;
1768         char *type = NULL;
1769         pkgmgrinfo_pkginfo_h handle;
1770         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1771         if (ret != PMINFO_R_OK)
1772                 return -1;
1773         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
1774         if (ret != PMINFO_R_OK) {
1775                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1776                 return -1;
1777         }
1778         printf("pkgtype: %s\n", type);
1779         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1780         return 0;
1781 }
1782  * @endcode
1783  */
1784 int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle);
1785
1786 /**
1787  * @fn int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle)
1788  * @brief       This API creates the package information filter handle from db.  All filter properties will be ANDed.
1789  The query will search the entire package information collected from the manifest file of all the installed packages
1790  *
1791  * @par         This API is for package-manager client application
1792  * @par Sync (or) Async : Synchronous API
1793  *
1794  * @param[out] handle           pointer to the package info filter handle.
1795  * @return      0 if success, error code(<0) if fail
1796  * @retval      PMINFO_R_OK     success
1797  * @retval      PMINFO_R_EINVAL invalid argument
1798  * @retval      PMINFO_R_ERROR  internal error
1799  * @pre         None
1800  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1801  * @see         pkgmgrinfo_pkginfo_filter_count()
1802  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1803  * @code
1804 static int get_rpm_pkg_count()
1805 {
1806         int ret = 0;
1807         int count = 0;
1808         pkgmgrinfo_pkginfo_filter_h handle;
1809         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1810         if (ret != PMINFO_R_OK)
1811                 return -1;
1812         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1813         if (ret != PMINFO_R_OK) {
1814                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1815                 return -1;
1816         }
1817         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1818         if (ret != PMINFO_R_OK) {
1819                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1820                 return -1;
1821         }
1822         printf("No of rpm pkgs: %d\n", count);
1823         pkgmgrinfo_pkginfo_filter_destroy(handle);
1824         return 0;
1825 }
1826  * @endcode
1827  */
1828 int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle);
1829
1830 /**
1831  * @fn int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle)
1832  * @brief       This API destroys the package information filter handle freeing up all the resources
1833  *
1834  * @par         This API is for package-manager client application
1835  * @par Sync (or) Async : Synchronous API
1836  *
1837  * @param[in] handle            pointer to the package info filter handle.
1838  * @return      0 if success, error code(<0) if fail
1839  * @retval      PMINFO_R_OK     success
1840  * @retval      PMINFO_R_EINVAL invalid argument
1841  * @retval      PMINFO_R_ERROR  internal error
1842  * @pre         pkgmgrinfo_pkginfo_filter_create()
1843  * @post                None
1844  * @see         pkgmgrinfo_pkginfo_filter_count()
1845  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1846  * @code
1847 static int get_rpm_pkg_count()
1848 {
1849         int ret = 0;
1850         int count = 0;
1851         pkgmgrinfo_pkginfo_filter_h handle;
1852         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1853         if (ret != PMINFO_R_OK)
1854                 return -1;
1855         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1856         if (ret != PMINFO_R_OK) {
1857                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1858                 return -1;
1859         }
1860         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1861         if (ret != PMINFO_R_OK) {
1862                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1863                 return -1;
1864         }
1865         printf("No of rpm pkgs: %d\n", count);
1866         pkgmgrinfo_pkginfo_filter_destroy(handle);
1867         return 0;
1868 }
1869  * @endcode
1870  */
1871 int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle);
1872
1873 /**
1874  * @fn int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const bool value)
1875  * @brief       This API adds a boolean filter property to the filter handle
1876  *
1877  * @par         This API is for package-manager client application
1878  * @par Sync (or) Async : Synchronous API
1879  *
1880  * @param[in] handle            pointer to the package info filter handle.
1881  * @param[in] property          boolean property name.
1882  * @param[in] value             value corresponding to the property.
1883  * @return      0 if success, error code(<0) if fail
1884  * @retval      PMINFO_R_OK     success
1885  * @retval      PMINFO_R_EINVAL invalid argument
1886  * @retval      PMINFO_R_ERROR  internal error
1887  * @pre         pkgmgrinfo_pkginfo_filter_create()
1888  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1889  * @see         pkgmgrinfo_pkginfo_filter_count()
1890  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1891  * @code
1892 static int get_preload_pkg_count()
1893 {
1894         int ret = 0;
1895         int count = 0;
1896         pkgmgrinfo_pkginfo_filter_h handle;
1897         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1898         if (ret != PMINFO_R_OK)
1899                 return -1;
1900         ret = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD, 1);
1901         if (ret != PMINFO_R_OK) {
1902                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1903                 return -1;
1904         }
1905         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1906         if (ret != PMINFO_R_OK) {
1907                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1908                 return -1;
1909         }
1910         printf("No of preload pkgs: %d\n", count);
1911         pkgmgrinfo_pkginfo_filter_destroy(handle);
1912         return 0;
1913 }
1914  * @endcode
1915  */
1916 int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle,
1917                 const char *property, const bool value);
1918
1919 /**
1920  * @fn int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const int value)
1921  * @brief       This API adds an integer filter property to the filter handle
1922  *
1923  * @par         This API is for package-manager client application
1924  * @par Sync (or) Async : Synchronous API
1925  *
1926  * @param[in] handle            pointer to the package info filter handle.
1927  * @param[in] property          integer property name.
1928  * @param[in] value             value corresponding to the property.
1929  * @return      0 if success, error code(<0) if fail
1930  * @retval      PMINFO_R_OK     success
1931  * @retval      PMINFO_R_EINVAL invalid argument
1932  * @retval      PMINFO_R_ERROR  internal error
1933  * @pre         pkgmgrinfo_pkginfo_filter_create()
1934  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1935  * @see         pkgmgrinfo_pkginfo_filter_count()
1936  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1937  * @code
1938 static int get_pkg_count()
1939 {
1940         int ret = 0;
1941         int count = 0;
1942         pkgmgrinfo_pkginfo_filter_h handle;
1943         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1944         if (ret != PMINFO_R_OK)
1945                 return -1;
1946         ret = pkgmgrinfo_pkginfo_filter_add_int(handle, PMINFO_PKGINFO_PROP_PACKAGE_SIZE, 10);
1947         if (ret != PMINFO_R_OK) {
1948                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1949                 return -1;
1950         }
1951         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1952         if (ret != PMINFO_R_OK) {
1953                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1954                 return -1;
1955         }
1956         printf("No of preload pkgs: %d\n", count);
1957         pkgmgrinfo_pkginfo_filter_destroy(handle);
1958         return 0;
1959 }
1960  * @endcode
1961  */
1962 int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle,
1963                 const char *property, const int value);
1964
1965 /**
1966  * @fn int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const char *value)
1967  * @brief       This API adds a string filter property to the filter handle
1968  *
1969  * @par         This API is for package-manager client application
1970  * @par Sync (or) Async : Synchronous API
1971  *
1972  * @param[in] handle            pointer to the package info filter handle.
1973  * @param[in] property          string property name.
1974  * @param[in] value             value corresponding to the property.
1975  * @return      0 if success, error code(<0) if fail
1976  * @retval      PMINFO_R_OK     success
1977  * @retval      PMINFO_R_EINVAL invalid argument
1978  * @retval      PMINFO_R_ERROR  internal error
1979  * @pre         pkgmgrinfo_pkginfo_filter_create()
1980  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1981  * @see         pkgmgrinfo_pkginfo_filter_count()
1982  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1983  * @code
1984 static int get_rpm_pkg_count()
1985 {
1986         int ret = 0;
1987         int count = 0;
1988         pkgmgrinfo_pkginfo_filter_h handle;
1989         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1990         if (ret != PMINFO_R_OK)
1991                 return -1;
1992         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1993         if (ret != PMINFO_R_OK) {
1994                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1995                 return -1;
1996         }
1997         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1998         if (ret != PMINFO_R_OK) {
1999                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2000                 return -1;
2001         }
2002         printf("No of rpm pkgs: %d\n", count);
2003         pkgmgrinfo_pkginfo_filter_destroy(handle);
2004         return 0;
2005 }
2006  * @endcode
2007  */
2008 int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle,
2009                 const char *property, const char *value);
2010
2011 /**
2012  * @fn int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle, pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data)
2013  * @brief       This API executes the user supplied callback function for each package that satisfy the filter conditions
2014  *
2015  * @par         This API is for package-manager client application
2016  * @par Sync (or) Async : Synchronous API
2017  *
2018  * @param[in] handle            pointer to the package info filter handle.
2019  * @param[in] pkg_cb            callback function.
2020  * @param[in] user_data         user data to be passed to the callback function
2021  * @return      0 if success, error code(<0) if fail
2022  * @retval      PMINFO_R_OK     success
2023  * @retval      PMINFO_R_EINVAL invalid argument
2024  * @retval      PMINFO_R_ERROR  internal error
2025  * @pre         pkgmgrinfo_pkginfo_filter_create()
2026  * @post                pkgmgrinfo_pkginfo_filter_destroy()
2027  * @see         pkgmgrinfo_pkginfo_filter_count()
2028  * @code
2029 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
2030 {
2031         char *pkgid = NULL;
2032         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
2033         printf("pkg id : %s\n", pkgid);
2034         return 0;
2035 }
2036
2037 static int get_rpm_pkg_list()
2038 {
2039         int ret = 0;
2040         pkgmgrinfo_pkginfo_filter_h handle;
2041         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2042         if (ret != PMINFO_R_OK)
2043                 return -1;
2044         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
2045         if (ret != PMINFO_R_OK) {
2046                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2047                 return -1;
2048         }
2049         ret = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(handle, pkg_list_cb, NULL);
2050         if (ret != PMINFO_R_OK) {
2051                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2052                 return -1;
2053         }
2054         pkgmgrinfo_pkginfo_filter_destroy(handle);
2055         return 0;
2056 }
2057  * @endcode
2058  */
2059 int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
2060                 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data);
2061 int pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
2062                 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data, uid_t uid);
2063
2064 /**
2065  * @fn int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count)
2066  * @fn int pkgmgrinfo_pkginfo_usr_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count, uid_t uid)
2067  * @brief       This API counts the package that satisfy the filter conditions
2068  *
2069  * @par         This API is for package-manager client application
2070  * @par Sync (or) Async : Synchronous API
2071  *
2072  * @param[in] handle            pointer to the package info filter handle.
2073  * @param[in] count             pointer to store the count value.
2074  * @param[in]   uid     the addressee user id of the instruction
2075  * @return      0 if success, error code(<0) if fail
2076  * @retval      PMINFO_R_OK     success
2077  * @retval      PMINFO_R_EINVAL invalid argument
2078  * @retval      PMINFO_R_ERROR  internal error
2079  * @pre         pkgmgrinfo_pkginfo_filter_create()
2080  * @post                pkgmgrinfo_pkginfo_filter_destroy()
2081  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
2082  * @code
2083 static int get_rpm_pkg_count()
2084 {
2085         int ret = 0;
2086         int count = 0;
2087         pkgmgrinfo_pkginfo_filter_h handle;
2088         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2089         if (ret != PMINFO_R_OK)
2090                 return -1;
2091         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
2092         if (ret != PMINFO_R_OK) {
2093                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2094                 return -1;
2095         }
2096         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
2097         if (ret != PMINFO_R_OK) {
2098                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2099                 return -1;
2100         }
2101         printf("No of rpm pkgs: %d\n", count);
2102         pkgmgrinfo_pkginfo_filter_destroy(handle);
2103         return 0;
2104 }
2105  * @endcode
2106  */
2107 int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count);
2108 int pkgmgrinfo_pkginfo_usr_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count, uid_t uid);
2109 /**
2110  * @fn  int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
2111                         pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
2112  * @brief       This API gets the list of privilege for a particular package
2113  *
2114  * @par         This API is for package-manager client application
2115  * @par Sync (or) Async : Synchronous API
2116  * @param[in]   handle          pointer to the package info handle.
2117  * @param[in]   privilege_func          callback function for list
2118  * @param[in] user_data user data to be passed to callback function
2119  * @return      0 if success, error code(<0) if fail
2120  * @retval      PMINFO_R_OK     success
2121  * @retval      PMINFO_R_EINVAL invalid argument
2122  * @retval      PMINFO_R_ERROR  internal error
2123  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2124  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2125  * @code
2126 int privilege_func(const char *name, void *user_data)
2127 {
2128         if (strcmp(name, (char *)user_data) == 0)
2129                 return -1;
2130         else
2131                 return 0;
2132 }
2133
2134 static int list_privilege(const char *package, char *privilege)
2135 {
2136         int ret = 0;
2137         pkgmgrinfo_pkginfo_h handle;
2138         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
2139         if (ret != PMINFO_R_OK)
2140                 return -1;
2141         ret = pkgmgrinfo_pkginfo_foreach_privilege(handle, privilege_func, (void *)privilege);
2142         if (ret != PMINFO_R_OK) {
2143                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2144                 return -1;
2145         }
2146         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2147         return 0;
2148 }
2149  * @endcode
2150  */
2151 int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
2152                         pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
2153
2154 /* TODO: add doxygen comment here */
2155 int pkgmgrinfo_pkginfo_get_size_from_xml(const char *manifest, int *size);
2156 int pkgmgrinfo_pkginfo_get_location_from_xml(const char *manifest, pkgmgrinfo_install_location *location);
2157 int pkgmgrinfo_pkginfo_is_for_all_users(pkgmgrinfo_pkginfo_h handle, bool *for_all_users);
2158 int pkgmgrinfo_appinfo_set_state_enabled(const char *appid, bool enabled);
2159 int pkgmgrinfo_appinfo_set_usr_state_enabled(const char *appid, bool enabled, uid_t uid);
2160 int pkgmgrinfo_appinfo_set_default_label(const char *appid, const char *label);
2161 int pkgmgrinfo_appinfo_set_usr_default_label(const char *appid, const char *label, uid_t uid);
2162
2163 /**
2164  * @fn  int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
2165  pkgmgrinfo_app_list_cb app_func, void *user_data)
2166  * @brief       This API gets list of installed applications for a particular package
2167  *
2168  * @par         This API is for package-manager client application
2169  * @par Sync (or) Async : Synchronous API
2170  * @param[in]   handle          package info handle
2171  * @param[in]   component       application component
2172  * @param[in]   app_func                iteration function for list
2173  * @param[in] user_data user data to be passed to callback function
2174  * @return      0 if success, error code(<0) if fail
2175  * @retval      PMINFO_R_OK     success
2176  * @retval      PMINFO_R_EINVAL invalid argument
2177  * @retval      PMINFO_R_ERROR  internal error
2178  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2179  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2180  * @code
2181 int app_func(pkgmgrinfo_appinfo_h handle, void *user_data)
2182 {
2183         char *appid = NULL;
2184         pkgmgrinfo_appinfo_get_appid(handle, &appid);
2185         printf("appid : %s\n", appid);
2186         return 0;
2187 }
2188
2189 static int list_apps(const char *pkgid)
2190 {
2191         int ret = 0;
2192         pkgmgrinfo_pkginfo_h handle;
2193         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2194         if (ret != PMINFO_R_OK)
2195                 return -1;
2196         ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, NULL);
2197         if (ret != PMINFO_R_OK) {
2198                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2199                 return -1;
2200         }
2201         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2202         return 0;
2203 }
2204  * @endcode
2205  */
2206 int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
2207                                                         pkgmgrinfo_app_list_cb app_func, void *user_data);
2208 int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
2209                                                         pkgmgrinfo_app_list_cb app_func, void *user_data, uid_t uid);
2210 /**
2211  * @fn  int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2212  * @brief       This API gets list of installed applications from all packages with  minimum informaion.
2213  *
2214  * @par         This API is for package-manager client application
2215  * @par Sync (or) Async : Synchronous API
2216  * @param[in]   app_func                iteration function for list
2217  * @param[in] user_data user data to be passed to callback function
2218  * @return      0 if success, error code(<0) if fail
2219  * @retval      PMINFO_R_OK     success
2220  * @retval      PMINFO_R_EINVAL invalid argument
2221  * @retval      PMINFO_R_ERROR  internal error
2222  * @pre         None
2223  * @post                None
2224  * @code
2225 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
2226 {
2227         char *pkgid1 = NULL;
2228         char *pkgid2 = NULL;
2229         pkgid1 = (char *)user_data;
2230         pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
2231         if (strcmp(pkgid1, pkgid2) == 0) {
2232                 return -1;
2233         } else {
2234                 return 0;
2235         }
2236 }
2237
2238 static int list_apps()
2239 {
2240         int ret = 0;
2241         char *name = "helloworld";
2242         ret = pkgmgrinfo_appinfo_get_install_list(app_list_cb, (void *)name);
2243         if (ret != PMINFO_R_OK) {
2244                 return -1;
2245         }
2246         return 0;
2247 }
2248  * @endcode
2249  */
2250 int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2251 int pkgmgrinfo_appinfo_get_usr_install_list(pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data);
2252 /**
2253  * @fn  int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2254  * @brief       This API gets list of installed applications from all packages.
2255  *
2256  * @par         This API is for package-manager client application
2257  * @par Sync (or) Async : Synchronous API
2258  * @param[in]   app_func                iteration function for list
2259  * @param[in] user_data user data to be passed to callback function
2260  * @return      0 if success, error code(<0) if fail
2261  * @retval      PMINFO_R_OK     success
2262  * @retval      PMINFO_R_EINVAL invalid argument
2263  * @retval      PMINFO_R_ERROR  internal error
2264  * @pre         None
2265  * @post                None
2266  * @code
2267 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
2268 {
2269         char *pkgid1 = NULL;
2270         char *pkgid2 = NULL;
2271         pkgid1 = (char *)user_data;
2272         pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
2273         if (strcmp(pkgid1, pkgid2) == 0) {
2274                 return -1;
2275         } else {
2276                 return 0;
2277         }
2278 }
2279
2280 static int list_apps()
2281 {
2282         int ret = 0;
2283         char *name = "helloworld";
2284         ret = pkgmgrinfo_appinfo_get_installed_list(app_list_cb, (void *)name);
2285         if (ret != PMINFO_R_OK) {
2286                 return -1;
2287         }
2288         return 0;
2289 }
2290  * @endcode
2291  */
2292 int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2293 int pkgmgrinfo_appinfo_get_usr_installed_list(pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data);
2294
2295 /**
2296  * @fn int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
2297  * @brief       This API creates the application information handle from db
2298  *
2299  * @par         This API is for package-manager client application
2300  * @par Sync (or) Async : Synchronous API
2301  *
2302  * @param[in]   appid   pointer to appid
2303  * @param[out] handle           pointer to the application info handle.
2304  * @return      0 if success, error code(<0) if fail
2305  * @retval      PMINFO_R_OK     success
2306  * @retval      PMINFO_R_EINVAL invalid argument
2307  * @retval      PMINFO_R_ERROR  internal error
2308  * @pre         None
2309  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2310  * @see         pkgmgrinfo_appinfo_get_pkgid()
2311  * @see         pkgmgrinfo_appinfo_is_multiple()
2312  * @code
2313 static int get_app_type(const char *appid)
2314 {
2315         int ret = 0;
2316         char *type = NULL;
2317         pkgmgrinfo_appinfo_h handle;
2318         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2319         if (ret != PMINFO_R_OK)
2320                 return -1;
2321         ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
2322         if (ret != PMINFO_R_OK) {
2323                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2324                 return -1;
2325         }
2326         printf("apptype: %s\n", type);
2327         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2328         return 0;
2329 }
2330  * @endcode
2331  */
2332 int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
2333 int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid, pkgmgrinfo_appinfo_h *handle);
2334 /**
2335  * @fn int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
2336  * @brief       This API gets the application ID
2337  *
2338  * @par         This API is for package-manager client application
2339  * @par Sync (or) Async : Synchronous API
2340  *
2341  * @param[in] handle            pointer to the application info handle.
2342  * @param[out] appid            pointer to hold appid
2343  * @return      0 if success, error code(<0) if fail
2344  * @retval      PMINFO_R_OK     success
2345  * @retval      PMINFO_R_EINVAL invalid argument
2346  * @retval      PMINFO_R_ERROR  internal error
2347  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2348  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2349  * @see         pkgmgrinfo_appinfo_get_pkgid()
2350  * @see         pkgmgrinfo_appinfo_is_multiple()
2351  * @code
2352 static int get_app_id(const char *appid)
2353 {
2354         int ret = 0;
2355         char *app_id = NULL;
2356         pkgmgrinfo_appinfo_h handle;
2357         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2358         if (ret != PMINFO_R_OK)
2359                 return -1;
2360         ret = pkgmgrinfo_appinfo_get_appid(handle, &app_id);
2361         if (ret != PMINFO_R_OK) {
2362                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2363                 return -1;
2364         }
2365         printf("app id: %s\n", app_id);
2366         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2367         return 0;
2368 }
2369  * @endcode
2370  */
2371 int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h  handle, char **appid);
2372
2373 /**
2374  * @fn int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name)
2375  * @brief       This API gets the package name of the application
2376  *
2377  * @par         This API is for package-manager client application
2378  * @par Sync (or) Async : Synchronous API
2379  *
2380  * @param[in] handle            pointer to the application info handle.
2381  * @param[out] pkg_name         pointer to hold package name
2382  * @return      0 if success, error code(<0) if fail
2383  * @retval      PMINFO_R_OK     success
2384  * @retval      PMINFO_R_EINVAL invalid argument
2385  * @retval      PMINFO_R_ERROR  internal error
2386  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2387  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2388  * @see         pkgmgrinfo_appinfo_get_appid()
2389  * @see         pkgmgrinfo_appinfo_is_multiple()
2390  * @code
2391 static int get_app_pkgname(const char *appid)
2392 {
2393         int ret = 0;
2394         char *pkgname = NULL;
2395         pkgmgrinfo_appinfo_h handle;
2396         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2397         if (ret != PMINFO_R_OK)
2398                 return -1;
2399         ret = pkgmgrinfo_appinfo_get_pkgname(handle, &pkgname);
2400         if (ret != PMINFO_R_OK) {
2401                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2402                 return -1;
2403         }
2404         printf("pkg name: %s\n", pkgname);
2405         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2406         return 0;
2407 }
2408  * @endcode
2409  */
2410 int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h  handle, char **pkg_name);
2411
2412 /**
2413  * @fn int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
2414  * @brief       This API gets the package id of the application
2415  *
2416  * @par         This API is for package-manager client application
2417  * @par Sync (or) Async : Synchronous API
2418  *
2419  * @param[in] handle            pointer to the application info handle.
2420  * @param[out] pkgid            pointer to hold package id
2421  * @return      0 if success, error code(<0) if fail
2422  * @retval      PMINFO_R_OK     success
2423  * @retval      PMINFO_R_EINVAL invalid argument
2424  * @retval      PMINFO_R_ERROR  internal error
2425  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2426  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2427  * @see         pkgmgrinfo_appinfo_get_appid()
2428  * @see         pkgmgrinfo_appinfo_is_multiple()
2429  * @code
2430 static int get_app_pkgid(const char *appid)
2431 {
2432         int ret = 0;
2433         char *pkgid = NULL;
2434         pkgmgrinfo_appinfo_h handle;
2435         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2436         if (ret != PMINFO_R_OK)
2437                 return -1;
2438         ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
2439         if (ret != PMINFO_R_OK) {
2440                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2441                 return -1;
2442         }
2443         printf("pkg id: %s\n", pkgid);
2444         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2445         return 0;
2446 }
2447  * @endcode
2448  */
2449 int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h  handle, char **pkgid);
2450
2451 /**
2452  * @fn int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec)
2453  * @brief       This API gets the executable name of the application
2454  *
2455  * @par         This API is for package-manager client application
2456  * @par Sync (or) Async : Synchronous API
2457  *
2458  * @param[in] handle            pointer to the application info handle.
2459  * @param[out] exec             pointer to hold app exec name
2460  * @return      0 if success, error code(<0) if fail
2461  * @retval      PMINFO_R_OK     success
2462  * @retval      PMINFO_R_EINVAL invalid argument
2463  * @retval      PMINFO_R_ERROR  internal error
2464  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2465  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2466  * @see         pkgmgrinfo_appinfo_get_appid()
2467  * @see         pkgmgrinfo_appinfo_is_multiple()
2468  * @code
2469 static int get_app_exec(const char *appid)
2470 {
2471         int ret = 0;
2472         char *exec = NULL;
2473         pkgmgrinfo_appinfo_h handle;
2474         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2475         if (ret != PMINFO_R_OK)
2476                 return -1;
2477         ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
2478         if (ret != PMINFO_R_OK) {
2479                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2480                 return -1;
2481         }
2482         printf("exec name: %s\n", exec);
2483         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2484         return 0;
2485 }
2486  * @endcode
2487  */
2488 int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h  handle, char **exec);
2489
2490 /**
2491  * @fn int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
2492  * @brief       This API gets the icon name of the application
2493  *
2494  * @par         This API is for package-manager client application
2495  * @par Sync (or) Async : Synchronous API
2496  *
2497  * @param[in] handle            pointer to the application info handle.
2498  * @param[out] icon             pointer to hold app icon name
2499  * @return      0 if success, error code(<0) if fail
2500  * @retval      PMINFO_R_OK     success
2501  * @retval      PMINFO_R_EINVAL invalid argument
2502  * @retval      PMINFO_R_ERROR  internal error
2503  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2504  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2505  * @see         pkgmgrinfo_appinfo_get_appid()
2506  * @see         pkgmgrinfo_appinfo_is_multiple()
2507  * @code
2508 static int get_app_icon(const char *appid)
2509 {
2510         int ret = 0;
2511         char *icon = NULL;
2512         pkgmgrinfo_appinfo_h handle;
2513         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2514         if (ret != PMINFO_R_OK)
2515                 return -1;
2516         ret = pkgmgrinfo_appinfo_get_icon(handle, &icon);
2517         if (ret != PMINFO_R_OK) {
2518                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2519                 return -1;
2520         }
2521         printf("icon name: %s\n", icon);
2522         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2523         return 0;
2524 }
2525  * @endcode
2526  */
2527 int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
2528
2529 /**
2530  * @fn int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
2531  * @brief       This API gets the label of the application
2532  *
2533  * @par         This API is for package-manager client application
2534  * @par Sync (or) Async : Synchronous API
2535  *
2536  * @param[in] handle            pointer to the application info handle.
2537  * @param[out] label            pointer to hold app label
2538  * @return      0 if success, error code(<0) if fail
2539  * @retval      PMINFO_R_OK     success
2540  * @retval      PMINFO_R_EINVAL invalid argument
2541  * @retval      PMINFO_R_ERROR  internal error
2542  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2543  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2544  * @see         pkgmgrinfo_appinfo_get_appid()
2545  * @see         pkgmgrinfo_appinfo_is_multiple()
2546  * @code
2547 static int get_app_label(const char *appid)
2548 {
2549         int ret = 0;
2550         char *label = NULL;
2551         pkgmgrinfo_appinfo_h handle;
2552         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2553         if (ret != PMINFO_R_OK)
2554                 return -1;
2555         ret = pkgmgrinfo_appinfo_get_label(handle, &label);
2556         if (ret != PMINFO_R_OK) {
2557                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2558                 return -1;
2559         }
2560         printf("label : %s\n", label);
2561         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2562         return 0;
2563 }
2564  * @endcode
2565  */
2566 int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h  handle, char **label);
2567
2568 /**
2569  * @fn int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
2570  * @brief       This API gets exactly matched label by given appid and locale
2571  *
2572  * @par         This API is for package-manager client application
2573  * @par Sync (or) Async : Synchronous API
2574  *
2575  * @param[in]   appid   pointer to appid
2576  * @param[in]   locale  pointer to locale
2577  * @param[out] label            pointer to hold app label
2578  * @return      0 if success, error code(<0) if fail
2579  * @retval      PMINFO_R_OK     success
2580  * @retval      PMINFO_R_EINVAL invalid argument
2581  * @retval      PMINFO_R_ERROR  internal error
2582  * @code
2583 static int get_localed_label(const char *appid, const char *locale)
2584 {
2585         int ret = 0;
2586         char *label = NULL;
2587
2588         ret = pkgmgrinfo_appinfo_get_localed_label(appid, locale, &label);
2589         if (ret != PMINFO_R_OK)
2590                 return -1;
2591
2592         printf("localed label: %s\n", label);
2593
2594         free(label);
2595
2596         return 0;
2597 }
2598  * @endcode
2599  */
2600 int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label);
2601 int pkgmgrinfo_appinfo_usr_get_localed_label(const char *appid, const char *locale, uid_t uid, char **label);
2602
2603 /**
2604  * @fn int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
2605  * @brief       This API gets the component of the application
2606  *
2607  * @par         This API is for package-manager client application
2608  * @par Sync (or) Async : Synchronous API
2609  *
2610  * @param[in] handle            pointer to the application info handle.
2611  * @param[out] component                pointer to hold app component
2612  * @return      0 if success, error code(<0) if fail
2613  * @retval      PMINFO_R_OK     success
2614  * @retval      PMINFO_R_EINVAL invalid argument
2615  * @retval      PMINFO_R_ERROR  internal error
2616  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2617  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2618  * @see         pkgmgrinfo_appinfo_get_appid()
2619  * @see         pkgmgrinfo_appinfo_is_multiple()
2620  * @code
2621 static int get_app_component(const char *appid)
2622 {
2623         int ret = 0;
2624         pkgmgrinfo_app_component component;
2625         pkgmgrinfo_appinfo_h handle;
2626         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2627         if (ret != PMINFO_R_OK)
2628                 return -1;
2629         ret = pkgmgrinfo_appinfo_get_component(handle, &component);
2630         if (ret != PMINFO_R_OK) {
2631                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2632                 return -1;
2633         }
2634         printf("component : %s\n", component);
2635         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2636         return 0;
2637 }
2638  * @endcode
2639  */
2640 int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_component *component);
2641
2642 /**
2643  * @fn int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
2644  * @brief       This API gets the apptype of the application
2645  *
2646  * @par         This API is for package-manager client application
2647  * @par Sync (or) Async : Synchronous API
2648  *
2649  * @param[in] handle            pointer to the application info handle.
2650  * @param[out] app_type         pointer to hold apptype
2651  * @return      0 if success, error code(<0) if fail
2652  * @retval      PMINFO_R_OK     success
2653  * @retval      PMINFO_R_EINVAL invalid argument
2654  * @retval      PMINFO_R_ERROR  internal error
2655  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2656  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2657  * @see         pkgmgrinfo_appinfo_get_appid()
2658  * @see         pkgmgrinfo_appinfo_is_multiple()
2659  * @code
2660 static int get_app_type(const char *appid)
2661 {
2662         int ret = 0;
2663         char *apptype = NULL;
2664         pkgmgrinfo_appinfo_h handle;
2665         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2666         if (ret != PMINFO_R_OK)
2667                 return -1;
2668         ret = pkgmgrinfo_appinfo_get_apptype(handle, &apptype);
2669         if (ret != PMINFO_R_OK) {
2670                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2671                 return -1;
2672         }
2673         printf("apptype : %s\n", apptype);
2674         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2675         return 0;
2676 }
2677  * @endcode
2678  */
2679 int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h  handle, char **app_type);
2680
2681 /**
2682  * @fn int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
2683                                                                                 int *operation_count, char ***operation)
2684  * @brief       This API gets the list of operation of the application
2685  *
2686  * @par         This API is for package-manager client application
2687  * @par Sync (or) Async : Synchronous API
2688  *
2689  * @param[in] handle            pointer to the appcontrol handle.
2690  * @param[out] operation_count          pointer to hold number of operations
2691  * @param[out] operation                pointer to hold list of operations
2692  * @return      0 if success, error code(<0) if fail
2693  * @retval      PMINFO_R_OK     success
2694  * @retval      PMINFO_R_EINVAL invalid argument
2695  * @retval      PMINFO_R_ERROR  internal error
2696  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2697  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2698  * @see         pkgmgrinfo_appinfo_get_uri()
2699  * @see         pkgmgrinfo_appinfo_get_mime()
2700  * @code
2701 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2702 {
2703         int oc = 0;
2704         int i = 0;
2705         char **operation;
2706         pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
2707         for (i = 0; i < oc; i++) {
2708                 if (strcmp(operation[i], (char *)user_data) == 0)
2709                         return -1;
2710                 else
2711                         return 0;
2712         }
2713 }
2714
2715 static int check_operation(const char *appid, char *operation)
2716 {
2717         int ret = 0;
2718         pkgmgrinfo_appinfo_h handle;
2719         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2720         if (ret != PMINFO_R_OK)
2721                 return -1;
2722         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
2723         if (ret != PMINFO_R_OK) {
2724                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2725                 return -1;
2726         }
2727         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2728         return 0;
2729 }
2730  * @endcode
2731  */
2732 int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
2733                                                                                 int *operation_count, char ***operation);
2734
2735 /**
2736  * @fn int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
2737                                                                                 int *uri_count, char ***uri)
2738  * @brief       This API gets the list of uri of the application
2739  *
2740  * @par         This API is for package-manager client application
2741  * @par Sync (or) Async : Synchronous API
2742  *
2743  * @param[in] handle            pointer to the appcontrol handle.
2744  * @param[out] uri_count                pointer to hold number of uris
2745  * @param[out] uri              pointer to hold list of uris
2746  * @return      0 if success, error code(<0) if fail
2747  * @retval      PMINFO_R_OK     success
2748  * @retval      PMINFO_R_EINVAL invalid argument
2749  * @retval      PMINFO_R_ERROR  internal error
2750  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2751  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2752  * @see         pkgmgrinfo_appinfo_get_operation()
2753  * @see         pkgmgrinfo_appinfo_get_mime()
2754  * @code
2755 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2756 {
2757         int uc = 0;
2758         int i = 0;
2759         char **uri;
2760         pkgmgrinfo_appinfo_get_uri(handle, &uc, &uri);
2761         for (i = 0; i < uc; i++) {
2762                 if (strcmp(uri[i], (char *)user_data) == 0)
2763                         return -1;
2764                 else
2765                         return 0;
2766         }
2767 }
2768
2769 static int check_uri(const char *appid, char *uri)
2770 {
2771         int ret = 0;
2772         pkgmgrinfo_appinfo_h handle;
2773         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2774         if (ret != PMINFO_R_OK)
2775                 return -1;
2776         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)uri);
2777         if (ret != PMINFO_R_OK) {
2778                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2779                 return -1;
2780         }
2781         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2782         return 0;
2783 }
2784  * @endcode
2785  */
2786 int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
2787                                                                                 int *uri_count, char ***uri);
2788
2789 /**
2790  * @fn int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
2791                                                                                 int *mime_count, char ***mime)
2792  * @brief       This API gets the list of mime of the application
2793  *
2794  * @par         This API is for package-manager client application
2795  * @par Sync (or) Async : Synchronous API
2796  *
2797  * @param[in] handle            pointer to the appcontrol handle.
2798  * @param[out] mime_count               pointer to hold number of mimes
2799  * @param[out] mime             pointer to hold list of mimes
2800  * @return      0 if success, error code(<0) if fail
2801  * @retval      PMINFO_R_OK     success
2802  * @retval      PMINFO_R_EINVAL invalid argument
2803  * @retval      PMINFO_R_ERROR  internal error
2804  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2805  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2806  * @see         pkgmgrinfo_appinfo_get_uri()
2807  * @see         pkgmgrinfo_appinfo_get_operation()
2808  * @code
2809 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2810 {
2811         int mc = 0;
2812         int i = 0;
2813         char **mime;
2814         pkgmgrinfo_appinfo_get_operation(handle, &mc, &mime);
2815         for (i = 0; i < mc; i++) {
2816                 if (strcmp(mime[i], (char *)user_data) == 0)
2817                         return -1;
2818                 else
2819                         return 0;
2820         }
2821 }
2822
2823 static int check_mime(const char *appid, char *mime)
2824 {
2825         int ret = 0;
2826         pkgmgrinfo_appinfo_h handle;
2827         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2828         if (ret != PMINFO_R_OK)
2829                 return -1;
2830         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)mime);
2831         if (ret != PMINFO_R_OK) {
2832                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2833                 return -1;
2834         }
2835         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2836         return 0;
2837 }
2838  * @endcode
2839  */
2840 int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
2841                                                                                 int *mime_count, char ***mime);
2842
2843 /**
2844  * @fn int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
2845                                                                                 int *subapp_count, char ***subapp)
2846  * @brief       This API gets the list of subapp of the application
2847  *
2848  * @par         This API is for package-manager client application
2849  * @par Sync (or) Async : Synchronous API
2850  *
2851  * @param[in] handle            pointer to the appcontrol handle.
2852  * @param[out] subapp_count             pointer to hold number of subapp
2853  * @param[out] subapp           pointer to hold list of subapp
2854  * @return      0 if success, error code(<0) if fail
2855  * @retval      PMINFO_R_OK     success
2856  * @retval      PMINFO_R_EINVAL invalid argument
2857  * @retval      PMINFO_R_ERROR  internal error
2858  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2859  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2860  * @see         pkgmgrinfo_appinfo_get_uri()
2861  * @see         pkgmgrinfo_appinfo_get_operation()
2862  * @code
2863 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2864 {
2865         int sc = 0;
2866         int i = 0;
2867         char **subapp = NULL;
2868         pkgmgrinfo_appinfo_get_subapp(handle, &sc, &subapp);
2869         for (i = 0; i < sc; i++) {
2870                 if (strcmp(subapp[i], (char *)user_data) == 0)
2871                         return -1;
2872                 else
2873                         return 0;
2874         }
2875 }
2876
2877 static int check_subapp(const char *appid, char *subapp)
2878 {
2879         int ret = 0;
2880         pkgmgrinfo_appinfo_h handle = NULL;
2881         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2882         if (ret != PMINFO_R_OK)
2883                 return -1;
2884         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)subapp);
2885         if (ret != PMINFO_R_OK) {
2886                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2887                 return -1;
2888         }
2889         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2890         return 0;
2891 }
2892  * @endcode
2893  */
2894 int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
2895                                                 int *subapp_count, char ***subapp);
2896
2897 /**
2898  * @fn int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
2899  * @brief       This API gets the notification icon of the application
2900  *
2901  * @par         This API is for package-manager client application
2902  * @par Sync (or) Async : Synchronous API
2903  *
2904  * @param[in] handle            pointer to the application info handle.
2905  * @param[out] path             pointer to hold notification icon
2906  * @return      0 if success, error code(<0) if fail
2907  * @retval      PMINFO_R_OK     success
2908  * @retval      PMINFO_R_EINVAL invalid argument
2909  * @retval      PMINFO_R_ERROR  internal error
2910  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2911  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2912  * @see         pkgmgrinfo_appinfo_get_appid()
2913  * @see         pkgmgrinfo_appinfo_is_multiple()
2914  * @code
2915 static int get_app_notification_icon(const char *appid)
2916 {
2917         int ret = 0;
2918         char *notification_icon = NULL;
2919         pkgmgrinfo_appinfo_h handle;
2920         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2921         if (ret != PMINFO_R_OK)
2922                 return -1;
2923         ret = pkgmgrinfo_appinfo_get_notification_icon(handle, &notification_icon);
2924         if (ret != PMINFO_R_OK) {
2925                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2926                 return -1;
2927         }
2928         printf("notification icon : %s\n", notification_icon);
2929         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2930         return 0;
2931 }
2932  * @endcode
2933  */
2934 int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
2935
2936 /**
2937  * @fn int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon)
2938  * @brief       This API gets the setting icon of the application
2939  *
2940  * @par         This API is for package-manager client application
2941  * @par Sync (or) Async : Synchronous API
2942  *
2943  * @param[in] handle            pointer to the application info handle.
2944  * @param[out] path             pointer to hold setting icon
2945  * @return      0 if success, error code(<0) if fail
2946  * @retval      PMINFO_R_OK     success
2947  * @retval      PMINFO_R_EINVAL invalid argument
2948  * @retval      PMINFO_R_ERROR  internal error
2949  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2950  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2951  * @see         pkgmgrinfo_appinfo_get_appid()
2952  * @see         pkgmgrinfo_appinfo_is_multiple()
2953  * @code
2954 static int get_app_setting_icon(const char *appid)
2955 {
2956         int ret = 0;
2957         char *setting_icon = NULL;
2958         pkgmgrinfo_appinfo_h handle;
2959         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2960         if (ret != PMINFO_R_OK)
2961                 return -1;
2962         ret = pkgmgrinfo_appinfo_get_setting_icon(handle, &setting_icon);
2963         if (ret != PMINFO_R_OK) {
2964                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2965                 return -1;
2966         }
2967         printf("setting icon : %s\n", setting_icon);
2968         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2969         return 0;
2970 }
2971  * @endcode
2972  */
2973 int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
2974
2975 /**
2976  * @fn int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
2977  * @brief       This API gets the type of recent image on app-tray
2978  *
2979  * @par         This API is for package-manager client application
2980  * @par Sync (or) Async : Synchronous API
2981  *
2982  * @param[in] handle            pointer to the application info handle.
2983  * @param[out] type             pointer to hold image type
2984  * @return      0 if success, error code(<0) if fail
2985  * @retval      PMINFO_R_OK     success
2986  * @retval      PMINFO_R_EINVAL invalid argument
2987  * @retval      PMINFO_R_ERROR  internal error
2988  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2989  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2990  * @see         pkgmgrinfo_appinfo_get_appid()
2991  * @see         pkgmgrinfo_appinfo_is_multiple()
2992  * @code
2993 static int get_app_recent_image_type(const char *appid)
2994 {
2995         int ret = 0;
2996         pkgmgrinfo_app_recentimage type;
2997         pkgmgrinfo_appinfo_h handle;
2998         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2999         if (ret != PMINFO_R_OK)
3000                 return -1;
3001         ret = pkgmgrinfo_appinfo_get_recent_image_type(handle, &type);
3002         if (ret != PMINFO_R_OK) {
3003                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3004                 return -1;
3005         }
3006         printf("recent image type: %d\n", type);
3007         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3008         return 0;
3009 }
3010  * @endcode
3011  */
3012 int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_recentimage *type);
3013
3014
3015 /**
3016  * @fn int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h  handle, char **preview_img)
3017  * @brief       This API gets the preview image of application
3018  *
3019  * @par Sync (or) Async : Synchronous API
3020  *
3021  * @param[in] handle            pointer to the application info handle.
3022  * @param[out] preview_img              pointer to hold preview image path
3023  * @return      0 if success, error code(<0) if fail
3024  * @retval      PMINFO_R_OK     success
3025  * @retval      PMINFO_R_EINVAL invalid argument
3026  * @retval      PMINFO_R_ERROR  internal error
3027  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3028  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3029  * @see         pkgmgrinfo_appinfo_get_appid()
3030  * @code
3031 static int get_app_previewimage(const char *appid)
3032 {
3033         int ret = 0;
3034         char *preview = NULL;
3035         pkgmgrinfo_appinfo_h handle = NULL;
3036         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3037         if (ret != PMINFO_R_OK)
3038                 return -1;
3039         ret = pkgmgrinfo_appinfo_get_preview_image(handle, &preview);
3040         if (ret != PMINFO_R_OK) {
3041                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3042                 return -1;
3043         }
3044         printf("preview image path : %s\n", preview);
3045         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3046         return 0;
3047 }
3048  * @endcode
3049  */
3050 int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h  handle, char **preview_img);
3051
3052
3053 /**
3054  * @fn int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
3055  * @brief       This API gets the package permission type of the application
3056  *
3057  * @par         This API is for package-manager client application
3058  * @par Sync (or) Async : Synchronous API
3059  *
3060  * @param[in] handle            pointer to the application info handle.
3061  * @param[out] permission               pointer to hold package permission
3062  * @return      0 if success, error code(<0) if fail
3063  * @retval      PMINFO_R_OK     success
3064  * @retval      PMINFO_R_EINVAL invalid argument
3065  * @retval      PMINFO_R_ERROR  internal error
3066  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3067  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3068  * @see         pkgmgrinfo_appinfo_get_appid()
3069  * @code
3070 static int get_app_permission(const char *appid)
3071 {
3072         int ret = 0;
3073         pkgmgrinfo_permission_type permission = 0;
3074         pkgmgrinfo_appinfo_h handle;
3075
3076         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3077         if (ret != PMINFO_R_OK)
3078                 return -1;
3079         ret = pkgmgrinfo_appinfo_get_permission_type(handle, &permission);
3080         if (ret != PMINFO_R_OK) {
3081                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3082                 return -1;
3083         }
3084         printf("permission type: %d\n", permission);
3085         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3086         return 0;
3087 }
3088  * @endcode
3089  */
3090 int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission);
3091
3092 /**
3093  * @fn int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
3094  * @brief       This API gets the component_type
3095  *
3096  * @par         This API is for package-manager client application
3097  * @par Sync (or) Async : Synchronous API
3098  *
3099  * @param[in] handle            pointer to the application info handle.
3100  * @param[out] component_type           pointer to hold component_type
3101  * @return      0 if success, error code(<0) if fail
3102  * @retval      PMINFO_R_OK     success
3103  * @retval      PMINFO_R_EINVAL invalid argument
3104  * @retval      PMINFO_R_ERROR  internal error
3105  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3106  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3107  * @see         pkgmgrinfo_appinfo_get_pkgid()
3108  * @see         pkgmgrinfo_appinfo_is_multiple()
3109  * @code
3110 static int get_component_type(const char *appid)
3111 {
3112         int ret = 0;
3113         char *component_type = NULL;
3114         pkgmgrinfo_appinfo_h handle;
3115         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3116         if (ret != PMINFO_R_OK)
3117                 return -1;
3118         ret = pkgmgrinfo_appinfo_get_component_type(handle, &component_type);
3119         if (ret != PMINFO_R_OK) {
3120                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3121                 return -1;
3122         }
3123         printf("component_type: %s\n", component_type);
3124         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3125         return 0;
3126 }
3127  * @endcode
3128  */
3129 int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h  handle, char **component_type);
3130
3131 /**
3132  * @fn int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
3133  * @brief       This API gets the application 'hwacceleration' value from the app ID
3134  *
3135  * @par         This API is for package-manager client application
3136  * @par Sync (or) Async : Synchronous API
3137  *
3138  * @param[in]   handle  pointer to application info handle
3139  * @param[out] hwacceleration           pointer to hold package hwacceleration value
3140  * @return      0 if success, error code(<0) if fail
3141  * @retval      PMINFO_R_OK     success
3142  * @retval      PMINFO_R_EINVAL invalid argument
3143  * @retval      PMINFO_R_ERROR  internal error
3144  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3145  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3146  * @see         pkgmgrinfo_appinfo_get_appid()
3147  * @see         pkgmgrinfo_appinfo_is_multiple()
3148  * @code
3149 static int get_app_hwacceleration(const char *appid)
3150 {
3151         int ret = 0;
3152         pkgmgrinfo_app_hwacceleration hwacceleration;
3153         pkgmgrinfo_appinfo_h handle;
3154         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3155         if (ret != PMINFO_R_OK)
3156                 return -1;
3157         ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacceleration);
3158         if (ret != PMINFO_R_OK) {
3159                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3160                 return -1;
3161         }
3162         printf("app hwacceleration: %d\n", hwacceleration);
3163         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3164         return 0;
3165 }
3166  * @endcode
3167  */
3168 int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_hwacceleration *hwacceleration);
3169
3170 /**
3171  * @fn int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader)
3172  * @brief       This API gets the application 'screenreader' value from the app ID
3173  *
3174  * @par         This API is for package-manager client application
3175  * @par Sync (or) Async : Synchronous API
3176  *
3177  * @param[in]   handle  pointer to application info handle
3178  * @param[out] screenreader             pointer to hold package accessibility value
3179  * @return      0 if success, error code(<0) if fail
3180  * @retval      PMINFO_R_OK     success
3181  * @retval      PMINFO_R_EINVAL invalid argument
3182  * @retval      PMINFO_R_ERROR  internal error
3183  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3184  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3185  * @see         pkgmgrinfo_appinfo_get_appid()
3186  * @see         pkgmgrinfo_appinfo_is_multiple()
3187  * @code
3188 static int get_app_screenreader(const char *appid)
3189 {
3190         int ret = 0;
3191         pkgmgrinfo_app_screenreader screenreader = PMINFO_USE_SYSTEM_SETTING;
3192         pkgmgrinfo_appinfo_h handle = NULL;
3193         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3194         if (ret != PMINFO_R_OK)
3195                 return -1;
3196         ret = pkgmgrinfo_appinfo_get_screenreader(handle, &screenreader);
3197         if (ret != PMINFO_R_OK) {
3198                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3199                 return -1;
3200         }
3201         printf("app screenreader: %d\n", screenreader);
3202         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3203         return 0;
3204 }
3205  * @endcode
3206  */
3207 int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader);
3208
3209 /**
3210  * @fn int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img)
3211  * @brief       This API gets the application's landscape & portrait effect images
3212  *
3213  * @par         This API is for package-manager client application
3214  * @par Sync (or) Async : Synchronous API
3215  *
3216  * @param[in]   handle  pointer to application info handle
3217  * @param[out]  portrait_img contains portrait mode effect image
3218  * @param[out]  landscape_img contains landscape mode effect image
3219  * @return      0 if success, error code(<0) if fail
3220  * @retval      PMINFO_R_OK     success
3221  * @retval      PMINFO_R_EINVAL invalid argument
3222  * @retval      PMINFO_R_ERROR  internal error
3223  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3224  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3225  * @see         pkgmgrinfo_appinfo_get_appid()
3226  * @see         pkgmgrinfo_appinfo_is_nodisplay()
3227  * @code
3228 static int get_app_effectimages(const char *appid)
3229 {
3230         int ret = 0;
3231         char *portraitimg = NULL;
3232         char *landscapeimg = NULL;
3233         pkgmgrinfo_appinfo_h handle;
3234         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3235         if (ret != PMINFO_R_OK)
3236                 return -1;
3237         ret = pkgmgrinfo_appinfo_get_effectimage(handle, &portraitimg, &landscapeimg);
3238         if (ret != PMINFO_R_OK) {
3239                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3240                 return -1;
3241         }
3242         printf("app effect image portrait: %s, app effect image landscape : %s\n", portraitimg, landscapeimg);
3243         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3244         return 0;
3245 }
3246  * @endcode
3247  */
3248 int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img);
3249
3250 /**
3251  * @fn int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h handle, char **submode_mainid)
3252  * @brief       This API gets the submode_mainid of the application
3253  *
3254  * @par         This API is for package-manager client application
3255  * @par Sync (or) Async : Synchronous API
3256  *
3257  * @param[in] handle            pointer to the application info handle.
3258  * @param[out] submode_mainid           pointer to hold package name
3259  * @return      0 if success, error code(<0) if fail
3260  * @retval      PMINFO_R_OK     success
3261  * @retval      PMINFO_R_EINVAL invalid argument
3262  * @retval      PMINFO_R_ERROR  internal error
3263  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3264  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3265  * @see         pkgmgrinfo_appinfo_get_appid()
3266  * @see         pkgmgrinfo_appinfo_is_multiple()
3267  * @code
3268 static int get_app_submode_mainid(const char *appid)
3269 {
3270         int ret = 0;
3271         char *submode_mainid = NULL;
3272         pkgmgrinfo_appinfo_h handle = NULL;
3273         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3274         if (ret != PMINFO_R_OK)
3275                 return -1;
3276         ret = pkgmgrinfo_appinfo_get_submode_mainid(handle, &submode_mainid);
3277         if (ret != PMINFO_R_OK) {
3278                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3279                 return -1;
3280         }
3281         printf("submode_mainid: %s\n", submode_mainid);
3282         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3283         return 0;
3284 }
3285  * @endcode
3286  */
3287 int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char **submode_mainid);
3288
3289 /**
3290  * @fn int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid, const char *type, char **appid, char **access);
3291  * @brief       This API gets the datacontrol info
3292  *
3293  * @par         This API is for package-manager client application
3294  * @par Sync (or) Async : Synchronous API
3295  *
3296  * @param[in] providerid                pointer to the providerid of dataconltrol.
3297  * @param[in] type                      pointer to the type of dataconltrol.
3298  * @param[out] appid                    pointer to hold appid, need to free after using
3299  * @param[out] access                   pointer to hold access, need to free after using
3300  * @return      0 if success, error code(<0) if fail
3301  * @retval      PMINFO_R_OK     success
3302  * @retval      PMINFO_R_EINVAL invalid argument
3303  * @retval      PMINFO_R_ERROR  internal error
3304  * @endcode
3305  */
3306 int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid, const char *type, char **appid, char **access);
3307 int pkgmgrinfo_appinfo_usr_get_datacontrol_info(const char *providerid, const char *type, uid_t uid, char **appid, char **access);
3308
3309 /**
3310  * @fn int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid);
3311  * @brief       This API gets the appid of datacontrol
3312  *
3313  * @par         This API is for package-manager client application
3314  * @par Sync (or) Async : Synchronous API
3315  *
3316  * @param[in] providerid                pointer to the providerid of dataconltrol.
3317  * @param[out] appid                    pointer to hold appid, need to free after using
3318  * @return      0 if success, error code(<0) if fail
3319  * @retval      PMINFO_R_OK     success
3320  * @retval      PMINFO_R_EINVAL invalid argument
3321  * @retval      PMINFO_R_ERROR  internal error
3322  * @endcode
3323  */
3324 int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid);
3325 int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid, uid_t uid, char **appid);
3326
3327 /**
3328  * @fn  int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
3329                         pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
3330  * @brief       This API gets the list of permission for a particular application
3331  *
3332  * @par         This API is for package-manager client application
3333  * @par Sync (or) Async : Synchronous API
3334  * @param[in]   handle          pointer to the application info handle.
3335  * @param[in]   permission_func         callback function for list
3336  * @param[in] user_data user data to be passed to callback function
3337  * @return      0 if success, error code(<0) if fail
3338  * @retval      PMINFO_R_OK     success
3339  * @retval      PMINFO_R_EINVAL invalid argument
3340  * @retval      PMINFO_R_ERROR  internal error
3341  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3342  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3343  * @code
3344 int permission_func(const char *name, void *user_data)
3345 {
3346         if (strcmp(name, (char *)user_data) == 0)
3347                 return -1;
3348         else
3349                 return 0;
3350 }
3351
3352 static int list_permission(const char *appid, char *permission)
3353 {
3354         int ret = 0;
3355         pkgmgrinfo_appinfo_h handle;
3356         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3357         if (ret != PMINFO_R_OK)
3358                 return -1;
3359         ret = pkgmgrinfo_appinfo_foreach_permission(handle, permission_func, (void *)permission);
3360         if (ret != PMINFO_R_OK) {
3361                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3362                 return -1;
3363         }
3364         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3365         return 0;
3366 }
3367  * @endcode
3368  */
3369 int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
3370                         pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
3371
3372 /**
3373  * @fn  int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
3374                         pkgmgrinfo_app_category_list_cb category_func, void *user_data);
3375  * @brief       This API gets the list of category for a particular application
3376  *
3377  * @par         This API is for package-manager client application
3378  * @par Sync (or) Async : Synchronous API
3379  * @param[in]   handle          pointer to the application info handle.
3380  * @param[in]   category_func           callback function for list
3381  * @param[in] user_data user data to be passed to callback function
3382  * @return      0 if success, error code(<0) if fail
3383  * @retval      PMINFO_R_OK     success
3384  * @retval      PMINFO_R_EINVAL invalid argument
3385  * @retval      PMINFO_R_ERROR  internal error
3386  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3387  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3388  * @code
3389 int category_func(const char *name, void *user_data)
3390 {
3391         if (strcmp(name, (char *)user_data) == 0)
3392                 return -1;
3393         else
3394                 return 0;
3395 }
3396
3397 static int list_category(const char *appid, char *category)
3398 {
3399         int ret = 0;
3400         pkgmgrinfo_appinfo_h handle;
3401         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3402         if (ret != PMINFO_R_OK)
3403                 return -1;
3404         ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)category);
3405         if (ret != PMINFO_R_OK) {
3406                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3407                 return -1;
3408         }
3409         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3410         return 0;
3411 }
3412  * @endcode
3413  */
3414 int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
3415                         pkgmgrinfo_app_category_list_cb category_func, void *user_data);
3416
3417 /**
3418  * @fn  int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
3419                         pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
3420  * @brief       This API gets the list of metadata for a particular application
3421  *
3422  * @par         This API is for package-manager client application
3423  * @par Sync (or) Async : Synchronous API
3424  * @param[in]   handle          pointer to the application info handle.
3425  * @param[in]   metadata_func           callback function for list
3426  * @param[in] user_data user data to be passed to callback function
3427  * @return      0 if success, error code(<0) if fail
3428  * @retval      PMINFO_R_OK     success
3429  * @retval      PMINFO_R_EINVAL invalid argument
3430  * @retval      PMINFO_R_ERROR  internal error
3431  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3432  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3433  * @code
3434 int metadata_func(const char *key, const char *value, void *user_data)
3435 {
3436         if (strcmp(key, (char *)user_data) == 0) {
3437                 printf("Value is %s\n", value);
3438                 return -1;
3439         }
3440         else
3441                 return 0;
3442 }
3443
3444 static int list_metadata(const char *appid, char *key)
3445 {
3446         int ret = 0;
3447         pkgmgrinfo_appinfo_h handle;
3448         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3449         if (ret != PMINFO_R_OK)
3450                 return -1;
3451         ret = pkgmgrinfo_appinfo_foreach_metadata(handle, metadata_func, (void *)key);
3452         if (ret != PMINFO_R_OK) {
3453                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3454                 return -1;
3455         }
3456         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3457         return 0;
3458 }
3459  * @endcode
3460  */
3461 int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
3462                         pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
3463
3464
3465 /**
3466  * @fn  int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
3467                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
3468  * @fn  int pkgmgrinfo_usr_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
3469                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data, uid_t uid);
3470  * @brief       This API gets the list of app-control for a particular application
3471  *
3472  * @par         This API is for package-manager client application
3473  * @par Sync (or) Async : Synchronous API
3474  * @param[in]   handle          pointer to the application info handle.
3475  * @param[in]   appcontrol_func         callback function for list
3476  * @param[in] user_data user data to be passed to callback function
3477  * @param[in]   uid     the addressee user id of the instruction
3478  * @return      0 if success, error code(<0) if fail
3479  * @retval      PMINFO_R_OK     success
3480  * @retval      PMINFO_R_EINVAL invalid argument
3481  * @retval      PMINFO_R_ERROR  internal error
3482  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3483  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3484  * @code
3485 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
3486 {
3487         int oc = 0;
3488         int i = 0;
3489         char **operation;
3490         pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
3491         for (i = 0; i < oc; i++) {
3492                 if (strcmp(operation[i], (char *)user_data) == 0)
3493                         return -1;
3494                 else
3495                         return 0;
3496         }
3497 }
3498
3499 static int check_operation(const char *appid, char *operation)
3500 {
3501         int ret = 0;
3502         pkgmgrinfo_appinfo_h handle;
3503         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3504         if (ret != PMINFO_R_OK)
3505                 return -1;
3506         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
3507         if (ret != PMINFO_R_OK) {
3508                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3509                 return -1;
3510         }
3511         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3512         return 0;
3513 }
3514  * @endcode
3515  */
3516 int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
3517                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
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)(uid_t target_uid, 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