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