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