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