Merge "fix insert retrieve and delete cert info" into tizen
[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_description(pkgmgrinfo_pkginfo_h handle, char **description)
885  * @brief       This API gets the package description 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] description              pointer to hold package description
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_description(const char *pkgid)
902 {
903         int ret = 0;
904         char *description = 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_description(handle, &description);
910         if (ret != PMINFO_R_OK) {
911                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
912                 return -1;
913         }
914         printf("pkg description: %s\n", description);
915         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
916         return 0;
917 }
918  * @endcode
919  */
920 int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description);
921
922 /**
923  * @fn int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name)
924  * @brief       This API gets the package's author name 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] author_name              pointer to hold package author name
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_author_name(const char *pkgid)
941 {
942         int ret = 0;
943         char *author_name = 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_author_name(handle, &author_name);
949         if (ret != PMINFO_R_OK) {
950                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
951                 return -1;
952         }
953         printf("pkg author name: %s\n", author_name);
954         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
955         return 0;
956 }
957  * @endcode
958  */
959 int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name);
960
961 /**
962  * @fn int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email)
963  * @brief       This API gets the package's author email 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_email             pointer to hold package author email
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_email(const char *pkgid)
980 {
981         int ret = 0;
982         char *author_email = 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_email(handle, &author_email);
988         if (ret != PMINFO_R_OK) {
989                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
990                 return -1;
991         }
992         printf("pkg author email: %s\n", author_email);
993         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
994         return 0;
995 }
996  * @endcode
997  */
998 int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email);
999
1000 /**
1001  * @fn int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href)
1002  * @brief       This API gets the package's author href 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_href              pointer to hold package author href
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_href(const char *pkgid)
1019 {
1020         int ret = 0;
1021         char *author_href = 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_href(handle, &author_href);
1027         if (ret != PMINFO_R_OK) {
1028                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1029                 return -1;
1030         }
1031         printf("pkg author href: %s\n", author_href);
1032         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1033         return 0;
1034 }
1035  * @endcode
1036  */
1037 int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href);
1038
1039 /**
1040  * @fn int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage)
1041  * @brief       This API gets the package installed storagae value 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] storage          pointer to hold package installed storage
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_installed_storage(const char *pkgid)
1058 {
1059         int ret = 0;
1060         pkgmgrinfo_installed_storage storage;
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_installed_storage(handle, &storage);
1066         if (ret != PMINFO_R_OK) {
1067                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1068                 return -1;
1069         }
1070         printf("pkg installed storage: %d\n", storage);
1071         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1072         return 0;
1073 }
1074  * @endcode
1075  */
1076 int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage);
1077
1078 /**
1079  * @fn int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time)
1080  * @brief       This API gets the installed time of package 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] installed_time           pointer to hold installed time of package
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_time(const char *pkgid)
1097 {
1098         int ret = 0;
1099         int installed_time = 0;
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_time(handle, &installed_time);
1105         if (ret != PMINFO_R_OK) {
1106                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1107                 return -1;
1108         }
1109         printf("installed_time: %d\n", installed_time);
1110         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1111         return 0;
1112 }
1113  * @endcode
1114  */
1115 int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time);
1116
1117 /**
1118  * @fn int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid)
1119  * @brief       This API gets the store client id 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] storeclientid            pointer to hold store client id 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_storeclientid(const char *pkgid)
1136 {
1137         int ret = 0;
1138         char *storeclientid = 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_storeclientid(handle, &storeclientid);
1144         if (ret != PMINFO_R_OK) {
1145                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1146                 return -1;
1147         }
1148         printf(store client id: %s\n", storeclientid);
1149         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1150         return 0;
1151 }
1152  * @endcode
1153  */
1154 int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid);
1155
1156 /**
1157  * @fn int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid)
1158  * @brief       This API gets the main app 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] mainappid                pointer to hold main app 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_mainappid(const char *pkgid)
1175 {
1176         int ret = 0;
1177         char *mainappid = 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_mainappid(handle, &mainappid);
1183         if (ret != PMINFO_R_OK) {
1184                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1185                 return -1;
1186         }
1187         printf(main app id: %s\n", mainappid);
1188         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1189         return 0;
1190 }
1191  * @endcode
1192  */
1193 int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid);
1194
1195 /**
1196  * @fn int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url)
1197  * @brief       This API gets the url 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] url              pointer to hold url 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_url(const char *pkgid)
1214 {
1215         int ret = 0;
1216         char *url = 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_url(handle, &url);
1222         if (ret != PMINFO_R_OK) {
1223                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1224                 return -1;
1225         }
1226         printf("url : %s\n", url);
1227         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1228         return 0;
1229 }
1230  * @endcode
1231  */
1232 int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url);
1233
1234
1235 /**
1236  * @fn int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path)
1237  * @brief       This API gets the root path of package
1238  *
1239  * @par Sync (or) Async : Synchronous API
1240  *
1241  * @param[in] handle            pointer to package info handle
1242  * @param[out] path             pointer to hold root path 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  * @code
1248 static int get_root_path(const char *pkgid)
1249 {
1250         int ret = 0;
1251         char *path = 0;
1252         pkgmgrinfo_pkginfo_h handle;
1253         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1254         if (ret != PMINFO_R_OK)
1255                 return -1;
1256
1257         ret = pkgmgrinfo_pkginfo_get_root_path(handle, &path);
1258         if (ret != PMINFO_R_OK) {
1259                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1260                 return -1;
1261         }
1262         printf("path : %s\n", path);
1263         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1264
1265         return 0;
1266 }
1267  * @endcode
1268  */
1269 int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path);
1270
1271
1272 /**
1273  * @fn int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path)
1274  * @brief       This API gets the csc path of package
1275  *
1276  * @par Sync (or) Async : Synchronous API
1277  *
1278  * @param[in] handle            pointer to package info handle
1279  * @param[out] path             pointer to hold csc path of package
1280  * @return      0 if success, error code(<0) if fail
1281  * @retval      PMINFO_R_OK     success
1282  * @retval      PMINFO_R_EINVAL invalid argument
1283  * @retval      PMINFO_R_ERROR  internal error
1284  * @code
1285 static int get_csc_path(const char *pkgid)
1286 {
1287         int ret = 0;
1288         char *path = 0;
1289         pkgmgrinfo_pkginfo_h handle;
1290         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1291         if (ret != PMINFO_R_OK)
1292                 return -1;
1293
1294         ret = pkgmgrinfo_pkginfo_get_csc_path(handle, &path);
1295         if (ret != PMINFO_R_OK) {
1296                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1297                 return -1;
1298         }
1299         printf("path : %s\n", path);
1300         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1301
1302         return 0;
1303 }
1304  * @endcode
1305  */
1306 int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path);
1307
1308 /**
1309  * @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)
1310  * @brief       This API compare the cert information from given package id
1311  *
1312  * @par         This API is for package-manager client application
1313  * @par Sync (or) Async : Synchronous API
1314  *
1315  * @param[in]   lhs_package_id  pointer to first package ID
1316  * @param[in]   rhs_package_id  pointer to second package ID
1317  * @param[out] compare_result           pointer to the compare result.
1318  * @return      0 if success, error code(<0) if fail
1319  * @retval      PMINFO_R_OK     success
1320  * @retval      PMINFO_R_EINVAL invalid argument
1321  * @retval      PMINFO_R_ERROR  internal error
1322  * @pre         None
1323  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1324  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1325  * @see         pkgmgrinfo_pkginfo_is_removable()
1326  * @code
1327 static int compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1328 {
1329         int ret = 0;
1330         pkgmgrinfo_cert_compare_result_type_e result;
1331
1332         ret = pkgmgrinfo_pkginfo_compare_pkg_cert_info(lhs_package_id, rhs_package_id, &result);
1333         if (ret != PMINFO_R_OK) {
1334                 return -1;
1335         }
1336         printf("result: %d\n", result);
1337         return 0;
1338 }
1339  * @endcode
1340  */
1341 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);
1342 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);
1343 /**
1344  * @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)
1345  * @brief       This API compare the cert information from given app id
1346  *
1347  * @par         This API is for package-manager client application
1348  * @par Sync (or) Async : Synchronous API
1349  *
1350  * @param[in]   lhs_app_id      pointer to first app ID
1351  * @param[in]   rhs_app_id      pointer to second app ID
1352  * @param[out] compare_result           pointer to the compare result.
1353  * @return      0 if success, error code(<0) if fail
1354  * @retval      PMINFO_R_OK     success
1355  * @retval      PMINFO_R_EINVAL invalid argument
1356  * @retval      PMINFO_R_ERROR  internal error
1357  * @pre         None
1358  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1359  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1360  * @see         pkgmgrinfo_pkginfo_is_removable()
1361  * @code
1362 static int compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1363 {
1364         int ret = 0;
1365         pkgmgrinfo_cert_compare_result_type_e result;
1366
1367         ret = pkgmgrinfo_pkginfo_compare_app_cert_info(lhs_app_id, rhs_app_id, &result);
1368         if (ret != PMINFO_R_OK) {
1369                 return -1;
1370         }
1371         printf("result: %d\n", result);
1372         return 0;
1373 }
1374  * @endcode
1375  */
1376 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);
1377 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);
1378 /**
1379  * @fn int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable)
1380  * @brief       This API gets the package 'removable' value from the package ID
1381  *
1382  * @par         This API is for package-manager client application
1383  * @par Sync (or) Async : Synchronous API
1384  *
1385  * @param[in]   handle  pointer to package info handle
1386  * @param[out] removable                pointer to hold package removable value
1387  * @return      0 if success, error code(<0) if fail
1388  * @retval      PMINFO_R_OK     success
1389  * @retval      PMINFO_R_EINVAL invalid argument
1390  * @retval      PMINFO_R_ERROR  internal error
1391  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1392  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1393  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1394  * @see         pkgmgrinfo_pkginfo_is_readonly()
1395  * @code
1396 static int get_pkg_removable(const char *pkgid)
1397 {
1398         int ret = 0;
1399         bool removable;
1400         pkgmgrinfo_pkginfo_h handle;
1401         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1402         if (ret != PMINFO_R_OK)
1403                 return -1;
1404         ret = pkgmgrinfo_pkginfo_is_removable(handle, &removable);
1405         if (ret != PMINFO_R_OK) {
1406                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1407                 return -1;
1408         }
1409         printf("pkg removable: %d\n", removable);
1410         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1411         return 0;
1412 }
1413  * @endcode
1414  */
1415 int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable);
1416
1417 /**
1418  * @fn int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable)
1419  * @brief       This API check that the package can move internal storage to external storage or external storage to internal storage 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] movable          pointer to hold package movable state
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  * @code
1434 static int get_pkg_movable(const char *pkgid)
1435 {
1436         int ret = 0;
1437         bool movable;
1438         pkgmgrinfo_pkginfo_h handle;
1439         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1440         if (ret != PMINFO_R_OK)
1441                 return -1;
1442         ret = pkgmgrinfo_pkginfo_is_movable(handle, &movable);
1443         if (ret != PMINFO_R_OK) {
1444                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1445                 return -1;
1446         }
1447         printf("pkg movable: %d\n", movable);
1448         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1449         return 0;
1450 }
1451  * @endcode
1452  */
1453 int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable);
1454
1455 /**
1456  * @fn int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload)
1457  * @brief       This API gets the package 'preload' value from the package ID
1458  *
1459  * @par         This API is for package-manager client application
1460  * @par Sync (or) Async : Synchronous API
1461  *
1462  * @param[in]   handle  pointer to package info handle
1463  * @param[out] preload          pointer to hold package preload value
1464  * @return      0 if success, error code(<0) if fail
1465  * @retval      PMINFO_R_OK     success
1466  * @retval      PMINFO_R_EINVAL invalid argument
1467  * @retval      PMINFO_R_ERROR  internal error
1468  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1469  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1470  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1471  * @see         pkgmgrinfo_pkginfo_is_readonly()
1472  * @code
1473 static int get_pkg_preload(const char *pkgid)
1474 {
1475         int ret = 0;
1476         bool preload;
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_preload(handle, &preload);
1482         if (ret != PMINFO_R_OK) {
1483                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1484                 return -1;
1485         }
1486         printf("pkg preload: %d\n", preload);
1487         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1488         return 0;
1489 }
1490  * @endcode
1491  */
1492 int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload);
1493
1494 /**
1495  * @fn int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
1496  * @brief       This API gets the value for given handle is system or not
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] system           pointer to hold  system is or not
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_system(const char *pkgid)
1513 {
1514         int ret = 0;
1515         bool system = false;
1516         pkgmgrinfo_pkginfo_h handle = NULL;
1517         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1518         if (ret != PMINFO_R_OK)
1519                 return -1;
1520         ret = pkgmgrinfo_pkginfo_is_system(handle, &system);
1521         if (ret != PMINFO_R_OK) {
1522                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1523                 return -1;
1524         }
1525         printf("pkg system: %d\n", system);
1526         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1527         return 0;
1528 }
1529  * @endcode
1530  */
1531 int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system);
1532
1533 /**
1534  * @fn int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
1535  * @brief       This API gets the package 'readonly' value from the package ID
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] readonly pointer to hold package readonly value
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_removable()
1550  * @code
1551 static int get_pkg_readonly(const char *pkgid)
1552 {
1553         int ret = 0;
1554         bool readonly;
1555         pkgmgrinfo_pkginfo_h handle;
1556         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1557         if (ret != PMINFO_R_OK)
1558                 return -1;
1559         ret = pkgmgrinfo_pkginfo_is_readonly(handle, &readonly);
1560         if (ret != PMINFO_R_OK) {
1561                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1562                 return -1;
1563         }
1564         printf("pkg readonly: %d\n", readonly);
1565         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1566         return 0;
1567 }
1568  * @endcode
1569  */
1570 int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly);
1571
1572
1573 /**
1574  * @fn int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update)
1575  * @brief       This API gets the package 'upate' value from the package ID
1576  *
1577  * @par         This API is for package-manager client application
1578  * @par Sync (or) Async : Synchronous API
1579  *
1580  * @param[in]   handle  pointer to package info handle
1581  * @param[out] update   pointer to hold package update value
1582  * @return      0 if success, error code(<0) if fail
1583  * @retval      PMINFO_R_OK     success
1584  * @retval      PMINFO_R_EINVAL invalid argument
1585  * @retval      PMINFO_R_ERROR  internal error
1586  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1587  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1588  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1589  * @code
1590 static int get_pkg_update(const char *pkgid)
1591 {
1592         int ret = 0;
1593         bool update;
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_update(handle, &update);
1599         if (ret != PMINFO_R_OK) {
1600                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1601                 return -1;
1602         }
1603         printf("pkg update: %d\n", update);
1604         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1605         return 0;
1606 }
1607  * @endcode
1608  */
1609 int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update);
1610
1611
1612 /**
1613  * @fn int pkgmgrinfo_pkginfo_is_global(uid_t uid, const char *pkgid)
1614  * @brief       This API gets the package 'uid' value from the view table of user database
1615  *
1616  * @par         This API is for package-manager client application
1617  * @par Sync (or) Async : Synchronous API
1618  *
1619  * @param[in]   uid     uid of the user to determine the database
1620  * @param[in]   pkgid   id of the current package
1621  * @return      1 if it a global package, 0 else
1622  */
1623
1624 int pkgmgrinfo_pkginfo_is_global(uid_t uid, const char *pkgid);
1625
1626
1627 /**
1628  * @fn int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible)
1629  * @brief       This API gets the package 'accessible' value from the package ID
1630  *
1631  * @par         This API is for package-manager client application
1632  * @par Sync (or) Async : Synchronous API
1633  *
1634  * @param[in]   handle  pointer to package info handle
1635  * @param[out] accessible       pointer to hold package accessible value
1636  * @return      0 if success, error code(<0) if fail
1637  * @retval      PMINFO_R_OK     success
1638  * @retval      PMINFO_R_EINVAL invalid argument
1639  * @retval      PMINFO_R_ERROR  internal error
1640  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1641  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1642  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1643  * @see         pkgmgrinfo_pkginfo_is_readonly()
1644  * @code
1645 static int get_pkg_accessible(const char *pkgid)
1646 {
1647         int ret = 0;
1648         bool accessible;
1649         pkgmgrinfo_pkginfo_h handle;
1650         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1651         if (ret != PMINFO_R_OK)
1652                 return -1;
1653         ret = pkgmgrinfo_pkginfo_is_accessible(handle, &accessible);
1654         if (ret != PMINFO_R_OK) {
1655                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1656                 return -1;
1657         }
1658         printf("pkg accessible: %d\n", accessible);
1659         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1660         return 0;
1661 }
1662  * @endcode
1663  */
1664 int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible);
1665
1666 /**
1667  * @fn int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle)
1668  * @brief       This API destroys the package information handle freeing up all the resources
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 the package info handle
1674  * @return      0 if success, error code(<0) if fail
1675  * @retval      PMINFO_R_OK     success
1676  * @retval      PMINFO_R_EINVAL invalid argument
1677  * @retval      PMINFO_R_ERROR  internal error
1678  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1679  * @post                None
1680  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1681  * @see         pkgmgrinfo_pkginfo_is_removable()
1682  * @code
1683 static int get_pkg_type(const char *pkgid)
1684 {
1685         int ret = 0;
1686         char *type = NULL;
1687         pkgmgrinfo_pkginfo_h handle;
1688         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1689         if (ret != PMINFO_R_OK)
1690                 return -1;
1691         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
1692         if (ret != PMINFO_R_OK) {
1693                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1694                 return -1;
1695         }
1696         printf("pkgtype: %s\n", type);
1697         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1698         return 0;
1699 }
1700  * @endcode
1701  */
1702 int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle);
1703
1704 /**
1705  * @fn int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle)
1706  * @brief       This API creates the package information filter handle from db.  All filter properties will be ANDed.
1707  The query will search the entire package information collected from the manifest file of all the installed packages
1708  *
1709  * @par         This API is for package-manager client application
1710  * @par Sync (or) Async : Synchronous API
1711  *
1712  * @param[out] handle           pointer to the package info filter 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         None
1718  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1719  * @see         pkgmgrinfo_pkginfo_filter_count()
1720  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1721  * @code
1722 static int get_rpm_pkg_count()
1723 {
1724         int ret = 0;
1725         int count = 0;
1726         pkgmgrinfo_pkginfo_filter_h handle;
1727         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1728         if (ret != PMINFO_R_OK)
1729                 return -1;
1730         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1731         if (ret != PMINFO_R_OK) {
1732                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1733                 return -1;
1734         }
1735         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1736         if (ret != PMINFO_R_OK) {
1737                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1738                 return -1;
1739         }
1740         printf("No of rpm pkgs: %d\n", count);
1741         pkgmgrinfo_pkginfo_filter_destroy(handle);
1742         return 0;
1743 }
1744  * @endcode
1745  */
1746 int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle);
1747
1748 /**
1749  * @fn int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle)
1750  * @brief       This API destroys the package information filter handle freeing up all the resources
1751  *
1752  * @par         This API is for package-manager client application
1753  * @par Sync (or) Async : Synchronous API
1754  *
1755  * @param[in] handle            pointer to the package info filter handle.
1756  * @return      0 if success, error code(<0) if fail
1757  * @retval      PMINFO_R_OK     success
1758  * @retval      PMINFO_R_EINVAL invalid argument
1759  * @retval      PMINFO_R_ERROR  internal error
1760  * @pre         pkgmgrinfo_pkginfo_filter_create()
1761  * @post                None
1762  * @see         pkgmgrinfo_pkginfo_filter_count()
1763  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1764  * @code
1765 static int get_rpm_pkg_count()
1766 {
1767         int ret = 0;
1768         int count = 0;
1769         pkgmgrinfo_pkginfo_filter_h handle;
1770         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1771         if (ret != PMINFO_R_OK)
1772                 return -1;
1773         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1774         if (ret != PMINFO_R_OK) {
1775                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1776                 return -1;
1777         }
1778         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1779         if (ret != PMINFO_R_OK) {
1780                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1781                 return -1;
1782         }
1783         printf("No of rpm pkgs: %d\n", count);
1784         pkgmgrinfo_pkginfo_filter_destroy(handle);
1785         return 0;
1786 }
1787  * @endcode
1788  */
1789 int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle);
1790
1791 /**
1792  * @fn int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const bool value)
1793  * @brief       This API adds a boolean filter property to the filter handle
1794  *
1795  * @par         This API is for package-manager client application
1796  * @par Sync (or) Async : Synchronous API
1797  *
1798  * @param[in] handle            pointer to the package info filter handle.
1799  * @param[in] property          boolean property name.
1800  * @param[in] value             value corresponding to the property.
1801  * @return      0 if success, error code(<0) if fail
1802  * @retval      PMINFO_R_OK     success
1803  * @retval      PMINFO_R_EINVAL invalid argument
1804  * @retval      PMINFO_R_ERROR  internal error
1805  * @pre         pkgmgrinfo_pkginfo_filter_create()
1806  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1807  * @see         pkgmgrinfo_pkginfo_filter_count()
1808  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1809  * @code
1810 static int get_preload_pkg_count()
1811 {
1812         int ret = 0;
1813         int count = 0;
1814         pkgmgrinfo_pkginfo_filter_h handle;
1815         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1816         if (ret != PMINFO_R_OK)
1817                 return -1;
1818         ret = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD, 1);
1819         if (ret != PMINFO_R_OK) {
1820                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1821                 return -1;
1822         }
1823         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1824         if (ret != PMINFO_R_OK) {
1825                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1826                 return -1;
1827         }
1828         printf("No of preload pkgs: %d\n", count);
1829         pkgmgrinfo_pkginfo_filter_destroy(handle);
1830         return 0;
1831 }
1832  * @endcode
1833  */
1834 int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle,
1835                 const char *property, const bool value);
1836
1837 /**
1838  * @fn int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const int value)
1839  * @brief       This API adds an integer filter property to the filter handle
1840  *
1841  * @par         This API is for package-manager client application
1842  * @par Sync (or) Async : Synchronous API
1843  *
1844  * @param[in] handle            pointer to the package info filter handle.
1845  * @param[in] property          integer property name.
1846  * @param[in] value             value corresponding to the property.
1847  * @return      0 if success, error code(<0) if fail
1848  * @retval      PMINFO_R_OK     success
1849  * @retval      PMINFO_R_EINVAL invalid argument
1850  * @retval      PMINFO_R_ERROR  internal error
1851  * @pre         pkgmgrinfo_pkginfo_filter_create()
1852  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1853  * @see         pkgmgrinfo_pkginfo_filter_count()
1854  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1855  * @code
1856 static int get_pkg_count()
1857 {
1858         int ret = 0;
1859         int count = 0;
1860         pkgmgrinfo_pkginfo_filter_h handle;
1861         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1862         if (ret != PMINFO_R_OK)
1863                 return -1;
1864         ret = pkgmgrinfo_pkginfo_filter_add_int(handle, PMINFO_PKGINFO_PROP_PACKAGE_SIZE, 10);
1865         if (ret != PMINFO_R_OK) {
1866                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1867                 return -1;
1868         }
1869         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1870         if (ret != PMINFO_R_OK) {
1871                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1872                 return -1;
1873         }
1874         printf("No of preload pkgs: %d\n", count);
1875         pkgmgrinfo_pkginfo_filter_destroy(handle);
1876         return 0;
1877 }
1878  * @endcode
1879  */
1880 int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle,
1881                 const char *property, const int value);
1882
1883 /**
1884  * @fn int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const char *value)
1885  * @brief       This API adds a string filter property to the filter handle
1886  *
1887  * @par         This API is for package-manager client application
1888  * @par Sync (or) Async : Synchronous API
1889  *
1890  * @param[in] handle            pointer to the package info filter handle.
1891  * @param[in] property          string property name.
1892  * @param[in] value             value corresponding to the property.
1893  * @return      0 if success, error code(<0) if fail
1894  * @retval      PMINFO_R_OK     success
1895  * @retval      PMINFO_R_EINVAL invalid argument
1896  * @retval      PMINFO_R_ERROR  internal error
1897  * @pre         pkgmgrinfo_pkginfo_filter_create()
1898  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1899  * @see         pkgmgrinfo_pkginfo_filter_count()
1900  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
1901  * @code
1902 static int get_rpm_pkg_count()
1903 {
1904         int ret = 0;
1905         int count = 0;
1906         pkgmgrinfo_pkginfo_filter_h handle;
1907         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1908         if (ret != PMINFO_R_OK)
1909                 return -1;
1910         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1911         if (ret != PMINFO_R_OK) {
1912                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1913                 return -1;
1914         }
1915         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
1916         if (ret != PMINFO_R_OK) {
1917                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1918                 return -1;
1919         }
1920         printf("No of rpm pkgs: %d\n", count);
1921         pkgmgrinfo_pkginfo_filter_destroy(handle);
1922         return 0;
1923 }
1924  * @endcode
1925  */
1926 int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle,
1927                 const char *property, const char *value);
1928
1929 /**
1930  * @fn int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle, pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data)
1931  * @brief       This API executes the user supplied callback function for each package that satisfy the filter conditions
1932  *
1933  * @par         This API is for package-manager client application
1934  * @par Sync (or) Async : Synchronous API
1935  *
1936  * @param[in] handle            pointer to the package info filter handle.
1937  * @param[in] pkg_cb            callback function.
1938  * @param[in] user_data         user data to be passed to the callback function
1939  * @return      0 if success, error code(<0) if fail
1940  * @retval      PMINFO_R_OK     success
1941  * @retval      PMINFO_R_EINVAL invalid argument
1942  * @retval      PMINFO_R_ERROR  internal error
1943  * @pre         pkgmgrinfo_pkginfo_filter_create()
1944  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1945  * @see         pkgmgrinfo_pkginfo_filter_count()
1946  * @code
1947 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
1948 {
1949         char *pkgid = NULL;
1950         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
1951         printf("pkg id : %s\n", pkgid);
1952         return 0;
1953 }
1954
1955 static int get_rpm_pkg_list()
1956 {
1957         int ret = 0;
1958         pkgmgrinfo_pkginfo_filter_h handle;
1959         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
1960         if (ret != PMINFO_R_OK)
1961                 return -1;
1962         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
1963         if (ret != PMINFO_R_OK) {
1964                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1965                 return -1;
1966         }
1967         ret = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(handle, pkg_list_cb, NULL);
1968         if (ret != PMINFO_R_OK) {
1969                 pkgmgrinfo_pkginfo_filter_destroy(handle);
1970                 return -1;
1971         }
1972         pkgmgrinfo_pkginfo_filter_destroy(handle);
1973         return 0;
1974 }
1975  * @endcode
1976  */
1977 int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
1978                 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data);
1979 int pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
1980                 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data, uid_t uid);
1981
1982 /**
1983  * @fn int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count)
1984  * @fn int pkgmgrinfo_pkginfo_usr_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count, uid_t uid)
1985  * @brief       This API counts the package that satisfy the filter conditions
1986  *
1987  * @par         This API is for package-manager client application
1988  * @par Sync (or) Async : Synchronous API
1989  *
1990  * @param[in] handle            pointer to the package info filter handle.
1991  * @param[in] count             pointer to store the count value.
1992  * @param[in]   uid     the addressee user id of the instruction
1993  * @return      0 if success, error code(<0) if fail
1994  * @retval      PMINFO_R_OK     success
1995  * @retval      PMINFO_R_EINVAL invalid argument
1996  * @retval      PMINFO_R_ERROR  internal error
1997  * @pre         pkgmgrinfo_pkginfo_filter_create()
1998  * @post                pkgmgrinfo_pkginfo_filter_destroy()
1999  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
2000  * @code
2001 static int get_rpm_pkg_count()
2002 {
2003         int ret = 0;
2004         int count = 0;
2005         pkgmgrinfo_pkginfo_filter_h handle;
2006         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2007         if (ret != PMINFO_R_OK)
2008                 return -1;
2009         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "rpm");
2010         if (ret != PMINFO_R_OK) {
2011                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2012                 return -1;
2013         }
2014         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
2015         if (ret != PMINFO_R_OK) {
2016                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2017                 return -1;
2018         }
2019         printf("No of rpm pkgs: %d\n", count);
2020         pkgmgrinfo_pkginfo_filter_destroy(handle);
2021         return 0;
2022 }
2023  * @endcode
2024  */
2025 int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count);
2026 int pkgmgrinfo_pkginfo_usr_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count, uid_t uid);
2027 /**
2028  * @fn  int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
2029                         pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
2030  * @brief       This API gets the list of privilege for a particular package
2031  *
2032  * @par         This API is for package-manager client application
2033  * @par Sync (or) Async : Synchronous API
2034  * @param[in]   handle          pointer to the package info handle.
2035  * @param[in]   privilege_func          callback function for list
2036  * @param[in] user_data user data to be passed to callback function
2037  * @return      0 if success, error code(<0) if fail
2038  * @retval      PMINFO_R_OK     success
2039  * @retval      PMINFO_R_EINVAL invalid argument
2040  * @retval      PMINFO_R_ERROR  internal error
2041  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2042  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2043  * @code
2044 int privilege_func(const char *name, void *user_data)
2045 {
2046         if (strcmp(name, (char *)user_data) == 0)
2047                 return -1;
2048         else
2049                 return 0;
2050 }
2051
2052 static int list_privilege(const char *package, char *privilege)
2053 {
2054         int ret = 0;
2055         pkgmgrinfo_pkginfo_h handle;
2056         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
2057         if (ret != PMINFO_R_OK)
2058                 return -1;
2059         ret = pkgmgrinfo_pkginfo_foreach_privilege(handle, privilege_func, (void *)privilege);
2060         if (ret != PMINFO_R_OK) {
2061                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2062                 return -1;
2063         }
2064         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2065         return 0;
2066 }
2067  * @endcode
2068  */
2069 int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
2070                         pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
2071
2072 /**
2073  * @fn  int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
2074  pkgmgrinfo_app_list_cb app_func, void *user_data)
2075  * @brief       This API gets list of installed applications for a particular package
2076  *
2077  * @par         This API is for package-manager client application
2078  * @par Sync (or) Async : Synchronous API
2079  * @param[in]   handle          package info handle
2080  * @param[in]   component       application component
2081  * @param[in]   app_func                iteration function for list
2082  * @param[in] user_data user data to be passed to callback function
2083  * @return      0 if success, error code(<0) if fail
2084  * @retval      PMINFO_R_OK     success
2085  * @retval      PMINFO_R_EINVAL invalid argument
2086  * @retval      PMINFO_R_ERROR  internal error
2087  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2088  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2089  * @code
2090 int app_func(pkgmgrinfo_appinfo_h handle, void *user_data)
2091 {
2092         char *appid = NULL;
2093         pkgmgrinfo_appinfo_get_appid(handle, &appid);
2094         printf("appid : %s\n", appid);
2095         return 0;
2096 }
2097
2098 static int list_apps(const char *pkgid)
2099 {
2100         int ret = 0;
2101         pkgmgrinfo_pkginfo_h handle;
2102         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2103         if (ret != PMINFO_R_OK)
2104                 return -1;
2105         ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, NULL);
2106         if (ret != PMINFO_R_OK) {
2107                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2108                 return -1;
2109         }
2110         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2111         return 0;
2112 }
2113  * @endcode
2114  */
2115 int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
2116                                                         pkgmgrinfo_app_list_cb app_func, void *user_data);
2117 int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
2118                                                         pkgmgrinfo_app_list_cb app_func, void *user_data, uid_t uid);
2119 /**
2120  * @fn  int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2121  * @brief       This API gets list of installed applications from all packages with  minimum informaion.
2122  *
2123  * @par         This API is for package-manager client application
2124  * @par Sync (or) Async : Synchronous API
2125  * @param[in]   app_func                iteration function for list
2126  * @param[in] user_data user data to be passed to callback function
2127  * @return      0 if success, error code(<0) if fail
2128  * @retval      PMINFO_R_OK     success
2129  * @retval      PMINFO_R_EINVAL invalid argument
2130  * @retval      PMINFO_R_ERROR  internal error
2131  * @pre         None
2132  * @post                None
2133  * @code
2134 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
2135 {
2136         char *pkgid1 = NULL;
2137         char *pkgid2 = NULL;
2138         pkgid1 = (char *)user_data;
2139         pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
2140         if (strcmp(pkgid1, pkgid2) == 0) {
2141                 return -1;
2142         } else {
2143                 return 0;
2144         }
2145 }
2146
2147 static int list_apps()
2148 {
2149         int ret = 0;
2150         char *name = "helloworld";
2151         ret = pkgmgrinfo_appinfo_get_install_list(app_list_cb, (void *)name);
2152         if (ret != PMINFO_R_OK) {
2153                 return -1;
2154         }
2155         return 0;
2156 }
2157  * @endcode
2158  */
2159 int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2160 int pkgmgrinfo_appinfo_get_usr_install_list(pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data);
2161 /**
2162  * @fn  int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2163  * @brief       This API gets list of installed applications from all packages.
2164  *
2165  * @par         This API is for package-manager client application
2166  * @par Sync (or) Async : Synchronous API
2167  * @param[in]   app_func                iteration function for list
2168  * @param[in] user_data user data to be passed to callback function
2169  * @return      0 if success, error code(<0) if fail
2170  * @retval      PMINFO_R_OK     success
2171  * @retval      PMINFO_R_EINVAL invalid argument
2172  * @retval      PMINFO_R_ERROR  internal error
2173  * @pre         None
2174  * @post                None
2175  * @code
2176 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
2177 {
2178         char *pkgid1 = NULL;
2179         char *pkgid2 = NULL;
2180         pkgid1 = (char *)user_data;
2181         pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
2182         if (strcmp(pkgid1, pkgid2) == 0) {
2183                 return -1;
2184         } else {
2185                 return 0;
2186         }
2187 }
2188
2189 static int list_apps()
2190 {
2191         int ret = 0;
2192         char *name = "helloworld";
2193         ret = pkgmgrinfo_appinfo_get_installed_list(app_list_cb, (void *)name);
2194         if (ret != PMINFO_R_OK) {
2195                 return -1;
2196         }
2197         return 0;
2198 }
2199  * @endcode
2200  */
2201 int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
2202 int pkgmgrinfo_appinfo_get_usr_installed_list(pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data);
2203
2204 /**
2205  * @fn int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
2206  * @brief       This API creates the application information handle from db
2207  *
2208  * @par         This API is for package-manager client application
2209  * @par Sync (or) Async : Synchronous API
2210  *
2211  * @param[in]   appid   pointer to appid
2212  * @param[out] handle           pointer to the application info handle.
2213  * @return      0 if success, error code(<0) if fail
2214  * @retval      PMINFO_R_OK     success
2215  * @retval      PMINFO_R_EINVAL invalid argument
2216  * @retval      PMINFO_R_ERROR  internal error
2217  * @pre         None
2218  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2219  * @see         pkgmgrinfo_appinfo_get_pkgid()
2220  * @see         pkgmgrinfo_appinfo_is_multiple()
2221  * @code
2222 static int get_app_type(const char *appid)
2223 {
2224         int ret = 0;
2225         char *type = NULL;
2226         pkgmgrinfo_appinfo_h handle;
2227         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2228         if (ret != PMINFO_R_OK)
2229                 return -1;
2230         ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
2231         if (ret != PMINFO_R_OK) {
2232                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2233                 return -1;
2234         }
2235         printf("apptype: %s\n", type);
2236         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2237         return 0;
2238 }
2239  * @endcode
2240  */
2241 int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
2242 int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid, pkgmgrinfo_appinfo_h *handle);
2243 /**
2244  * @fn int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
2245  * @brief       This API gets the application ID
2246  *
2247  * @par         This API is for package-manager client application
2248  * @par Sync (or) Async : Synchronous API
2249  *
2250  * @param[in] handle            pointer to the application info handle.
2251  * @param[out] appid            pointer to hold appid
2252  * @return      0 if success, error code(<0) if fail
2253  * @retval      PMINFO_R_OK     success
2254  * @retval      PMINFO_R_EINVAL invalid argument
2255  * @retval      PMINFO_R_ERROR  internal error
2256  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2257  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2258  * @see         pkgmgrinfo_appinfo_get_pkgid()
2259  * @see         pkgmgrinfo_appinfo_is_multiple()
2260  * @code
2261 static int get_app_id(const char *appid)
2262 {
2263         int ret = 0;
2264         char *app_id = NULL;
2265         pkgmgrinfo_appinfo_h handle;
2266         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2267         if (ret != PMINFO_R_OK)
2268                 return -1;
2269         ret = pkgmgrinfo_appinfo_get_appid(handle, &app_id);
2270         if (ret != PMINFO_R_OK) {
2271                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2272                 return -1;
2273         }
2274         printf("app id: %s\n", app_id);
2275         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2276         return 0;
2277 }
2278  * @endcode
2279  */
2280 int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h  handle, char **appid);
2281
2282 /**
2283  * @fn int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name)
2284  * @brief       This API gets the package name of the application
2285  *
2286  * @par         This API is for package-manager client application
2287  * @par Sync (or) Async : Synchronous API
2288  *
2289  * @param[in] handle            pointer to the application info handle.
2290  * @param[out] pkg_name         pointer to hold package name
2291  * @return      0 if success, error code(<0) if fail
2292  * @retval      PMINFO_R_OK     success
2293  * @retval      PMINFO_R_EINVAL invalid argument
2294  * @retval      PMINFO_R_ERROR  internal error
2295  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2296  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2297  * @see         pkgmgrinfo_appinfo_get_appid()
2298  * @see         pkgmgrinfo_appinfo_is_multiple()
2299  * @code
2300 static int get_app_pkgname(const char *appid)
2301 {
2302         int ret = 0;
2303         char *pkgname = NULL;
2304         pkgmgrinfo_appinfo_h handle;
2305         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2306         if (ret != PMINFO_R_OK)
2307                 return -1;
2308         ret = pkgmgrinfo_appinfo_get_pkgname(handle, &pkgname);
2309         if (ret != PMINFO_R_OK) {
2310                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2311                 return -1;
2312         }
2313         printf("pkg name: %s\n", pkgname);
2314         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2315         return 0;
2316 }
2317  * @endcode
2318  */
2319 int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h  handle, char **pkg_name);
2320
2321 /**
2322  * @fn int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
2323  * @brief       This API gets the package id of the application
2324  *
2325  * @par         This API is for package-manager client application
2326  * @par Sync (or) Async : Synchronous API
2327  *
2328  * @param[in] handle            pointer to the application info handle.
2329  * @param[out] pkgid            pointer to hold package id
2330  * @return      0 if success, error code(<0) if fail
2331  * @retval      PMINFO_R_OK     success
2332  * @retval      PMINFO_R_EINVAL invalid argument
2333  * @retval      PMINFO_R_ERROR  internal error
2334  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2335  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2336  * @see         pkgmgrinfo_appinfo_get_appid()
2337  * @see         pkgmgrinfo_appinfo_is_multiple()
2338  * @code
2339 static int get_app_pkgid(const char *appid)
2340 {
2341         int ret = 0;
2342         char *pkgid = NULL;
2343         pkgmgrinfo_appinfo_h handle;
2344         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2345         if (ret != PMINFO_R_OK)
2346                 return -1;
2347         ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
2348         if (ret != PMINFO_R_OK) {
2349                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2350                 return -1;
2351         }
2352         printf("pkg id: %s\n", pkgid);
2353         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2354         return 0;
2355 }
2356  * @endcode
2357  */
2358 int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h  handle, char **pkgid);
2359
2360 /**
2361  * @fn int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec)
2362  * @brief       This API gets the executable name of the application
2363  *
2364  * @par         This API is for package-manager client application
2365  * @par Sync (or) Async : Synchronous API
2366  *
2367  * @param[in] handle            pointer to the application info handle.
2368  * @param[out] exec             pointer to hold app exec name
2369  * @return      0 if success, error code(<0) if fail
2370  * @retval      PMINFO_R_OK     success
2371  * @retval      PMINFO_R_EINVAL invalid argument
2372  * @retval      PMINFO_R_ERROR  internal error
2373  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2374  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2375  * @see         pkgmgrinfo_appinfo_get_appid()
2376  * @see         pkgmgrinfo_appinfo_is_multiple()
2377  * @code
2378 static int get_app_exec(const char *appid)
2379 {
2380         int ret = 0;
2381         char *exec = NULL;
2382         pkgmgrinfo_appinfo_h handle;
2383         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2384         if (ret != PMINFO_R_OK)
2385                 return -1;
2386         ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
2387         if (ret != PMINFO_R_OK) {
2388                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2389                 return -1;
2390         }
2391         printf("exec name: %s\n", exec);
2392         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2393         return 0;
2394 }
2395  * @endcode
2396  */
2397 int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h  handle, char **exec);
2398
2399 /**
2400  * @fn int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
2401  * @brief       This API gets the icon name of the application
2402  *
2403  * @par         This API is for package-manager client application
2404  * @par Sync (or) Async : Synchronous API
2405  *
2406  * @param[in] handle            pointer to the application info handle.
2407  * @param[out] icon             pointer to hold app icon name
2408  * @return      0 if success, error code(<0) if fail
2409  * @retval      PMINFO_R_OK     success
2410  * @retval      PMINFO_R_EINVAL invalid argument
2411  * @retval      PMINFO_R_ERROR  internal error
2412  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2413  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2414  * @see         pkgmgrinfo_appinfo_get_appid()
2415  * @see         pkgmgrinfo_appinfo_is_multiple()
2416  * @code
2417 static int get_app_icon(const char *appid)
2418 {
2419         int ret = 0;
2420         char *icon = NULL;
2421         pkgmgrinfo_appinfo_h handle;
2422         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2423         if (ret != PMINFO_R_OK)
2424                 return -1;
2425         ret = pkgmgrinfo_appinfo_get_icon(handle, &icon);
2426         if (ret != PMINFO_R_OK) {
2427                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2428                 return -1;
2429         }
2430         printf("icon name: %s\n", icon);
2431         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2432         return 0;
2433 }
2434  * @endcode
2435  */
2436 int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
2437
2438 /**
2439  * @fn int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
2440  * @brief       This API gets the label of the application
2441  *
2442  * @par         This API is for package-manager client application
2443  * @par Sync (or) Async : Synchronous API
2444  *
2445  * @param[in] handle            pointer to the application info handle.
2446  * @param[out] label            pointer to hold app label
2447  * @return      0 if success, error code(<0) if fail
2448  * @retval      PMINFO_R_OK     success
2449  * @retval      PMINFO_R_EINVAL invalid argument
2450  * @retval      PMINFO_R_ERROR  internal error
2451  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2452  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2453  * @see         pkgmgrinfo_appinfo_get_appid()
2454  * @see         pkgmgrinfo_appinfo_is_multiple()
2455  * @code
2456 static int get_app_label(const char *appid)
2457 {
2458         int ret = 0;
2459         char *label = NULL;
2460         pkgmgrinfo_appinfo_h handle;
2461         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2462         if (ret != PMINFO_R_OK)
2463                 return -1;
2464         ret = pkgmgrinfo_appinfo_get_label(handle, &label);
2465         if (ret != PMINFO_R_OK) {
2466                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2467                 return -1;
2468         }
2469         printf("label : %s\n", label);
2470         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2471         return 0;
2472 }
2473  * @endcode
2474  */
2475 int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h  handle, char **label);
2476
2477 /**
2478  * @fn int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
2479  * @brief       This API gets the component of the application
2480  *
2481  * @par         This API is for package-manager client application
2482  * @par Sync (or) Async : Synchronous API
2483  *
2484  * @param[in] handle            pointer to the application info handle.
2485  * @param[out] component                pointer to hold app component
2486  * @return      0 if success, error code(<0) if fail
2487  * @retval      PMINFO_R_OK     success
2488  * @retval      PMINFO_R_EINVAL invalid argument
2489  * @retval      PMINFO_R_ERROR  internal error
2490  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2491  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2492  * @see         pkgmgrinfo_appinfo_get_appid()
2493  * @see         pkgmgrinfo_appinfo_is_multiple()
2494  * @code
2495 static int get_app_component(const char *appid)
2496 {
2497         int ret = 0;
2498         pkgmgrinfo_app_component component;
2499         pkgmgrinfo_appinfo_h handle;
2500         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2501         if (ret != PMINFO_R_OK)
2502                 return -1;
2503         ret = pkgmgrinfo_appinfo_get_component(handle, &component);
2504         if (ret != PMINFO_R_OK) {
2505                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2506                 return -1;
2507         }
2508         printf("component : %s\n", component);
2509         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2510         return 0;
2511 }
2512  * @endcode
2513  */
2514 int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_component *component);
2515
2516 /**
2517  * @fn int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
2518  * @brief       This API gets the apptype of the application
2519  *
2520  * @par         This API is for package-manager client application
2521  * @par Sync (or) Async : Synchronous API
2522  *
2523  * @param[in] handle            pointer to the application info handle.
2524  * @param[out] app_type         pointer to hold apptype
2525  * @return      0 if success, error code(<0) if fail
2526  * @retval      PMINFO_R_OK     success
2527  * @retval      PMINFO_R_EINVAL invalid argument
2528  * @retval      PMINFO_R_ERROR  internal error
2529  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2530  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2531  * @see         pkgmgrinfo_appinfo_get_appid()
2532  * @see         pkgmgrinfo_appinfo_is_multiple()
2533  * @code
2534 static int get_app_type(const char *appid)
2535 {
2536         int ret = 0;
2537         char *apptype = NULL;
2538         pkgmgrinfo_appinfo_h handle;
2539         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2540         if (ret != PMINFO_R_OK)
2541                 return -1;
2542         ret = pkgmgrinfo_appinfo_get_apptype(handle, &apptype);
2543         if (ret != PMINFO_R_OK) {
2544                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2545                 return -1;
2546         }
2547         printf("apptype : %s\n", apptype);
2548         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2549         return 0;
2550 }
2551  * @endcode
2552  */
2553 int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h  handle, char **app_type);
2554
2555 /**
2556  * @fn int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
2557                                                                                 int *operation_count, char ***operation)
2558  * @brief       This API gets the list of operation of the application
2559  *
2560  * @par         This API is for package-manager client application
2561  * @par Sync (or) Async : Synchronous API
2562  *
2563  * @param[in] handle            pointer to the appcontrol handle.
2564  * @param[out] operation_count          pointer to hold number of operations
2565  * @param[out] operation                pointer to hold list of operations
2566  * @return      0 if success, error code(<0) if fail
2567  * @retval      PMINFO_R_OK     success
2568  * @retval      PMINFO_R_EINVAL invalid argument
2569  * @retval      PMINFO_R_ERROR  internal error
2570  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2571  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2572  * @see         pkgmgrinfo_appinfo_get_uri()
2573  * @see         pkgmgrinfo_appinfo_get_mime()
2574  * @code
2575 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2576 {
2577         int oc = 0;
2578         int i = 0;
2579         char **operation;
2580         pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
2581         for (i = 0; i < oc; i++) {
2582                 if (strcmp(operation[i], (char *)user_data) == 0)
2583                         return -1;
2584                 else
2585                         return 0;
2586         }
2587 }
2588
2589 static int check_operation(const char *appid, char *operation)
2590 {
2591         int ret = 0;
2592         pkgmgrinfo_appinfo_h handle;
2593         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2594         if (ret != PMINFO_R_OK)
2595                 return -1;
2596         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
2597         if (ret != PMINFO_R_OK) {
2598                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2599                 return -1;
2600         }
2601         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2602         return 0;
2603 }
2604  * @endcode
2605  */
2606 int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
2607                                                                                 int *operation_count, char ***operation);
2608
2609 /**
2610  * @fn int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
2611                                                                                 int *uri_count, char ***uri)
2612  * @brief       This API gets the list of uri of the application
2613  *
2614  * @par         This API is for package-manager client application
2615  * @par Sync (or) Async : Synchronous API
2616  *
2617  * @param[in] handle            pointer to the appcontrol handle.
2618  * @param[out] uri_count                pointer to hold number of uris
2619  * @param[out] uri              pointer to hold list of uris
2620  * @return      0 if success, error code(<0) if fail
2621  * @retval      PMINFO_R_OK     success
2622  * @retval      PMINFO_R_EINVAL invalid argument
2623  * @retval      PMINFO_R_ERROR  internal error
2624  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2625  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2626  * @see         pkgmgrinfo_appinfo_get_operation()
2627  * @see         pkgmgrinfo_appinfo_get_mime()
2628  * @code
2629 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2630 {
2631         int uc = 0;
2632         int i = 0;
2633         char **uri;
2634         pkgmgrinfo_appinfo_get_uri(handle, &uc, &uri);
2635         for (i = 0; i < uc; i++) {
2636                 if (strcmp(uri[i], (char *)user_data) == 0)
2637                         return -1;
2638                 else
2639                         return 0;
2640         }
2641 }
2642
2643 static int check_uri(const char *appid, char *uri)
2644 {
2645         int ret = 0;
2646         pkgmgrinfo_appinfo_h handle;
2647         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2648         if (ret != PMINFO_R_OK)
2649                 return -1;
2650         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)uri);
2651         if (ret != PMINFO_R_OK) {
2652                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2653                 return -1;
2654         }
2655         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2656         return 0;
2657 }
2658  * @endcode
2659  */
2660 int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
2661                                                                                 int *uri_count, char ***uri);
2662
2663 /**
2664  * @fn int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
2665                                                                                 int *mime_count, char ***mime)
2666  * @brief       This API gets the list of mime of the application
2667  *
2668  * @par         This API is for package-manager client application
2669  * @par Sync (or) Async : Synchronous API
2670  *
2671  * @param[in] handle            pointer to the appcontrol handle.
2672  * @param[out] mime_count               pointer to hold number of mimes
2673  * @param[out] mime             pointer to hold list of mimes
2674  * @return      0 if success, error code(<0) if fail
2675  * @retval      PMINFO_R_OK     success
2676  * @retval      PMINFO_R_EINVAL invalid argument
2677  * @retval      PMINFO_R_ERROR  internal error
2678  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2679  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2680  * @see         pkgmgrinfo_appinfo_get_uri()
2681  * @see         pkgmgrinfo_appinfo_get_operation()
2682  * @code
2683 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2684 {
2685         int mc = 0;
2686         int i = 0;
2687         char **mime;
2688         pkgmgrinfo_appinfo_get_operation(handle, &mc, &mime);
2689         for (i = 0; i < mc; i++) {
2690                 if (strcmp(mime[i], (char *)user_data) == 0)
2691                         return -1;
2692                 else
2693                         return 0;
2694         }
2695 }
2696
2697 static int check_mime(const char *appid, char *mime)
2698 {
2699         int ret = 0;
2700         pkgmgrinfo_appinfo_h handle;
2701         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2702         if (ret != PMINFO_R_OK)
2703                 return -1;
2704         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)mime);
2705         if (ret != PMINFO_R_OK) {
2706                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2707                 return -1;
2708         }
2709         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2710         return 0;
2711 }
2712  * @endcode
2713  */
2714 int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
2715                                                                                 int *mime_count, char ***mime);
2716
2717 /**
2718  * @fn int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
2719                                                                                 int *subapp_count, char ***subapp)
2720  * @brief       This API gets the list of subapp of the application
2721  *
2722  * @par         This API is for package-manager client application
2723  * @par Sync (or) Async : Synchronous API
2724  *
2725  * @param[in] handle            pointer to the appcontrol handle.
2726  * @param[out] subapp_count             pointer to hold number of subapp
2727  * @param[out] subapp           pointer to hold list of subapp
2728  * @return      0 if success, error code(<0) if fail
2729  * @retval      PMINFO_R_OK     success
2730  * @retval      PMINFO_R_EINVAL invalid argument
2731  * @retval      PMINFO_R_ERROR  internal error
2732  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2733  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2734  * @see         pkgmgrinfo_appinfo_get_uri()
2735  * @see         pkgmgrinfo_appinfo_get_operation()
2736  * @code
2737 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
2738 {
2739         int sc = 0;
2740         int i = 0;
2741         char **subapp = NULL;
2742         pkgmgrinfo_appinfo_get_subapp(handle, &sc, &subapp);
2743         for (i = 0; i < sc; i++) {
2744                 if (strcmp(subapp[i], (char *)user_data) == 0)
2745                         return -1;
2746                 else
2747                         return 0;
2748         }
2749 }
2750
2751 static int check_subapp(const char *appid, char *subapp)
2752 {
2753         int ret = 0;
2754         pkgmgrinfo_appinfo_h handle = NULL;
2755         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2756         if (ret != PMINFO_R_OK)
2757                 return -1;
2758         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)subapp);
2759         if (ret != PMINFO_R_OK) {
2760                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2761                 return -1;
2762         }
2763         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2764         return 0;
2765 }
2766  * @endcode
2767  */
2768 int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
2769                                                 int *subapp_count, char ***subapp);
2770
2771 /**
2772  * @fn int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
2773  * @brief       This API gets the notification icon of the application
2774  *
2775  * @par         This API is for package-manager client application
2776  * @par Sync (or) Async : Synchronous API
2777  *
2778  * @param[in] handle            pointer to the application info handle.
2779  * @param[out] path             pointer to hold notification icon
2780  * @return      0 if success, error code(<0) if fail
2781  * @retval      PMINFO_R_OK     success
2782  * @retval      PMINFO_R_EINVAL invalid argument
2783  * @retval      PMINFO_R_ERROR  internal error
2784  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2785  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2786  * @see         pkgmgrinfo_appinfo_get_appid()
2787  * @see         pkgmgrinfo_appinfo_is_multiple()
2788  * @code
2789 static int get_app_notification_icon(const char *appid)
2790 {
2791         int ret = 0;
2792         char *notification_icon = NULL;
2793         pkgmgrinfo_appinfo_h handle;
2794         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2795         if (ret != PMINFO_R_OK)
2796                 return -1;
2797         ret = pkgmgrinfo_appinfo_get_notification_icon(handle, &notification_icon);
2798         if (ret != PMINFO_R_OK) {
2799                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2800                 return -1;
2801         }
2802         printf("notification icon : %s\n", notification_icon);
2803         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2804         return 0;
2805 }
2806  * @endcode
2807  */
2808 int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
2809
2810 /**
2811  * @fn int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon)
2812  * @brief       This API gets the setting icon of the application
2813  *
2814  * @par         This API is for package-manager client application
2815  * @par Sync (or) Async : Synchronous API
2816  *
2817  * @param[in] handle            pointer to the application info handle.
2818  * @param[out] path             pointer to hold setting icon
2819  * @return      0 if success, error code(<0) if fail
2820  * @retval      PMINFO_R_OK     success
2821  * @retval      PMINFO_R_EINVAL invalid argument
2822  * @retval      PMINFO_R_ERROR  internal error
2823  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2824  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2825  * @see         pkgmgrinfo_appinfo_get_appid()
2826  * @see         pkgmgrinfo_appinfo_is_multiple()
2827  * @code
2828 static int get_app_setting_icon(const char *appid)
2829 {
2830         int ret = 0;
2831         char *setting_icon = NULL;
2832         pkgmgrinfo_appinfo_h handle;
2833         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2834         if (ret != PMINFO_R_OK)
2835                 return -1;
2836         ret = pkgmgrinfo_appinfo_get_setting_icon(handle, &setting_icon);
2837         if (ret != PMINFO_R_OK) {
2838                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2839                 return -1;
2840         }
2841         printf("setting icon : %s\n", setting_icon);
2842         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2843         return 0;
2844 }
2845  * @endcode
2846  */
2847 int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
2848
2849 /**
2850  * @fn int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
2851  * @brief       This API gets the type of recent image on app-tray
2852  *
2853  * @par         This API is for package-manager client application
2854  * @par Sync (or) Async : Synchronous API
2855  *
2856  * @param[in] handle            pointer to the application info handle.
2857  * @param[out] type             pointer to hold image type
2858  * @return      0 if success, error code(<0) if fail
2859  * @retval      PMINFO_R_OK     success
2860  * @retval      PMINFO_R_EINVAL invalid argument
2861  * @retval      PMINFO_R_ERROR  internal error
2862  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2863  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2864  * @see         pkgmgrinfo_appinfo_get_appid()
2865  * @see         pkgmgrinfo_appinfo_is_multiple()
2866  * @code
2867 static int get_app_recent_image_type(const char *appid)
2868 {
2869         int ret = 0;
2870         pkgmgrinfo_app_recentimage type;
2871         pkgmgrinfo_appinfo_h handle;
2872         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2873         if (ret != PMINFO_R_OK)
2874                 return -1;
2875         ret = pkgmgrinfo_appinfo_get_recent_image_type(handle, &type);
2876         if (ret != PMINFO_R_OK) {
2877                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2878                 return -1;
2879         }
2880         printf("recent image type: %d\n", type);
2881         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2882         return 0;
2883 }
2884  * @endcode
2885  */
2886 int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_recentimage *type);
2887
2888
2889 /**
2890  * @fn int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h  handle, char **preview_img)
2891  * @brief       This API gets the preview image of application
2892  *
2893  * @par Sync (or) Async : Synchronous API
2894  *
2895  * @param[in] handle            pointer to the application info handle.
2896  * @param[out] preview_img              pointer to hold preview image path
2897  * @return      0 if success, error code(<0) if fail
2898  * @retval      PMINFO_R_OK     success
2899  * @retval      PMINFO_R_EINVAL invalid argument
2900  * @retval      PMINFO_R_ERROR  internal error
2901  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2902  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2903  * @see         pkgmgrinfo_appinfo_get_appid()
2904  * @code
2905 static int get_app_previewimage(const char *appid)
2906 {
2907         int ret = 0;
2908         char *preview = NULL;
2909         pkgmgrinfo_appinfo_h handle = NULL;
2910         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2911         if (ret != PMINFO_R_OK)
2912                 return -1;
2913         ret = pkgmgrinfo_appinfo_get_preview_image(handle, &preview);
2914         if (ret != PMINFO_R_OK) {
2915                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2916                 return -1;
2917         }
2918         printf("preview image path : %s\n", preview);
2919         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2920         return 0;
2921 }
2922  * @endcode
2923  */
2924 int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h  handle, char **preview_img);
2925
2926
2927 /**
2928  * @fn int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
2929  * @brief       This API gets the package permission type of the application
2930  *
2931  * @par         This API is for package-manager client application
2932  * @par Sync (or) Async : Synchronous API
2933  *
2934  * @param[in] handle            pointer to the application info handle.
2935  * @param[out] permission               pointer to hold package permission
2936  * @return      0 if success, error code(<0) if fail
2937  * @retval      PMINFO_R_OK     success
2938  * @retval      PMINFO_R_EINVAL invalid argument
2939  * @retval      PMINFO_R_ERROR  internal error
2940  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2941  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
2942  * @see         pkgmgrinfo_appinfo_get_appid()
2943  * @code
2944 static int get_app_permission(const char *appid)
2945 {
2946         int ret = 0;
2947         pkgmgrinfo_permission_type permission = 0;
2948         pkgmgrinfo_appinfo_h handle;
2949
2950         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2951         if (ret != PMINFO_R_OK)
2952                 return -1;
2953         ret = pkgmgrinfo_appinfo_get_permission_type(handle, &permission);
2954         if (ret != PMINFO_R_OK) {
2955                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2956                 return -1;
2957         }
2958         printf("permission type: %d\n", permission);
2959         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2960         return 0;
2961 }
2962  * @endcode
2963  */
2964 int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission);
2965
2966 /**
2967  * @fn int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
2968  * @brief       This API gets the component_type
2969  *
2970  * @par         This API is for package-manager client application
2971  * @par Sync (or) Async : Synchronous API
2972  *
2973  * @param[in] handle            pointer to the application info handle.
2974  * @param[out] component_type           pointer to hold component_type
2975  * @return      0 if success, error code(<0) if fail
2976  * @retval      PMINFO_R_OK     success
2977  * @retval      PMINFO_R_EINVAL invalid argument
2978  * @retval      PMINFO_R_ERROR  internal error
2979  * @pre         pkgmgrinfo_appinfo_get_appinfo()
2980  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
2981  * @see         pkgmgrinfo_appinfo_get_pkgid()
2982  * @see         pkgmgrinfo_appinfo_is_multiple()
2983  * @code
2984 static int get_component_type(const char *appid)
2985 {
2986         int ret = 0;
2987         char *component_type = NULL;
2988         pkgmgrinfo_appinfo_h handle;
2989         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
2990         if (ret != PMINFO_R_OK)
2991                 return -1;
2992         ret = pkgmgrinfo_appinfo_get_component_type(handle, &component_type);
2993         if (ret != PMINFO_R_OK) {
2994                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
2995                 return -1;
2996         }
2997         printf("component_type: %s\n", component_type);
2998         pkgmgrinfo_appinfo_destroy_appinfo(handle);
2999         return 0;
3000 }
3001  * @endcode
3002  */
3003 int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h  handle, char **component_type);
3004
3005 /**
3006  * @fn int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
3007  * @brief       This API gets the application 'hwacceleration' value from the app ID
3008  *
3009  * @par         This API is for package-manager client application
3010  * @par Sync (or) Async : Synchronous API
3011  *
3012  * @param[in]   handle  pointer to application info handle
3013  * @param[out] hwacceleration           pointer to hold package hwacceleration value
3014  * @return      0 if success, error code(<0) if fail
3015  * @retval      PMINFO_R_OK     success
3016  * @retval      PMINFO_R_EINVAL invalid argument
3017  * @retval      PMINFO_R_ERROR  internal error
3018  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3019  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3020  * @see         pkgmgrinfo_appinfo_get_appid()
3021  * @see         pkgmgrinfo_appinfo_is_multiple()
3022  * @code
3023 static int get_app_hwacceleration(const char *appid)
3024 {
3025         int ret = 0;
3026         pkgmgrinfo_app_hwacceleration hwacceleration;
3027         pkgmgrinfo_appinfo_h handle;
3028         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3029         if (ret != PMINFO_R_OK)
3030                 return -1;
3031         ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacceleration);
3032         if (ret != PMINFO_R_OK) {
3033                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3034                 return -1;
3035         }
3036         printf("app hwacceleration: %d\n", hwacceleration);
3037         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3038         return 0;
3039 }
3040  * @endcode
3041  */
3042 int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_hwacceleration *hwacceleration);
3043
3044 /**
3045  * @fn int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader)
3046  * @brief       This API gets the application 'screenreader' value from the app ID
3047  *
3048  * @par         This API is for package-manager client application
3049  * @par Sync (or) Async : Synchronous API
3050  *
3051  * @param[in]   handle  pointer to application info handle
3052  * @param[out] screenreader             pointer to hold package accessibility value
3053  * @return      0 if success, error code(<0) if fail
3054  * @retval      PMINFO_R_OK     success
3055  * @retval      PMINFO_R_EINVAL invalid argument
3056  * @retval      PMINFO_R_ERROR  internal error
3057  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3058  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3059  * @see         pkgmgrinfo_appinfo_get_appid()
3060  * @see         pkgmgrinfo_appinfo_is_multiple()
3061  * @code
3062 static int get_app_screenreader(const char *appid)
3063 {
3064         int ret = 0;
3065         pkgmgrinfo_app_screenreader screenreader = PMINFO_USE_SYSTEM_SETTING;
3066         pkgmgrinfo_appinfo_h handle = NULL;
3067         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3068         if (ret != PMINFO_R_OK)
3069                 return -1;
3070         ret = pkgmgrinfo_appinfo_get_screenreader(handle, &screenreader);
3071         if (ret != PMINFO_R_OK) {
3072                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3073                 return -1;
3074         }
3075         printf("app screenreader: %d\n", screenreader);
3076         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3077         return 0;
3078 }
3079  * @endcode
3080  */
3081 int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader);
3082
3083 /**
3084  * @fn int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img)
3085  * @brief       This API gets the application's landscape & portrait effect images
3086  *
3087  * @par         This API is for package-manager client application
3088  * @par Sync (or) Async : Synchronous API
3089  *
3090  * @param[in]   handle  pointer to application info handle
3091  * @param[out]  portrait_img contains portrait mode effect image
3092  * @param[out]  landscape_img contains landscape mode effect image
3093  * @return      0 if success, error code(<0) if fail
3094  * @retval      PMINFO_R_OK     success
3095  * @retval      PMINFO_R_EINVAL invalid argument
3096  * @retval      PMINFO_R_ERROR  internal error
3097  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3098  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3099  * @see         pkgmgrinfo_appinfo_get_appid()
3100  * @see         pkgmgrinfo_appinfo_is_nodisplay()
3101  * @code
3102 static int get_app_effectimages(const char *appid)
3103 {
3104         int ret = 0;
3105         char *portraitimg = NULL;
3106         char *landscapeimg = NULL;
3107         pkgmgrinfo_appinfo_h handle;
3108         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3109         if (ret != PMINFO_R_OK)
3110                 return -1;
3111         ret = pkgmgrinfo_appinfo_get_effectimage(handle, &portraitimg, &landscapeimg);
3112         if (ret != PMINFO_R_OK) {
3113                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3114                 return -1;
3115         }
3116         printf("app effect image portrait: %s, app effect image landscape : %s\n", portraitimg, landscapeimg);
3117         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3118         return 0;
3119 }
3120  * @endcode
3121  */
3122 int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img);
3123
3124 /**
3125  * @fn int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h handle, char **submode_mainid)
3126  * @brief       This API gets the submode_mainid of the application
3127  *
3128  * @par         This API is for package-manager client application
3129  * @par Sync (or) Async : Synchronous API
3130  *
3131  * @param[in] handle            pointer to the application info handle.
3132  * @param[out] submode_mainid           pointer to hold package name
3133  * @return      0 if success, error code(<0) if fail
3134  * @retval      PMINFO_R_OK     success
3135  * @retval      PMINFO_R_EINVAL invalid argument
3136  * @retval      PMINFO_R_ERROR  internal error
3137  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3138  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3139  * @see         pkgmgrinfo_appinfo_get_appid()
3140  * @see         pkgmgrinfo_appinfo_is_multiple()
3141  * @code
3142 static int get_app_submode_mainid(const char *appid)
3143 {
3144         int ret = 0;
3145         char *submode_mainid = NULL;
3146         pkgmgrinfo_appinfo_h handle = NULL;
3147         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3148         if (ret != PMINFO_R_OK)
3149                 return -1;
3150         ret = pkgmgrinfo_appinfo_get_submode_mainid(handle, &submode_mainid);
3151         if (ret != PMINFO_R_OK) {
3152                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3153                 return -1;
3154         }
3155         printf("submode_mainid: %s\n", submode_mainid);
3156         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3157         return 0;
3158 }
3159  * @endcode
3160  */
3161 int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char **submode_mainid);
3162
3163 /**
3164  * @fn  int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
3165                         pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
3166  * @brief       This API gets the list of permission for a particular application
3167  *
3168  * @par         This API is for package-manager client application
3169  * @par Sync (or) Async : Synchronous API
3170  * @param[in]   handle          pointer to the application info handle.
3171  * @param[in]   permission_func         callback function for list
3172  * @param[in] user_data user data to be passed to callback function
3173  * @return      0 if success, error code(<0) if fail
3174  * @retval      PMINFO_R_OK     success
3175  * @retval      PMINFO_R_EINVAL invalid argument
3176  * @retval      PMINFO_R_ERROR  internal error
3177  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3178  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3179  * @code
3180 int permission_func(const char *name, void *user_data)
3181 {
3182         if (strcmp(name, (char *)user_data) == 0)
3183                 return -1;
3184         else
3185                 return 0;
3186 }
3187
3188 static int list_permission(const char *appid, char *permission)
3189 {
3190         int ret = 0;
3191         pkgmgrinfo_appinfo_h handle;
3192         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3193         if (ret != PMINFO_R_OK)
3194                 return -1;
3195         ret = pkgmgrinfo_appinfo_foreach_permission(handle, permission_func, (void *)permission);
3196         if (ret != PMINFO_R_OK) {
3197                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3198                 return -1;
3199         }
3200         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3201         return 0;
3202 }
3203  * @endcode
3204  */
3205 int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
3206                         pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
3207
3208 /**
3209  * @fn  int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
3210                         pkgmgrinfo_app_category_list_cb category_func, void *user_data);
3211  * @brief       This API gets the list of category for a particular application
3212  *
3213  * @par         This API is for package-manager client application
3214  * @par Sync (or) Async : Synchronous API
3215  * @param[in]   handle          pointer to the application info handle.
3216  * @param[in]   category_func           callback function for list
3217  * @param[in] user_data user data to be passed to callback function
3218  * @return      0 if success, error code(<0) if fail
3219  * @retval      PMINFO_R_OK     success
3220  * @retval      PMINFO_R_EINVAL invalid argument
3221  * @retval      PMINFO_R_ERROR  internal error
3222  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3223  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3224  * @code
3225 int category_func(const char *name, void *user_data)
3226 {
3227         if (strcmp(name, (char *)user_data) == 0)
3228                 return -1;
3229         else
3230                 return 0;
3231 }
3232
3233 static int list_category(const char *appid, char *category)
3234 {
3235         int ret = 0;
3236         pkgmgrinfo_appinfo_h handle;
3237         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3238         if (ret != PMINFO_R_OK)
3239                 return -1;
3240         ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)category);
3241         if (ret != PMINFO_R_OK) {
3242                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3243                 return -1;
3244         }
3245         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3246         return 0;
3247 }
3248  * @endcode
3249  */
3250 int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
3251                         pkgmgrinfo_app_category_list_cb category_func, void *user_data);
3252
3253 /**
3254  * @fn  int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
3255                         pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
3256  * @brief       This API gets the list of metadata for a particular application
3257  *
3258  * @par         This API is for package-manager client application
3259  * @par Sync (or) Async : Synchronous API
3260  * @param[in]   handle          pointer to the application info handle.
3261  * @param[in]   metadata_func           callback function for list
3262  * @param[in] user_data user data to be passed to callback function
3263  * @return      0 if success, error code(<0) if fail
3264  * @retval      PMINFO_R_OK     success
3265  * @retval      PMINFO_R_EINVAL invalid argument
3266  * @retval      PMINFO_R_ERROR  internal error
3267  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3268  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3269  * @code
3270 int metadata_func(const char *key, const char *value, void *user_data)
3271 {
3272         if (strcmp(key, (char *)user_data) == 0) {
3273                 printf("Value is %s\n", value);
3274                 return -1;
3275         }
3276         else
3277                 return 0;
3278 }
3279
3280 static int list_metadata(const char *appid, char *key)
3281 {
3282         int ret = 0;
3283         pkgmgrinfo_appinfo_h handle;
3284         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3285         if (ret != PMINFO_R_OK)
3286                 return -1;
3287         ret = pkgmgrinfo_appinfo_foreach_metadata(handle, metadata_func, (void *)key);
3288         if (ret != PMINFO_R_OK) {
3289                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3290                 return -1;
3291         }
3292         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3293         return 0;
3294 }
3295  * @endcode
3296  */
3297 int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
3298                         pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
3299
3300
3301 /**
3302  * @fn  int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
3303                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
3304  * @fn  int pkgmgrinfo_usr_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
3305                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data, uid_t uid);
3306  * @brief       This API gets the list of app-control for a particular application
3307  *
3308  * @par         This API is for package-manager client application
3309  * @par Sync (or) Async : Synchronous API
3310  * @param[in]   handle          pointer to the application info handle.
3311  * @param[in]   appcontrol_func         callback function for list
3312  * @param[in] user_data user data to be passed to callback function
3313  * @param[in]   uid     the addressee user id of the instruction
3314  * @return      0 if success, error code(<0) if fail
3315  * @retval      PMINFO_R_OK     success
3316  * @retval      PMINFO_R_EINVAL invalid argument
3317  * @retval      PMINFO_R_ERROR  internal error
3318  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3319  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3320  * @code
3321 int appcontrol_func(pkgmgrinfo_appcontrol_h handle, void *user_data)
3322 {
3323         int oc = 0;
3324         int i = 0;
3325         char **operation;
3326         pkgmgrinfo_appinfo_get_operation(handle, &oc, &operation);
3327         for (i = 0; i < oc; i++) {
3328                 if (strcmp(operation[i], (char *)user_data) == 0)
3329                         return -1;
3330                 else
3331                         return 0;
3332         }
3333 }
3334
3335 static int check_operation(const char *appid, char *operation)
3336 {
3337         int ret = 0;
3338         pkgmgrinfo_appinfo_h handle;
3339         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3340         if (ret != PMINFO_R_OK)
3341                 return -1;
3342         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
3343         if (ret != PMINFO_R_OK) {
3344                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3345                 return -1;
3346         }
3347         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3348         return 0;
3349 }
3350  * @endcode
3351  */
3352 int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
3353                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
3354 int pkgmgrinfo_usr_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
3355                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data, uid_t uid);
3356
3357 /**
3358  * @fn int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay)
3359  * @brief       This API gets the application 'nodisplay' value from the app ID
3360  *
3361  * @par         This API is for package-manager client application
3362  * @par Sync (or) Async : Synchronous API
3363  *
3364  * @param[in]   handle  pointer to application info handle
3365  * @param[out] nodisplay                pointer to hold package nodisplay value
3366  * @return      0 if success, error code(<0) if fail
3367  * @retval      PMINFO_R_OK     success
3368  * @retval      PMINFO_R_EINVAL invalid argument
3369  * @retval      PMINFO_R_ERROR  internal error
3370  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3371  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3372  * @see         pkgmgrinfo_appinfo_get_appid()
3373  * @see         pkgmgrinfo_appinfo_is_multiple()
3374  * @code
3375 static int get_app_nodisplay(const char *appid)
3376 {
3377         int ret = 0;
3378         bool nodisplay;
3379         pkgmgrinfo_appinfo_h handle;
3380         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3381         if (ret != PMINFO_R_OK)
3382                 return -1;
3383         ret = pkgmgrinfo_appinfo_is_nodisplay(handle, &nodisplay);
3384         if (ret != PMINFO_R_OK) {
3385                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3386                 return -1;
3387         }
3388         printf("app nodisplay: %d\n", nodisplay);
3389         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3390         return 0;
3391 }
3392  * @endcode
3393  */
3394 int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h  handle, bool *nodisplay);
3395
3396 /**
3397  * @fn int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multiple)
3398  * @brief       This API gets the application 'multiple' value from the app ID
3399  *
3400  * @par         This API is for package-manager client application
3401  * @par Sync (or) Async : Synchronous API
3402  *
3403  * @param[in]   handle  pointer to application info handle
3404  * @param[out] multiple         pointer to hold package multiple value
3405  * @return      0 if success, error code(<0) if fail
3406  * @retval      PMINFO_R_OK     success
3407  * @retval      PMINFO_R_EINVAL invalid argument
3408  * @retval      PMINFO_R_ERROR  internal error
3409  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3410  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3411  * @see         pkgmgrinfo_appinfo_get_appid()
3412  * @see         pkgmgrinfo_appinfo_is_nodisplay()
3413  * @code
3414 static int get_app_multiple(const char *appid)
3415 {
3416         int ret = 0;
3417         bool multiple;
3418         pkgmgrinfo_appinfo_h handle;
3419         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3420         if (ret != PMINFO_R_OK)
3421                 return -1;
3422         ret = pkgmgrinfo_appinfo_is_multiple(handle, &multiple);
3423         if (ret != PMINFO_R_OK) {
3424                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3425                 return -1;
3426         }
3427         printf("app multiple: %d\n", multiple);
3428         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3429         return 0;
3430 }
3431  * @endcode
3432  */
3433 int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h  handle, bool *multiple);
3434
3435 /**
3436  * @fn int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
3437  * @brief       This API gets the application 'indicatordisplay' value. If true, indicator will be displayed during
3438  *              application launching effect. If fales, indicator will be hidden during application launching effect
3439  *
3440  * @par         This API is for package-manager client application
3441  * @par Sync (or) Async : Synchronous API
3442  *
3443  * @param[in]   handle  pointer to application info handle
3444  * @param[out]  indicator_disp contains indicator display status for application launching effect
3445  * @return      0 if success, error code(<0) if fail
3446  * @retval      PMINFO_R_OK     success
3447  * @retval      PMINFO_R_EINVAL invalid argument
3448  * @retval      PMINFO_R_ERROR  internal error
3449  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3450  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3451  * @see         pkgmgrinfo_appinfo_get_appid()
3452  * @see         pkgmgrinfo_appinfo_is_nodisplay()
3453  * @code
3454 static int get_app_indicator_display(const char *appid)
3455 {
3456         int ret = 0;
3457         bool indicator_disp;
3458         pkgmgrinfo_appinfo_h handle;
3459         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3460         if (ret != PMINFO_R_OK)
3461                 return -1;
3462         ret = pkgmgrinfo_appinfo_is_indicator_display_allowed(handle, &indicator_disp);
3463         if (ret != PMINFO_R_OK){
3464                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3465                 return -1;
3466         }
3467         printf("app indicator disp : %d\n", indicator_disp);
3468         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3469         return 0;
3470 }
3471  * @endcode
3472  */
3473 int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp);
3474
3475 /**
3476  * @fn int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h handle, bool *taskmanage)
3477  * @brief       This API gets the application 'taskmanage' value from the app ID
3478  *
3479  * @par         This API is for package-manager client application
3480  * @par Sync (or) Async : Synchronous API
3481  *
3482  * @param[in]   handle  pointer to application info handle
3483  * @param[out] taskmanage               pointer to hold package taskmanage value
3484  * @return      0 if success, error code(<0) if fail
3485  * @retval      PMINFO_R_OK     success
3486  * @retval      PMINFO_R_EINVAL invalid argument
3487  * @retval      PMINFO_R_ERROR  internal error
3488  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3489  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3490  * @see         pkgmgrinfo_appinfo_get_appid()
3491  * @see         pkgmgrinfo_appinfo_is_multiple()
3492  * @code
3493 static int get_app_taskmanage(const char *appid)
3494 {
3495         int ret = 0;
3496         bool taskmanage;
3497         pkgmgrinfo_appinfo_h handle;
3498         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3499         if (ret != PMINFO_R_OK)
3500                 return -1;
3501         ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &taskmanage);
3502         if (ret != PMINFO_R_OK) {
3503                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3504                 return -1;
3505         }
3506         printf("app taskmanage: %d\n", taskmanage);
3507         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3508         return 0;
3509 }
3510  * @endcode
3511  */
3512 int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h  handle, bool *taskmanage);
3513
3514 /**
3515  * @fn int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h handle, bool *enabled)
3516  * @brief       This API gets the application 'taskmanage' value from the app ID
3517  *
3518  * @par         This API is for package-manager client application
3519  * @par Sync (or) Async : Synchronous API
3520  *
3521  * @param[in]   handle  pointer to application info handle
3522  * @param[out] enabled          pointer to hold package enabled value
3523  * @return      0 if success, error code(<0) if fail
3524  * @retval      PMINFO_R_OK     success
3525  * @retval      PMINFO_R_EINVAL invalid argument
3526  * @retval      PMINFO_R_ERROR  internal error
3527  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3528  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3529  * @see         pkgmgrinfo_appinfo_get_appid()
3530  * @see         pkgmgrinfo_appinfo_is_multiple()
3531  * @code
3532 static int get_app_enabled(const char *appid)
3533 {
3534         int ret = 0;
3535         bool enabled;
3536         pkgmgrinfo_appinfo_h handle;
3537         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3538         if (ret != PMINFO_R_OK)
3539                 return -1;
3540         ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &enabled);
3541         if (ret != PMINFO_R_OK) {
3542                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3543                 return -1;
3544         }
3545         printf("app enabled: %d\n", enabled);
3546         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3547         return 0;
3548 }
3549  * @endcode
3550  */
3551 int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h  handle, bool *enabled);
3552
3553 /**
3554  * @fn int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h handle, bool *onboot)
3555  * @brief       This API gets the application 'onboot' value from the app ID
3556  *
3557  * @par         This API is for package-manager client application
3558  * @par Sync (or) Async : Synchronous API
3559  *
3560  * @param[in]   handle  pointer to application info handle
3561  * @param[out] onboot           pointer to hold package onboot value
3562  * @return      0 if success, error code(<0) if fail
3563  * @retval      PMINFO_R_OK     success
3564  * @retval      PMINFO_R_EINVAL invalid argument
3565  * @retval      PMINFO_R_ERROR  internal error
3566  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3567  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3568  * @see         pkgmgrinfo_appinfo_get_appid()
3569  * @see         pkgmgrinfo_appinfo_is_multiple()
3570  * @code
3571 static int get_app_onboot(const char *appid)
3572 {
3573         int ret = 0;
3574         bool onboot;
3575         pkgmgrinfo_appinfo_h handle;
3576         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3577         if (ret != PMINFO_R_OK)
3578                 return -1;
3579         ret = pkgmgrinfo_appinfo_is_onboot(handle, &onboot);
3580         if (ret != PMINFO_R_OK) {
3581                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3582                 return -1;
3583         }
3584         printf("app onboot: %d\n", onboot);
3585         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3586         return 0;
3587 }
3588  * @endcode
3589  */
3590 int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h  handle, bool *onboot);
3591
3592 /**
3593  * @fn int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h handle, bool *autorestart)
3594  * @brief       This API gets the application 'autorestart' value from the app ID
3595  *
3596  * @par         This API is for package-manager client application
3597  * @par Sync (or) Async : Synchronous API
3598  *
3599  * @param[in]   handle  pointer to application info handle
3600  * @param[out] autorestart              pointer to hold package autorestart value
3601  * @return      0 if success, error code(<0) if fail
3602  * @retval      PMINFO_R_OK     success
3603  * @retval      PMINFO_R_EINVAL invalid argument
3604  * @retval      PMINFO_R_ERROR  internal error
3605  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3606  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3607  * @see         pkgmgrinfo_appinfo_get_appid()
3608  * @see         pkgmgrinfo_appinfo_is_multiple()
3609  * @code
3610 static int get_app_autorestart(const char *appid)
3611 {
3612         int ret = 0;
3613         bool autorestart;
3614         pkgmgrinfo_appinfo_h handle;
3615         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3616         if (ret != PMINFO_R_OK)
3617                 return -1;
3618         ret = pkgmgrinfo_appinfo_is_autorestart(handle, &autorestart);
3619         if (ret != PMINFO_R_OK) {
3620                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3621                 return -1;
3622         }
3623         printf("app autorestart: %d\n", autorestart);
3624         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3625         return 0;
3626 }
3627  * @endcode
3628  */
3629 int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h  handle, bool *autorestart);
3630
3631 /**
3632  * @fn int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainapp)
3633  * @brief       This API gets the value for given application is main app or not from handle
3634  *
3635  * @par         This API is for package-manager client application
3636  * @par Sync (or) Async : Synchronous API
3637  *
3638  * @param[in]   handle  pointer to application info handle
3639  * @param[out] mainapp          pointer to hold package mainapp is or not
3640  * @return      0 if success, error code(<0) if fail
3641  * @retval      PMINFO_R_OK     success
3642  * @retval      PMINFO_R_EINVAL invalid argument
3643  * @retval      PMINFO_R_ERROR  internal error
3644  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3645  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3646  * @see         pkgmgrinfo_appinfo_get_appid()
3647  * @see         pkgmgrinfo_appinfo_is_multiple()
3648  * @code
3649 static int get_app_mainapp(const char *appid)
3650 {
3651         int ret = 0;
3652         bool mainapp;
3653         pkgmgrinfo_appinfo_h handle;
3654         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3655         if (ret != PMINFO_R_OK)
3656                 return -1;
3657         ret = pkgmgrinfo_appinfo_is_mainapp(handle, &mainapp);
3658         if (ret != PMINFO_R_OK) {
3659                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3660                 return -1;
3661         }
3662         printf("mainapp: %d\n", mainapp);
3663         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3664         return 0;
3665 }
3666  * @endcode
3667  */
3668 int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainapp);
3669
3670
3671 /**
3672  * @fn int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload)
3673  * @brief       This API gets the value for given application is preload or not from handle
3674  *
3675  * @par         This API is for package-manager client application
3676  * @par Sync (or) Async : Synchronous API
3677  *
3678  * @param[in]   handle  pointer to application info handle
3679  * @param[out] preload          pointer to hold preload is or not
3680  * @return      0 if success, error code(<0) if fail
3681  * @retval      PMINFO_R_OK     success
3682  * @retval      PMINFO_R_EINVAL invalid argument
3683  * @retval      PMINFO_R_ERROR  internal error
3684  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3685  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3686  * @see         pkgmgrinfo_appinfo_get_appid()
3687  * @see         pkgmgrinfo_appinfo_is_multiple()
3688  * @code
3689 static int get_app_preload(const char *appid)
3690 {
3691         int ret = 0;
3692         bool preload = 0;
3693         pkgmgrinfo_appinfo_h handle = NULL;
3694         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3695         if (ret != PMINFO_R_OK)
3696                 return -1;
3697         ret = pkgmgrinfo_appinfo_is_preload(handle, &preload);
3698         if (ret != PMINFO_R_OK) {
3699                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3700                 return -1;
3701         }
3702         printf("preload: %d\n", preload);
3703         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3704         return 0;
3705 }
3706  * @endcode
3707  */
3708 int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload);
3709
3710 /**
3711  * @fn int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode)
3712  * @brief       This API gets the value for given application is submode or not from handle
3713  *
3714  * @par         This API is for package-manager client application
3715  * @par Sync (or) Async : Synchronous API
3716  *
3717  * @param[in]   handle  pointer to application info handle
3718  * @param[out] submode          pointer to hold submode is or not
3719  * @return      0 if success, error code(<0) if fail
3720  * @retval      PMINFO_R_OK     success
3721  * @retval      PMINFO_R_EINVAL invalid argument
3722  * @retval      PMINFO_R_ERROR  internal error
3723  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3724  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3725  * @see         pkgmgrinfo_appinfo_get_appid()
3726  * @see         pkgmgrinfo_appinfo_is_multiple()
3727  * @code
3728 static int get_app_submode(const char *appid)
3729 {
3730         int ret = 0;
3731         bool submode = 0;
3732         pkgmgrinfo_appinfo_h handle = NULL;
3733         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3734         if (ret != PMINFO_R_OK)
3735                 return -1;
3736         ret = pkgmgrinfo_appinfo_is_submode(handle, &submode);
3737         if (ret != PMINFO_R_OK) {
3738                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3739                 return -1;
3740         }
3741         printf("submode: %d\n", submode);
3742         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3743         return 0;
3744 }
3745  * @endcode
3746  */
3747 int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode);
3748
3749 /**
3750  * @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
3751  * @brief       This API destroys the application information handle freeing up all the resources
3752  *
3753  * @par         This API is for package-manager client application
3754  * @par Sync (or) Async : Synchronous API
3755  *
3756  * @param[in] handle            pointer to the application info handle.
3757  * @return      0 if success, error code(<0) if fail
3758  * @retval      PMINFO_R_OK     success
3759  * @retval      PMINFO_R_EINVAL invalid argument
3760  * @retval      PMINFO_R_ERROR  internal error
3761  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3762  * @post                None
3763  * @see         pkgmgrinfo_appinfo_get_pkgid()
3764  * @see         pkgmgrinfo_appinfo_is_multiple()
3765  * @code
3766 static int get_app_type(const char *appid)
3767 {
3768         int ret = 0;
3769         char *type = NULL;
3770         pkgmgrinfo_appinfo_h handle;
3771         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3772         if (ret != PMINFO_R_OK)
3773                 return -1;
3774         ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
3775         if (ret != PMINFO_R_OK) {
3776                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3777                 return -1;
3778         }
3779         printf("apptype: %s\n", type);
3780         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3781         return 0;
3782 }
3783  * @endcode
3784  */
3785 int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h  handle);
3786
3787 /**
3788  * @fn int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle)
3789  * @brief       This API creates the application information filter handle from db.  All filter properties will be ANDed.
3790  The query will search the entire application information collected from the manifest file of all the installed packages
3791  *
3792  * @par         This API is for package-manager client application
3793  * @par Sync (or) Async : Synchronous API
3794  *
3795  * @param[out] handle           pointer to the application info filter handle.
3796  * @return      0 if success, error code(<0) if fail
3797  * @retval      PMINFO_R_OK     success
3798  * @retval      PMINFO_R_EINVAL invalid argument
3799  * @retval      PMINFO_R_ERROR  internal error
3800  * @pre         None
3801  * @post                pkgmgrinfo_appinfo_filter_destroy()
3802  * @see         pkgmgrinfo_appinfo_filter_count()
3803  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3804  * @code
3805 static int get_capp_count()
3806 {
3807         int ret = 0;
3808         int count = 0;
3809         pkgmgrinfo_appinfo_filter_h handle;
3810         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3811         if (ret != PMINFO_R_OK)
3812                 return -1;
3813         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
3814         if (ret != PMINFO_R_OK) {
3815                 pkgmgrinfo_appinfo_filter_destroy(handle);
3816                 return -1;
3817         }
3818         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3819         if (ret != PMINFO_R_OK) {
3820                 pkgmgrinfo_appinfo_filter_destroy(handle);
3821                 return -1;
3822         }
3823         printf("No of capp: %d\n", count);
3824         pkgmgrinfo_appinfo_filter_destroy(handle);
3825         return 0;
3826 }
3827  * @endcode
3828  */
3829 int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle);
3830
3831 /**
3832  * @fn int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle)
3833  * @brief       This API destroys the application information filter handle freeing up all the resources
3834  *
3835  * @par         This API is for package-manager client application
3836  * @par Sync (or) Async : Synchronous API
3837  *
3838  * @param[in] handle            pointer to the application info filter handle.
3839  * @return      0 if success, error code(<0) if fail
3840  * @retval      PMINFO_R_OK     success
3841  * @retval      PMINFO_R_EINVAL invalid argument
3842  * @retval      PMINFO_R_ERROR  internal error
3843  * @pre         pkgmgrinfo_appinfo_filter_create()
3844  * @post                None
3845  * @see         pkgmgrinfo_appinfo_filter_count()
3846  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3847  * @code
3848 static int get_capp_count()
3849 {
3850         int ret = 0;
3851         int count = 0;
3852         pkgmgrinfo_appinfo_filter_h handle;
3853         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3854         if (ret != PMINFO_R_OK)
3855                 return -1;
3856         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
3857         if (ret != PMINFO_R_OK) {
3858                 pkgmgrinfo_appinfo_filter_destroy(handle);
3859                 return -1;
3860         }
3861         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3862         if (ret != PMINFO_R_OK) {
3863                 pkgmgrinfo_appinfo_filter_destroy(handle);
3864                 return -1;
3865         }
3866         printf("No of capp: %d\n", count);
3867         pkgmgrinfo_appinfo_filter_destroy(handle);
3868         return 0;
3869 }
3870  * @endcode
3871  */
3872 int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle);
3873
3874 /**
3875  * @fn int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle, const char *property, const bool value)
3876  * @brief       This API adds a boolean filter property to the filter handle
3877  *
3878  * @par         This API is for package-manager client application
3879  * @par Sync (or) Async : Synchronous API
3880  *
3881  * @param[in] handle            pointer to the application info filter handle.
3882  * @param[in] property          boolean property name.
3883  * @param[in] value             value corresponding to the property.
3884  * @return      0 if success, error code(<0) if fail
3885  * @retval      PMINFO_R_OK     success
3886  * @retval      PMINFO_R_EINVAL invalid argument
3887  * @retval      PMINFO_R_ERROR  internal error
3888  * @pre         pkgmgrinfo_appinfo_filter_create()
3889  * @post                pkgmgrinfo_appinfo_filter_destroy()
3890  * @see         pkgmgrinfo_appinfo_filter_count()
3891  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3892  * @code
3893 static int get_taskmanageable_app_count()
3894 {
3895         int ret = 0;
3896         int count = 0;
3897         pkgmgrinfo_appinfo_filter_h handle;
3898         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3899         if (ret != PMINFO_R_OK)
3900                 return -1;
3901         ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_TASKMANAGE, 1);
3902         if (ret != PMINFO_R_OK) {
3903                 pkgmgrinfo_appinfo_filter_destroy(handle);
3904                 return -1;
3905         }
3906         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3907         if (ret != PMINFO_R_OK) {
3908                 pkgmgrinfo_appinfo_filter_destroy(handle);
3909                 return -1;
3910         }
3911         printf("No of taskmanageable apps: %d\n", count);
3912         pkgmgrinfo_appinfo_filter_destroy(handle);
3913         return 0;
3914 }
3915  * @endcode
3916  */
3917 int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
3918                 const char *property, const bool value);
3919
3920 /**
3921  * @fn int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle, const char *property, const int value)
3922  * @brief       This API adds an integer filter property to the filter handle
3923  *
3924  * @par         This API is for package-manager client application
3925  * @par Sync (or) Async : Synchronous API
3926  *
3927  * @param[in] handle            pointer to the application info filter handle.
3928  * @param[in] property          integer property name.
3929  * @param[in] value             value corresponding to the property.
3930  * @return      0 if success, error code(<0) if fail
3931  * @retval      PMINFO_R_OK     success
3932  * @retval      PMINFO_R_EINVAL invalid argument
3933  * @retval      PMINFO_R_ERROR  internal error
3934  * @pre         pkgmgrinfo_appinfo_filter_create()
3935  * @post                pkgmgrinfo_appinfo_filter_destroy()
3936  * @see         pkgmgrinfo_appinfo_filter_count()
3937  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3938  * @code
3939 static int get_taskmanageable_app_count()
3940 {
3941         int ret = 0;
3942         int count = 0;
3943         pkgmgrinfo_appinfo_filter_h handle;
3944         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3945         if (ret != PMINFO_R_OK)
3946                 return -1;
3947         ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_XXX, 10);
3948         if (ret != PMINFO_R_OK) {
3949                 pkgmgrinfo_appinfo_filter_destroy(handle);
3950                 return -1;
3951         }
3952         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3953         if (ret != PMINFO_R_OK) {
3954                 pkgmgrinfo_appinfo_filter_destroy(handle);
3955                 return -1;
3956         }
3957         printf("No of apps: %d\n", count);
3958         pkgmgrinfo_appinfo_filter_destroy(handle);
3959         return 0;
3960 }
3961  * @endcode
3962  */
3963 int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
3964                 const char *property, const int value);
3965
3966 /**
3967  * @fn int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle, const char *property, const char *value)
3968  * @brief       This API adds a string filter property to the filter handle
3969  *
3970  * @par         This API is for package-manager client application
3971  * @par Sync (or) Async : Synchronous API
3972  *
3973  * @param[in] handle            pointer to the application info filter handle.
3974  * @param[in] property          string property name.
3975  * @param[in] value             value corresponding to the property.
3976  * @return      0 if success, error code(<0) if fail
3977  * @retval      PMINFO_R_OK     success
3978  * @retval      PMINFO_R_EINVAL invalid argument
3979  * @retval      PMINFO_R_ERROR  internal error
3980  * @pre         pkgmgrinfo_appinfo_filter_create()
3981  * @post                pkgmgrinfo_appinfo_filter_destroy()
3982  * @see         pkgmgrinfo_appinfo_filter_count()
3983  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
3984  * @code
3985 static int get_capp_count()
3986 {
3987         int ret = 0;
3988         int count = 0;
3989         pkgmgrinfo_appinfo_filter_h handle;
3990         ret = pkgmgrinfo_appinfo_filter_create(&handle);
3991         if (ret != PMINFO_R_OK)
3992                 return -1;
3993         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
3994         if (ret != PMINFO_R_OK) {
3995                 pkgmgrinfo_appinfo_filter_destroy(handle);
3996                 return -1;
3997         }
3998         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
3999         if (ret != PMINFO_R_OK) {
4000                 pkgmgrinfo_appinfo_filter_destroy(handle);
4001                 return -1;
4002         }
4003         printf("No of capp: %d\n", count);
4004         pkgmgrinfo_appinfo_filter_destroy(handle);
4005         return 0;
4006 }
4007  * @endcode
4008  */
4009 int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
4010                 const char *property, const char *value);
4011
4012 /**
4013  * @fn int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle, pkgmgrinfo_app_list_cb app_cb, void *user_data)
4014  * @brief       This API executes the user supplied callback function for each application that satisfy the filter conditions
4015  *
4016  * @par         This API is for package-manager client application
4017  * @par Sync (or) Async : Synchronous API
4018  *
4019  * @param[in] handle            pointer to the application info filter handle.
4020  * @param[in] app_cb            callback function.
4021  * @param[in] user_data         user data to be passed to the callback function
4022  * @return      0 if success, error code(<0) if fail
4023  * @retval      PMINFO_R_OK     success
4024  * @retval      PMINFO_R_EINVAL invalid argument
4025  * @retval      PMINFO_R_ERROR  internal error
4026  * @pre         pkgmgrinfo_appinfo_filter_create()
4027  * @post                pkgmgrinfo_appinfo_filter_destroy()
4028  * @see         pkgmgrinfo_appinfo_filter_count()
4029  * @code
4030 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
4031 {
4032         char *appid = NULL;
4033         pkgmgrinfo_appinfo_get_appid(handle, &appid);
4034         printf("appid : %s\n", appid);
4035         return 0;
4036 }
4037
4038 static int get_capp_list()
4039 {
4040         int ret = 0;
4041         pkgmgrinfo_appinfo_filter_h handle;
4042         ret = pkgmgrinfo_appinfo_filter_create(&handle);
4043         if (ret != PMINFO_R_OK)
4044                 return -1;
4045         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
4046         if (ret != PMINFO_R_OK) {
4047                 pkgmgrinfo_appinfo_filter_destroy(handle);
4048                 return -1;
4049         }
4050         ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, app_list_cb, NULL);
4051         if (ret != PMINFO_R_OK) {
4052                 pkgmgrinfo_appinfo_filter_destroy(handle);
4053                 return -1;
4054         }
4055         pkgmgrinfo_appinfo_filter_destroy(handle);
4056         return 0;
4057 }
4058  * @endcode
4059  */
4060 int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
4061                 pkgmgrinfo_app_list_cb app_cb, void *user_data);
4062 int pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
4063                 pkgmgrinfo_app_list_cb app_cb, void *user_data, uid_t uid);
4064
4065 /**
4066  * @fn int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count)
4067  * @fn int pkgmgrinfo_appinfo_usr_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count, uid_t uid)
4068  * @brief       This API counts the application that satisfy the filter conditions
4069  *
4070  * @par         This API is for package-manager client application
4071  * @par Sync (or) Async : Synchronous API
4072  *
4073  * @param[in] handle            pointer to the application info filter handle.
4074  * @param[in] count             pointer to store count value
4075  * @param[in]   uid     the addressee user id of the instruction
4076  * @return      0 if success, error code(<0) if fail
4077  * @retval      PMINFO_R_OK     success
4078  * @retval      PMINFO_R_EINVAL invalid argument
4079  * @retval      PMINFO_R_ERROR  internal error
4080  * @pre         pkgmgrinfo_appinfo_filter_create()
4081  * @post                pkgmgrinfo_appinfo_filter_destroy()
4082  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
4083  * @code
4084 static int get_capp_count()
4085 {
4086         int ret = 0;
4087         int count = 0;
4088         pkgmgrinfo_appinfo_filter_h handle;
4089         ret = pkgmgrinfo_appinfo_filter_create(&handle);
4090         if (ret != PMINFO_R_OK)
4091                 return -1;
4092         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
4093         if (ret != PMINFO_R_OK) {
4094                 pkgmgrinfo_appinfo_filter_destroy(handle);
4095                 return -1;
4096         }
4097         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
4098         if (ret != PMINFO_R_OK) {
4099                 pkgmgrinfo_appinfo_filter_destroy(handle);
4100                 return -1;
4101         }
4102         printf("No of capp: %d\n", count);
4103         pkgmgrinfo_appinfo_filter_destroy(handle);
4104         return 0;
4105 }
4106  * @endcode
4107  */
4108 int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count);
4109 int pkgmgrinfo_appinfo_usr_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count, uid_t uid);
4110 /**
4111  * @fn int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle)
4112  * @brief       This API creates the application's metadata  information filter handle from db.
4113  *
4114  * @par         This API is for package-manager client application
4115  * @par Sync (or) Async : Synchronous API
4116  *
4117  * @param[out] handle           pointer to the application metadata info filter handle.
4118  * @return      0 if success, error code(<0) if fail
4119  * @retval      PMINFO_R_OK     success
4120  * @retval      PMINFO_R_EINVAL invalid argument
4121  * @retval      PMINFO_R_ERROR  internal error
4122  * @pre         None
4123  * @post                pkgmgrinfo_appinfo_metadata_filter_destroy()
4124  * @see         pkgmgrinfo_appinfo_metadata_filter_foreach()
4125  * @code
4126 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
4127 {
4128         char *appid = NULL;
4129         pkgmgrinfo_appinfo_get_appid(handle, &appid);
4130         printf("appid : %s\n", appid);
4131         return 0;
4132 }
4133
4134 static int get_app_list(const char *mkey, const char *mvalue)
4135 {
4136         int ret = 0;
4137         pkgmgrinfo_appinfo_metadata_filter_h handle;
4138         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
4139         if (ret != PMINFO_R_OK)
4140                 return -1;
4141         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
4142         if (ret != PMINFO_R_OK) {
4143                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4144                 return -1;
4145         }
4146         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
4147         if (ret != PMINFO_R_OK) {
4148                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4149                 return -1;
4150         }
4151         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4152         return 0;
4153 }
4154  * @endcode
4155  */
4156 int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle);
4157
4158 /**
4159  * @fn int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle)
4160  * @brief       This API destroys the application's metadata  information filter handle.
4161  *
4162  * @par         This API is for package-manager client application
4163  * @par Sync (or) Async : Synchronous API
4164  *
4165  * @param[in] handle            pointer to the application metadata info filter handle.
4166  * @return      0 if success, error code(<0) if fail
4167  * @retval      PMINFO_R_OK     success
4168  * @retval      PMINFO_R_EINVAL invalid argument
4169  * @retval      PMINFO_R_ERROR  internal error
4170  * @pre         pkgmgrinfo_appinfo_metadata_filter_create()
4171  * @post                None
4172  * @see         pkgmgrinfo_appinfo_metadata_filter_foreach()
4173  * @code
4174 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
4175 {
4176         char *appid = NULL;
4177         pkgmgrinfo_appinfo_get_appid(handle, &appid);
4178         printf("appid : %s\n", appid);
4179         return 0;
4180 }
4181
4182 static int get_app_list(const char *mkey, const char *mvalue)
4183 {
4184         int ret = 0;
4185         pkgmgrinfo_appinfo_metadata_filter_h handle;
4186         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
4187         if (ret != PMINFO_R_OK)
4188                 return -1;
4189         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
4190         if (ret != PMINFO_R_OK) {
4191                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4192                 return -1;
4193         }
4194         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
4195         if (ret != PMINFO_R_OK) {
4196                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4197                 return -1;
4198         }
4199         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4200         return 0;
4201 }
4202  * @endcode
4203  */
4204 int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle);
4205
4206 /**
4207  * @fn int pkgmgrinfo_appinfo_metadata_filter_add(pkgmgrinfo_appinfo_metadata_filter_h handle, const char *key, const char *value)
4208  * @brief       This API adds filter condition for the query API.  The query will search the entire application metadata  information collected from
4209  * the manifest file of all the installed packages. You can specify value as NULL to search based on key only.
4210  *
4211  * @par         This API is for package-manager client application
4212  * @par Sync (or) Async : Synchronous API
4213  *
4214  * @param[in] handle            pointer to the application metadata info filter handle.
4215  * @param[in] key                       pointer to metadata key
4216  * @param[in] value                     pointer to metadata value
4217  * @return      0 if success, error code(<0) if fail
4218  * @retval      PMINFO_R_OK     success
4219  * @retval      PMINFO_R_EINVAL invalid argument
4220  * @retval      PMINFO_R_ERROR  internal error
4221  * @pre         pkgmgrinfo_appinfo_metadata_filter_create()
4222  * @post                pkgmgrinfo_appinfo_metadata_filter_foreach(), pkgmgrinfo_appinfo_metadata_filter_destroy()
4223  * @see         pkgmgrinfo_appinfo_metadata_filter_foreach()
4224  * @code
4225 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
4226 {
4227         char *appid = NULL;
4228         pkgmgrinfo_appinfo_get_appid(handle, &appid);
4229         printf("appid : %s\n", appid);
4230         return 0;
4231 }
4232
4233 static int get_app_list(const char *mkey, const char *mvalue)
4234 {
4235         int ret = 0;
4236         pkgmgrinfo_appinfo_metadata_filter_h handle;
4237         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
4238         if (ret != PMINFO_R_OK)
4239                 return -1;
4240         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
4241         if (ret != PMINFO_R_OK) {
4242                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4243                 return -1;
4244         }
4245         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
4246         if (ret != PMINFO_R_OK) {
4247                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4248                 return -1;
4249         }
4250         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4251         return 0;
4252 }
4253  * @endcode
4254  */
4255 int pkgmgrinfo_appinfo_metadata_filter_add(pkgmgrinfo_appinfo_metadata_filter_h handle,
4256                 const char *key, const char *value);
4257
4258 /**
4259  * @fn int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle, pkgmgrinfo_app_list_cb app_cb, void *user_data)
4260  * @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)
4261  * @brief       This API executes the filter query. The query will search the entire application metadata  information collected from
4262  * the manifest file of all the installed packages. For each application returned by the query, the callback will be called. If callback returns
4263  * negative value, no more callbacks will be called and API will return.
4264  *
4265  * @par         This API is for package-manager client application
4266  * @par Sync (or) Async : Synchronous API
4267  *
4268  * @param[in] handle            pointer to the application metadata info filter handle.
4269  * @param[in] app_cb            function pointer to callback
4270  * @param[in] user_data         pointer to user data
4271  * @param[in]   uid     the addressee user id of the instruction
4272  * @return      0 if success, error code(<0) if fail
4273  * @retval      PMINFO_R_OK     success
4274  * @retval      PMINFO_R_EINVAL invalid argument
4275  * @retval      PMINFO_R_ERROR  internal error
4276  * @pre         pkgmgrinfo_appinfo_metadata_filter_create()
4277  * @post                pkgmgrinfo_appinfo_metadata_filter_destroy()
4278  * @code
4279 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
4280 {
4281         char *appid = NULL;
4282         pkgmgrinfo_appinfo_get_appid(handle, &appid);
4283         printf("appid : %s\n", appid);
4284         return 0;
4285 }
4286
4287 static int get_app_list(const char *mkey, const char *mvalue)
4288 {
4289         int ret = 0;
4290         pkgmgrinfo_appinfo_metadata_filter_h handle;
4291         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
4292         if (ret != PMINFO_R_OK)
4293                 return -1;
4294         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
4295         if (ret != PMINFO_R_OK) {
4296                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4297                 return -1;
4298         }
4299         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
4300         if (ret != PMINFO_R_OK) {
4301                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4302                 return -1;
4303         }
4304         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
4305         return 0;
4306 }
4307  * @endcode
4308  */
4309 int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle,
4310                 pkgmgrinfo_app_list_cb app_cb, void *user_data);
4311 int pkgmgrinfo_appinfo_usr_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle,
4312                 pkgmgrinfo_app_list_cb app_cb, void *user_data, uid_t uid);
4313 /**
4314  * @fn int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle)
4315  * @brief       This API creates the package cert information handle to get data from db.
4316  *
4317  * @par         This API is for package-manager client application
4318  * @par Sync (or) Async : Synchronous API
4319  *
4320  * @param[out] handle           pointer to the package cert handle.
4321  * @return      0 if success, error code(<0) if fail
4322  * @retval      PMINFO_R_OK     success
4323  * @retval      PMINFO_R_EINVAL invalid argument
4324  * @retval      PMINFO_R_ERROR  internal error
4325  * @pre         None
4326  * @post                pkgmgrinfo_pkginfo_destroy_certinfo()
4327  * @see         pkgmgrinfo_pkginfo_get_cert_value()
4328  * @see         pkgmgrinfo_pkginfo_load_certinfo()
4329  * @code
4330 static int get_cert_info(const char *pkgid)
4331 {
4332         int ret = 0;
4333         pkgmgrinfo_certinfo_h handle;
4334         char *auth_cert = NULL;
4335         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
4336         if (ret != PMINFO_R_OK)
4337                 return -1;
4338         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
4339         if (ret != PMINFO_R_OK) {
4340                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4341                 return -1;
4342         }
4343         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
4344         if (ret != PMINFO_R_OK) {
4345                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4346                 return -1;
4347         }
4348         printf("Author root certificate: %s\n", auth_root);
4349         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4350         return 0;
4351 }
4352  * @endcode
4353  */
4354 int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle);
4355
4356 /**
4357  * @fn int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle)
4358  * @brief       This API loads the package cert information handle with data from db.
4359  *
4360  * @par         This API is for package-manager client application
4361  * @par Sync (or) Async : Synchronous API
4362  *
4363  * @param[in] pkgid             pointer to the package ID.
4364  * @param[in] handle            pointer to the package cert handle.
4365  * @return      0 if success, error code(<0) if fail
4366  * @retval      PMINFO_R_OK     success
4367  * @retval      PMINFO_R_EINVAL invalid argument
4368  * @retval      PMINFO_R_ERROR  internal error
4369  * @pre         pkgmgrinfo_pkginfo_create_certinfo()
4370  * @post                pkgmgrinfo_pkginfo_destroy_certinfo()
4371  * @see         pkgmgrinfo_pkginfo_get_cert_value()
4372  * @code
4373 static int get_cert_info(const char *pkgid)
4374 {
4375         int ret = 0;
4376         pkgmgrinfo_certinfo_h handle;
4377         char *auth_cert = NULL;
4378         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
4379         if (ret != PMINFO_R_OK)
4380                 return -1;
4381         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
4382         if (ret != PMINFO_R_OK) {
4383                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4384                 return -1;
4385         }
4386         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
4387         if (ret != PMINFO_R_OK) {
4388                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4389                 return -1;
4390         }
4391         printf("Author root certificate: %s\n", auth_root);
4392         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4393         return 0;
4394 }
4395  * @endcode
4396  */
4397 int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle, uid_t uid);
4398
4399 /**
4400  * @fn int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value)
4401  * @brief       This API gets the package cert information from the handle
4402  *
4403  * @par         This API is for package-manager client application
4404  * @par Sync (or) Async : Synchronous API
4405  *
4406  * @param[in] handle            pointer to the package cert handle.
4407  * @param[in] cert_type         certificate type
4408  * @param[out] cert_value       pointer to hold certificate value
4409  * @return      0 if success, error code(<0) if fail
4410  * @retval      PMINFO_R_OK     success
4411  * @retval      PMINFO_R_EINVAL invalid argument
4412  * @retval      PMINFO_R_ERROR  internal error
4413  * @pre         pkgmgrinfo_pkginfo_create_certinfo()
4414  * @post                pkgmgrinfo_pkginfo_destroy_certinfo()
4415  * @see         pkgmgrinfo_pkginfo_load_certinfo()
4416  * @code
4417 static int get_cert_info(const char *pkgid)
4418 {
4419         int ret = 0;
4420         pkgmgrinfo_certinfo_h handle;
4421         char *auth_cert = NULL;
4422         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
4423         if (ret != PMINFO_R_OK)
4424                 return -1;
4425         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
4426         if (ret != PMINFO_R_OK) {
4427                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4428                 return -1;
4429         }
4430         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
4431         if (ret != PMINFO_R_OK) {
4432                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4433                 return -1;
4434         }
4435         printf("Author root certificate: %s\n", auth_root);
4436         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4437         return 0;
4438 }
4439  * @endcode
4440  */
4441 int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value);
4442
4443 /**
4444  * @fn int pkgmgrinfo_pkginfo_destroy_certinfo(pkgmgrinfo_certinfo_h handle)
4445  * @brief       This API destroys the package cert information handle freeing up all the resources
4446  *
4447  * @par         This API is for package-manager client application
4448  * @par Sync (or) Async : Synchronous API
4449  *
4450  * @param[in] handle            pointer to the package cert handle.
4451  * @return      0 if success, error code(<0) if fail
4452  * @retval      PMINFO_R_OK     success
4453  * @retval      PMINFO_R_EINVAL invalid argument
4454  * @retval      PMINFO_R_ERROR  internal error
4455  * @pre         pkgmgrinfo_pkginfo_create_certinfo()
4456  * @post                None
4457  * @see         pkgmgrinfo_pkginfo_load_certinfo()
4458  * @code
4459 static int get_cert_info(const char *pkgid)
4460 {
4461         int ret = 0;
4462         pkgmgrinfo_certinfo_h handle;
4463         char *auth_cert = NULL;
4464         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
4465         if (ret != PMINFO_R_OK)
4466                 return -1;
4467         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
4468         if (ret != PMINFO_R_OK) {
4469                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4470                 return -1;
4471         }
4472         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
4473         if (ret != PMINFO_R_OK) {
4474                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4475                 return -1;
4476         }
4477         printf("Author root certificate: %s\n", auth_root);
4478         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
4479         return 0;
4480 }
4481  * @endcode
4482  */
4483 int pkgmgrinfo_pkginfo_destroy_certinfo(pkgmgrinfo_certinfo_h handle);
4484
4485 /**
4486  * @fn int pkgmgrinfo_delete_certinfo(const char *pkgid)
4487  * @brief       This API deletes the package cert information from DB
4488  *
4489  * @par         This API is for package-manager client application
4490  * @par Sync (or) Async : Synchronous API
4491  *
4492  * @param[in] pkgid             pointer to the package ID.
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         None
4498  * @post                None
4499  * @code
4500 static int delete_cert_info(const char *pkgid)
4501 {
4502         int ret = 0;
4503         ret = pkgmgrinfo_delete_certinfo(pkgid);
4504         if (ret != PMINFO_R_OK)
4505                 return -1;
4506         return 0;
4507 }
4508  * @endcode
4509  */
4510  int pkgmgrinfo_delete_certinfo(const char *pkgid);
4511  int pkgmgrinfo_delete_usr_certinfo(const char *pkgid, uid_t uid);
4512 /**
4513  * @fn int pkgmgrinfo_create_pkgdbinfo(const char *pkgid, pkgmgrinfo_pkgdbinfo_h *handle)
4514  * @fn int pkgmgrinfo_create_pkgusrdbinfo(const char *pkgid, pkgmgrinfo_pkgdbinfo_h *handle)
4515  * @brief       This API creates the package db information handle to set data in db.
4516  *
4517  * @par         This API is for package-manager client application
4518  * @par Sync (or) Async : Synchronous API
4519  *
4520  * @param[in] pkgid     pointer to the package ID.
4521  * @param[in]   uid     the addressee user id of the instruction
4522  * @param[out] handle           pointer to the package db info handle.
4523  * @return      0 if success, error code(<0) if fail
4524  * @retval      PMINFO_R_OK     success
4525  * @retval      PMINFO_R_EINVAL invalid argument
4526  * @retval      PMINFO_R_ERROR  internal error
4527  * @pre         None
4528  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4529  * @see         pkgmgrinfo_save_pkgdbinfo()
4530  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4531  * @code
4532 static int set_pkg_in_db(const char *pkgid)
4533 {
4534         int ret = 0;
4535         pkgmgrinfo_pkgdbinfo_h handle;
4536         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4537         if (ret != PMINFO_R_OK)
4538                 return -1;
4539         ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
4540         if (ret != PMINFO_R_OK) {
4541                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4542                 return -1;
4543         }
4544         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4545         if (ret != PMINFO_R_OK) {
4546                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4547                 return -1;
4548         }
4549         pkgmgrinfo_destroy_pkgdbinfo(handle);
4550         return 0;
4551 }
4552  * @endcode
4553  */
4554 int pkgmgrinfo_create_pkgdbinfo(const char *pkgid, pkgmgrinfo_pkgdbinfo_h *handle);
4555 int pkgmgrinfo_create_pkgusrdbinfo(const char *pkgid, uid_t uid, pkgmgrinfo_pkgdbinfo_h *handle);
4556
4557 /**
4558  * @fn int pkgmgrinfo_set_type_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *type)
4559  * @brief       This API sets the package type in db handle
4560  *
4561  * @par         This API is for package-manager client application
4562  * @par Sync (or) Async : Synchronous API
4563  *
4564  * @param[in] handle    pointer to the pkgdbinfo handle.
4565  * @param[in] type              pointer to the package type.
4566  * @return      0 if success, error code(<0) if fail
4567  * @retval      PMINFO_R_OK     success
4568  * @retval      PMINFO_R_EINVAL invalid argument
4569  * @retval      PMINFO_R_ERROR  internal error
4570  * @pre         pkgmgrinfo_create_pkgdbinfo()
4571  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4572  * @see         pkgmgrinfo_save_pkgdbinfo()
4573  * @see         pkgmgrinfo_set_version_to_pkgdbinfo()
4574  * @code
4575 static int set_pkg_type_in_db(const char *pkgid)
4576 {
4577         int ret = 0;
4578         pkgmgrinfo_pkgdbinfo_h handle;
4579         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4580         if (ret != PMINFO_R_OK)
4581                 return -1;
4582         ret = pkgmgrinfo_set_type_to_pkgdbinfo(handle, "wgt");
4583         if (ret != PMINFO_R_OK) {
4584                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4585                 return -1;
4586         }
4587         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4588         if (ret != PMINFO_R_OK) {
4589                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4590                 return -1;
4591         }
4592         pkgmgrinfo_destroy_pkgdbinfo(handle);
4593         return 0;
4594 }
4595  * @endcode
4596  */
4597 int pkgmgrinfo_set_type_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *type);
4598
4599 /**
4600  * @fn int pkgmgrinfo_set_version_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *version)
4601  * @brief       This API sets the package version in db handle
4602  *
4603  * @par         This API is for package-manager client application
4604  * @par Sync (or) Async : Synchronous API
4605  *
4606  * @param[in] handle    pointer to the pkgdbinfo handle.
4607  * @param[in] version           pointer to the package version
4608  * @return      0 if success, error code(<0) if fail
4609  * @retval      PMINFO_R_OK     success
4610  * @retval      PMINFO_R_EINVAL invalid argument
4611  * @retval      PMINFO_R_ERROR  internal error
4612  * @pre         pkgmgrinfo_create_pkgdbinfo()
4613  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4614  * @see         pkgmgrinfo_save_pkgdbinfo()
4615  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4616  * @code
4617 static int set_pkg_version_in_db(const char *pkgid)
4618 {
4619         int ret = 0;
4620         pkgmgrinfo_pkgdbinfo_h handle;
4621         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4622         if (ret != PMINFO_R_OK)
4623                 return -1;
4624         ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
4625         if (ret != PMINFO_R_OK) {
4626                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4627                 return -1;
4628         }
4629         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4630         if (ret != PMINFO_R_OK) {
4631                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4632                 return -1;
4633         }
4634         pkgmgrinfo_destroy_pkgdbinfo(handle);
4635         return 0;
4636 }
4637  * @endcode
4638  */
4639 int pkgmgrinfo_set_version_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *version);
4640
4641 /**
4642  * @fn int pkgmgrinfo_set_install_location_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
4643  * @brief       This API sets the package install location 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] location  package install location
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_type_to_pkgdbinfo()
4658  * @code
4659 static int set_pkg_install_location_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_install_location_to_pkgdbinfo(handle, INSTALL_INTERNAL);
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_install_location_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location);
4682
4683 /**
4684  * @fn int pkgmgrinfo_set_size_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *size)
4685  * @brief       This API sets the package size 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] size              pointer to the package size
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_size_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_size_to_pkgdbinfo(handle, "15");
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_size_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *size);
4724
4725 /**
4726  * @fn int pkgmgrinfo_set_label_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *label, const char *locale)
4727  * @brief       This API sets the package label 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] label             pointer to the package label
4734  * @param[in] locale    pointer to the locale
4735  * @return      0 if success, error code(<0) if fail
4736  * @retval      PMINFO_R_OK     success
4737  * @retval      PMINFO_R_EINVAL invalid argument
4738  * @retval      PMINFO_R_ERROR  internal error
4739  * @pre         pkgmgrinfo_create_pkgdbinfo()
4740  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4741  * @see         pkgmgrinfo_save_pkgdbinfo()
4742  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4743  * @code
4744 static int set_pkg_label_in_db(const char *pkgid)
4745 {
4746         int ret = 0;
4747         pkgmgrinfo_pkgdbinfo_h handle;
4748         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4749         if (ret != PMINFO_R_OK)
4750                 return -1;
4751         ret = pkgmgrinfo_set_label_to_pkgdbinfo(handle, "helloworld", "en-us");
4752         if (ret != PMINFO_R_OK) {
4753                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4754                 return -1;
4755         }
4756         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4757         if (ret != PMINFO_R_OK) {
4758                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4759                 return -1;
4760         }
4761         pkgmgrinfo_destroy_pkgdbinfo(handle);
4762         return 0;
4763 }
4764  * @endcode
4765  */
4766 int pkgmgrinfo_set_label_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *label, const char *locale);
4767
4768 /**
4769  * @fn int pkgmgrinfo_set_icon_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *icon, const char *locale)
4770  * @brief       This API sets the package icon in db handle
4771  *
4772  * @par         This API is for package-manager client application
4773  * @par Sync (or) Async : Synchronous API
4774  *
4775  * @param[in] handle    pointer to the pkgdbinfo handle.
4776  * @param[in] icon              pointer to the package icon
4777  * @param[in] locale    pointer to the locale
4778  * @return      0 if success, error code(<0) if fail
4779  * @retval      PMINFO_R_OK     success
4780  * @retval      PMINFO_R_EINVAL invalid argument
4781  * @retval      PMINFO_R_ERROR  internal error
4782  * @pre         pkgmgrinfo_create_pkgdbinfo()
4783  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4784  * @see         pkgmgrinfo_save_pkgdbinfo()
4785  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4786  * @code
4787 static int set_pkg_icon_in_db(const char *pkgid)
4788 {
4789         int ret = 0;
4790         pkgmgrinfo_pkgdbinfo_h handle;
4791         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4792         if (ret != PMINFO_R_OK)
4793                 return -1;
4794         ret = pkgmgrinfo_set_icon_to_pkgdbinfo(handle, "helloworld.png", "en-us");
4795         if (ret != PMINFO_R_OK) {
4796                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4797                 return -1;
4798         }
4799         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4800         if (ret != PMINFO_R_OK) {
4801                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4802                 return -1;
4803         }
4804         pkgmgrinfo_destroy_pkgdbinfo(handle);
4805         return 0;
4806 }
4807  * @endcode
4808  */
4809 int pkgmgrinfo_set_icon_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *icon, const char *locale);
4810
4811 /**
4812  * @fn int pkgmgrinfo_set_description_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *description, const char *locale)
4813  * @brief       This API sets the package description in db handle
4814  *
4815  * @par         This API is for package-manager client application
4816  * @par Sync (or) Async : Synchronous API
4817  *
4818  * @param[in] handle    pointer to the pkgdbinfo handle.
4819  * @param[in] description               pointer to the package description
4820  * @param[in] locale    pointer to the locale
4821  * @return      0 if success, error code(<0) if fail
4822  * @retval      PMINFO_R_OK     success
4823  * @retval      PMINFO_R_EINVAL invalid argument
4824  * @retval      PMINFO_R_ERROR  internal error
4825  * @pre         pkgmgrinfo_create_pkgdbinfo()
4826  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4827  * @see         pkgmgrinfo_save_pkgdbinfo()
4828  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4829  * @code
4830 static int set_pkg_description_in_db(const char *pkgid)
4831 {
4832         int ret = 0;
4833         pkgmgrinfo_pkgdbinfo_h handle;
4834         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4835         if (ret != PMINFO_R_OK)
4836                 return -1;
4837         ret = pkgmgrinfo_set_description_to_pkgdbinfo(handle, "helloworld application", "en-us");
4838         if (ret != PMINFO_R_OK) {
4839                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4840                 return -1;
4841         }
4842         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4843         if (ret != PMINFO_R_OK) {
4844                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4845                 return -1;
4846         }
4847         pkgmgrinfo_destroy_pkgdbinfo(handle);
4848         return 0;
4849 }
4850  * @endcode
4851  */
4852 int pkgmgrinfo_set_description_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *description, const char *locale);
4853
4854 /**
4855  * @fn int pkgmgrinfo_set_author_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *author_name,
4856  const char *author_email, const char *author_href, const char *locale)
4857  * @brief       This API sets the package author info in db handle
4858  *
4859  * @par         This API is for package-manager client application
4860  * @par Sync (or) Async : Synchronous API
4861  *
4862  * @param[in] handle    pointer to the pkgdbinfo handle.
4863  * @param[in] author_name               pointer to the package author name
4864  * @param[in] author_email              pointer to the package author email
4865  * @param[in] author_href               pointer to the package author href
4866  * @param[in] locale    pointer to the locale
4867  * @return      0 if success, error code(<0) if fail
4868  * @retval      PMINFO_R_OK     success
4869  * @retval      PMINFO_R_EINVAL invalid argument
4870  * @retval      PMINFO_R_ERROR  internal error
4871  * @pre         pkgmgrinfo_create_pkgdbinfo()
4872  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4873  * @see         pkgmgrinfo_save_pkgdbinfo()
4874  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4875  * @code
4876 static int set_pkg_author_in_db(const char *pkgid)
4877 {
4878         int ret = 0;
4879         pkgmgrinfo_pkgdbinfo_h handle;
4880         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4881         if (ret != PMINFO_R_OK)
4882                 return -1;
4883         ret = pkgmgrinfo_set_author_to_pkgdbinfo(handle, "John", "john@samsung.com", "www.samsung.com", "en-us");
4884         if (ret != PMINFO_R_OK) {
4885                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4886                 return -1;
4887         }
4888         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4889         if (ret != PMINFO_R_OK) {
4890                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4891                 return -1;
4892         }
4893         pkgmgrinfo_destroy_pkgdbinfo(handle);
4894         return 0;
4895 }
4896  * @endcode
4897  */
4898 int pkgmgrinfo_set_author_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *author_name,
4899                         const char *author_email, const char *author_href, const char *locale);
4900
4901 /**
4902  * @fn int pkgmgrinfo_set_removable_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int removable)
4903  * @brief       This API sets the package 'removable' value in db handle
4904  *
4905  * @par         This API is for package-manager client application
4906  * @par Sync (or) Async : Synchronous API
4907  *
4908  * @param[in] handle    pointer to the pkgdbinfo handle.
4909  * @param[in] removable         package removable value
4910  * @return      0 if success, error code(<0) if fail
4911  * @retval      PMINFO_R_OK     success
4912  * @retval      PMINFO_R_EINVAL invalid argument
4913  * @retval      PMINFO_R_ERROR  internal error
4914  * @pre         pkgmgrinfo_create_pkgdbinfo()
4915  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4916  * @see         pkgmgrinfo_save_pkgdbinfo()
4917  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4918  * @code
4919 static int set_pkg_removable_in_db(const char *pkgid)
4920 {
4921         int ret = 0;
4922         pkgmgrinfo_pkgdbinfo_h handle;
4923         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4924         if (ret != PMINFO_R_OK)
4925                 return -1;
4926         ret = pkgmgrinfo_set_removable_to_pkgdbinfo(handle, 1);
4927         if (ret != PMINFO_R_OK) {
4928                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4929                 return -1;
4930         }
4931         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4932         if (ret != PMINFO_R_OK) {
4933                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4934                 return -1;
4935         }
4936         pkgmgrinfo_destroy_pkgdbinfo(handle);
4937         return 0;
4938 }
4939  * @endcode
4940  */
4941 int pkgmgrinfo_set_removable_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int removable);
4942
4943 /**
4944  * @fn int pkgmgrinfo_set_preload_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int preload)
4945  * @brief       This API sets the package 'preload' value in db handle
4946  *
4947  * @par         This API is for package-manager client application
4948  * @par Sync (or) Async : Synchronous API
4949  *
4950  * @param[in] handle    pointer to the pkgdbinfo handle.
4951  * @param[in] preload           package preload value
4952  * @return      0 if success, error code(<0) if fail
4953  * @retval      PMINFO_R_OK     success
4954  * @retval      PMINFO_R_EINVAL invalid argument
4955  * @retval      PMINFO_R_ERROR  internal error
4956  * @pre         pkgmgrinfo_create_pkgdbinfo()
4957  * @post                pkgmgrinfo_destroy_pkgdbinfo()
4958  * @see         pkgmgrinfo_save_pkgdbinfo()
4959  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
4960  * @code
4961 static int set_pkg_preload_in_db(const char *pkgid)
4962 {
4963         int ret = 0;
4964         pkgmgrinfo_pkgdbinfo_h handle;
4965         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
4966         if (ret != PMINFO_R_OK)
4967                 return -1;
4968         ret = pkgmgrinfo_set_preload_to_pkgdbinfo(handle, 1);
4969         if (ret != PMINFO_R_OK) {
4970                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4971                 return -1;
4972         }
4973         ret = pkgmgrinfo_save_pkgdbinfo(handle);
4974         if (ret != PMINFO_R_OK) {
4975                 pkgmgrinfo_destroy_pkgdbinfo(handle);
4976                 return -1;
4977         }
4978         pkgmgrinfo_destroy_pkgdbinfo(handle);
4979         return 0;
4980 }
4981  * @endcode
4982  */
4983 int pkgmgrinfo_set_preload_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int preload);
4984
4985 /**
4986  * @fn int pkgmgrinfo_set_installed_storage_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
4987  * @brief       This API sets the package 'installed_storage' 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] location          installed_storage 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  * @code
5002 static int set_pkg_installed_storage_in_db(const char *pkgid)
5003 {
5004         int ret = 0;
5005         pkgmgrinfo_pkgdbinfo_h handle;
5006         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
5007         if (ret != PMINFO_R_OK)
5008                 return -1;
5009         ret = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_INTERNAL);
5010         if (ret != PMINFO_R_OK) {
5011                 pkgmgrinfo_destroy_pkgdbinfo(handle);
5012                 return -1;
5013         }
5014         ret = pkgmgrinfo_save_pkgdbinfo(handle);
5015         if (ret != PMINFO_R_OK) {
5016                 pkgmgrinfo_destroy_pkgdbinfo(handle);
5017                 return -1;
5018         }
5019         pkgmgrinfo_destroy_pkgdbinfo(handle);
5020         return 0;
5021 }
5022  * @endcode
5023  */
5024 int pkgmgrinfo_set_installed_storage_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location);
5025
5026 /**
5027  * @fn int pkgmgrinfo_save_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
5028  * @fn int pkgmgrinfo_save_pkgdbusrinfo(pkgmgrinfo_pkgdbinfo_h handle, uid_t uid)
5029  * @brief       This API saves all the information from the handle to the DB.
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 package db info handle.
5035  * @param[in]   uid     the addressee user id of the instruction
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_set_type_to_pkgdbinfo()
5043  * @code
5044 static int set_pkg_in_db(const char *pkgid)
5045 {
5046         int ret = 0;
5047         pkgmgrinfo_pkgdbinfo_h handle;
5048         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
5049         if (ret != PMINFO_R_OK)
5050                 return -1;
5051         ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
5052         if (ret != PMINFO_R_OK) {
5053                 pkgmgrinfo_destroy_pkgdbinfo(handle);
5054                 return -1;
5055         }
5056         ret = pkgmgrinfo_save_pkgdbinfo(handle);
5057         if (ret != PMINFO_R_OK) {
5058                 pkgmgrinfo_destroy_pkgdbinfo(handle);
5059                 return -1;
5060         }
5061         pkgmgrinfo_destroy_pkgdbinfo(handle);
5062         return 0;
5063 }
5064  * @endcode
5065  */
5066 int pkgmgrinfo_save_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle);
5067 int pkgmgrinfo_save_pkgdbusrinfo(pkgmgrinfo_pkgdbinfo_h handle, uid_t uid);
5068 /**
5069  * @fn int pkgmgrinfo_destroy_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
5070  * @brief       This API destroys the package db information handle freeing up all the resources
5071  *
5072  * @par         This API is for package-manager client application
5073  * @par Sync (or) Async : Synchronous API
5074  *
5075  * @param[in] handle            pointer to the package db info handle.
5076  * @return      0 if success, error code(<0) if fail
5077  * @retval      PMINFO_R_OK     success
5078  * @retval      PMINFO_R_EINVAL invalid argument
5079  * @retval      PMINFO_R_ERROR  internal error
5080  * @pre         pkgmgrinfo_create_pkgdbinfo()
5081  * @post                None
5082  * @see         pkgmgrinfo_save_pkgdbinfo()
5083  * @see         pkgmgrinfo_set_type_to_pkgdbinfo()
5084  * @code
5085 static int set_pkg_in_db(const char *pkgid)
5086 {
5087         int ret = 0;
5088         pkgmgrinfo_pkgdbinfo_h handle;
5089         ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
5090         if (ret != PMINFO_R_OK)
5091                 return -1;
5092         ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, "0.0.1");
5093         if (ret != PMINFO_R_OK) {
5094                 pkgmgrinfo_destroy_pkgdbinfo(handle);
5095                 return -1;
5096         }
5097         ret = pkgmgrinfo_save_pkgdbinfo(handle);
5098         if (ret != PMINFO_R_OK) {
5099                 pkgmgrinfo_destroy_pkgdbinfo(handle);
5100                 return -1;
5101         }
5102         pkgmgrinfo_destroy_pkgdbinfo(handle);
5103         return 0;
5104 }
5105  * @endcode
5106  */
5107 int pkgmgrinfo_destroy_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle);
5108
5109
5110 /**
5111  * @fn int pkgmgrinfo_create_certinfo_set_handle(pkgmgrinfo_instcertinfo_h *handle)
5112  * @brief       This API creates the package cert information handle to set data in db.
5113  *
5114  * @par         This API is for package-manager client application
5115  * @par Sync (or) Async : Synchronous API
5116  *
5117  * @param[out] handle           pointer to the package cert handle.
5118  * @return      0 if success, error code(<0) if fail
5119  * @retval      PMINFO_R_OK     success
5120  * @retval      PMINFO_R_EINVAL invalid argument
5121  * @retval      PMINFO_R_ERROR  internal error
5122  * @pre         None
5123  * @post                pkgmgrinfo_destroy_certinfo_set_handle()
5124  * @see         pkgmgrinfo_set_cert_value()
5125  * @see         pkgmgrinfo_save_certinfo()
5126  * @code
5127 static int set_cert_in_db(const char *pkgid)
5128 {
5129         int ret = 0;
5130         pkgmgrinfo_instcertinfo_h handle;
5131         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
5132         if (ret != PMINFO_R_OK)
5133                 return -1;
5134         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
5135         if (ret != PMINFO_R_OK) {
5136                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5137                 return -1;
5138         }
5139         ret = pkgmgrinfo_save_certinfo(pkgid, handle);
5140         if (ret != PMINFO_R_OK) {
5141                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5142                 return -1;
5143         }
5144         pkgmgrinfo_destroy_certinfo_set_handle(handle);
5145         return 0;
5146 }
5147  * @endcode
5148  */
5149 int pkgmgrinfo_create_certinfo_set_handle(pkgmgrinfo_instcertinfo_h *handle);
5150
5151 /**
5152  * @fn int pkgmgrinfo_set_cert_value(pkgmgrinfo_instcertinfo_h handle, pkgmgrinfo_instcert_type cert_type, char *cert_value)
5153  * @brief       This API sets the package cert information in the handle.
5154  *
5155  * @par         This API is for package-manager client application
5156  * @par Sync (or) Async : Synchronous API
5157  *
5158  * @param[in] handle            pointer to the package cert handle.
5159  * @param[in] cert_type         certificate type.
5160  * @param[in] cert_value        certificate value.
5161  * @return      0 if success, error code(<0) if fail
5162  * @retval      PMINFO_R_OK     success
5163  * @retval      PMINFO_R_EINVAL invalid argument
5164  * @retval      PMINFO_R_ERROR  internal error
5165  * @pre         pkgmgrinfo_create_certinfo_set_handle()
5166  * @post                pkgmgrinfo_destroy_certinfo_set_handle()
5167  * @see         pkgmgrinfo_save_certinfo()
5168  * @code
5169 static int set_cert_in_db(const char *pkgid)
5170 {
5171         int ret = 0;
5172         pkgmgrinfo_instcertinfo_h handle;
5173         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
5174         if (ret != PMINFO_R_OK)
5175                 return -1;
5176         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
5177         if (ret != PMINFO_R_OK) {
5178                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5179                 return -1;
5180         }
5181         ret = pkgmgrinfo_save_certinfo(pkgid, handle);
5182         if (ret != PMINFO_R_OK) {
5183                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5184                 return -1;
5185         }
5186         pkgmgrinfo_destroy_certinfo_set_handle(handle);
5187         return 0;
5188 }
5189  * @endcode
5190  */
5191 int pkgmgrinfo_set_cert_value(pkgmgrinfo_instcertinfo_h handle, pkgmgrinfo_instcert_type cert_type, char *cert_value);
5192
5193 /**
5194  * @fn int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle)
5195  * @brief       This API saves the package cert information in the DB.
5196  *
5197  * @par         This API is for package-manager client application
5198  * @par Sync (or) Async : Synchronous API
5199  *
5200  * @param[in] pkgid             pointer to the package ID.
5201  * @param[in] 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         pkgmgrinfo_create_certinfo_set_handle()
5207  * @post                pkgmgrinfo_destroy_certinfo_set_handle()
5208  * @see         pkgmgrinfo_save_certinfo()
5209  * @code
5210 static int set_cert_in_db(const char *pkgid)
5211 {
5212         int ret = 0;
5213         pkgmgrinfo_instcertinfo_h handle;
5214         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
5215         if (ret != PMINFO_R_OK)
5216                 return -1;
5217         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
5218         if (ret != PMINFO_R_OK) {
5219                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5220                 return -1;
5221         }
5222         ret = pkgmgrinfo_save_certinfo(pkgid, handle);
5223         if (ret != PMINFO_R_OK) {
5224                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5225                 return -1;
5226         }
5227         pkgmgrinfo_destroy_certinfo_set_handle(handle);
5228         return 0;
5229 }
5230  * @endcode
5231  */
5232 int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle, uid_t uid);
5233
5234 /**
5235  * @fn int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle)
5236  * @brief       This API destroys the package cert information handle freeing up all the resources.
5237  *
5238  * @par         This API is for package-manager client application
5239  * @par Sync (or) Async : Synchronous API
5240  *
5241  * @param[in] handle            pointer to the package cert handle.
5242  * @return      0 if success, error code(<0) if fail
5243  * @retval      PMINFO_R_OK     success
5244  * @retval      PMINFO_R_EINVAL invalid argument
5245  * @retval      PMINFO_R_ERROR  internal error
5246  * @pre         pkgmgrinfo_create_certinfo_set_handle()
5247  * @post                None
5248  * @see         pkgmgrinfo_save_certinfo()
5249  * @code
5250 static int set_cert_in_db(const char *pkgid)
5251 {
5252         int ret = 0;
5253         pkgmgrinfo_instcertinfo_h handle;
5254         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
5255         if (ret != PMINFO_R_OK)
5256                 return -1;
5257         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
5258         if (ret != PMINFO_R_OK) {
5259                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5260                 return -1;
5261         }
5262         ret = pkgmgrinfo_save_certinfo(pkgid, handle);
5263         if (ret != PMINFO_R_OK) {
5264                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
5265                 return -1;
5266         }
5267         pkgmgrinfo_destroy_certinfo_set_handle(handle);
5268         return 0;
5269 }
5270  * @endcode
5271  */
5272 int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle);
5273
5274 /**
5275  * @fn int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access)
5276  * @brief       This API gets the datacontrol info
5277  *
5278  * @par         This API is for package-manager client application
5279  * @par Sync (or) Async : Synchronous API
5280  *
5281  * @param[in] providerid                pointer to the providerid of dataconltrol.
5282  * @param[in] type                      pointer to the type of dataconltrol.
5283  * @param[out] appid                    pointer to hold appid, need to free after using
5284  * @param[out] access                   pointer to hold access, need to free after using
5285  * @return      0 if success, error code(<0) if fail
5286  * @retval      PMINFO_R_OK     success
5287  * @retval      PMINFO_R_EINVAL invalid argument
5288  * @retval      PMINFO_R_ERROR  internal error
5289  * @endcode
5290  */
5291 int pkgmgrinfo_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access);
5292
5293 /**
5294  * @fn int pkgmgrinfo_appinfo_is_guestmode_appstatus(pkgmgrinfo_appinfo_h handle, bool *status)
5295  * @brief       This API gets the application 'guest mode visibility' value from the DB
5296  *
5297  * @par         This API is for package-manager client application
5298  * @par Sync (or) Async : Synchronous API
5299  *
5300  * @param[in]   handle  pointer to application info handle
5301  * @param[out] status           pointer to hold app guest mode visibility value
5302  * @return      0 if success, error code(<0) if fail
5303  * @retval      PMINFO_R_OK     success
5304  * @retval      PMINFO_R_EINVAL invalid argument
5305  * @retval      PMINFO_R_ERROR  internal error
5306  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5307  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5308  * @see         pkgmgrinfo_appinfo_get_appid()
5309  * @see         pkgmgrinfo_appinfo_is_multiple()
5310  * @code
5311 static int get_app_guestmode_visibility(const char *appid)
5312 {
5313         int ret = 0;
5314         bool status;
5315         pkgmgrinfo_appinfo_h handle;
5316         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5317         if (ret != PMINFO_R_OK)
5318                 return -1;
5319         ret = pkgmgrinfo_appinfo_is_guestmode_visibility(handle, &status);
5320         if (ret != PMINFO_R_OK) {
5321                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5322                 return -1;
5323         }
5324         printf("app guest mode visibility: %d\n", status);
5325         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5326         return 0;
5327 }
5328  * @endcode
5329  */
5330  int pkgmgrinfo_appinfo_is_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool *status);
5331
5332 /**
5333  * @fn int pkgmgrinfo_appinfo_set_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool status)
5334  * @brief       This API sets the application 'guest mode visibility' value in the DB
5335  *
5336  * @par         This API is for package-manager client application
5337  * @par Sync (or) Async : Synchronous API
5338  *
5339  * @param[in]   handle  pointer to application info handle
5340  * @param[out] status   app guest mode visibility value
5341  * @return      0 if success, error code(<0) if fail
5342  * @retval      PMINFO_R_OK     success
5343  * @retval      PMINFO_R_EINVAL invalid argument
5344  * @retval      PMINFO_R_ERROR  internal error
5345  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5346  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5347  * @see         pkgmgrinfo_appinfo_get_appid()
5348  * @see         pkgmgrinfo_appinfo_is_multiple()
5349  * @code
5350 static int set_app_guestmode_visibility(const char *appid, bool value)
5351 {
5352         int ret = 0;
5353         pkgmgrinfo_appinfo_h handle;
5354         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5355         if (ret != PMINFO_R_OK)
5356                 return -1;
5357         ret = pkgmgrinfo_appinfo_set_guestmode_visibility(handle, value);
5358         if (ret != PMINFO_R_OK) {
5359                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5360                 return -1;
5361         }
5362         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5363         return 0;
5364 }
5365  * @endcode
5366  */
5367  int pkgmgrinfo_appinfo_set_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool status);
5368  int pkgmgrinfo_appinfo_set_usr_guestmode_visibility(pkgmgrinfo_appinfo_h handle, uid_t uid, bool status);
5369 /**
5370  * @pkgmgrinfo client API
5371 **/
5372
5373 /**
5374  * @brief listening status type in pkgmgrinfo.
5375  */
5376 #define PMINFO_CLIENT_STATUS_ALL                                                0x00
5377 #define PMINFO_CLIENT_STATUS_INSTALL                                    0x01
5378 #define PMINFO_CLIENT_STATUS_UNINSTALL                                  0x02
5379 #define PMINFO_CLIENT_STATUS_UPGRADE                                    0x04
5380 #define PMINFO_CLIENT_STATUS_MOVE                                               0x08
5381 #define PMINFO_CLIENT_STATUS_CLEAR_DATA                                 0x10
5382 #define PMINFO_CLIENT_STATUS_INSTALL_PROGRESS                   0x20
5383
5384 /**
5385  * @brief type definition.
5386  */
5387 typedef void pkgmgrinfo_client;
5388 typedef int (*pkgmgrinfo_handler)(int req_id, const char *pkg_type,
5389                                 const char *pkgid, const char *key,
5390                                 const char *val, const void *pmsg, void *data);
5391
5392 typedef enum {
5393         PMINFO_REQUEST = 0,
5394         PMINFO_LISTENING,
5395         PMINFO_BROADCAST,
5396 }pkgmgrinfo_client_type;
5397
5398 /**
5399  * @brief       This APIs provides pkgmgrinfo client listener
5400  */
5401 pkgmgrinfo_client *pkgmgrinfo_client_new(pkgmgrinfo_client_type ctype);
5402 int pkgmgrinfo_client_set_status_type(pkgmgrinfo_client *pc, int status_type);
5403 int pkgmgrinfo_client_listen_status(pkgmgrinfo_client *pc, pkgmgrinfo_handler event_cb, void *data);
5404 int pkgmgrinfo_client_free(pkgmgrinfo_client *pc);
5405 int pkgmgrinfo_client_request_enable_external_pkg(char *pkgid);
5406
5407 /**
5408  * @pkgmgrinfo client API end
5409 **/
5410
5411
5412 /** @} */
5413 #ifdef __cplusplus
5414 }
5415 #endif
5416 #endif                          /* __PKG_INFO_H__ */
5417 /**
5418  * @}
5419  * @}
5420  */
5421