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