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