Add attribute for lib rpk
[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  * @file                pkgmgr-info.h
25  * @author              Sewook Park <sewook7.park@samsung.com>
26  * @author              Shobhit Srivastava <shobhit.s@samsung.com>
27  * @version             0.1
28  * @brief               This file declares API of pkgmgr-info library
29  *
30  * @addtogroup          APPLICATION_FRAMEWORK
31  * @{
32  *
33  * @defgroup            PackageManagerInfo
34  * @section             Header Header file to include:
35  * @code
36  * #include             <pkgmgr-info.h>
37  * @endcode
38  *
39  * @}
40  */
41
42 #ifndef __PKG_INFO_H__
43 #define __PKG_INFO_H__
44
45 #include <errno.h>
46 #include <stdbool.h>
47 #include <unistd.h>
48 #include <sys/types.h>
49
50 #include "pkgmgrinfo_type.h"
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56
57 /**
58  * @mainpage
59  *
60  * This is package information library
61  *
62  * Package Information Library is used to get package related information.\n
63  * It uses the package manifest information database to get any package related information\n
64  * It also provides API to set information in the package info database\n
65  *
66  */
67
68 /**
69  * @file        pkgmgr-info.h
70  * @brief       Package Information Library Header File
71  *
72  * Generated by    Sewook Park <sewook7.park@samsung.com>
73  */
74
75
76
77  /** String property for filtering based on package info*/
78 #define PMINFO_PKGINFO_PROP_PACKAGE_ID          "PMINFO_PKGINFO_PROP_PACKAGE_ID"
79  /** String property for filtering based on package info*/
80 #define PMINFO_PKGINFO_PROP_PACKAGE_TYPE        "PMINFO_PKGINFO_PROP_PACKAGE_TYPE"
81  /** String property for filtering based on package info*/
82 #define PMINFO_PKGINFO_PROP_PACKAGE_VERSION     "PMINFO_PKGINFO_PROP_PACKAGE_VERSION"
83  /** String property for filtering based on package info*/
84 #define PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION            "PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION"
85   /** String property for filtering based on package info*/
86 #define PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE           "PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE"
87  /** String property for filtering based on package info*/
88 #define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME         "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME"
89  /** String property for filtering based on package info*/
90 #define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL                "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL"
91  /** String property for filtering based on package info*/
92 #define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF         "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF"
93  /** String property for filtering based on package info*/
94 #define PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE           "PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE"
95  /** String property for filtering based on package info*/
96 #define PMINFO_PKGINFO_PROP_PACKAGE_RES_TYPE            "PMINFO_PKGINFO_PROP_PACKAGE_RES_TYPE"
97
98  /** Boolean property for filtering based on package info*/
99 #define PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE           "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"
100  /** Boolean property for filtering based on package info*/
101 #define PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD             "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"
102  /** Boolean property for filtering based on package info*/
103 #define PMINFO_PKGINFO_PROP_PACKAGE_READONLY            "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"
104    /** Boolean property for filtering based on package info*/
105 #define PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM              "PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM"
106   /** Boolean property for filtering based on package info*/
107 #define PMINFO_PKGINFO_PROP_PACKAGE_UPDATE              "PMINFO_PKGINFO_PROP_PACKAGE_UPDATE"
108   /** Boolean property for filtering based on package info*/
109 #define PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING          "PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING"
110    /** Boolean property for filtering based on package info*/
111 #define PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING           "PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING"
112    /** Boolean property for filtering based on package info*/
113 #define PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE             "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE"
114    /** Boolean property for filtering based on package info*/
115 #define PMINFO_PKGINFO_PROP_PACKAGE_DISABLE             "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE"
116    /** Boolean property for filtering based on package info*/
117 #define PMINFO_PKGINFO_PROP_PACKAGE_CHECK_STORAGE               "PMINFO_PKGINFO_PROP_PACKAGE_CHECK_STORAGE"
118
119  /** Integer property for filtering based on package info*/
120 #define PMINFO_PKGINFO_PROP_PACKAGE_SIZE                "PMINFO_PKGINFO_PROP_PACKAGE_SIZE"
121
122  /** String property for filtering based on app info*/
123 #define PMINFO_APPINFO_PROP_APP_ID              "PMINFO_APPINFO_PROP_APP_ID"
124  /** String property for filtering based on app info*/
125 #define PMINFO_APPINFO_PROP_APP_COMPONENT               "PMINFO_APPINFO_PROP_APP_COMPONENT"
126  /** String property for filtering based on app info*/
127 #define PMINFO_APPINFO_PROP_APP_EXEC            "PMINFO_APPINFO_PROP_APP_EXEC"
128  /** String property for filtering based on app info*/
129 #define PMINFO_APPINFO_PROP_APP_ICON            "PMINFO_APPINFO_PROP_APP_ICON"
130  /** String property for filtering based on app info*/
131 #define PMINFO_APPINFO_PROP_APP_TYPE            "PMINFO_APPINFO_PROP_APP_TYPE"
132  /** String property for filtering based on app info*/
133 #define PMINFO_APPINFO_PROP_APP_OPERATION       "PMINFO_APPINFO_PROP_APP_OPERATION"
134  /** String property for filtering based on app info*/
135 #define PMINFO_APPINFO_PROP_APP_URI                     "PMINFO_APPINFO_PROP_APP_URI"
136  /** String property for filtering based on app info*/
137 #define PMINFO_APPINFO_PROP_APP_MIME            "PMINFO_APPINFO_PROP_APP_MIME"
138  /** String property for filtering based on app info*/
139 #define PMINFO_APPINFO_PROP_APP_CATEGORY        "PMINFO_APPINFO_PROP_APP_CATEGORY"
140  /** String property for filtering based on app info*/
141 #define PMINFO_APPINFO_PROP_APP_HWACCELERATION  "PMINFO_APPINFO_PROP_APP_HWACCELERATION"
142  /** String property for filtering based on app info*/
143 #define PMINFO_APPINFO_PROP_APP_SCREENREADER    "PMINFO_APPINFO_PROP_APP_SCREENREADER"
144  /** String property for filtering based on app info*/
145 #define PMINFO_APPINFO_PROP_APP_PACKAGE         "PMINFO_APPINFO_PROP_APP_PACKAGE"
146  /** String property for filtering based on app info*/
147 #define PMINFO_APPINFO_PROP_APP_INSTALLED_STORAGE               "PMINFO_APPINFO_PROP_APP_INSTALLED_STORAGE"
148  /** String property for filtering based on app info*/
149 #define PMINFO_APPINFO_PROP_PRIVILEGE   "PMINFO_APPINFO_PROP_PRIVILEGE"
150
151 /** Integer property for filtering app support mode */
152 #define PMINFO_APPINFO_PROP_APP_SUPPORT_MODE            "PMINFO_APPINFO_PROP_APP_SUPPORT_MODE"
153
154  /** Boolean property for filtering based on app info*/
155 #define PMINFO_APPINFO_PROP_APP_NODISPLAY               "PMINFO_APPINFO_PROP_APP_NODISPLAY"
156  /** Boolean property for filtering based on app info*/
157 #define PMINFO_APPINFO_PROP_APP_MULTIPLE                "PMINFO_APPINFO_PROP_APP_MULTIPLE"
158  /** Boolean property for filtering based on app info*/
159 #define PMINFO_APPINFO_PROP_APP_ONBOOT                  "PMINFO_APPINFO_PROP_APP_ONBOOT"
160  /** Boolean property for filtering based on app info*/
161 #define PMINFO_APPINFO_PROP_APP_AUTORESTART     "PMINFO_APPINFO_PROP_APP_AUTORESTART"
162  /** Boolean property for filtering based on app info*/
163 #define PMINFO_APPINFO_PROP_APP_TASKMANAGE      "PMINFO_APPINFO_PROP_APP_TASKMANAGE"
164  /** Boolean property for filtering based on app info*/
165 #define PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION "PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION"
166  /** Boolean property for filtering based on app info*/
167 #define PMINFO_APPINFO_PROP_APP_UI_GADGET       "PMINFO_APPINFO_PROP_APP_UI_GADGET"
168  /** Boolean property for filtering based on app info*/
169 #define PMINFO_APPINFO_PROP_APP_DISABLE "PMINFO_APPINFO_PROP_APP_DISABLE"
170  /** Boolean property for filtering based on app info*/
171 #define PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE "PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE"
172  /** Boolean property for filtering based on app info*/
173 #define PMINFO_APPINFO_PROP_APP_CHECK_STORAGE   "PMINFO_APPINFO_PROP_APP_CHECK_STORAGE"
174 /** Boolean property for filtering based on app info*/
175 #define PMINFO_APPINFO_PROP_PKG_DISABLE "PMINFO_APPINFO_PROP_PKG_DISABLE"
176
177  /** will be updated*/
178  /** string property for filtering based on pkg info*/
179 #define PMINFO_PKGINFO_PROP_RANGE_BASIC "PMINFO_PKGINFO_PROP_RANGE_BASIC"
180
181 /* For multiuser support */
182 const char *getIconPath(uid_t uid, bool readonly);
183 char *getUserPkgParserDBPath(void);
184 char *getUserPkgParserDBPathUID(uid_t uid);
185 char *getUserPkgCertDBPath(void);
186 const char *getUserManifestPath(uid_t uid, bool readonly);
187
188 /**
189  * @fn  int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
190  * @fn  int pkgmgrinfo_pkginfo_get_usr_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data, uid_t uid)
191  * @brief       This API gets list of installed packages
192  *
193  * @par         This API is for package-manager client application
194  * @par Sync (or) Async : Synchronous API
195  * @param[in]   pkg_list_cb     iteration function for list
196  * @param[in]   user_data       user data to be passed to callback function
197  * @param[in]   uid     the addressee user id of the instruction
198  * @return      0 if success, error code(<0) if fail
199  * @retval      PMINFO_R_OK     success
200  * @retval      PMINFO_R_EINVAL invalid argument
201  * @retval      PMINFO_R_ERROR  internal error
202  * @pre         None
203  * @post        None
204  * @code
205 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
206 {
207         char *pkgid1 = NULL;
208         char *pkgid2 = NULL;
209         pkgid1 = (char *)user_data;
210         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid2);
211         if (strcmp(pkgid1, pkgid2) == 0) {
212                 return -1;
213         } else {
214                 return 0;
215         }
216 }
217
218 static int list_pkgs()
219 {
220         int ret = 0;
221         char *name = "helloworld";
222         ret = pkgmgrinfo_pkginfo_get_list(pkg_list_cb, (void *)name);
223         if (ret != PMINFO_R_OK) {
224                 return -1;
225         }
226         return 0;
227 }
228  * @endcode
229  */
230 int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
231 int pkgmgrinfo_pkginfo_get_usr_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data, uid_t uid);
232
233 /**
234  * @fn  int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
235  * @fn  int pkgmgrinfo_pkginfo_get_usr_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data, uid_t uid)
236  * @brief       This API gets list of disabled packages
237  *
238  * @par         This API is for package-manager client application
239  * @par Sync (or) Async : Synchronous API
240  * @param[in]   pkg_list_cb     iteration function for list
241  * @param[in]   user_data       user data to be passed to callback function
242  * @param[in]   uid     the addressee user id of the instruction
243  * @return      0 if success, error code(<0) if fail
244  * @retval      PMINFO_R_OK     success
245  * @retval      PMINFO_R_EINVAL invalid argument
246  * @retval      PMINFO_R_ERROR  internal error
247  * @pre         None
248  * @post        None
249  */
250 int pkgmgrinfo_pkginfo_get_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data);
251 int pkgmgrinfo_pkginfo_get_usr_disabled_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data, uid_t uid);
252
253 /**
254  * @fn int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
255  * @brief       This API creates the package information handle from db which is not disabled
256  *
257  * @par         This API is for package-manager client application
258  * @par Sync (or) Async : Synchronous API
259  *
260  * @param[in]   pkgid   pointer to package ID
261  * @param[in]   uid     the addressee user id of the instruction
262  * @param[out] handle           pointer to the package info handle.
263  * @return      0 if success, error code(<0) if fail
264  * @retval      PMINFO_R_OK     success
265  * @retval      PMINFO_R_EINVAL invalid argument
266  * @retval      PMINFO_R_ERROR  internal error
267  * @pre         None
268  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
269  * @see         pkgmgrinfo_pkginfo_get_pkgid()
270  * @see         pkgmgrinfo_pkginfo_is_removable()
271  * @code
272 static int get_pkg_type(const char *pkgid)
273 {
274         int ret = 0;
275         char *type = NULL;
276         pkgmgrinfo_pkginfo_h handle;
277         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
278         if (ret != PMINFO_R_OK)
279                 return -1;
280         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
281         if (ret != PMINFO_R_OK) {
282                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
283                 return -1;
284         }
285         printf("pkgtype: %s\n", type);
286         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
287         return 0;
288 }
289  * @endcode
290  */
291 int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
292 int pkgmgrinfo_pkginfo_get_usr_pkginfo(const char *pkgid, uid_t uid, pkgmgrinfo_pkginfo_h *handle);
293
294 /**
295  * @fn int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
296  * @brief       This API creates the disabled package information handle from db
297  *
298  * @par         This API is for package-manager client application
299  * @par Sync (or) Async : Synchronous API
300  *
301  * @param[in]   pkgid   pointer to package ID
302  * @param[in]   uid     the addressee user id of the instruction
303  * @param[out] handle           pointer to the package info handle.
304  * @return      0 if success, error code(<0) if fail
305  * @retval      PMINFO_R_OK     success
306  * @retval      PMINFO_R_EINVAL invalid argument
307  * @retval      PMINFO_R_ERROR  internal error
308  * @pre         None
309  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
310  * @see         pkgmgrinfo_pkginfo_get_pkginfo()
311  */
312 int pkgmgrinfo_pkginfo_get_disabled_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
313 int pkgmgrinfo_pkginfo_get_usr_disabled_pkginfo(const char *pkgid, uid_t uid, pkgmgrinfo_pkginfo_h *handle);
314
315 /**
316  * @fn int pkgmgrinfo_pkginfo_get_all_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
317  * @brief       This API creates the package information handle from db regardless of its disable or storage status
318  *
319  * @par         This API is for package-manager client application
320  * @par Sync (or) Async : Synchronous API
321  *
322  * @param[in]   pkgid   pointer to package ID
323  * @param[in]   uid     the addressee user id of the instruction
324  * @param[out] handle           pointer to the package info handle.
325  * @return      0 if success, error code(<0) if fail
326  * @retval      PMINFO_R_OK     success
327  * @retval      PMINFO_R_EINVAL invalid argument
328  * @retval      PMINFO_R_ERROR  internal error
329  * @pre         None
330  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
331  * @see         pkgmgrinfo_pkginfo_get_pkgid()
332  * @see         pkgmgrinfo_pkginfo_is_removable()
333  * @code
334 static int get_pkg_type(const char *pkgid)
335 {
336         int ret = 0;
337         char *type = NULL;
338         pkgmgrinfo_pkginfo_h handle;
339         ret = pkgmgrinfo_pkginfo_get_all_pkginfo(pkgid, &handle);
340         if (ret != PMINFO_R_OK)
341                 return -1;
342         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
343         if (ret != PMINFO_R_OK) {
344                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
345                 return -1;
346         }
347         printf("pkgtype: %s\n", type);
348         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
349         return 0;
350 }
351  * @endcode
352  */
353 int pkgmgrinfo_pkginfo_get_all_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle);
354 int pkgmgrinfo_pkginfo_get_usr_all_pkginfo(const char *pkgid, uid_t uid, pkgmgrinfo_pkginfo_h *handle);
355
356 /**
357  * @fn int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name)
358  * @brief       This API gets the package name from the package ID
359  *
360  * @par         This API is for package-manager client application
361  * @par Sync (or) Async : Synchronous API
362  *
363  * @param[in]   handle  pointer to package info handle
364  * @param[out]  pkg_name        pointer to hold package name
365  * @return      0 if success, error code(<0) if fail
366  * @retval      PMINFO_R_OK     success
367  * @retval      PMINFO_R_EINVAL invalid argument
368  * @retval      PMINFO_R_ERROR  internal error
369  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
370  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
371  * @see         pkgmgrinfo_pkginfo_get_type()
372  * @see         pkgmgrinfo_pkginfo_is_removable()
373  * @code
374 static int get_pkg_name(const char *pkgid)
375 {
376         int ret = 0;
377         char *pkgname = NULL;
378         pkgmgrinfo_pkginfo_h handle;
379         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
380         if (ret != PMINFO_R_OK)
381                 return -1;
382         ret = pkgmgrinfo_pkginfo_get_pkgname(handle, &pkgname);
383         if (ret != PMINFO_R_OK) {
384                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
385                 return -1;
386         }
387         printf("pkgname: %s\n", pkgname);
388         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
389         return 0;
390 }
391  * @endcode
392  */
393 int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name);
394
395 /**
396  * @fn int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid)
397  * @brief       This API gets the package id from the package ID
398  *
399  * @par         This API is for package-manager client application
400  * @par Sync (or) Async : Synchronous API
401  *
402  * @param[in]   handle  pointer to package info handle
403  * @param[out]  pkgid   pointer to hold package id
404  * @return      0 if success, error code(<0) if fail
405  * @retval      PMINFO_R_OK     success
406  * @retval      PMINFO_R_EINVAL invalid argument
407  * @retval      PMINFO_R_ERROR  internal error
408  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
409  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
410  * @see         pkgmgrinfo_pkginfo_get_type()
411  * @see         pkgmgrinfo_pkginfo_is_removable()
412  * @code
413 static int get_pkgid(const char *pkgid)
414 {
415         int ret = 0;
416         char *pkg_id = NULL;
417         pkgmgrinfo_pkginfo_h handle;
418         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
419         if (ret != PMINFO_R_OK)
420                 return -1;
421         ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkg_id);
422         if (ret != PMINFO_R_OK) {
423                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
424                 return -1;
425         }
426         printf("pkg id: %s\n", pkg_id);
427         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
428         return 0;
429 }
430  * @endcode
431  */
432 int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid);
433
434 /**
435  * @fn int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type)
436  * @brief       This API gets the package type from the package ID
437  *
438  * @par         This API is for package-manager client application
439  * @par Sync (or) Async : Synchronous API
440  *
441  * @param[in]   handle  pointer to package info handle
442  * @param[out] type             pointer to hold package type
443  * @return      0 if success, error code(<0) if fail
444  * @retval      PMINFO_R_OK     success
445  * @retval      PMINFO_R_EINVAL invalid argument
446  * @retval      PMINFO_R_ERROR  internal error
447  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
448  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
449  * @see         pkgmgrinfo_pkginfo_get_pkgid()
450  * @see         pkgmgrinfo_pkginfo_is_removable()
451  * @code
452 static int get_pkg_type(const char *pkgid)
453 {
454         int ret = 0;
455         char *type = NULL;
456         pkgmgrinfo_pkginfo_h handle;
457         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
458         if (ret != PMINFO_R_OK)
459                 return -1;
460         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
461         if (ret != PMINFO_R_OK) {
462                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
463                 return -1;
464         }
465         printf("pkgtype: %s\n", type);
466         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
467         return 0;
468 }
469  * @endcode
470  */
471 int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type);
472
473 /**
474  * @fn int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version)
475  * @brief       This API gets the package version from the package ID
476  *
477  * @par         This API is for package-manager client application
478  * @par Sync (or) Async : Synchronous API
479  *
480  * @param[in]   handle  pointer to package info handle
481  * @param[out] version          pointer to hold package version
482  * @return      0 if success, error code(<0) if fail
483  * @retval      PMINFO_R_OK     success
484  * @retval      PMINFO_R_EINVAL invalid argument
485  * @retval      PMINFO_R_ERROR  internal error
486  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
487  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
488  * @see         pkgmgrinfo_pkginfo_get_pkgid()
489  * @see         pkgmgrinfo_pkginfo_is_removable()
490  * @code
491 static int get_pkg_version(const char *pkgid)
492 {
493         int ret = 0;
494         char *version = NULL;
495         pkgmgrinfo_pkginfo_h handle;
496         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
497         if (ret != PMINFO_R_OK)
498                 return -1;
499         ret = pkgmgrinfo_pkginfo_get_version(handle, &version);
500         if (ret != PMINFO_R_OK) {
501                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
502                 return -1;
503         }
504         printf("pkg version: %s\n", version);
505         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
506         return 0;
507 }
508  * @endcode
509  */
510 int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version);
511
512 /**
513  * @fn int pkgmgrinfo_pkginfo_get_api_version(pkgmgrinfo_pkginfo_h handle, char **api_version)
514  * @brief       This API gets the package api_version from the package ID
515  *
516  * @par         This API is for package-manager client application
517  * @par Sync (or) Async : Synchronous API
518  *
519  * @param[in]   handle  pointer to package info handle
520  * @param[out] api_version              pointer to hold package api_version
521  * @return      0 if success, error code(<0) if fail
522  * @retval      PMINFO_R_OK     success
523  * @retval      PMINFO_R_EINVAL invalid argument
524  * @retval      PMINFO_R_ERROR  internal error
525  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
526  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
527  * @see         pkgmgrinfo_pkginfo_get_pkgid()
528  * @see         pkgmgrinfo_pkginfo_is_removable()
529  * @code
530 static int get_pkg_api_version(const char *pkgid)
531 {
532         int ret = 0;
533         char *api_version = NULL;
534         pkgmgrinfo_pkginfo_h handle = NULL;
535         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
536         if (ret != PMINFO_R_OK)
537                 return -1;
538         ret = pkgmgrinfo_pkginfo_get_api_version(handle, &api_version);
539         if (ret != PMINFO_R_OK) {
540                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
541                 return -1;
542         }
543         printf("pkg api_version: %s\n", api_version);
544         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
545         return 0;
546 }
547  * @endcode
548  */
549 int pkgmgrinfo_pkginfo_get_api_version(pkgmgrinfo_pkginfo_h handle, char **api_version);
550
551 /**
552  * @fn int pkgmgrinfo_pkginfo_get_tep_name(pkgmgrinfo_pkginfo_h handle, char **tep_name)
553  * @brief       This API gets tep(tizen expansion package) file name associated with the package
554  *
555  * @par This API is for package-manager client application
556  * @par Sync (or) Async : Synchronous API
557  *
558  * @param[in] handle    pointer to the pkginfo handle.
559  * @param[out] tep_name pointer to hold tep name
560  * @return      0 if success, error code(<0) if fail
561  * @retval      PMINFO_R_OK success
562  * @retval      PMINFO_R_EINVAL invalid argument
563  * @retval      PMINFO_R_ERROR  internal error
564  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
565  * @post        pkgmgrinfo_pkginfo_destroy_pkginfo()
566  * @see pkgmgrinfo_pkginfo_get_pkgid()
567  * @code
568 static int get_tep_name(const char *pkgid)
569 {
570         int ret = 0;
571         char *tep_name = NULL;
572         pkgmgrinfo_pkginfo_h handle = NULL;
573         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
574         if (ret != PMINFO_R_OK)
575                 return -1;
576         ret = pkgmgrinfo_pkginfo_get_tep_name(handle, &tep_name);
577         if (ret != PMINFO_R_OK) {
578                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
579                 return -1;
580         }
581         printf("TEP name is: %s\n", tep_name);
582         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
583         return 0;
584 }
585  * @endcode
586  */
587 int pkgmgrinfo_pkginfo_get_tep_name(pkgmgrinfo_pkginfo_h handle, char **tep_name);
588
589 /**
590  * @fn int pkgmgrinfo_pkginfo_get_zip_mount_file(pkgmgrinfo_pkginfo_h handle, char **zip_mount_file)
591  * @brief       This API gets package mount point path associated with the package
592  *                      if package is mount-installed. Otherwise, zip_mount_file is left as NULL value
593  *
594  * @par This API is for package-manager client application
595  * @par Sync (or) Async : Synchronous API
596  *
597  * @param[in] handle    pointer to the pkginfo handle.
598  * @param[out] zip_mount_file   pointer to hold zip mount file
599  * @return      0 if success, error code(<0) if fail
600  * @retval      PMINFO_R_OK success
601  * @retval      PMINFO_R_EINVAL invalid argument
602  * @retval      PMINFO_R_ERROR  internal error
603  * @pre pkgmgrinfo_pkginfo_get_pkginfo()
604  * @post        pkgmgrinfo_pkginfo_destroy_pkginfo()
605  * @see pkgmgrinfo_pkginfo_get_pkgid()
606  * @code
607 static int get_zip_mount_file(const char *pkgid)
608 {
609         int ret = 0;
610         char *zip_mount_file = NULL;
611         pkgmgrinfo_pkginfo_h handle = NULL;
612         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
613         if (ret != PMINFO_R_OK)
614                 return -1;
615         ret = pkgmgrinfo_pkginfo_get_zip_mount_file(handle, &zip_mount_file);
616         if (ret != PMINFO_R_OK) {
617                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
618                 return -1;
619         }
620         if (zip_mount_file != NULL)
621                 printf("Zip mount path is: %s\n", zip_mount_file);
622         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
623         return 0;
624 }
625  * @endcode
626  */
627 int pkgmgrinfo_pkginfo_get_zip_mount_file(pkgmgrinfo_pkginfo_h handle, char **zip_mount_file);
628
629 /**
630  * @fn int pkgmgrinfo_pkginfo_get_external_image_path(pkgmgrinfo_pkginfo_h handle, char **ext_image_path)
631  * @brief       This API gets package external image path associated with the package
632  *                      if package is installed in external storage.
633  *                      Otherwise, the return value will be PMINFO_R_ENOENT.
634  *
635  * @par This API is for package-manager client application
636  * @par Sync (or) Async : Synchronous API
637  *
638  * @param[in] handle    pointer to the pkginfo handle.
639  * @param[out] ext_image_path   pointer to hold external image path
640  * @return      0 if success, error code(<0) if fail
641  * @retval      PMINFO_R_OK success
642  * @retval      PMINFO_R_EINVAL invalid argument
643  * @retval      PMINFO_R_ERROR  internal error
644  * @revall      PMINFO_R_ENOENT no valid data
645  * @pre pkgmgrinfo_pkginfo_get_pkginfo()
646  * @post        pkgmgrinfo_pkginfo_destroy_pkginfo()
647  * @see pkgmgrinfo_pkginfo_get_pkgid()
648  * @code
649 static int get_external_image_path(const char *pkgid)
650 {
651         int ret = 0;
652         char *ext_image_path = NULL;
653         pkgmgrinfo_pkginfo_h handle = NULL;
654         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
655         if (ret != PMINFO_R_OK)
656                 return -1;
657         ret = pkgmgrinfo_pkginfo_get_external_image_path(handle, &ext_image_path);
658         if (ret != PMINFO_R_OK) {
659                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
660                 return -1;
661         }
662         printf("external image path is: %s\n", ext_image_path);
663         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
664         return 0;
665 }
666  * @endcode
667  */
668 int pkgmgrinfo_pkginfo_get_external_image_path(pkgmgrinfo_pkginfo_h handle, char **ext_image_path);
669
670 /**
671  * @fn int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
672  * @brief       This API gets the package install location from the package ID
673  *
674  * @par         This API is for package-manager client application
675  * @par Sync (or) Async : Synchronous API
676  *
677  * @param[in] handle    pointer to package info handle
678  * @param[out] location         pointer to hold package install location
679  * @return      0 if success, error code(<0) if fail
680  * @retval      PMINFO_R_OK     success
681  * @retval      PMINFO_R_EINVAL invalid argument
682  * @retval      PMINFO_R_ERROR  internal error
683  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
684  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
685  * @see         pkgmgrinfo_pkginfo_get_pkgid()
686  * @see         pkgmgrinfo_pkginfo_is_removable()
687  * @code
688 static int get_pkg_install_location(const char *pkgid)
689 {
690         int ret = 0;
691         pkgmgrinfo_install_location location;
692         pkgmgrinfo_pkginfo_h handle;
693         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
694         if (ret != PMINFO_R_OK)
695                 return -1;
696         ret = pkgmgrinfo_pkginfo_get_install_location(handle, &location);
697         if (ret != PMINFO_R_OK) {
698                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
699                 return -1;
700         }
701         printf("pkg install location: %d\n", location);
702         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
703         return 0;
704 }
705  * @endcode
706  */
707 int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location);
708
709 /**
710  * @fn int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size)
711  * @brief       This API gets the package size from the package ID. size will be 0 if package install location is internal-only.
712  size will be 0 if package install location is prefer-external but size is not specified in manifest file.Application should check
713  the return value of pkgmgrinfo_pkginfo_get_install_location() and use it to distinguish the above cases.
714  *
715  * @par         This API is for package-manager client application
716  * @par Sync (or) Async : Synchronous API
717  *
718  * @param[in]   handle  pointer to package info handle
719  * @param[out] size             pointer to hold package size
720  * @return      0 if success, error code(<0) if fail
721  * @retval      PMINFO_R_OK     success
722  * @retval      PMINFO_R_EINVAL invalid argument
723  * @retval      PMINFO_R_ERROR  internal error
724  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
725  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
726  * @see         pkgmgrinfo_pkginfo_get_pkgid()
727  * @see         pkgmgrinfo_pkginfo_is_removable()
728  * @code
729 static int get_pkg_size(const char *pkgid)
730 {
731         int ret = 0;
732         int size = 0;
733         pkgmgrinfo_pkginfo_h handle;
734         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
735         if (ret != PMINFO_R_OK)
736                 return -1;
737         ret = pkgmgrinfo_pkginfo_get_package_size(handle, &size);
738         if (ret != PMINFO_R_OK) {
739                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
740                 return -1;
741         }
742         printf("pkgsize: %d\n", size);
743         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
744         return 0;
745 }
746  * @endcode
747  */
748 int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size);
749
750 /**
751  * @fn int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon)
752  * @brief       This API gets the package icon from the package ID
753  *
754  * @par         This API is for package-manager client application
755  * @par Sync (or) Async : Synchronous API
756  *
757  * @param[in]   handle  pointer to package info handle
758  * @param[out] icon             pointer to hold package icon
759  * @return      0 if success, error code(<0) if fail
760  * @retval      PMINFO_R_OK     success
761  * @retval      PMINFO_R_EINVAL invalid argument
762  * @retval      PMINFO_R_ERROR  internal error
763  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
764  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
765  * @see         pkgmgrinfo_pkginfo_get_pkgid()
766  * @see         pkgmgrinfo_pkginfo_is_removable()
767  * @code
768 static int get_pkg_icon(const char *pkgid)
769 {
770         int ret = 0;
771         char *icon = NULL;
772         pkgmgrinfo_pkginfo_h handle;
773         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
774         if (ret != PMINFO_R_OK)
775                 return -1;
776         ret = pkgmgrinfo_pkginfo_get_icon(handle, &icon);
777         if (ret != PMINFO_R_OK) {
778                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
779                 return -1;
780         }
781         printf("pkg icon: %s\n", icon);
782         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
783         return 0;
784 }
785  * @endcode
786  */
787 int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon);
788
789 /**
790  * @fn int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
791  * @brief       This API gets the package label from the package ID
792  *
793  * @par         This API is for package-manager client application
794  * @par Sync (or) Async : Synchronous API
795  *
796  * @param[in]   handle  pointer to package info handle
797  * @param[out] label            pointer to hold package label
798  * @return      0 if success, error code(<0) if fail
799  * @retval      PMINFO_R_OK     success
800  * @retval      PMINFO_R_EINVAL invalid argument
801  * @retval      PMINFO_R_ERROR  internal error
802  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
803  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
804  * @see         pkgmgrinfo_pkginfo_get_pkgid()
805  * @see         pkgmgrinfo_pkginfo_is_removable()
806  * @code
807 static int get_pkg_label(const char *pkgid)
808 {
809         int ret = 0;
810         char *label = NULL;
811         pkgmgrinfo_pkginfo_h handle;
812         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
813         if (ret != PMINFO_R_OK)
814                 return -1;
815         ret = pkgmgrinfo_pkginfo_get_label(handle, &label);
816         if (ret != PMINFO_R_OK) {
817                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
818                 return -1;
819         }
820         printf("pkg label: %s\n", label);
821         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
822         return 0;
823 }
824  * @endcode
825  */
826 int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label);
827
828 /**
829  * @fn int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description)
830  * @brief       This API gets the package description from the package ID
831  *
832  * @par         This API is for package-manager client application
833  * @par Sync (or) Async : Synchronous API
834  *
835  * @param[in]   handle  pointer to package info handle
836  * @param[out] description              pointer to hold package description
837  * @return      0 if success, error code(<0) if fail
838  * @retval      PMINFO_R_OK     success
839  * @retval      PMINFO_R_EINVAL invalid argument
840  * @retval      PMINFO_R_ERROR  internal error
841  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
842  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
843  * @see         pkgmgrinfo_pkginfo_get_pkgid()
844  * @see         pkgmgrinfo_pkginfo_is_removable()
845  * @code
846 static int get_pkg_description(const char *pkgid)
847 {
848         int ret = 0;
849         char *description = NULL;
850         pkgmgrinfo_pkginfo_h handle;
851         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
852         if (ret != PMINFO_R_OK)
853                 return -1;
854         ret = pkgmgrinfo_pkginfo_get_description(handle, &description);
855         if (ret != PMINFO_R_OK) {
856                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
857                 return -1;
858         }
859         printf("pkg description: %s\n", description);
860         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
861         return 0;
862 }
863  * @endcode
864  */
865 int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description);
866
867 /**
868  * @fn int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name)
869  * @brief       This API gets the package's author name from the package ID
870  *
871  * @par         This API is for package-manager client application
872  * @par Sync (or) Async : Synchronous API
873  *
874  * @param[in]   handle  pointer to package info handle
875  * @param[out] author_name              pointer to hold package author name
876  * @return      0 if success, error code(<0) if fail
877  * @retval      PMINFO_R_OK     success
878  * @retval      PMINFO_R_EINVAL invalid argument
879  * @retval      PMINFO_R_ERROR  internal error
880  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
881  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
882  * @see         pkgmgrinfo_pkginfo_get_pkgid()
883  * @see         pkgmgrinfo_pkginfo_is_removable()
884  * @code
885 static int get_pkg_author_name(const char *pkgid)
886 {
887         int ret = 0;
888         char *author_name = NULL;
889         pkgmgrinfo_pkginfo_h handle;
890         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
891         if (ret != PMINFO_R_OK)
892                 return -1;
893         ret = pkgmgrinfo_pkginfo_get_author_name(handle, &author_name);
894         if (ret != PMINFO_R_OK) {
895                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
896                 return -1;
897         }
898         printf("pkg author name: %s\n", author_name);
899         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
900         return 0;
901 }
902  * @endcode
903  */
904 int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name);
905
906 /**
907  * @fn int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email)
908  * @brief       This API gets the package's author email from the package ID
909  *
910  * @par         This API is for package-manager client application
911  * @par Sync (or) Async : Synchronous API
912  *
913  * @param[in]   handle  pointer to package info handle
914  * @param[out] author_email             pointer to hold package author email
915  * @return      0 if success, error code(<0) if fail
916  * @retval      PMINFO_R_OK     success
917  * @retval      PMINFO_R_EINVAL invalid argument
918  * @retval      PMINFO_R_ERROR  internal error
919  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
920  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
921  * @see         pkgmgrinfo_pkginfo_get_pkgid()
922  * @see         pkgmgrinfo_pkginfo_is_removable()
923  * @code
924 static int get_pkg_author_email(const char *pkgid)
925 {
926         int ret = 0;
927         char *author_email = NULL;
928         pkgmgrinfo_pkginfo_h handle;
929         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
930         if (ret != PMINFO_R_OK)
931                 return -1;
932         ret = pkgmgrinfo_pkginfo_get_author_email(handle, &author_email);
933         if (ret != PMINFO_R_OK) {
934                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
935                 return -1;
936         }
937         printf("pkg author email: %s\n", author_email);
938         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
939         return 0;
940 }
941  * @endcode
942  */
943 int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email);
944
945 /**
946  * @fn int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href)
947  * @brief       This API gets the package's author href from the package ID
948  *
949  * @par         This API is for package-manager client application
950  * @par Sync (or) Async : Synchronous API
951  *
952  * @param[in]   handle  pointer to package info handle
953  * @param[out] author_href              pointer to hold package author href
954  * @return      0 if success, error code(<0) if fail
955  * @retval      PMINFO_R_OK     success
956  * @retval      PMINFO_R_EINVAL invalid argument
957  * @retval      PMINFO_R_ERROR  internal error
958  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
959  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
960  * @see         pkgmgrinfo_pkginfo_get_pkgid()
961  * @see         pkgmgrinfo_pkginfo_is_removable()
962  * @code
963 static int get_pkg_author_href(const char *pkgid)
964 {
965         int ret = 0;
966         char *author_href = NULL;
967         pkgmgrinfo_pkginfo_h handle;
968         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
969         if (ret != PMINFO_R_OK)
970                 return -1;
971         ret = pkgmgrinfo_pkginfo_get_author_href(handle, &author_href);
972         if (ret != PMINFO_R_OK) {
973                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
974                 return -1;
975         }
976         printf("pkg author href: %s\n", author_href);
977         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
978         return 0;
979 }
980  * @endcode
981  */
982 int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href);
983
984 /**
985  * @fn int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage)
986  * @brief       This API gets the package installed storagae value from the package ID
987  *
988  * @par         This API is for package-manager client application
989  * @par Sync (or) Async : Synchronous API
990  *
991  * @param[in]   handle  pointer to package info handle
992  * @param[out] storage          pointer to hold package installed storage
993  * @return      0 if success, error code(<0) if fail
994  * @retval      PMINFO_R_OK     success
995  * @retval      PMINFO_R_EINVAL invalid argument
996  * @retval      PMINFO_R_ERROR  internal error
997  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
998  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
999  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1000  * @see         pkgmgrinfo_pkginfo_is_removable()
1001  * @code
1002 static int get_pkg_installed_storage(const char *pkgid)
1003 {
1004         int ret = 0;
1005         pkgmgrinfo_installed_storage storage;
1006         pkgmgrinfo_pkginfo_h handle;
1007         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1008         if (ret != PMINFO_R_OK)
1009                 return -1;
1010         ret = pkgmgrinfo_pkginfo_get_installed_storage(handle, &storage);
1011         if (ret != PMINFO_R_OK) {
1012                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1013                 return -1;
1014         }
1015         printf("pkg installed storage: %d\n", storage);
1016         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1017         return 0;
1018 }
1019  * @endcode
1020  */
1021 int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage);
1022
1023 /**
1024  * @fn int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time)
1025  * @brief       This API gets the installed time of package from the package ID
1026  *
1027  * @par         This API is for package-manager client application
1028  * @par Sync (or) Async : Synchronous API
1029  *
1030  * @param[in]   handle  pointer to package info handle
1031  * @param[out] installed_time           pointer to hold installed time of package
1032  * @return      0 if success, error code(<0) if fail
1033  * @retval      PMINFO_R_OK     success
1034  * @retval      PMINFO_R_EINVAL invalid argument
1035  * @retval      PMINFO_R_ERROR  internal error
1036  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1037  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1038  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1039  * @see         pkgmgrinfo_pkginfo_is_removable()
1040  * @code
1041 static int get_pkg_installed_time(const char *pkgid)
1042 {
1043         int ret = 0;
1044         int installed_time = 0;
1045         pkgmgrinfo_pkginfo_h handle;
1046         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1047         if (ret != PMINFO_R_OK)
1048                 return -1;
1049         ret = pkgmgrinfo_pkginfo_get_installed_time(handle, &installed_time);
1050         if (ret != PMINFO_R_OK) {
1051                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1052                 return -1;
1053         }
1054         printf("installed_time: %d\n", installed_time);
1055         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1056         return 0;
1057 }
1058  * @endcode
1059  */
1060 int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time);
1061
1062 /**
1063  * @fn int pkgmgrinfo_updateinfo_create(pkgmgrinfo_updateinfo_h *update_handle)
1064  * @brief       This API creates the update info handle
1065  *
1066  * @par         This API is for package-manager client application
1067  * @par Sync (or) Async : Synchronous API
1068  *
1069  * @param[out]  handle  pointer to package update info handle
1070  * @return      0 if success, error code(<0) if fail
1071  * @retval      PMINFO_R_OK     success
1072  * @retval      PMINFO_R_EINVAL invalid argument
1073  * @retval      PMINFO_R_ERROR  internal error
1074  * @post        pkgmgrinfo_updateinfo_destroy()
1075  * @see         pkgmgrinfo_updateinfo_set_pkgid()
1076  * @see         pkgmgrinfo_updateinfo_set_version()
1077  * @see         pkgmgrinfo_updateinfo_set_type()
1078  * @see         pkgmgr_client_register_pkg_updateinfo()
1079  * @code
1080 static int updateinfo_handle_create()
1081 {
1082         int ret = 0;
1083
1084         pkgmgrinfo_updateinfo_h handle;
1085         ret = pkgmgrinfo_updateinfo_create(&handle);
1086         if (ret != PMINFO_R_OK)
1087                 return -1;
1088         pkgmgrinfo_update_infodestroy(handle);
1089         return 0;
1090 }
1091  * @endcode
1092  */
1093 int pkgmgrinfo_updateinfo_create(pkgmgrinfo_updateinfo_h *update_handle);
1094
1095 /**
1096  * @fn int pkgmgrinfo_updateinfo_destroy(pkgmgrinfo_updateinfo_h update_handle)
1097  * @brief       This API destroy the update info handle
1098  *
1099  * @par         This API is for package-manager client application
1100  * @par Sync (or) Async : Synchronous API
1101  *
1102  * @param[in]   handle  pointer to package update info handle
1103  * @return      0 if success, error code(<0) if fail
1104  * @retval      PMINFO_R_OK     success
1105  * @retval      PMINFO_R_EINVAL invalid argument
1106  * @pre         pkgmgrinfo_updateinfo_create()
1107  * @see         pkgmgr_client_register_pkg_updateinfo()
1108  * @code
1109 static int updateinfo_handle_destroy(pkgmgrinfo_updateinfo_h handle)
1110 {
1111         int ret = 0;
1112
1113         ret = pkgmgrinfo_updateinfo_destroy(handle);
1114         if (ret != PMINFO_R_OK)
1115                 return -1;
1116         return 0;
1117 }
1118  * @endcode
1119  */
1120 int pkgmgrinfo_updateinfo_destroy(pkgmgrinfo_updateinfo_h update_handle);
1121
1122 /**
1123  * @fn int pkgmgrinfo_updateinfo_get_updateinfo(const char *pkgid, pkgmgrinfo_updateinfo_h *update_handle)
1124  * @brief       This API creates the package update information handle from db
1125  *
1126  * @par         This API is for package-manager client application
1127  * @par Sync (or) Async : Synchronous API
1128  *
1129  * @param[in]   pkgid   pointer to package ID
1130  * @param[in]   uid     the addressee user id of the instruction
1131  * @param[out] update_handle            pointer to the package update info handle.
1132  * @return      0 if success, error code(<0) if fail
1133  * @retval      PMINFO_R_OK     success
1134  * @retval      PMINFO_R_EINVAL invalid argument
1135  * @retval      PMINFO_R_ERROR  internal error
1136  * @pre         None
1137  * @post                pkgmgrinfo_updateinfo_destroy()
1138  * @see         pkgmgrinfo_updateinfo_get_pkgid()
1139  * @see         pkgmgrinfo_updateinfo_get_version()
1140  * @see         pkgmgrinfo_updateinfo_get_update_type()
1141  * @code
1142 static int get_pkg_update_info(const char *pkgid)
1143 {
1144         int ret = 0;
1145         char *version;
1146         pkgmgrinfo_updateinfo_h handle;
1147         ret = pkgmgrinfo_updateinfo_get_updateinfo(pkgid, &handle);
1148         if (ret != PMINFO_R_OK)
1149                 return -1;
1150         ret = pkgmgrinfo_updateinfo_get_version(handle, &version);
1151         if (ret != PMINFO_R_OK) {
1152                 pkgmgrinfo_updateinfo_destroy(handle);
1153                 return -1;
1154         }
1155         printf("pkg update version: %s\n", version
1156         pkgmgrinfo_updateinfo_destroy(handle);
1157         return 0;
1158 }
1159  * @endcode
1160  */
1161 int pkgmgrinfo_updateinfo_get_updateinfo(const char *pkgid, pkgmgrinfo_updateinfo_h *update_handle);
1162 int pkgmgrinfo_updateinfo_get_usr_updateinfo(const char *pkgid, pkgmgrinfo_updateinfo_h *update_handle, uid_t uid);
1163
1164 /**
1165  * @fn int pkgmgrinfo_updateinfo_set_pkgid(pkgmgrinfo_updateinfo_h updateinfo_handle, const char *pkgid)
1166  * @brief       This API sets given pkgid into handle
1167  *
1168  * @par         This API is for package-manager client application
1169  * @par Sync (or) Async : Synchronous API
1170  *
1171  * @param[in]   handle  pointer to package update info handle
1172  * @param[in]   pkgid   package id
1173  * @return      0 if success, error code(<0) if fail
1174  * @retval      PMINFO_R_OK     success
1175  * @retval      PMINFO_R_EINVAL invalid argument
1176  * @retval      PMINFO_R_ERROR  internal error
1177  * @code
1178 static int set_pkgid_to_handle(pkgmgrinfo_updateinfo_h handle, const char *pkgid)
1179 {
1180         int ret = 0;
1181
1182         ret = pkgmgrinfo_updateinfo_set_pkgid(handle, pkgid);
1183         if (ret != PMINFO_R_OK)
1184                 return -1;
1185         return 0;
1186 }
1187  * @endcode
1188  */
1189 int pkgmgrinfo_updateinfo_set_pkgid(pkgmgrinfo_updateinfo_h updateinfo_handle, const char *pkgid);
1190
1191 /**
1192  * @fn int pkgmgrinfo_updateinfo_set_version(pkgmgrinfo_updateinfo_h updateinfo_handle, const char *version)
1193  * @brief       This API sets given version into handle
1194  *
1195  * @par         This API is for package-manager client application
1196  * @par Sync (or) Async : Synchronous API
1197  *
1198  * @param[in]   handle  pointer to package update info handle
1199  * @param[in]   version update version
1200  * @return      0 if success, error code(<0) if fail
1201  * @retval      PMINFO_R_OK     success
1202  * @retval      PMINFO_R_EINVAL invalid argument
1203  * @retval      PMINFO_R_ERROR  internal error
1204  * @code
1205 static int set_version_to_handle(pkgmgrinfo_updateinfo_h handle, const char *version)
1206 {
1207         int ret = 0;
1208
1209         ret = pkgmgrinfo_updateinfo_set_version(handle, version);
1210         if (ret != PMINFO_R_OK)
1211                 return -1;
1212         return 0;
1213 }
1214  * @endcode
1215  */
1216 int pkgmgrinfo_updateinfo_set_version(pkgmgrinfo_updateinfo_h updateinfo_handle, const char *version);
1217
1218 /**
1219  * @fn int pkgmgrinfo_updateinfo_set_type(pkgmgrinfo_updateinfo_h updateinfo_handle, pkgmgrinfo_updateinfo_update_type type)
1220  * @brief       This API sets given update type into handle
1221  *
1222  * @par         This API is for package-manager client application
1223  * @par Sync (or) Async : Synchronous API
1224  *
1225  * @param[in]   handle  pointer to package update info handle
1226  * @param[in]   type    update type
1227  * @return      0 if success, error code(<0) if fail
1228  * @retval      PMINFO_R_OK     success
1229  * @retval      PMINFO_R_EINVAL invalid argument
1230  * @retval      PMINFO_R_ERROR  internal error
1231  * @code
1232 static int set_type_to_handle(pkgmgrinfo_updateinfo_h handle, pkgmgrinfo_updateinfo_update_type type)
1233 {
1234         int ret = 0;
1235
1236         ret = pkgmgrinfo_updateinfo_set_type(handle, type);
1237         if (ret != PMINFO_R_OK)
1238                 return -1;
1239         return 0;
1240 }
1241  * @endcode
1242  */
1243 int pkgmgrinfo_updateinfo_set_type(pkgmgrinfo_updateinfo_h updateinfo_handle, pkgmgrinfo_updateinfo_update_type type);
1244
1245 /**
1246  * @fn int pkgmgrinfo_updateinfo_get_pkgid(pkgmgrinfo_updateinfo_h update_handle, char **pkgid)
1247  * @brief       This API retrieves the pkgid from given update info
1248  *
1249  * @par         This API is for package-manager client application
1250  * @par Sync (or) Async : Synchronous API
1251  *
1252  * @param[in]   handle  pointer to package update info handle
1253  * @param[out]  pkgid   package id
1254  * @return      0 if success, error code(<0) if fail
1255  * @retval      PMINFO_R_OK     success
1256  * @retval      PMINFO_R_EINVAL invalid argument
1257  * @retval      PMINFO_R_ERROR  internal error
1258  * @code
1259 static int get_pkgid_from_handle(pkgmgrinfo_updateinfo_h handle)
1260 {
1261         int ret = 0;
1262         char *pkgid;
1263
1264         ret = pkgmgrinfo_updateinfo_get_pkgid(handle, &pkgid);
1265         if (ret != PMINFO_R_OK)
1266                 return -1;
1267         return 0;
1268 }
1269  * @endcode
1270  */
1271 int pkgmgrinfo_updateinfo_get_pkgid(pkgmgrinfo_updateinfo_h update_handle, char **pkgid);
1272
1273 /**
1274  * @fn int pkgmgrinfo_updateinfo_get_version(pkgmgrinfo_updateinfo_h updateinfo_handle, char **version)
1275  * @brief       This API retrieves the version from given update info
1276  *
1277  * @par         This API is for package-manager client application
1278  * @par Sync (or) Async : Synchronous API
1279  *
1280  * @param[in]   handle  pointer to package update info handle
1281  * @param[out]  version update version
1282  * @return      0 if success, error code(<0) if fail
1283  * @retval      PMINFO_R_OK     success
1284  * @retval      PMINFO_R_EINVAL invalid argument
1285  * @retval      PMINFO_R_ERROR  internal error
1286  * @code
1287 static int get_version_from_handle(pkgmgrinfo_updateinfo_h handle)
1288 {
1289         int ret = 0;
1290         char *version;
1291
1292         ret = pkgmgrinfo_updateinfo_get_version(handle, &version);
1293         if (ret != PMINFO_R_OK)
1294                 return -1;
1295         return 0;
1296 }
1297  * @endcode
1298  */
1299 int pkgmgrinfo_updateinfo_get_version(pkgmgrinfo_updateinfo_h updateinfo_handle, char **version);
1300
1301 /**
1302  * @fn int pkgmgrinfo_updateinfo_get_update_type(pkgmgrinfo_updateinfo_h updateinfo_handle, pkgmgrinfo_updateinfo_update_type *type)
1303  * @brief       This API retrieves the update type from given update info
1304  *
1305  * @par         This API is for package-manager client application
1306  * @par Sync (or) Async : Synchronous API
1307  *
1308  * @param[in]   handle  pointer to package update info handle
1309  * @param[out]  type    update type
1310  * @return      0 if success, error code(<0) if fail
1311  * @retval      PMINFO_R_OK     success
1312  * @retval      PMINFO_R_EINVAL invalid argument
1313  * @retval      PMINFO_R_ERROR  internal error
1314  * @code
1315 static int get_type_from_handle(pkgmgrinfo_updateinfo_h handle)
1316 {
1317         int ret = 0;
1318         pkgmgrinfo_updateinfo_update_type *type;
1319
1320         ret = pkgmgrinfo_updateinfo_get_type(handle, &type);
1321         if (ret != PMINFO_R_OK)
1322                 return -1;
1323         return 0;
1324 }
1325  * @endcode
1326  */
1327 int pkgmgrinfo_updateinfo_get_update_type(pkgmgrinfo_updateinfo_h updateinfo_handle, pkgmgrinfo_updateinfo_update_type *type);
1328
1329
1330 /**
1331  * @fn int pkgmgrinfo_updateinfo_foreach_updateinfo(pkgmgrinfo_foreach_updateinfo_cb callback, void *user_data)
1332  * @brief       This API retrieve the update informations and invoke given callback for it.
1333  *
1334  * @par         This API is for package-manager client application
1335  * @par Sync (or) Async : Synchronous API
1336  *
1337  * @param[in]   callback        callback to be invoked for each retrieved informations
1338  * @param[in]   user_data       user data to be passed to callback
1339  * @return      0 if success, error code(<0) if fail
1340  * @retval      PMINFO_R_OK     success
1341  * @retval      PMINFO_R_EINVAL invalid argument
1342  * @retval      PMINFO_R_ERROR  internal error
1343  * @code
1344 static int foreach_pkg_updateinfo(pkgmgrinfo_foreach_updateinfo_cb callback)
1345 {
1346         int ret = 0;
1347
1348         ret = pkgmgrinfo_updateinfo_foreach_updateinfo(callback, NULL);
1349         if (ret != PMINFO_R_OK)
1350                 return -1;
1351         return 0;
1352 }
1353  * @endcode
1354  */
1355 int pkgmgrinfo_updateinfo_foreach_updateinfo(pkgmgrinfo_foreach_updateinfo_cb callback, void *user_data);
1356 int pkgmgrinfo_updateinfo_usr_foreach_updateinfo(uid_t uid, pkgmgrinfo_foreach_updateinfo_cb callback, void *user_data);
1357
1358 /**
1359  * @fn int pkgmgrinfo_plugininfo_is_executed(const char *pkgid, const char *appid, const char *plugin_type, const char *plugin_name, bool *is_executed);
1360  * @brief       This API checkes whether given plugin had been executed with given package ID and application ID or not.
1361  *
1362  * @par         This API is for package-manager client application
1363  * @par Sync (or) Async : Synchronous API
1364  *
1365  * @param[in]   pkgid   package ID
1366  * @param[in]   appid   application ID
1367  * @param[in]   plugin_type     plugin type to be checked
1368  * @param[in]   plugin_name     plugin name to be checked
1369  * @param[out]  is_executed     check result
1370  * @return      0 if success, error code(<0) if fail
1371  * @retval      PMINFO_R_OK     success
1372  * @retval      PMINFO_R_EINVAL invalid argument
1373  * @retval      PMINFO_R_ERROR  internal error
1374  * @code
1375 static bool check_execute_info(const char *pkgid, const char *appid, const char *plugin_type, const char *plugin_name)
1376 {
1377         int ret = 0;
1378         bool is_executed;
1379
1380         ret = pkgmgrinfo_plugininfo_is_executed(pkgid, appid, plugin_type, plugin_name, &is_executed);
1381         if (ret != PMINFO_R_OK)
1382                 return -1;
1383         printf("is checked is [%d]\n", is_executed);
1384         return 0;
1385 }
1386  * @endcode
1387  */
1388 int pkgmgrinfo_plugininfo_is_executed(const char *pkgid, const char *appid,
1389                 const char *plugin_type, const char *plugin_name, bool *is_executed);
1390
1391 /**
1392  * @fn int pkgmgrinfo_plugininfo_foreach_plugininfo(const char *pkgid, const char *plugin_type, const char *plugin_name, pkgmgrinfo_plugin_list_cb plugin_list_cb, void *user_data);
1393  * @brief       This API retrieve the previous plugin execution info and invoke callbacks each of it.
1394  *
1395  * @par         This API is for package-manager client application
1396  * @par Sync (or) Async : Synchronous API
1397  *
1398  * @param[in]   pkgid                   package ID
1399  * @param[in]   plugin_type             type of plugin
1400  * @param[in]   plugin_name             name of plugin
1401  * @param[in]   plugin_list_cb  callback to be invoked for each plugin execution info
1402  * @param[out]  user_data               user data to be passed to callback
1403  * @return      0 if success, error code(<0) if fail
1404  * @retval      PMINFO_R_OK     success
1405  * @retval      PMINFO_R_EINVAL invalid argument
1406  * @retval      PMINFO_R_ERROR  internal error
1407  * @code
1408 static int foreach_pkg_plugininfo(const char *pkgid, const char *plugin_type, const char *plugin_name, pkgmgrinfo_plugin_list_cb callback)
1409 {
1410         int ret = 0;
1411
1412         ret = pkgmgrinfo_plugininfo_foreach_plugininfo(pkgid, plugin_type, plugin_name, callback, NULL);
1413         if (ret != PMINFO_R_OK)
1414                 return -1;
1415         return 0;
1416 }
1417  * @endcode
1418  */
1419 int pkgmgrinfo_plugininfo_foreach_plugininfo(const char *pkgid,
1420                 const char *plugin_type, const char *plugin_name,
1421                 pkgmgrinfo_plugin_list_cb plugin_list_cb, void *user_data);
1422
1423 /**
1424  * @fn int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
1425  * @brief       This API gets the launch mode of package from the package ID
1426  *
1427  * @par         This API is for package-manager client application
1428  * @par Sync (or) Async : Synchronous API
1429  *
1430  * @param[in]   handle  pointer to package info handle
1431  * @param[out] mode             pointer to hold launch mode of package
1432  * @return      0 if success, error code(<0) if fail
1433  * @retval      PMINFO_R_OK     success
1434  * @retval      PMINFO_R_EINVAL invalid argument
1435  * @retval      PMINFO_R_ERROR  internal error
1436  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1437  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1438  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1439  * @see         pkgmgrinfo_pkginfo_is_removable()
1440  * @code
1441 static int get_pkg_launch_mode(const char *pkgid)
1442 {
1443         int ret = 0;
1444         char *launch_mode = NULL;
1445         pkgmgrinfo_pkginfo_h handle;
1446         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1447         if (ret != PMINFO_R_OK)
1448                 return -1;
1449         ret = pkgmgrinfo_pkginfo_get_launch_mode(handle, &mode);
1450         if (ret != PMINFO_R_OK) {
1451                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1452                 return -1;
1453         }
1454         printf("launch mode: %s\n", mode);
1455         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1456         return 0;
1457 }
1458  * @endcode
1459  */
1460 int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode);
1461
1462 /**
1463  * @fn int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid)
1464  * @brief       This API gets the store client id of package from the package ID
1465  *
1466  * @par         This API is for package-manager client application
1467  * @par Sync (or) Async : Synchronous API
1468  *
1469  * @param[in]   handle  pointer to package info handle
1470  * @param[out] storeclientid            pointer to hold store client id of package
1471  * @return      0 if success, error code(<0) if fail
1472  * @retval      PMINFO_R_OK     success
1473  * @retval      PMINFO_R_EINVAL invalid argument
1474  * @retval      PMINFO_R_ERROR  internal error
1475  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1476  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1477  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1478  * @see         pkgmgrinfo_pkginfo_is_removable()
1479  * @code
1480 static int get_pkg_storeclientid(const char *pkgid)
1481 {
1482         int ret = 0;
1483         char *storeclientid = 0;
1484         pkgmgrinfo_pkginfo_h handle;
1485         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1486         if (ret != PMINFO_R_OK)
1487                 return -1;
1488         ret = pkgmgrinfo_pkginfo_get_storeclientid(handle, &storeclientid);
1489         if (ret != PMINFO_R_OK) {
1490                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1491                 return -1;
1492         }
1493         printf(store client id: %s\n", storeclientid);
1494         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1495         return 0;
1496 }
1497  * @endcode
1498  */
1499 int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid);
1500
1501 /**
1502  * @fn int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid)
1503  * @brief       This API gets the main app id of package from the package ID
1504  *
1505  * @par         This API is for package-manager client application
1506  * @par Sync (or) Async : Synchronous API
1507  *
1508  * @param[in]   handle  pointer to package info handle
1509  * @param[out] mainappid                pointer to hold main app id of package
1510  * @return      0 if success, error code(<0) if fail
1511  * @retval      PMINFO_R_OK     success
1512  * @retval      PMINFO_R_EINVAL invalid argument
1513  * @retval      PMINFO_R_ERROR  internal error
1514  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1515  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1516  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1517  * @see         pkgmgrinfo_pkginfo_is_removable()
1518  * @code
1519 static int get_pkg_mainappid(const char *pkgid)
1520 {
1521         int ret = 0;
1522         char *mainappid = 0;
1523         pkgmgrinfo_pkginfo_h handle;
1524         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1525         if (ret != PMINFO_R_OK)
1526                 return -1;
1527         ret = pkgmgrinfo_pkginfo_get_mainappid(handle, &mainappid);
1528         if (ret != PMINFO_R_OK) {
1529                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1530                 return -1;
1531         }
1532         printf(main app id: %s\n", mainappid);
1533         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1534         return 0;
1535 }
1536  * @endcode
1537  */
1538 int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid);
1539
1540 /**
1541  * @fn int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url)
1542  * @brief       This API gets the url of package from the package ID
1543  *
1544  * @par         This API is for package-manager client application
1545  * @par Sync (or) Async : Synchronous API
1546  *
1547  * @param[in]   handle  pointer to package info handle
1548  * @param[out] url              pointer to hold url of package
1549  * @return      0 if success, error code(<0) if fail
1550  * @retval      PMINFO_R_OK     success
1551  * @retval      PMINFO_R_EINVAL invalid argument
1552  * @retval      PMINFO_R_ERROR  internal error
1553  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1554  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1555  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1556  * @see         pkgmgrinfo_pkginfo_is_removable()
1557  * @code
1558 static int get_pkg_url(const char *pkgid)
1559 {
1560         int ret = 0;
1561         char *url = 0;
1562         pkgmgrinfo_pkginfo_h handle;
1563         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1564         if (ret != PMINFO_R_OK)
1565                 return -1;
1566         ret = pkgmgrinfo_pkginfo_get_url(handle, &url);
1567         if (ret != PMINFO_R_OK) {
1568                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1569                 return -1;
1570         }
1571         printf("url : %s\n", url);
1572         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1573         return 0;
1574 }
1575  * @endcode
1576  */
1577 int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url);
1578
1579 /**
1580  * @fn int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path)
1581  * @brief       This API gets the root path of package
1582  *
1583  * @par Sync (or) Async : Synchronous API
1584  *
1585  * @param[in] handle            pointer to package info handle
1586  * @param[out] path             pointer to hold root path of package
1587  * @return      0 if success, error code(<0) if fail
1588  * @retval      PMINFO_R_OK     success
1589  * @retval      PMINFO_R_EINVAL invalid argument
1590  * @retval      PMINFO_R_ERROR  internal error
1591  * @code
1592 static int get_root_path(const char *pkgid)
1593 {
1594         int ret = 0;
1595         char *path = 0;
1596         pkgmgrinfo_pkginfo_h handle;
1597         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1598         if (ret != PMINFO_R_OK)
1599                 return -1;
1600
1601         ret = pkgmgrinfo_pkginfo_get_root_path(handle, &path);
1602         if (ret != PMINFO_R_OK) {
1603                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1604                 return -1;
1605         }
1606         printf("path : %s\n", path);
1607         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1608
1609         return 0;
1610 }
1611  * @endcode
1612  */
1613 int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path);
1614
1615
1616 /**
1617  * @fn int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path)
1618  * @brief       This API gets the csc path of package
1619  *
1620  * @par Sync (or) Async : Synchronous API
1621  *
1622  * @param[in] handle            pointer to package info handle
1623  * @param[out] path             pointer to hold csc path of package
1624  * @return      0 if success, error code(<0) if fail
1625  * @retval      PMINFO_R_OK     success
1626  * @retval      PMINFO_R_EINVAL invalid argument
1627  * @retval      PMINFO_R_ERROR  internal error
1628  * @code
1629 static int get_csc_path(const char *pkgid)
1630 {
1631         int ret = 0;
1632         char *path = 0;
1633         pkgmgrinfo_pkginfo_h handle;
1634         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1635         if (ret != PMINFO_R_OK)
1636                 return -1;
1637
1638         ret = pkgmgrinfo_pkginfo_get_csc_path(handle, &path);
1639         if (ret != PMINFO_R_OK) {
1640                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1641                 return -1;
1642         }
1643         printf("path : %s\n", path);
1644         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1645
1646         return 0;
1647 }
1648  * @endcode
1649  */
1650 int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path);
1651
1652 /**
1653  * @fn int pkgmgrinfo_pkginfo_get_res_type(pkgmgrinfo_pkginfo_h handle, char **res_type)
1654  * @brief       This API gets the resource type of package
1655  *
1656  * @par Sync (or) Async : Synchronous API
1657  *
1658  * @param[in]   handle          pointer to package info handle
1659  * @param[out]  res_type        pointer to hold resource type of package
1660  * @return      0 if success, error code(<0) if fail
1661  * @retval      PMINFO_R_OK     success
1662  * @retval      PMINFO_R_EINVAL invalid argument
1663  * @retval      PMINFO_R_ERROR  internal error
1664  * @code
1665 static int get_res_type(const char *pkgid)
1666 {
1667         int ret = 0;
1668         char *res_type = 0;
1669         pkgmgrinfo_pkginfo_h handle;
1670         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1671         if (ret != PMINFO_R_OK)
1672                 return -1;
1673
1674         ret = pkgmgrinfo_pkginfo_get_res_type(handle, &res_type);
1675         if (ret != PMINFO_R_OK) {
1676                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1677                 return -1;
1678         }
1679         printf("res_type : %s\n", res_type);
1680         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1681
1682         return 0;
1683 }
1684  * @endcode
1685  */
1686 int pkgmgrinfo_pkginfo_get_res_type(pkgmgrinfo_pkginfo_h handle, char **res_type);
1687
1688 /**
1689  * @fn int pkgmgrinfo_pkginfo_get_res_version(pkgmgrinfo_pkginfo_h handle, char **res_version)
1690  * @brief       This API gets the resource version of package
1691  *
1692  * @par Sync (or) Async : Synchronous API
1693  *
1694  * @param[in]   handle          pointer to package info handle
1695  * @param[out]  res_version     pointer to hold resource version of package
1696  * @return      0 if success, error code(<0) if fail
1697  * @retval      PMINFO_R_OK     success
1698  * @retval      PMINFO_R_EINVAL invalid argument
1699  * @retval      PMINFO_R_ERROR  internal error
1700  * @code
1701 static int get_res_version(const char *pkgid)
1702 {
1703         int ret = 0;
1704         char *res_version = 0;
1705         pkgmgrinfo_pkginfo_h handle;
1706         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1707         if (ret != PMINFO_R_OK)
1708                 return -1;
1709
1710         ret = pkgmgrinfo_pkginfo_get_res_version(handle, &res_version);
1711         if (ret != PMINFO_R_OK) {
1712                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1713                 return -1;
1714         }
1715         printf("res_version : %s\n", res_version);
1716         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1717
1718         return 0;
1719 }
1720  * @endcode
1721  */
1722 int pkgmgrinfo_pkginfo_get_res_version(pkgmgrinfo_pkginfo_h handle, char **res_version);
1723
1724 /**
1725  * @fn int pkgmgrinfo_pkginfo_get_light_user_switch_mode(pkgmgrinfo_pkginfo_h handle, char **mode)
1726  * @brief       This API gets the light_user_switch_mode of package
1727  *
1728  * @par Sync (or) Async : Synchronous API
1729  *
1730  * @param[in]   handle          pointer to package info handle
1731  * @param[out]  mode            pointer to hold resource version of package
1732  * @return      0 if success, error code(<0) if fail
1733  * @retval      PMINFO_R_OK     success
1734  * @retval      PMINFO_R_EINVAL invalid argument
1735  * @retval      PMINFO_R_ERROR  internal error
1736  * @code
1737 static int get_light_user_switch_mode(const char *pkgid)
1738 {
1739         int ret = 0;
1740         char *mode = 0;
1741         pkgmgrinfo_pkginfo_h handle;
1742         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1743         if (ret != PMINFO_R_OK)
1744                 return -1;
1745
1746         ret = pkgmgrinfo_pkginfo_get_light_user_switch_mode(handle, &mode);
1747         if (ret != PMINFO_R_OK) {
1748                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1749                 return -1;
1750         }
1751         printf("light_user_switch_mode : %s\n", mode);
1752         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1753
1754         return 0;
1755 }
1756  * @endcode
1757  */
1758 int pkgmgrinfo_pkginfo_get_light_user_switch_mode(pkgmgrinfo_pkginfo_h handle, char **mode);
1759
1760 /**
1761  * @fn int pkgmgrinfo_pkginfo_get_support_mode(pkgmgrinfo_pkginfo_h handle, int *support_mode)
1762  * @brief       This API gets the support_mode of package
1763  *
1764  * @par Sync (or) Async : Synchronous API
1765  *
1766  * @param[in] handle            pointer to package info handle
1767  * @param[out] support_mode             pointer to hold support_mode of package
1768  * @return      0 if success, error code(<0) if fail
1769  * @retval      PMINFO_R_OK     success
1770  * @retval      PMINFO_R_EINVAL invalid argument
1771  * @retval      PMINFO_R_ERROR  internal error
1772  * @code
1773 static int get_support_mode(const char *pkgid)
1774 {
1775         int ret = 0;
1776         int support_mode = 0;
1777         pkgmgrinfo_pkginfo_h handle = NULL;
1778         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1779         if (ret != PMINFO_R_OK)
1780                 return -1;
1781
1782         ret = pkgmgrinfo_pkginfo_get_support_mode(handle, &support_mode);
1783         if (ret != PMINFO_R_OK) {
1784                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1785                 return -1;
1786         }
1787         printf("support_mode : %s\n", support_mode);
1788         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1789
1790         return 0;
1791 }
1792  * @endcode
1793  */
1794 int pkgmgrinfo_pkginfo_get_support_mode(pkgmgrinfo_pkginfo_h handle, int *support_mode);
1795
1796 /**
1797  * @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)
1798  * @brief       This API compare the cert information from given package id
1799  *
1800  * @par         This API is for package-manager client application
1801  * @par Sync (or) Async : Synchronous API
1802  *
1803  * @param[in]   lhs_package_id  pointer to first package ID
1804  * @param[in]   rhs_package_id  pointer to second package ID
1805  * @param[out] compare_result           pointer to the compare result.
1806  * @return      0 if success, error code(<0) if fail
1807  * @retval      PMINFO_R_OK     success
1808  * @retval      PMINFO_R_EINVAL invalid argument
1809  * @retval      PMINFO_R_ERROR  internal error
1810  * @pre         None
1811  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1812  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1813  * @see         pkgmgrinfo_pkginfo_is_removable()
1814  * @code
1815 static int compare_pkg_cert_info(const char *lhs_package_id, const char *rhs_package_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1816 {
1817         int ret = 0;
1818         pkgmgrinfo_cert_compare_result_type_e result;
1819
1820         ret = pkgmgrinfo_pkginfo_compare_pkg_cert_info(lhs_package_id, rhs_package_id, &result);
1821         if (ret != PMINFO_R_OK) {
1822                 return -1;
1823         }
1824         printf("result: %d\n", result);
1825         return 0;
1826 }
1827  * @endcode
1828  */
1829 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);
1830 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);
1831 /**
1832  * @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)
1833  * @brief       This API compare the cert information from given app id
1834  *
1835  * @par         This API is for package-manager client application
1836  * @par Sync (or) Async : Synchronous API
1837  *
1838  * @param[in]   lhs_app_id      pointer to first app ID
1839  * @param[in]   rhs_app_id      pointer to second app ID
1840  * @param[out] compare_result           pointer to the compare result.
1841  * @return      0 if success, error code(<0) if fail
1842  * @retval      PMINFO_R_OK     success
1843  * @retval      PMINFO_R_EINVAL invalid argument
1844  * @retval      PMINFO_R_ERROR  internal error
1845  * @pre         None
1846  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1847  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1848  * @see         pkgmgrinfo_pkginfo_is_removable()
1849  * @code
1850 static int compare_app_cert_info(const char *lhs_app_id, const char *rhs_app_id, pkgmgrinfo_cert_compare_result_type_e *compare_result)
1851 {
1852         int ret = 0;
1853         pkgmgrinfo_cert_compare_result_type_e result;
1854
1855         ret = pkgmgrinfo_pkginfo_compare_app_cert_info(lhs_app_id, rhs_app_id, &result);
1856         if (ret != PMINFO_R_OK) {
1857                 return -1;
1858         }
1859         printf("result: %d\n", result);
1860         return 0;
1861 }
1862  * @endcode
1863  */
1864 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);
1865 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);
1866 /**
1867  * @fn int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable)
1868  * @brief       This API gets the package 'removable' value from the package ID
1869  *
1870  * @par         This API is for package-manager client application
1871  * @par Sync (or) Async : Synchronous API
1872  *
1873  * @param[in]   handle  pointer to package info handle
1874  * @param[out] removable                pointer to hold package removable value
1875  * @return      0 if success, error code(<0) if fail
1876  * @retval      PMINFO_R_OK     success
1877  * @retval      PMINFO_R_EINVAL invalid argument
1878  * @retval      PMINFO_R_ERROR  internal error
1879  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1880  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1881  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1882  * @see         pkgmgrinfo_pkginfo_is_readonly()
1883  * @code
1884 static int get_pkg_removable(const char *pkgid)
1885 {
1886         int ret = 0;
1887         bool removable;
1888         pkgmgrinfo_pkginfo_h handle;
1889         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1890         if (ret != PMINFO_R_OK)
1891                 return -1;
1892         ret = pkgmgrinfo_pkginfo_is_removable(handle, &removable);
1893         if (ret != PMINFO_R_OK) {
1894                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1895                 return -1;
1896         }
1897         printf("pkg removable: %d\n", removable);
1898         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1899         return 0;
1900 }
1901  * @endcode
1902  */
1903 int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable);
1904
1905 /**
1906  * @fn int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable)
1907  * @brief       This API check that the package can move internal storage to external storage or external storage to internal storage from the package ID
1908  *
1909  * @par         This API is for package-manager client application
1910  * @par Sync (or) Async : Synchronous API
1911  *
1912  * @param[in]   handle  pointer to package info handle
1913  * @param[out] movable          pointer to hold package movable state
1914  * @return      0 if success, error code(<0) if fail
1915  * @retval      PMINFO_R_OK     success
1916  * @retval      PMINFO_R_EINVAL invalid argument
1917  * @retval      PMINFO_R_ERROR  internal error
1918  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1919  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1920  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1921  * @code
1922 static int get_pkg_movable(const char *pkgid)
1923 {
1924         int ret = 0;
1925         bool movable;
1926         pkgmgrinfo_pkginfo_h handle;
1927         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1928         if (ret != PMINFO_R_OK)
1929                 return -1;
1930         ret = pkgmgrinfo_pkginfo_is_movable(handle, &movable);
1931         if (ret != PMINFO_R_OK) {
1932                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1933                 return -1;
1934         }
1935         printf("pkg movable: %d\n", movable);
1936         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1937         return 0;
1938 }
1939  * @endcode
1940  */
1941 int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable);
1942
1943 /**
1944  * @fn int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload)
1945  * @brief       This API gets the package 'preload' value from the package ID
1946  *
1947  * @par         This API is for package-manager client application
1948  * @par Sync (or) Async : Synchronous API
1949  *
1950  * @param[in]   handle  pointer to package info handle
1951  * @param[out] preload          pointer to hold package preload value
1952  * @return      0 if success, error code(<0) if fail
1953  * @retval      PMINFO_R_OK     success
1954  * @retval      PMINFO_R_EINVAL invalid argument
1955  * @retval      PMINFO_R_ERROR  internal error
1956  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1957  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1958  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1959  * @see         pkgmgrinfo_pkginfo_is_readonly()
1960  * @code
1961 static int get_pkg_preload(const char *pkgid)
1962 {
1963         int ret = 0;
1964         bool preload;
1965         pkgmgrinfo_pkginfo_h handle;
1966         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
1967         if (ret != PMINFO_R_OK)
1968                 return -1;
1969         ret = pkgmgrinfo_pkginfo_is_preload(handle, &preload);
1970         if (ret != PMINFO_R_OK) {
1971                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1972                 return -1;
1973         }
1974         printf("pkg preload: %d\n", preload);
1975         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1976         return 0;
1977 }
1978  * @endcode
1979  */
1980 int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload);
1981
1982 /**
1983  * @fn int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
1984  * @brief       This API gets the value for given handle is system or not
1985  *
1986  * @par         This API is for package-manager client application
1987  * @par Sync (or) Async : Synchronous API
1988  *
1989  * @param[in]   handle  pointer to package info handle
1990  * @param[out] system           pointer to hold  system is or not
1991  * @return      0 if success, error code(<0) if fail
1992  * @retval      PMINFO_R_OK     success
1993  * @retval      PMINFO_R_EINVAL invalid argument
1994  * @retval      PMINFO_R_ERROR  internal error
1995  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
1996  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
1997  * @see         pkgmgrinfo_pkginfo_get_pkgid()
1998  * @see         pkgmgrinfo_pkginfo_is_readonly()
1999  * @code
2000 static int get_pkg_system(const char *pkgid)
2001 {
2002         int ret = 0;
2003         bool system = false;
2004         pkgmgrinfo_pkginfo_h handle = NULL;
2005         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2006         if (ret != PMINFO_R_OK)
2007                 return -1;
2008         ret = pkgmgrinfo_pkginfo_is_system(handle, &system);
2009         if (ret != PMINFO_R_OK) {
2010                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2011                 return -1;
2012         }
2013         printf("pkg system: %d\n", system);
2014         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2015         return 0;
2016 }
2017  * @endcode
2018  */
2019 int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system);
2020
2021 /**
2022  * @fn int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
2023  * @brief       This API gets the package 'readonly' value from the package ID
2024  *
2025  * @par         This API is for package-manager client application
2026  * @par Sync (or) Async : Synchronous API
2027  *
2028  * @param[in]   handle  pointer to package info handle
2029  * @param[out] readonly pointer to hold package readonly value
2030  * @return      0 if success, error code(<0) if fail
2031  * @retval      PMINFO_R_OK     success
2032  * @retval      PMINFO_R_EINVAL invalid argument
2033  * @retval      PMINFO_R_ERROR  internal error
2034  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2035  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2036  * @see         pkgmgrinfo_pkginfo_get_pkgid()
2037  * @see         pkgmgrinfo_pkginfo_is_removable()
2038  * @code
2039 static int get_pkg_readonly(const char *pkgid)
2040 {
2041         int ret = 0;
2042         bool readonly;
2043         pkgmgrinfo_pkginfo_h handle;
2044         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2045         if (ret != PMINFO_R_OK)
2046                 return -1;
2047         ret = pkgmgrinfo_pkginfo_is_readonly(handle, &readonly);
2048         if (ret != PMINFO_R_OK) {
2049                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2050                 return -1;
2051         }
2052         printf("pkg readonly: %d\n", readonly);
2053         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2054         return 0;
2055 }
2056  * @endcode
2057  */
2058 int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly);
2059
2060
2061 /**
2062  * @fn int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update)
2063  * @brief       This API gets the package 'update' value from the package ID
2064  *
2065  * @par         This API is for package-manager client application
2066  * @par Sync (or) Async : Synchronous API
2067  *
2068  * @param[in]   handle  pointer to package info handle
2069  * @param[out] update   pointer to hold package update value
2070  * @return      0 if success, error code(<0) if fail
2071  * @retval      PMINFO_R_OK     success
2072  * @retval      PMINFO_R_EINVAL invalid argument
2073  * @retval      PMINFO_R_ERROR  internal error
2074  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2075  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2076  * @see         pkgmgrinfo_pkginfo_get_pkgid()
2077  * @code
2078 static int get_pkg_update(const char *pkgid)
2079 {
2080         int ret = 0;
2081         bool update;
2082         pkgmgrinfo_pkginfo_h handle;
2083         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2084         if (ret != PMINFO_R_OK)
2085                 return -1;
2086         ret = pkgmgrinfo_pkginfo_is_update(handle, &update);
2087         if (ret != PMINFO_R_OK) {
2088                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2089                 return -1;
2090         }
2091         printf("pkg update: %d\n", update);
2092         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2093         return 0;
2094 }
2095  * @endcode
2096  */
2097 int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update);
2098
2099 /**
2100  * @fn int pkgmgrinfo_pkginfo_is_support_disable(pkgmgrinfo_pkginfo_h handle, bool *support_disable)
2101  * @brief       This API gets the package 'support_disable' value from the package ID
2102  *
2103  * @par         This API is for package-manager client application
2104  * @par Sync (or) Async : Synchronous API
2105  *
2106  * @param[in]   handle  pointer to package info handle
2107  * @param[out]  support_disable pointer to hold package support_disable value
2108  * @return      0 if success, error code(<0) if fail
2109  * @retval      PMINFO_R_OK     success
2110  * @retval      PMINFO_R_EINVAL invalid argument
2111  * @retval      PMINFO_R_ERROR  internal error
2112  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2113  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2114  * @see         pkgmgrinfo_pkginfo_get_pkgid()
2115  * @code
2116 static int get_pkg_support_disable(const char *pkgid)
2117 {
2118         int ret = 0;
2119         bool support_disable;
2120         pkgmgrinfo_pkginfo_h handle = NULL;
2121         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2122         if (ret != PMINFO_R_OK)
2123                 return -1;
2124         ret = pkgmgrinfo_pkginfo_is_support_disable(handle, &support_disable);
2125         if (ret != PMINFO_R_OK) {
2126                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2127                 return -1;
2128         }
2129         printf("pkg support_disable: %d\n", support_disable);
2130         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2131         return 0;
2132 }
2133  * @endcode
2134  */
2135 int pkgmgrinfo_pkginfo_is_support_disable(pkgmgrinfo_pkginfo_h handle, bool *support_disable);
2136
2137 /**
2138  * @fn int pkgmgrinfo_pkginfo_is_global(pkgmgrinfo_pkginfo_h handle, bool *global)
2139  * @brief       This API gets whether the given package is global package or user package
2140  *
2141  * @par         This API is for package-manager client application
2142  * @par Sync (or) Async : Synchronous API
2143  *
2144  * @param[in]   handle  pointer to package info handle
2145  * @param[in]   global  pointer to hold package global value
2146  * @return      0 if success, error code(<0) if fail
2147  * @retval      PMINFO_R_OK     success
2148  * @retval      PMINFO_R_EINVAL invalid argument
2149  * @retval      PMINFO_R_ERROR  internal error
2150  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2151  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2152  * @see         pkgmgrinfo_pkginfo_get_pkgid()
2153  static int get_pkg_support_disable(const char *pkgid)
2154  {
2155          int ret = 0;
2156          bool global;
2157          pkgmgrinfo_pkginfo_h handle = NULL;
2158          ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2159          if (ret != PMINFO_R_OK)
2160                  return -1;
2161          ret = pkgmgrinfo_pkginfo_is_global(handle, &global);
2162          if (ret != PMINFO_R_OK) {
2163                  pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2164                  return -1;
2165          }
2166          printf("pkg is_global: %d\n", global);
2167          pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2168          return 0;
2169  }
2170   * @endcode
2171   */
2172 int pkgmgrinfo_pkginfo_is_global(pkgmgrinfo_pkginfo_h handle, bool *global);
2173
2174 /**
2175  * @fn int pkgmgrinfo_pkginfo_is_lib(pkgmgrinfo_pkginfo_h handle, bool *lib)
2176  * @brief       This API gets whether the given package is lib resource package or not
2177  *
2178  * @par         This API is for package-manager client application
2179  * @par Sync (or) Async : Synchronous API
2180  *
2181  * @param[in]   handle  pointer to package info handle
2182  * @param[in]   global  pointer to hold package global value
2183  * @return      0 if success, error code(<0) if fail
2184  * @retval      PMINFO_R_OK     success
2185  * @retval      PMINFO_R_EINVAL invalid argument
2186  * @retval      PMINFO_R_ERROR  internal error
2187  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2188  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2189  * @see         pkgmgrinfo_pkginfo_get_pkgid()
2190 static int get_pkg_is_lib(const char *pkgid)
2191 {
2192         int ret = 0;
2193         bool lib;
2194         pkgmgrinfo_pkginfo_h handle = NULL;
2195         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2196         if (ret != PMINFO_R_OK)
2197                 return -1;
2198         ret = pkgmgrinfo_pkginfo_is_lib(handle, &lib);
2199         if (ret != PMINFO_R_OK) {
2200                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2201                 return -1;
2202         }
2203         printf("pkg lib: %d\n", lib);
2204         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2205         return 0;
2206 }
2207  * @endcode
2208  */
2209 int pkgmgrinfo_pkginfo_is_lib(pkgmgrinfo_pkginfo_h handle, bool *lib);
2210
2211 /**
2212  * @fn int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible)
2213  * @brief       This API gets the package 'accessible' value from the package ID
2214  *
2215  * @par         This API is for package-manager client application
2216  * @par Sync (or) Async : Synchronous API
2217  *
2218  * @param[in]   handle  pointer to package info handle
2219  * @param[out] accessible       pointer to hold package accessible value
2220  * @return      0 if success, error code(<0) if fail
2221  * @retval      PMINFO_R_OK     success
2222  * @retval      PMINFO_R_EINVAL invalid argument
2223  * @retval      PMINFO_R_ERROR  internal error
2224  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2225  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2226  * @see         pkgmgrinfo_pkginfo_get_pkgid()
2227  * @see         pkgmgrinfo_pkginfo_is_readonly()
2228  * @code
2229 static int get_pkg_accessible(const char *pkgid)
2230 {
2231         int ret = 0;
2232         bool accessible;
2233         pkgmgrinfo_pkginfo_h handle;
2234         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2235         if (ret != PMINFO_R_OK)
2236                 return -1;
2237         ret = pkgmgrinfo_pkginfo_is_accessible(handle, &accessible);
2238         if (ret != PMINFO_R_OK) {
2239                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2240                 return -1;
2241         }
2242         printf("pkg accessible: %d\n", accessible);
2243         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2244         return 0;
2245 }
2246  * @endcode
2247  */
2248 int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible);
2249
2250 /**
2251  * @fn int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle)
2252  * @brief       This API destroys the package information handle freeing up all the resources
2253  *
2254  * @par         This API is for package-manager client application
2255  * @par Sync (or) Async : Synchronous API
2256  *
2257  * @param[in]   handle  pointer to the package info handle
2258  * @return      0 if success, error code(<0) if fail
2259  * @retval      PMINFO_R_OK     success
2260  * @retval      PMINFO_R_EINVAL invalid argument
2261  * @retval      PMINFO_R_ERROR  internal error
2262  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2263  * @post                None
2264  * @see         pkgmgrinfo_pkginfo_get_pkgid()
2265  * @see         pkgmgrinfo_pkginfo_is_removable()
2266  * @code
2267 static int get_pkg_type(const char *pkgid)
2268 {
2269         int ret = 0;
2270         char *type = NULL;
2271         pkgmgrinfo_pkginfo_h handle;
2272         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2273         if (ret != PMINFO_R_OK)
2274                 return -1;
2275         ret = pkgmgrinfo_pkginfo_get_type(handle, &type);
2276         if (ret != PMINFO_R_OK) {
2277                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2278                 return -1;
2279         }
2280         printf("pkgtype: %s\n", type);
2281         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2282         return 0;
2283 }
2284  * @endcode
2285  */
2286 int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle);
2287
2288 /**
2289  * @fn int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle)
2290  * @brief       This API creates the package information filter handle from db.  All filter properties will be ANDed.
2291  The query will search the entire package information collected from the manifest file of all the installed packages
2292  *
2293  * @par         This API is for package-manager client application
2294  * @par Sync (or) Async : Synchronous API
2295  *
2296  * @param[out] handle           pointer to the package info filter handle.
2297  * @return      0 if success, error code(<0) if fail
2298  * @retval      PMINFO_R_OK     success
2299  * @retval      PMINFO_R_EINVAL invalid argument
2300  * @retval      PMINFO_R_ERROR  internal error
2301  * @pre         None
2302  * @post                pkgmgrinfo_pkginfo_filter_destroy()
2303  * @see         pkgmgrinfo_pkginfo_filter_count()
2304  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
2305  * @code
2306 static int get_tpk_pkg_count()
2307 {
2308         int ret = 0;
2309         int count = 0;
2310         pkgmgrinfo_pkginfo_filter_h handle;
2311         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2312         if (ret != PMINFO_R_OK)
2313                 return -1;
2314         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "tpk");
2315         if (ret != PMINFO_R_OK) {
2316                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2317                 return -1;
2318         }
2319         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
2320         if (ret != PMINFO_R_OK) {
2321                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2322                 return -1;
2323         }
2324         printf("No of tpk pkgs: %d\n", count);
2325         pkgmgrinfo_pkginfo_filter_destroy(handle);
2326         return 0;
2327 }
2328  * @endcode
2329  */
2330 int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle);
2331
2332 /**
2333  * @fn int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle)
2334  * @brief       This API destroys the package information filter handle freeing up all the resources
2335  *
2336  * @par         This API is for package-manager client application
2337  * @par Sync (or) Async : Synchronous API
2338  *
2339  * @param[in] handle            pointer to the package info filter handle.
2340  * @return      0 if success, error code(<0) if fail
2341  * @retval      PMINFO_R_OK     success
2342  * @retval      PMINFO_R_EINVAL invalid argument
2343  * @retval      PMINFO_R_ERROR  internal error
2344  * @pre         pkgmgrinfo_pkginfo_filter_create()
2345  * @post                None
2346  * @see         pkgmgrinfo_pkginfo_filter_count()
2347  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
2348  * @code
2349 static int get_tpk_pkg_count()
2350 {
2351         int ret = 0;
2352         int count = 0;
2353         pkgmgrinfo_pkginfo_filter_h handle;
2354         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2355         if (ret != PMINFO_R_OK)
2356                 return -1;
2357         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "tpk");
2358         if (ret != PMINFO_R_OK) {
2359                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2360                 return -1;
2361         }
2362         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
2363         if (ret != PMINFO_R_OK) {
2364                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2365                 return -1;
2366         }
2367         printf("No of tpk pkgs: %d\n", count);
2368         pkgmgrinfo_pkginfo_filter_destroy(handle);
2369         return 0;
2370 }
2371  * @endcode
2372  */
2373 int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle);
2374
2375 /**
2376  * @fn int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const bool value)
2377  * @brief       This API adds a boolean filter property to the filter handle
2378  *
2379  * @par         This API is for package-manager client application
2380  * @par Sync (or) Async : Synchronous API
2381  *
2382  * @param[in] handle            pointer to the package info filter handle.
2383  * @param[in] property          boolean property name.
2384  * @param[in] value             value corresponding to the property.
2385  * @return      0 if success, error code(<0) if fail
2386  * @retval      PMINFO_R_OK     success
2387  * @retval      PMINFO_R_EINVAL invalid argument
2388  * @retval      PMINFO_R_ERROR  internal error
2389  * @pre         pkgmgrinfo_pkginfo_filter_create()
2390  * @post                pkgmgrinfo_pkginfo_filter_destroy()
2391  * @see         pkgmgrinfo_pkginfo_filter_count()
2392  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
2393  * @code
2394 static int get_preload_pkg_count()
2395 {
2396         int ret = 0;
2397         int count = 0;
2398         pkgmgrinfo_pkginfo_filter_h handle;
2399         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2400         if (ret != PMINFO_R_OK)
2401                 return -1;
2402         ret = pkgmgrinfo_pkginfo_filter_add_bool(handle, PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD, 1);
2403         if (ret != PMINFO_R_OK) {
2404                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2405                 return -1;
2406         }
2407         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
2408         if (ret != PMINFO_R_OK) {
2409                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2410                 return -1;
2411         }
2412         printf("No of preload pkgs: %d\n", count);
2413         pkgmgrinfo_pkginfo_filter_destroy(handle);
2414         return 0;
2415 }
2416  * @endcode
2417  */
2418 int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle,
2419                 const char *property, const bool value);
2420
2421 /**
2422  * @fn int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const int value)
2423  * @brief       This API adds an integer filter property to the filter handle
2424  *
2425  * @par         This API is for package-manager client application
2426  * @par Sync (or) Async : Synchronous API
2427  *
2428  * @param[in] handle            pointer to the package info filter handle.
2429  * @param[in] property          integer property name.
2430  * @param[in] value             value corresponding to the property.
2431  * @return      0 if success, error code(<0) if fail
2432  * @retval      PMINFO_R_OK     success
2433  * @retval      PMINFO_R_EINVAL invalid argument
2434  * @retval      PMINFO_R_ERROR  internal error
2435  * @pre         pkgmgrinfo_pkginfo_filter_create()
2436  * @post                pkgmgrinfo_pkginfo_filter_destroy()
2437  * @see         pkgmgrinfo_pkginfo_filter_count()
2438  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
2439  * @code
2440 static int get_pkg_count()
2441 {
2442         int ret = 0;
2443         int count = 0;
2444         pkgmgrinfo_pkginfo_filter_h handle;
2445         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2446         if (ret != PMINFO_R_OK)
2447                 return -1;
2448         ret = pkgmgrinfo_pkginfo_filter_add_int(handle, PMINFO_PKGINFO_PROP_PACKAGE_SIZE, 10);
2449         if (ret != PMINFO_R_OK) {
2450                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2451                 return -1;
2452         }
2453         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
2454         if (ret != PMINFO_R_OK) {
2455                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2456                 return -1;
2457         }
2458         printf("No of preload pkgs: %d\n", count);
2459         pkgmgrinfo_pkginfo_filter_destroy(handle);
2460         return 0;
2461 }
2462  * @endcode
2463  */
2464 int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle,
2465                 const char *property, const int value);
2466
2467 /**
2468  * @fn int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle, const char *property, const char *value)
2469  * @brief       This API adds a string filter property to the filter handle
2470  *
2471  * @par         This API is for package-manager client application
2472  * @par Sync (or) Async : Synchronous API
2473  *
2474  * @param[in] handle            pointer to the package info filter handle.
2475  * @param[in] property          string property name.
2476  * @param[in] value             value corresponding to the property.
2477  * @return      0 if success, error code(<0) if fail
2478  * @retval      PMINFO_R_OK     success
2479  * @retval      PMINFO_R_EINVAL invalid argument
2480  * @retval      PMINFO_R_ERROR  internal error
2481  * @pre         pkgmgrinfo_pkginfo_filter_create()
2482  * @post                pkgmgrinfo_pkginfo_filter_destroy()
2483  * @see         pkgmgrinfo_pkginfo_filter_count()
2484  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
2485  * @code
2486 static int get_tpk_pkg_count()
2487 {
2488         int ret = 0;
2489         int count = 0;
2490         pkgmgrinfo_pkginfo_filter_h handle;
2491         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2492         if (ret != PMINFO_R_OK)
2493                 return -1;
2494         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "tpk");
2495         if (ret != PMINFO_R_OK) {
2496                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2497                 return -1;
2498         }
2499         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
2500         if (ret != PMINFO_R_OK) {
2501                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2502                 return -1;
2503         }
2504         printf("No of tpk pkgs: %d\n", count);
2505         pkgmgrinfo_pkginfo_filter_destroy(handle);
2506         return 0;
2507 }
2508  * @endcode
2509  */
2510 int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle,
2511                 const char *property, const char *value);
2512
2513 /**
2514  * @fn int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle, pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data)
2515  * @brief       This API executes the user supplied callback function for each package that satisfy the filter conditions
2516  *
2517  * @par         This API is for package-manager client application
2518  * @par Sync (or) Async : Synchronous API
2519  *
2520  * @param[in] handle            pointer to the package info filter handle.
2521  * @param[in] pkg_cb            callback function.
2522  * @param[in] user_data         user data to be passed to the callback function
2523  * @return      0 if success, error code(<0) if fail
2524  * @retval      PMINFO_R_OK     success
2525  * @retval      PMINFO_R_EINVAL invalid argument
2526  * @retval      PMINFO_R_ERROR  internal error
2527  * @pre         pkgmgrinfo_pkginfo_filter_create()
2528  * @post                pkgmgrinfo_pkginfo_filter_destroy()
2529  * @see         pkgmgrinfo_pkginfo_filter_count()
2530  * @code
2531 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
2532 {
2533         char *pkgid = NULL;
2534         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
2535         printf("pkg id : %s\n", pkgid);
2536         return 0;
2537 }
2538
2539 static int get_tpk_pkg_list()
2540 {
2541         int ret = 0;
2542         pkgmgrinfo_pkginfo_filter_h handle;
2543         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2544         if (ret != PMINFO_R_OK)
2545                 return -1;
2546         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "tpk");
2547         if (ret != PMINFO_R_OK) {
2548                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2549                 return -1;
2550         }
2551         ret = pkgmgrinfo_pkginfo_filter_foreach_pkginfo(handle, pkg_list_cb, NULL);
2552         if (ret != PMINFO_R_OK) {
2553                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2554                 return -1;
2555         }
2556         pkgmgrinfo_pkginfo_filter_destroy(handle);
2557         return 0;
2558 }
2559  * @endcode
2560  */
2561 int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
2562                 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data);
2563 int pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
2564                 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data, uid_t uid);
2565
2566 /**
2567  * @fn int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count)
2568  * @fn int pkgmgrinfo_pkginfo_usr_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count, uid_t uid)
2569  * @brief       This API counts the package that satisfy the filter conditions
2570  *
2571  * @par         This API is for package-manager client application
2572  * @par Sync (or) Async : Synchronous API
2573  *
2574  * @param[in] handle            pointer to the package info filter handle.
2575  * @param[in] count             pointer to store the count value.
2576  * @param[in]   uid     the addressee user id of the instruction
2577  * @return      0 if success, error code(<0) if fail
2578  * @retval      PMINFO_R_OK     success
2579  * @retval      PMINFO_R_EINVAL invalid argument
2580  * @retval      PMINFO_R_ERROR  internal error
2581  * @pre         pkgmgrinfo_pkginfo_filter_create()
2582  * @post                pkgmgrinfo_pkginfo_filter_destroy()
2583  * @see         pkgmgrinfo_pkginfo_filter_foreach_pkginfo()
2584  * @code
2585 static int get_tpk_pkg_count()
2586 {
2587         int ret = 0;
2588         int count = 0;
2589         pkgmgrinfo_pkginfo_filter_h handle;
2590         ret = pkgmgrinfo_pkginfo_filter_create(&handle);
2591         if (ret != PMINFO_R_OK)
2592                 return -1;
2593         ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_TYPE, "tpk");
2594         if (ret != PMINFO_R_OK) {
2595                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2596                 return -1;
2597         }
2598         ret = pkgmgrinfo_pkginfo_filter_count(handle, &count);
2599         if (ret != PMINFO_R_OK) {
2600                 pkgmgrinfo_pkginfo_filter_destroy(handle);
2601                 return -1;
2602         }
2603         printf("No of tpk pkgs: %d\n", count);
2604         pkgmgrinfo_pkginfo_filter_destroy(handle);
2605         return 0;
2606 }
2607  * @endcode
2608  */
2609 int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count);
2610 int pkgmgrinfo_pkginfo_usr_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count, uid_t uid);
2611
2612 /**
2613  * @fn  int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
2614                         pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
2615  * @brief       This API gets the list of privilege for a particular package
2616  *
2617  * @par         This API is for package-manager client application
2618  * @par Sync (or) Async : Synchronous API
2619  * @param[in]   handle          pointer to the package info handle.
2620  * @param[in]   privilege_func          callback function for list
2621  * @param[in] user_data user data to be passed to callback function
2622  * @return      0 if success, error code(<0) if fail
2623  * @retval      PMINFO_R_OK     success
2624  * @retval      PMINFO_R_EINVAL invalid argument
2625  * @retval      PMINFO_R_ERROR  internal error
2626  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2627  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2628  * @code
2629 int privilege_func(const char *name, void *user_data)
2630 {
2631         if (strcmp(name, (char *)user_data) == 0)
2632                 return -1;
2633         else
2634                 return 0;
2635 }
2636
2637 static int list_privilege(const char *package, char *privilege)
2638 {
2639         int ret = 0;
2640         pkgmgrinfo_pkginfo_h handle;
2641         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
2642         if (ret != PMINFO_R_OK)
2643                 return -1;
2644         ret = pkgmgrinfo_pkginfo_foreach_privilege(handle, privilege_func, (void *)privilege);
2645         if (ret != PMINFO_R_OK) {
2646                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2647                 return -1;
2648         }
2649         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2650         return 0;
2651 }
2652  * @endcode
2653  */
2654 int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
2655                         pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
2656
2657 /**
2658  * @fn  int pkgmgrinfo_pkginfo_foreach_appdefined_privilege(pkgmgrinfo_pkginfo_h handle,
2659                         pkgmgrinfo_pkg_appdefined_privilege_list_cb privilege_func, void *user_data);
2660  * @brief       This API gets the list of appdefined privilege for a particular package
2661  *
2662  * @par         This API is for package-manager client application
2663  * @par Sync (or) Async : Synchronous API
2664  * @param[in]   handle          pointer to the package info handle.
2665  * @param[in]   privilege_func          callback function for list
2666  * @param[in] user_data user data to be passed to callback function
2667  * @return      0 if success, error code(<0) if fail
2668  * @retval      PMINFO_R_OK     success
2669  * @retval      PMINFO_R_EINVAL invalid argument
2670  * @retval      PMINFO_R_ERROR  internal error
2671  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2672  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2673  * @code
2674 int privilege_func(const char *name, const char *license_path, void *user_data)
2675 {
2676         printf("appdefined privilege : %s", name);
2677         if (license_path)
2678                 printf("licensed privilege, lecense path : %s", license_path);
2679         return 0;
2680 }
2681
2682 static int list_appdefined_privilege(const char *package)
2683 {
2684         int ret = 0;
2685         pkgmgrinfo_pkginfo_h handle;
2686         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
2687         if (ret != PMINFO_R_OK)
2688                 return -1;
2689         ret = pkgmgrinfo_pkginfo_foreach_appdefined_privilege(handle, privilege_func, NULL);
2690         if (ret != PMINFO_R_OK) {
2691                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2692                 return -1;
2693         }
2694         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2695         return 0;
2696 }
2697  * @endcode
2698  */
2699 int pkgmgrinfo_pkginfo_foreach_appdefined_privilege(pkgmgrinfo_pkginfo_h handle,
2700                         pkgmgrinfo_pkg_appdefined_privilege_list_cb privilege_func, void *user_data);
2701
2702 /**
2703  * @fn  int pkgmgrinfo_pkginfo_foreach_plugin(pkgmgrinfo_pkginfo_h handle,
2704                         pkgmgrinfo_plugin_list_cb plugin_func, void *user_data);
2705  * @brief       This API gets the list of plugin execution info for a particular package
2706  *
2707  * @par         This API is for package-manager client application
2708  * @par Sync (or) Async : Synchronous API
2709  * @param[in]   handle          pointer to the package info handle.
2710  * @param[in]   plugin_func             callback function for list
2711  * @param[in] user_data user data to be passed to callback function
2712  * @return      0 if success, error code(<0) if fail
2713  * @retval      PMINFO_R_OK     success
2714  * @retval      PMINFO_R_EINVAL invalid argument
2715  * @retval      PMINFO_R_ERROR  internal error
2716  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2717  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2718  * @code
2719 int plugin_func(const char *pkgid, const char *appid,
2720                                 const char *plugin_type, const char *plugin_name,
2721                                 void *user_data)
2722 {
2723         printf("appid : %s, type : %s, name : %s\n", appid, plugin_type, plugin_name);
2724
2725         return 0;
2726 }
2727
2728 static int list_plugin(const char *package)
2729 {
2730         int ret = 0;
2731         pkgmgrinfo_pkginfo_h handle;
2732         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
2733         if (ret != PMINFO_R_OK)
2734                 return -1;
2735         ret = pkgmgrinfo_pkginfo_foreach_plugin(handle, plugin_func, NULL);
2736         if (ret != PMINFO_R_OK) {
2737                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2738                 return -1;
2739         }
2740         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2741         return 0;
2742 }
2743  * @endcode
2744  */
2745 int pkgmgrinfo_pkginfo_foreach_plugin(pkgmgrinfo_pkginfo_h handle,
2746                         pkgmgrinfo_plugin_list_cb plugin_func, void *user_data);
2747
2748 /**
2749  * @fn  int pkgmgrinfo_pkginfo_foreach_metadata(pkgmgrinfo_pkginfo_h handle,
2750                         pkgmgrinfo_pkg_metadata_list_cb metadata_func, void *user_data);
2751  * @brief       This API gets the list of metadata for a particular package
2752  *
2753  * @par         This API is for package-manager client application
2754  * @par Sync (or) Async : Synchronous API
2755  * @param[in]   handle          pointer to the package info handle.
2756  * @param[in]   metadata_func           callback function for list
2757  * @param[in] user_data user data to be passed to callback function
2758  * @return      0 if success, error code(<0) if fail
2759  * @retval      PMINFO_R_OK     success
2760  * @retval      PMINFO_R_EINVAL invalid argument
2761  * @retval      PMINFO_R_ERROR  internal error
2762  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
2763  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
2764  * @code
2765 int metadata_func(const char *key, const char *value, void *user_data)
2766 {
2767         if (strcmp(key, (char *)user_data) == 0) {
2768                 printf("Value is %s\n", value);
2769                 return -1;
2770         }
2771         else
2772                 return 0;
2773 }
2774
2775 static int list_metadata(const char *pkgid, char *key)
2776 {
2777         int ret = 0;
2778         pkgmgrinfo_pkginfo_h handle;
2779         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
2780         if (ret != PMINFO_R_OK)
2781                 return -1;
2782         ret = pkgmgrinfo_pkginfo_foreach_metadata(handle, metadata_func, (void *)key);
2783         if (ret != PMINFO_R_OK) {
2784                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2785                 return -1;
2786         }
2787         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
2788         return 0;
2789 }
2790  * @endcode
2791  */
2792 int pkgmgrinfo_pkginfo_foreach_metadata(pkgmgrinfo_pkginfo_h handle,
2793                         pkgmgrinfo_pkg_metadata_list_cb metadata_func, void *user_data);
2794
2795 /**
2796  * @fn int pkgmgrinfo_pkginfo_metadata_filter_create(pkgmgrinfo_pkginfo_metadata_filter_h *handle)
2797  * @brief       This API creates the application's metadata  information filter handle from db.
2798  *
2799  * @par         This API is for package-manager client application
2800  * @par Sync (or) Async : Synchronous API
2801  *
2802  * @param[out] handle           pointer to the package metadata info filter handle.
2803  * @return      0 if success, error code(<0) if fail
2804  * @retval      PMINFO_R_OK     success
2805  * @retval      PMINFO_R_EINVAL invalid argument
2806  * @retval      PMINFO_R_ERROR  internal error
2807  * @pre         None
2808  * @post                pkgmgrinfo_pkginfo_metadata_filter_destroy()
2809  * @see         pkgmgrinfo_pkginfo_metadata_filter_foreach()
2810  * @code
2811 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
2812 {
2813         char *pkgid = NULL;
2814         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
2815         printf("pkgid : %s\n", pkgid);
2816         return 0;
2817 }
2818
2819 static int get_pkg_list(const char *mkey, const char *mvalue)
2820 {
2821         int ret = 0;
2822         pkgmgrinfo_pkginfo_metadata_filter_h handle;
2823         ret = pkgmgrinfo_pkginfo_metadata_filter_create(&handle);
2824         if (ret != PMINFO_R_OK)
2825                 return -1;
2826         ret = pkgmgrinfo_pkginfo_metadata_filter_add(handle, mkey, mvalue);
2827         if (ret != PMINFO_R_OK) {
2828                 pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2829                 return -1;
2830         }
2831         ret = pkgmgrinfo_pkginfo_metadata_filter_foreach(handle, pkg_list_cb, NULL);
2832         if (ret != PMINFO_R_OK) {
2833                 pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2834                 return -1;
2835         }
2836         pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2837         return 0;
2838 }
2839  * @endcode
2840  */
2841 int pkgmgrinfo_pkginfo_metadata_filter_create(pkgmgrinfo_pkginfo_metadata_filter_h *handle);
2842
2843 /**
2844  * @fn int pkgmgrinfo_pkginfo_metadata_filter_destroy(pkgmgrinfo_pkginfo_metadata_filter_h handle)
2845  * @brief       This API destroys the package's metadata  information filter handle.
2846  *
2847  * @par         This API is for package-manager client application
2848  * @par Sync (or) Async : Synchronous API
2849  *
2850  * @param[in] handle            pointer to the package metadata info filter handle.
2851  * @return      0 if success, error code(<0) if fail
2852  * @retval      PMINFO_R_OK     success
2853  * @retval      PMINFO_R_EINVAL invalid argument
2854  * @retval      PMINFO_R_ERROR  internal error
2855  * @pre         pkgmgrinfo_pkginfo_metadata_filter_create()
2856  * @post                None
2857  * @see         pkgmgrinfo_pkginfo_metadata_filter_foreach()
2858  * @code
2859 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
2860 {
2861         char *pkgid = NULL;
2862         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
2863         printf("pkgid : %s\n", pkgid);
2864         return 0;
2865 }
2866
2867 static int get_pkg_list(const char *mkey, const char *mvalue)
2868 {
2869         int ret = 0;
2870         pkgmgrinfo_pkginfo_metadata_filter_h handle;
2871         ret = pkgmgrinfo_pkginfo_metadata_filter_create(&handle);
2872         if (ret != PMINFO_R_OK)
2873                 return -1;
2874         ret = pkgmgrinfo_pkginfo_metadata_filter_add(handle, mkey, mvalue);
2875         if (ret != PMINFO_R_OK) {
2876                 pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2877                 return -1;
2878         }
2879         ret = pkgmgrinfo_pkginfo_metadata_filter_foreach(handle, pkg_list_cb, NULL);
2880         if (ret != PMINFO_R_OK) {
2881                 pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2882                 return -1;
2883         }
2884         pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2885         return 0;
2886 }
2887  * @endcode
2888  */
2889 int pkgmgrinfo_pkginfo_metadata_filter_destroy(pkgmgrinfo_pkginfo_metadata_filter_h handle);
2890
2891 /**
2892  * @fn int pkgmgrinfo_pkginfo_metadata_filter_add(pkgmgrinfo_pkginfo_metadata_filter_h handle, const char *key, const char *value)
2893  * @brief       This API adds filter condition for the query API.  The query will search the entire package metadata  information collected from
2894  * the manifest file of all the installed packages. You can specify value as NULL to search based on key only.
2895  *
2896  * @par         This API is for package-manager client application
2897  * @par Sync (or) Async : Synchronous API
2898  *
2899  * @param[in] handle            pointer to the package metadata info filter handle.
2900  * @param[in] key                       pointer to metadata key
2901  * @param[in] value                     pointer to metadata value
2902  * @return      0 if success, error code(<0) if fail
2903  * @retval      PMINFO_R_OK     success
2904  * @retval      PMINFO_R_EINVAL invalid argument
2905  * @retval      PMINFO_R_ERROR  internal error
2906  * @pre         pkgmgrinfo_pkginfo_metadata_filter_create()
2907  * @post                pkgmgrinfo_pkginfo_metadata_filter_foreach(), pkgmgrinfo_pkginfo_metadata_filter_destroy()
2908  * @see         pkgmgrinfo_pkginfo_metadata_filter_foreach()
2909  * @code
2910 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
2911 {
2912         char *pkgid = NULL;
2913         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
2914         printf("pkgid : %s\n", pkgid);
2915         return 0;
2916 }
2917
2918 static int get_pkg_list(const char *mkey, const char *mvalue)
2919 {
2920         int ret = 0;
2921         pkgmgrinfo_pkginfo_metadata_filter_h handle;
2922         ret = pkgmgrinfo_pkginfo_metadata_filter_create(&handle);
2923         if (ret != PMINFO_R_OK)
2924                 return -1;
2925         ret = pkgmgrinfo_pkginfo_metadata_filter_add(handle, mkey, mvalue);
2926         if (ret != PMINFO_R_OK) {
2927                 pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2928                 return -1;
2929         }
2930         ret = pkgmgrinfo_pkginfo_metadata_filter_foreach(handle, pkg_list_cb, NULL);
2931         if (ret != PMINFO_R_OK) {
2932                 pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2933                 return -1;
2934         }
2935         pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2936         return 0;
2937 }
2938  * @endcode
2939  */
2940 int pkgmgrinfo_pkginfo_metadata_filter_add(pkgmgrinfo_pkginfo_metadata_filter_h handle,
2941                 const char *key, const char *value);
2942
2943 /**
2944  * @fn int pkgmgrinfo_pkginfo_metadata_filter_foreach(pkgmgrinfo_pkginfo_metadata_filter_h handle, pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data)
2945  * @fn int pkgmgrinfo_pkginfo_usr_metadata_filter_foreach(pkgmgrinfo_pkginfo_metadata_filter_h handle, pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data, uid_t uid)
2946  * @brief       This API executes the filter query. The query will search the entire package metadata  information collected from
2947  * the manifest file of all the installed packages. For each package returned by the query, the callback will be called. If callback returns
2948  * negative value, no more callbacks will be called and API will return.
2949  *
2950  * @par         This API is for package-manager client application
2951  * @par Sync (or) Async : Synchronous API
2952  *
2953  * @param[in] handle            pointer to the package metadata info filter handle.
2954  * @param[in] app_cb            function pointer to callback
2955  * @param[in] user_data         pointer to user data
2956  * @param[in]   uid     the addressee user id of the instruction
2957  * @return      0 if success, error code(<0) if fail
2958  * @retval      PMINFO_R_OK     success
2959  * @retval      PMINFO_R_EINVAL invalid argument
2960  * @retval      PMINFO_R_ERROR  internal error
2961  * @pre         pkgmgrinfo_pkginfo_metadata_filter_create()
2962  * @post                pkgmgrinfo_pkginfo_metadata_filter_destroy()
2963  * @code
2964 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
2965 {
2966         char *pkgid = NULL;
2967         pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
2968         printf("pkgid : %s\n", pkgid);
2969         return 0;
2970 }
2971
2972 static int get_pkg_list(const char *mkey, const char *mvalue)
2973 {
2974         int ret = 0;
2975         pkgmgrinfo_pkginfo_metadata_filter_h handle;
2976         ret = pkgmgrinfo_pkginfo_metadata_filter_create(&handle);
2977         if (ret != PMINFO_R_OK)
2978                 return -1;
2979         ret = pkgmgrinfo_pkginfo_metadata_filter_add(handle, mkey, mvalue);
2980         if (ret != PMINFO_R_OK) {
2981                 pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2982                 return -1;
2983         }
2984         ret = pkgmgrinfo_pkginfo_metadata_filter_foreach(handle, pkg_list_cb, NULL);
2985         if (ret != PMINFO_R_OK) {
2986                 pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2987                 return -1;
2988         }
2989         pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
2990         return 0;
2991 }
2992  * @endcode
2993  */
2994 int pkgmgrinfo_pkginfo_metadata_filter_foreach(pkgmgrinfo_pkginfo_metadata_filter_h handle,
2995                 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data);
2996 int pkgmgrinfo_pkginfo_usr_metadata_filter_foreach(pkgmgrinfo_pkginfo_metadata_filter_h handle,
2997                 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data, uid_t uid);
2998
2999 /* TODO: add doxygen comment here */
3000 int pkgmgrinfo_pkginfo_is_for_all_users(pkgmgrinfo_pkginfo_h handle, bool *for_all_users);
3001
3002 /**
3003  * @fn int pkgmgrinfo_appinfo_clone_appinfo(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_pkginfo_h *clone)
3004  * @brief       This API copy the application information handle
3005  *
3006  * @par         This API is for package-manager client application
3007  * @par Sync (or) Async : Synchronous API
3008  *
3009  * @param[in]   handle  pointer to the package info handle.
3010  * @param[out]  handle  pointer to the package info handle.
3011  * @return      0 if success, error code(<0) if fail
3012  * @retval      PMINFO_R_OK     success
3013  * @retval      PMINFO_R_EINVAL invalid argument
3014  * @retval      PMINFO_R_ERROR  internal error
3015  * @pre         None
3016  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3017  * @code
3018 static int get_appinfo_clone(pkgmgrinfo_pkginfo_h handle)
3019 {
3020         int ret = 0;
3021
3022         pkgmgrinfo_pkginfo_h clone;
3023
3024         ret = pkgmgrinfo_appinfo_clone_appinfo(handle, &clone);
3025         if (ret != PMINFO_R_OK)
3026                 return -1;
3027
3028
3029         printf("package: %s\n", clone->package);
3030         pkgmgrinfo_appinfo_destroy_appinfo(clone);
3031         return 0;
3032 }
3033  * @endcode
3034  */
3035 int pkgmgrinfo_appinfo_clone_appinfo(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_pkginfo_h *clone);
3036
3037
3038 /**
3039  * @fn  int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
3040  pkgmgrinfo_app_list_cb app_func, void *user_data)
3041  * @brief       This API gets list of installed applications for a particular package
3042  *
3043  * @par         This API is for package-manager client application
3044  * @par Sync (or) Async : Synchronous API
3045  * @param[in]   handle          package info handle
3046  * @param[in]   component       application component
3047  * @param[in]   app_func                iteration function for list
3048  * @param[in] user_data user data to be passed to callback function
3049  * @return      0 if success, error code(<0) if fail
3050  * @retval      PMINFO_R_OK     success
3051  * @retval      PMINFO_R_EINVAL invalid argument
3052  * @retval      PMINFO_R_ERROR  internal error
3053  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
3054  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
3055  * @code
3056 int app_func(pkgmgrinfo_appinfo_h handle, void *user_data)
3057 {
3058         char *appid = NULL;
3059         pkgmgrinfo_appinfo_get_appid(handle, &appid);
3060         printf("appid : %s\n", appid);
3061         return 0;
3062 }
3063
3064 static int list_apps(const char *pkgid)
3065 {
3066         int ret = 0;
3067         pkgmgrinfo_pkginfo_h handle;
3068         ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
3069         if (ret != PMINFO_R_OK)
3070                 return -1;
3071         ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, NULL);
3072         if (ret != PMINFO_R_OK) {
3073                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
3074                 return -1;
3075         }
3076         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
3077         return 0;
3078 }
3079  * @endcode
3080  */
3081 int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
3082                                                         pkgmgrinfo_app_list_cb app_func, void *user_data);
3083 int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
3084                                                         pkgmgrinfo_app_list_cb app_func, void *user_data, uid_t uid);
3085
3086 /**
3087  * @fn  int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
3088  * @brief       This API gets list of installed applications from all packages.
3089  *
3090  * @par         This API is for package-manager client application
3091  * @par Sync (or) Async : Synchronous API
3092  * @param[in]   app_func                iteration function for list
3093  * @param[in] user_data user data to be passed to callback function
3094  * @return      0 if success, error code(<0) if fail
3095  * @retval      PMINFO_R_OK     success
3096  * @retval      PMINFO_R_EINVAL invalid argument
3097  * @retval      PMINFO_R_ERROR  internal error
3098  * @pre         None
3099  * @post                None
3100  * @code
3101 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
3102 {
3103         char *pkgid1 = NULL;
3104         char *pkgid2 = NULL;
3105         pkgid1 = (char *)user_data;
3106         pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid2);
3107         if (strcmp(pkgid1, pkgid2) == 0) {
3108                 return -1;
3109         } else {
3110                 return 0;
3111         }
3112 }
3113
3114 static int list_apps()
3115 {
3116         int ret = 0;
3117         char *name = "helloworld";
3118         ret = pkgmgrinfo_appinfo_get_installed_list(app_list_cb, (void *)name);
3119         if (ret != PMINFO_R_OK) {
3120                 return -1;
3121         }
3122         return 0;
3123 }
3124  * @endcode
3125  */
3126 int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data);
3127 int pkgmgrinfo_appinfo_get_usr_installed_list(pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data);
3128
3129 /**
3130  * @fn int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
3131  * @brief       This API creates the disabled application information handle from db
3132  *
3133  * @par         This API is for package-manager client application
3134  * @par Sync (or) Async : Synchronous API
3135  *
3136  * @param[in]   appid   pointer to appid
3137  * @param[out] handle           pointer to the application info handle.
3138  * @return      0 if success, error code(<0) if fail
3139  * @retval      PMINFO_R_OK     success
3140  * @retval      PMINFO_R_EINVAL invalid argument
3141  * @retval      PMINFO_R_ERROR  internal error
3142  * @pre         None
3143  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3144  * @see         pkgmgrinfo_appinfo_get_pkgid()
3145  * @see         pkgmgrinfo_appinfo_is_multiple()
3146  * @code
3147 static int get_disabled_app_type(const char *appid)
3148 {
3149         int ret = 0;
3150         char *type = NULL;
3151         pkgmgrinfo_appinfo_h handle;
3152         ret = pkgmgrinfo_appinfo_get_disabled_appinfo(appid, &handle);
3153         if (ret != PMINFO_R_OK)
3154                 return -1;
3155         ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
3156         if (ret != PMINFO_R_OK) {
3157                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3158                 return -1;
3159         }
3160         printf("apptype: %s\n", type);
3161         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3162         return 0;
3163 }
3164  * @endcode
3165  */
3166 int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
3167 int pkgmgrinfo_appinfo_get_usr_disabled_appinfo(const char *appid, uid_t uid, pkgmgrinfo_appinfo_h *handle);
3168
3169 /**
3170  * @fn int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
3171  * @brief       This API creates the application information handle from db
3172  *
3173  * @par         This API is for package-manager client application
3174  * @par Sync (or) Async : Synchronous API
3175  *
3176  * @param[in]   appid   pointer to appid
3177  * @param[out] handle           pointer to the application info handle.
3178  * @return      0 if success, error code(<0) if fail
3179  * @retval      PMINFO_R_OK     success
3180  * @retval      PMINFO_R_EINVAL invalid argument
3181  * @retval      PMINFO_R_ERROR  internal error
3182  * @pre         None
3183  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3184  * @see         pkgmgrinfo_appinfo_get_pkgid()
3185  * @see         pkgmgrinfo_appinfo_is_multiple()
3186  * @code
3187 static int get_app_type(const char *appid)
3188 {
3189         int ret = 0;
3190         char *type = NULL;
3191         pkgmgrinfo_appinfo_h handle;
3192         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3193         if (ret != PMINFO_R_OK)
3194                 return -1;
3195         ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
3196         if (ret != PMINFO_R_OK) {
3197                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3198                 return -1;
3199         }
3200         printf("apptype: %s\n", type);
3201         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3202         return 0;
3203 }
3204  * @endcode
3205  */
3206 int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
3207 int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid, pkgmgrinfo_appinfo_h *handle);
3208
3209 /**
3210  * @fn int pkgmgrinfo_appinfo_get_all_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
3211  * @brief       This API creates the application information handle from db regardless of its disable or storage status
3212  *
3213  * @par         This API is for package-manager client application
3214  * @par Sync (or) Async : Synchronous API
3215  *
3216  * @param[in]   appid   pointer to appid
3217  * @param[out] handle           pointer to the application info handle.
3218  * @return      0 if success, error code(<0) if fail
3219  * @retval      PMINFO_R_OK     success
3220  * @retval      PMINFO_R_EINVAL invalid argument
3221  * @retval      PMINFO_R_ERROR  internal error
3222  * @pre         None
3223  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3224  * @see         pkgmgrinfo_appinfo_get_pkgid()
3225  * @see         pkgmgrinfo_appinfo_is_multiple()
3226  * @code
3227 static int get_app_type(const char *appid)
3228 {
3229         int ret = 0;
3230         char *type = NULL;
3231         pkgmgrinfo_appinfo_h handle;
3232         ret = pkgmgrinfo_appinfo_get_all_appinfo(appid, &handle);
3233         if (ret != PMINFO_R_OK)
3234                 return -1;
3235         ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
3236         if (ret != PMINFO_R_OK) {
3237                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3238                 return -1;
3239         }
3240         printf("apptype: %s\n", type);
3241         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3242         return 0;
3243 }
3244  * @endcode
3245  */
3246 int pkgmgrinfo_appinfo_get_all_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle);
3247 int pkgmgrinfo_appinfo_get_usr_all_appinfo(const char *appid, uid_t uid, pkgmgrinfo_appinfo_h *handle);
3248
3249 /**
3250  * @fn int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
3251  * @brief       This API gets the application ID
3252  *
3253  * @par         This API is for package-manager client application
3254  * @par Sync (or) Async : Synchronous API
3255  *
3256  * @param[in] handle            pointer to the application info handle.
3257  * @param[out] appid            pointer to hold appid
3258  * @return      0 if success, error code(<0) if fail
3259  * @retval      PMINFO_R_OK     success
3260  * @retval      PMINFO_R_EINVAL invalid argument
3261  * @retval      PMINFO_R_ERROR  internal error
3262  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3263  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3264  * @see         pkgmgrinfo_appinfo_get_pkgid()
3265  * @see         pkgmgrinfo_appinfo_is_multiple()
3266  * @code
3267 static int get_app_id(const char *appid)
3268 {
3269         int ret = 0;
3270         char *app_id = NULL;
3271         pkgmgrinfo_appinfo_h handle;
3272         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3273         if (ret != PMINFO_R_OK)
3274                 return -1;
3275         ret = pkgmgrinfo_appinfo_get_appid(handle, &app_id);
3276         if (ret != PMINFO_R_OK) {
3277                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3278                 return -1;
3279         }
3280         printf("app id: %s\n", app_id);
3281         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3282         return 0;
3283 }
3284  * @endcode
3285  */
3286 int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h  handle, char **appid);
3287
3288 /**
3289  * @fn int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name)
3290  * @brief       This API gets the package name of the application
3291  *
3292  * @par         This API is for package-manager client application
3293  * @par Sync (or) Async : Synchronous API
3294  *
3295  * @param[in] handle            pointer to the application info handle.
3296  * @param[out] pkg_name         pointer to hold package name
3297  * @return      0 if success, error code(<0) if fail
3298  * @retval      PMINFO_R_OK     success
3299  * @retval      PMINFO_R_EINVAL invalid argument
3300  * @retval      PMINFO_R_ERROR  internal error
3301  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3302  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3303  * @see         pkgmgrinfo_appinfo_get_appid()
3304  * @see         pkgmgrinfo_appinfo_is_multiple()
3305  * @code
3306 static int get_app_pkgname(const char *appid)
3307 {
3308         int ret = 0;
3309         char *pkgname = NULL;
3310         pkgmgrinfo_appinfo_h handle;
3311         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3312         if (ret != PMINFO_R_OK)
3313                 return -1;
3314         ret = pkgmgrinfo_appinfo_get_pkgname(handle, &pkgname);
3315         if (ret != PMINFO_R_OK) {
3316                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3317                 return -1;
3318         }
3319         printf("pkg name: %s\n", pkgname);
3320         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3321         return 0;
3322 }
3323  * @endcode
3324  */
3325 int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h  handle, char **pkg_name);
3326
3327 /**
3328  * @fn int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
3329  * @brief       This API gets the package id of the application
3330  *
3331  * @par         This API is for package-manager client application
3332  * @par Sync (or) Async : Synchronous API
3333  *
3334  * @param[in] handle            pointer to the application info handle.
3335  * @param[out] pkgid            pointer to hold package id
3336  * @return      0 if success, error code(<0) if fail
3337  * @retval      PMINFO_R_OK     success
3338  * @retval      PMINFO_R_EINVAL invalid argument
3339  * @retval      PMINFO_R_ERROR  internal error
3340  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3341  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3342  * @see         pkgmgrinfo_appinfo_get_appid()
3343  * @see         pkgmgrinfo_appinfo_is_multiple()
3344  * @code
3345 static int get_app_pkgid(const char *appid)
3346 {
3347         int ret = 0;
3348         char *pkgid = NULL;
3349         pkgmgrinfo_appinfo_h handle;
3350         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3351         if (ret != PMINFO_R_OK)
3352                 return -1;
3353         ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgid);
3354         if (ret != PMINFO_R_OK) {
3355                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3356                 return -1;
3357         }
3358         printf("pkg id: %s\n", pkgid);
3359         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3360         return 0;
3361 }
3362  * @endcode
3363  */
3364 int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h  handle, char **pkgid);
3365
3366 /**
3367  * @fn int pkgmgrinfo_appinfo_get_pkgtype(pkgmgrinfo_appinfo_h handle, char **pkgtype)
3368  * @brief       This API gets the package type of the application
3369  *
3370  * @par         This API is for package-manager client application
3371  * @par Sync (or) Async : Synchronous API
3372  *
3373  * @param[in] handle            pointer to the application info handle.
3374  * @param[out] pkgtype          pointer to hold package type
3375  * @return      0 if success, error code(<0) if fail
3376  * @retval      PMINFO_R_OK     success
3377  * @retval      PMINFO_R_EINVAL invalid argument
3378  * @retval      PMINFO_R_ERROR  internal error
3379  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3380  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3381  * @see         pkgmgrinfo_appinfo_get_appid()
3382  * @see         pkgmgrinfo_appinfo_is_multiple()
3383  * @code
3384 static int get_app_pkgtype(const char *appid)
3385 {
3386         int ret = 0;
3387         char *pkgtype = NULL;
3388         pkgmgrinfo_appinfo_h handle = NULL;
3389         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3390         if (ret != PMINFO_R_OK)
3391                 return -1;
3392         ret = pkgmgrinfo_appinfo_get_pkgtype(handle, &pkgtype);
3393         if (ret != PMINFO_R_OK) {
3394                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3395                 return -1;
3396         }
3397         printf("pkgtype: %s\n", pkgtype);
3398         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3399         return 0;
3400 }
3401  * @endcode
3402  */
3403 int pkgmgrinfo_appinfo_get_pkgtype(pkgmgrinfo_appinfo_h  handle, char **pkgtype);
3404
3405 /**
3406  * @fn int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec)
3407  * @brief       This API gets the executable name of the application
3408  *
3409  * @par         This API is for package-manager client application
3410  * @par Sync (or) Async : Synchronous API
3411  *
3412  * @param[in] handle            pointer to the application info handle.
3413  * @param[out] exec             pointer to hold app exec name
3414  * @return      0 if success, error code(<0) if fail
3415  * @retval      PMINFO_R_OK     success
3416  * @retval      PMINFO_R_EINVAL invalid argument
3417  * @retval      PMINFO_R_ERROR  internal error
3418  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3419  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3420  * @see         pkgmgrinfo_appinfo_get_appid()
3421  * @see         pkgmgrinfo_appinfo_is_multiple()
3422  * @code
3423 static int get_app_exec(const char *appid)
3424 {
3425         int ret = 0;
3426         char *exec = NULL;
3427         pkgmgrinfo_appinfo_h handle;
3428         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3429         if (ret != PMINFO_R_OK)
3430                 return -1;
3431         ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
3432         if (ret != PMINFO_R_OK) {
3433                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3434                 return -1;
3435         }
3436         printf("exec name: %s\n", exec);
3437         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3438         return 0;
3439 }
3440  * @endcode
3441  */
3442 int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h  handle, char **exec);
3443
3444 /**
3445  * @fn int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
3446  * @brief       This API gets the icon name of the application
3447  *
3448  * @par         This API is for package-manager client application
3449  * @par Sync (or) Async : Synchronous API
3450  *
3451  * @param[in] handle            pointer to the application info handle.
3452  * @param[out] icon             pointer to hold app icon name
3453  * @return      0 if success, error code(<0) if fail
3454  * @retval      PMINFO_R_OK     success
3455  * @retval      PMINFO_R_EINVAL invalid argument
3456  * @retval      PMINFO_R_ERROR  internal error
3457  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3458  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3459  * @see         pkgmgrinfo_appinfo_get_appid()
3460  * @see         pkgmgrinfo_appinfo_is_multiple()
3461  * @code
3462 static int get_app_icon(const char *appid)
3463 {
3464         int ret = 0;
3465         char *icon = NULL;
3466         pkgmgrinfo_appinfo_h handle;
3467         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3468         if (ret != PMINFO_R_OK)
3469                 return -1;
3470         ret = pkgmgrinfo_appinfo_get_icon(handle, &icon);
3471         if (ret != PMINFO_R_OK) {
3472                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3473                 return -1;
3474         }
3475         printf("icon name: %s\n", icon);
3476         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3477         return 0;
3478 }
3479  * @endcode
3480  */
3481 int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
3482
3483 /**
3484  * @fn int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
3485  * @brief       This API gets the label of the application
3486  *
3487  * @par         This API is for package-manager client application
3488  * @par Sync (or) Async : Synchronous API
3489  *
3490  * @param[in] handle            pointer to the application info handle.
3491  * @param[out] label            pointer to hold app label
3492  * @return      0 if success, error code(<0) if fail
3493  * @retval      PMINFO_R_OK     success
3494  * @retval      PMINFO_R_EINVAL invalid argument
3495  * @retval      PMINFO_R_ERROR  internal error
3496  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3497  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3498  * @see         pkgmgrinfo_appinfo_get_appid()
3499  * @see         pkgmgrinfo_appinfo_is_multiple()
3500  * @code
3501 static int get_app_label(const char *appid)
3502 {
3503         int ret = 0;
3504         char *label = NULL;
3505         pkgmgrinfo_appinfo_h handle;
3506         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3507         if (ret != PMINFO_R_OK)
3508                 return -1;
3509         ret = pkgmgrinfo_appinfo_get_label(handle, &label);
3510         if (ret != PMINFO_R_OK) {
3511                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3512                 return -1;
3513         }
3514         printf("label : %s\n", label);
3515         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3516         return 0;
3517 }
3518  * @endcode
3519  */
3520 int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h  handle, char **label);
3521
3522 /**
3523  * @fn int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
3524  * @brief       This API gets exactly matched label by given appid and locale
3525  *
3526  * @par         This API is for package-manager client application
3527  * @par Sync (or) Async : Synchronous API
3528  *
3529  * @param[in]   appid   pointer to appid
3530  * @param[in]   locale  pointer to locale
3531  * @param[out] label            pointer to hold app label
3532  * @return      0 if success, error code(<0) if fail
3533  * @retval      PMINFO_R_OK     success
3534  * @retval      PMINFO_R_EINVAL invalid argument
3535  * @retval      PMINFO_R_ERROR  internal error
3536  * @code
3537 static int get_localed_label(const char *appid, const char *locale)
3538 {
3539         int ret = 0;
3540         char *label = NULL;
3541
3542         ret = pkgmgrinfo_appinfo_get_localed_label(appid, locale, &label);
3543         if (ret != PMINFO_R_OK)
3544                 return -1;
3545
3546         printf("localed label: %s\n", label);
3547
3548         free(label);
3549
3550         return 0;
3551 }
3552  * @endcode
3553  */
3554 int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label);
3555 int pkgmgrinfo_appinfo_usr_get_localed_label(const char *appid, const char *locale, uid_t uid, char **label);
3556
3557 /**
3558  * @fn int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const char *metadata_key, char **metadata_value)
3559  * @brief       This API gets metadata value by given metadata key
3560  *
3561  * @par         This API is for package-manager client application
3562  * @par Sync (or) Async : Synchronous API
3563  *
3564  * @param[in]   handle  pointer to the application info handle
3565  * @param[in]   metadata_key    metadata key
3566  * @param[out] metadata_value           pointer to hold metadata value
3567  * @return      0 if success, error code(<0) if fail
3568  * @retval      PMINFO_R_OK     success
3569  * @retval      PMINFO_R_EINVAL invalid argument
3570  * @code
3571 static int get_metadata_value(const char *appid, const char *metadata_key)
3572 {
3573         int ret = 0;
3574         pkgmgrinfo_appinfo_h handle = NULL;
3575         char *metadata_value = NULL;
3576
3577         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3578         if (ret != PMINFO_R_OK)
3579                 return -1;
3580
3581         ret = pkgmgrinfo_appinfo_get_metadata_value(handle, metadata_key, &metadata_value);
3582         if (ret != PMINFO_R_OK) {
3583                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3584                 return -1;
3585         }
3586
3587         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3588         return 0;
3589 }
3590  * @endcode
3591  */
3592 int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const char *metadata_key, char **metadata_value);
3593
3594 /**
3595  * @fn int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
3596  * @brief       This API gets the component of the application
3597  *
3598  * @par         This API is for package-manager client application
3599  * @par Sync (or) Async : Synchronous API
3600  *
3601  * @param[in] handle            pointer to the application info handle.
3602  * @param[out] component                pointer to hold app component
3603  * @return      0 if success, error code(<0) if fail
3604  * @retval      PMINFO_R_OK     success
3605  * @retval      PMINFO_R_EINVAL invalid argument
3606  * @retval      PMINFO_R_ERROR  internal error
3607  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3608  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3609  * @see         pkgmgrinfo_appinfo_get_appid()
3610  * @see         pkgmgrinfo_appinfo_is_multiple()
3611  * @code
3612 static int get_app_component(const char *appid)
3613 {
3614         int ret = 0;
3615         pkgmgrinfo_app_component component;
3616         pkgmgrinfo_appinfo_h handle;
3617         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3618         if (ret != PMINFO_R_OK)
3619                 return -1;
3620         ret = pkgmgrinfo_appinfo_get_component(handle, &component);
3621         if (ret != PMINFO_R_OK) {
3622                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3623                 return -1;
3624         }
3625         printf("component : %s\n", component);
3626         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3627         return 0;
3628 }
3629  * @endcode
3630  */
3631 int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_component *component);
3632
3633 /**
3634  * @fn int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
3635  * @brief       This API gets the apptype of the application
3636  *
3637  * @par         This API is for package-manager client application
3638  * @par Sync (or) Async : Synchronous API
3639  *
3640  * @param[in] handle            pointer to the application info handle.
3641  * @param[out] app_type         pointer to hold apptype
3642  * @return      0 if success, error code(<0) if fail
3643  * @retval      PMINFO_R_OK     success
3644  * @retval      PMINFO_R_EINVAL invalid argument
3645  * @retval      PMINFO_R_ERROR  internal error
3646  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3647  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3648  * @see         pkgmgrinfo_appinfo_get_appid()
3649  * @see         pkgmgrinfo_appinfo_is_multiple()
3650  * @code
3651 static int get_app_type(const char *appid)
3652 {
3653         int ret = 0;
3654         char *apptype = NULL;
3655         pkgmgrinfo_appinfo_h handle;
3656         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3657         if (ret != PMINFO_R_OK)
3658                 return -1;
3659         ret = pkgmgrinfo_appinfo_get_apptype(handle, &apptype);
3660         if (ret != PMINFO_R_OK) {
3661                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3662                 return -1;
3663         }
3664         printf("apptype : %s\n", apptype);
3665         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3666         return 0;
3667 }
3668  * @endcode
3669  */
3670 int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h  handle, char **app_type);
3671
3672 /**
3673  * @fn int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
3674  * @brief       This API gets the notification icon of the application
3675  *
3676  * @par         This API is for package-manager client application
3677  * @par Sync (or) Async : Synchronous API
3678  *
3679  * @param[in] handle            pointer to the application info handle.
3680  * @param[out] path             pointer to hold notification icon
3681  * @return      0 if success, error code(<0) if fail
3682  * @retval      PMINFO_R_OK     success
3683  * @retval      PMINFO_R_EINVAL invalid argument
3684  * @retval      PMINFO_R_ERROR  internal error
3685  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3686  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3687  * @see         pkgmgrinfo_appinfo_get_appid()
3688  * @see         pkgmgrinfo_appinfo_is_multiple()
3689  * @code
3690 static int get_app_notification_icon(const char *appid)
3691 {
3692         int ret = 0;
3693         char *notification_icon = NULL;
3694         pkgmgrinfo_appinfo_h handle;
3695         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3696         if (ret != PMINFO_R_OK)
3697                 return -1;
3698         ret = pkgmgrinfo_appinfo_get_notification_icon(handle, &notification_icon);
3699         if (ret != PMINFO_R_OK) {
3700                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3701                 return -1;
3702         }
3703         printf("notification icon : %s\n", notification_icon);
3704         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3705         return 0;
3706 }
3707  * @endcode
3708  */
3709 int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h  handle, char **icon);
3710
3711 /**
3712  * @fn int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
3713  * @brief       This API gets the type of recent image on app-tray
3714  *
3715  * @par         This API is for package-manager client application
3716  * @par Sync (or) Async : Synchronous API
3717  *
3718  * @param[in] handle            pointer to the application info handle.
3719  * @param[out] type             pointer to hold image type
3720  * @return      0 if success, error code(<0) if fail
3721  * @retval      PMINFO_R_OK     success
3722  * @retval      PMINFO_R_EINVAL invalid argument
3723  * @retval      PMINFO_R_ERROR  internal error
3724  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3725  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3726  * @see         pkgmgrinfo_appinfo_get_appid()
3727  * @see         pkgmgrinfo_appinfo_is_multiple()
3728  * @code
3729 static int get_app_recent_image_type(const char *appid)
3730 {
3731         int ret = 0;
3732         pkgmgrinfo_app_recentimage type;
3733         pkgmgrinfo_appinfo_h handle;
3734         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3735         if (ret != PMINFO_R_OK)
3736                 return -1;
3737         ret = pkgmgrinfo_appinfo_get_recent_image_type(handle, &type);
3738         if (ret != PMINFO_R_OK) {
3739                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3740                 return -1;
3741         }
3742         printf("recent image type: %d\n", type);
3743         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3744         return 0;
3745 }
3746  * @endcode
3747  */
3748 int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_recentimage *type);
3749
3750
3751 /**
3752  * @fn int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h  handle, char **preview_img)
3753  * @brief       This API gets the preview image of application
3754  *
3755  * @par Sync (or) Async : Synchronous API
3756  *
3757  * @param[in] handle            pointer to the application info handle.
3758  * @param[out] preview_img              pointer to hold preview image path
3759  * @return      0 if success, error code(<0) if fail
3760  * @retval      PMINFO_R_OK     success
3761  * @retval      PMINFO_R_EINVAL invalid argument
3762  * @retval      PMINFO_R_ERROR  internal error
3763  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3764  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3765  * @see         pkgmgrinfo_appinfo_get_appid()
3766  * @code
3767 static int get_app_previewimage(const char *appid)
3768 {
3769         int ret = 0;
3770         char *preview = NULL;
3771         pkgmgrinfo_appinfo_h handle = NULL;
3772         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3773         if (ret != PMINFO_R_OK)
3774                 return -1;
3775         ret = pkgmgrinfo_appinfo_get_preview_image(handle, &preview);
3776         if (ret != PMINFO_R_OK) {
3777                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3778                 return -1;
3779         }
3780         printf("preview image path : %s\n", preview);
3781         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3782         return 0;
3783 }
3784  * @endcode
3785  */
3786 int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h  handle, char **preview_img);
3787
3788
3789 /**
3790  * @fn int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
3791  * @brief       This API gets the package permission type of the application
3792  *
3793  * @par         This API is for package-manager client application
3794  * @par Sync (or) Async : Synchronous API
3795  *
3796  * @param[in] handle            pointer to the application info handle.
3797  * @param[out] permission               pointer to hold package permission
3798  * @return      0 if success, error code(<0) if fail
3799  * @retval      PMINFO_R_OK     success
3800  * @retval      PMINFO_R_EINVAL invalid argument
3801  * @retval      PMINFO_R_ERROR  internal error
3802  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3803  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3804  * @see         pkgmgrinfo_appinfo_get_appid()
3805  * @code
3806 static int get_app_permission(const char *appid)
3807 {
3808         int ret = 0;
3809         pkgmgrinfo_permission_type permission = 0;
3810         pkgmgrinfo_appinfo_h handle;
3811
3812         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3813         if (ret != PMINFO_R_OK)
3814                 return -1;
3815         ret = pkgmgrinfo_appinfo_get_permission_type(handle, &permission);
3816         if (ret != PMINFO_R_OK) {
3817                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3818                 return -1;
3819         }
3820         printf("permission type: %d\n", permission);
3821         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3822         return 0;
3823 }
3824  * @endcode
3825  */
3826 int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission);
3827
3828 /**
3829  * @fn int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
3830  * @brief       This API gets the component_type
3831  *
3832  * @par         This API is for package-manager client application
3833  * @par Sync (or) Async : Synchronous API
3834  *
3835  * @param[in] handle            pointer to the application info handle.
3836  * @param[out] component_type           pointer to hold component_type
3837  * @return      0 if success, error code(<0) if fail
3838  * @retval      PMINFO_R_OK     success
3839  * @retval      PMINFO_R_EINVAL invalid argument
3840  * @retval      PMINFO_R_ERROR  internal error
3841  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3842  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3843  * @see         pkgmgrinfo_appinfo_get_pkgid()
3844  * @see         pkgmgrinfo_appinfo_is_multiple()
3845  * @code
3846 static int get_component_type(const char *appid)
3847 {
3848         int ret = 0;
3849         char *component_type = NULL;
3850         pkgmgrinfo_appinfo_h handle;
3851         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3852         if (ret != PMINFO_R_OK)
3853                 return -1;
3854         ret = pkgmgrinfo_appinfo_get_component_type(handle, &component_type);
3855         if (ret != PMINFO_R_OK) {
3856                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3857                 return -1;
3858         }
3859         printf("component_type: %s\n", component_type);
3860         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3861         return 0;
3862 }
3863  * @endcode
3864  */
3865 int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h  handle, char **component_type);
3866
3867 /**
3868  * @fn int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
3869  * @brief       This API gets the application 'hwacceleration' value from the app ID
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 application info handle
3875  * @param[out] hwacceleration           pointer to hold package hwacceleration value
3876  * @return      0 if success, error code(<0) if fail
3877  * @retval      PMINFO_R_OK     success
3878  * @retval      PMINFO_R_EINVAL invalid argument
3879  * @retval      PMINFO_R_ERROR  internal error
3880  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3881  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3882  * @see         pkgmgrinfo_appinfo_get_appid()
3883  * @see         pkgmgrinfo_appinfo_is_multiple()
3884  * @code
3885 static int get_app_hwacceleration(const char *appid)
3886 {
3887         int ret = 0;
3888         pkgmgrinfo_app_hwacceleration hwacceleration;
3889         pkgmgrinfo_appinfo_h handle;
3890         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3891         if (ret != PMINFO_R_OK)
3892                 return -1;
3893         ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacceleration);
3894         if (ret != PMINFO_R_OK) {
3895                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3896                 return -1;
3897         }
3898         printf("app hwacceleration: %d\n", hwacceleration);
3899         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3900         return 0;
3901 }
3902  * @endcode
3903  */
3904 int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_hwacceleration *hwacceleration);
3905
3906 /**
3907  * @fn int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader)
3908  * @brief       This API gets the application 'screenreader' value from the app ID
3909  *
3910  * @par         This API is for package-manager client application
3911  * @par Sync (or) Async : Synchronous API
3912  *
3913  * @param[in]   handle  pointer to application info handle
3914  * @param[out] screenreader             pointer to hold package accessibility value
3915  * @return      0 if success, error code(<0) if fail
3916  * @retval      PMINFO_R_OK     success
3917  * @retval      PMINFO_R_EINVAL invalid argument
3918  * @retval      PMINFO_R_ERROR  internal error
3919  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3920  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
3921  * @see         pkgmgrinfo_appinfo_get_appid()
3922  * @see         pkgmgrinfo_appinfo_is_multiple()
3923  * @code
3924 static int get_app_screenreader(const char *appid)
3925 {
3926         int ret = 0;
3927         pkgmgrinfo_app_screenreader screenreader = PMINFO_USE_SYSTEM_SETTING;
3928         pkgmgrinfo_appinfo_h handle = NULL;
3929         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3930         if (ret != PMINFO_R_OK)
3931                 return -1;
3932         ret = pkgmgrinfo_appinfo_get_screenreader(handle, &screenreader);
3933         if (ret != PMINFO_R_OK) {
3934                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3935                 return -1;
3936         }
3937         printf("app screenreader: %d\n", screenreader);
3938         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3939         return 0;
3940 }
3941  * @endcode
3942  */
3943 int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h  handle, pkgmgrinfo_app_screenreader *screenreader);
3944
3945 /**
3946  * @fn int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img)
3947  * @brief       This API gets the application's landscape & portrait effect images
3948  *
3949  * @par         This API is for package-manager client application
3950  * @par Sync (or) Async : Synchronous API
3951  *
3952  * @param[in]   handle  pointer to application info handle
3953  * @param[out]  portrait_img contains portrait mode effect image
3954  * @param[out]  landscape_img contains landscape mode effect image
3955  * @return      0 if success, error code(<0) if fail
3956  * @retval      PMINFO_R_OK     success
3957  * @retval      PMINFO_R_EINVAL invalid argument
3958  * @retval      PMINFO_R_ERROR  internal error
3959  * @pre         pkgmgrinfo_appinfo_get_appinfo()
3960  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
3961  * @see         pkgmgrinfo_appinfo_get_appid()
3962  * @see         pkgmgrinfo_appinfo_is_nodisplay()
3963  * @code
3964 static int get_app_effectimages(const char *appid)
3965 {
3966         int ret = 0;
3967         char *portraitimg = NULL;
3968         char *landscapeimg = NULL;
3969         pkgmgrinfo_appinfo_h handle;
3970         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
3971         if (ret != PMINFO_R_OK)
3972                 return -1;
3973         ret = pkgmgrinfo_appinfo_get_effectimage(handle, &portraitimg, &landscapeimg);
3974         if (ret != PMINFO_R_OK) {
3975                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
3976                 return -1;
3977         }
3978         printf("app effect image portrait: %s, app effect image landscape : %s\n", portraitimg, landscapeimg);
3979         pkgmgrinfo_appinfo_destroy_appinfo(handle);
3980         return 0;
3981 }
3982  * @endcode
3983  */
3984 int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h  handle, char **portrait_img, char **landscape_img);
3985
3986 /**
3987  * @fn int pkgmgrinfo_appinfo_get_effectimage_type(pkgmgrinfo_appinfo_h  handle, char **effectimg_type)
3988  * @brief       This API gets the application's effect image type
3989  *
3990  * @par         This API is for package-manager client application
3991  * @par Sync (or) Async : Synchronous API
3992  *
3993  * @param[in]   handle  pointer to application info handle
3994  * @param[out]  effectimg_type contains effect image type
3995  * @return      0 if success, error code(<0) if fail
3996  * @retval      PMINFO_R_OK     success
3997  * @retval      PMINFO_R_EINVAL invalid argument
3998  * @retval      PMINFO_R_ERROR  internal error
3999  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4000  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4001  * @see         pkgmgrinfo_appinfo_get_appid()
4002  * @see         pkgmgrinfo_appinfo_is_nodisplay()
4003  * @code
4004 static int get_app_effectimage_type(const char *appid)
4005 {
4006         int ret = 0;
4007         char *effectimg_type = NULL;
4008         pkgmgrinfo_appinfo_h handle = NULL;
4009         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4010         if (ret != PMINFO_R_OK)
4011                 return -1;
4012         ret = pkgmgrinfo_appinfo_get_effectimage_type(handle, &effectimg_type);
4013         if (ret != PMINFO_R_OK) {
4014                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4015                 return -1;
4016         }
4017         printf("app effect image type: %s\n", effectimg_type);
4018         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4019         return 0;
4020 }
4021  * @endcode
4022  */
4023 int pkgmgrinfo_appinfo_get_effectimage_type(pkgmgrinfo_appinfo_h handle, char **effectimg_type);
4024
4025 /**
4026  * @fn int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h handle, char **submode_mainid)
4027  * @brief       This API gets the submode_mainid of the application
4028  *
4029  * @par         This API is for package-manager client application
4030  * @par Sync (or) Async : Synchronous API
4031  *
4032  * @param[in] handle            pointer to the application info handle.
4033  * @param[out] submode_mainid           pointer to hold package name
4034  * @return      0 if success, error code(<0) if fail
4035  * @retval      PMINFO_R_OK     success
4036  * @retval      PMINFO_R_EINVAL invalid argument
4037  * @retval      PMINFO_R_ERROR  internal error
4038  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4039  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4040  * @see         pkgmgrinfo_appinfo_get_appid()
4041  * @see         pkgmgrinfo_appinfo_is_multiple()
4042  * @code
4043 static int get_app_submode_mainid(const char *appid)
4044 {
4045         int ret = 0;
4046         char *submode_mainid = NULL;
4047         pkgmgrinfo_appinfo_h handle = NULL;
4048         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4049         if (ret != PMINFO_R_OK)
4050                 return -1;
4051         ret = pkgmgrinfo_appinfo_get_submode_mainid(handle, &submode_mainid);
4052         if (ret != PMINFO_R_OK) {
4053                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4054                 return -1;
4055         }
4056         printf("submode_mainid: %s\n", submode_mainid);
4057         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4058         return 0;
4059 }
4060  * @endcode
4061  */
4062 int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char **submode_mainid);
4063
4064 /**
4065  * @fn int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid, const char *type, char **appid, char **access);
4066  * @brief       This API gets the datacontrol info
4067  *
4068  * @par         This API is for package-manager client application
4069  * @par Sync (or) Async : Synchronous API
4070  *
4071  * @param[in] providerid                pointer to the providerid of dataconltrol.
4072  * @param[in] type                      pointer to the type of dataconltrol.
4073  * @param[out] appid                    pointer to hold appid, need to free after using
4074  * @param[out] access                   pointer to hold access, need to free after using
4075  * @return      0 if success, error code(<0) if fail
4076  * @retval      PMINFO_R_OK     success
4077  * @retval      PMINFO_R_EINVAL invalid argument
4078  * @retval      PMINFO_R_ERROR  internal error
4079  * @endcode
4080  */
4081 int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid, const char *type, char **appid, char **access);
4082 int pkgmgrinfo_appinfo_usr_get_datacontrol_info(const char *providerid, const char *type, uid_t uid, char **appid, char **access);
4083
4084 /**
4085  * @fn int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid);
4086  * @brief       This API gets the appid of datacontrol
4087  *
4088  * @par         This API is for package-manager client application
4089  * @par Sync (or) Async : Synchronous API
4090  *
4091  * @param[in] providerid                pointer to the providerid of dataconltrol.
4092  * @param[out] appid                    pointer to hold appid, need to free after using
4093  * @return      0 if success, error code(<0) if fail
4094  * @retval      PMINFO_R_OK     success
4095  * @retval      PMINFO_R_EINVAL invalid argument
4096  * @retval      PMINFO_R_ERROR  internal error
4097  * @endcode
4098  */
4099 int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid);
4100 int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid, uid_t uid, char **appid);
4101
4102 /**
4103  * @fn int pkgmgrinfo_appinfo_get_datacontrol_trusted_info(const char *providerid, char **appid, bool *is_trusted);
4104  * @brief       This API gets the information about trusted datacontrol
4105  *
4106  * @par         This API is for package-manager client application
4107  * @par Sync (or) Async : Synchronous API
4108  *
4109  * @param[in] providerid                pointer to the providerid of datacontrol.
4110  * @param[out] appid                    pointer to hold appid, need to free after using
4111  * @param[out] is_trusted               pointer to hold whether it provides trusted datacontrol
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  * @endcode
4117  */
4118 int pkgmgrinfo_appinfo_get_datacontrol_trusted_info(const char *providerid,
4119                 const char *type, char **appid, bool *is_trusted);
4120 int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(const char *providerid,
4121                 const char *type, uid_t uid, char **appid, bool *is_trusted);
4122
4123 /**
4124  * @fn int pkgmgrinfo_appinfo_foreach_datacontrol_privileges(const char *providerid, const char *type,
4125                 pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
4126  * @brief       This API retrieves the privileges and invokes given callback for each privilege.
4127  *
4128  * @par         This API is for package-manager client application
4129  * @par Sync (or) Async : Synchronous API
4130  *
4131  * @param[in] providerid                pointer to the providerid of datacontrol.
4132  * @param[in] type                      pointer to the type of dataconltrol.
4133  * @param[in] privilege_func            callback function for list
4134  * @param[in] user_data user data to be passed to callback function
4135  * @return      0 if success, error code(<0) if fail
4136  * @retval      PMINFO_R_OK     success
4137  * @retval      PMINFO_R_EINVAL invalid argument
4138  * @retval      PMINFO_R_ERROR  internal error
4139  */
4140 int pkgmgrinfo_appinfo_foreach_datacontrol_privileges(const char *providerid, const char *type,
4141                 pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
4142 int pkgmgrinfo_appinfo_usr_foreach_datacontrol_privileges(const char *providerid, const char *type,
4143                 pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data, uid_t uid);
4144
4145 /**
4146  * @fn int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h  handle, char **alias_appid)
4147  * @brief       This API gets the alias_appid of the application
4148  *
4149  * @par         This API is for package-manager client application
4150  * @par Sync (or) Async : Synchronous API
4151  *
4152  * @param[in] handle            pointer to the application info handle.
4153  * @param[out] alias_appid              pointer to hold app alias_appid
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         pkgmgrinfo_appinfo_get_appinfo()
4159  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4160  * @see         pkgmgrinfo_appinfo_get_appid()
4161  * @code
4162 static int get_alias_appid(const char *appid)
4163 {
4164         int ret = 0;
4165         char *alias_appid= 0;
4166         pkgmgrinfo_appinfo_h handle = NULL;
4167         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4168         if (ret != PMINFO_R_OK)
4169                 return -1;
4170         ret = pkgmgrinfo_appinfo_get_alias_appid(handle, &alias_appid);
4171         if (ret != PMINFO_R_OK) {
4172                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4173                 return -1;
4174         }
4175         printf("alias_appid: %s\n", alias_appid);
4176         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4177         return 0;
4178 }
4179  * @endcode
4180  */
4181 int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **alias_appid);
4182
4183 /**
4184  * @fn int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h  handle, char **effective_appid)
4185  * @brief       This API gets the effective_appid of the application
4186  *
4187  * @par         This API is for package-manager client application
4188  * @par Sync (or) Async : Synchronous API
4189  *
4190  * @param[in] handle            pointer to the application info handle.
4191  * @param[out] effective_appid          pointer to hold app effective_appid
4192  * @return      0 if success, error code(<0) if fail
4193  * @retval      PMINFO_R_OK     success
4194  * @retval      PMINFO_R_EINVAL invalid argument
4195  * @retval      PMINFO_R_ERROR  internal error
4196  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4197  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4198  * @see         pkgmgrinfo_appinfo_get_appid()
4199  * @code
4200 static int get_effective_appid(const char *appid)
4201 {
4202         int ret = 0;
4203         char *effective_appid= 0;
4204         pkgmgrinfo_appinfo_h handle = NULL;
4205         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4206         if (ret != PMINFO_R_OK)
4207                 return -1;
4208         ret = pkgmgrinfo_appinfo_get_effective_appid(handle, &effective_appid);
4209         if (ret != PMINFO_R_OK) {
4210                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4211                 return -1;
4212         }
4213         printf("effective_appid: %s\n", effective_appid);
4214         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4215         return 0;
4216 }
4217  * @endcode
4218  */
4219 int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h handle, char **effective_appid);
4220
4221 /**
4222  * @fn int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_name)
4223  * @brief       This API gets tep(tizen expansion package) file name associated with the package which contain given application
4224  *
4225  * @par This API is for package-manager client application
4226  * @par Sync (or) Async : Synchronous API
4227  *
4228  * @param[in] handle            pointer to the appinfo handle.
4229  * @param[out] tep_name         pointer to hold tep name
4230  * @return      0 if success, error code(<0) if fail
4231  * @retval      PMINFO_R_OK success
4232  * @retval      PMINFO_R_EINVAL invalid argument
4233  * @retval      PMINFO_R_ERROR  internal error
4234  * @pre pkgmgrinfo_appinfo_get_appinfo()
4235  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
4236  * @see pkgmgrinfo_appinfo_get_appid()
4237  * @code
4238 static int get_tep_name(const char *appid)
4239 {
4240         int ret = 0;
4241         char *tep_name = NULL;
4242         pkgmgrinfo_appinfo_h handle = NULL;
4243         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4244         if (ret != PMINFO_R_OK)
4245                 return -1;
4246         ret = pkgmgrinfo_appinfo_get_tep_name(handle, &tep_name);
4247         if (ret != PMINFO_R_OK) {
4248                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4249                 return -1;
4250         }
4251         printf("TEP name is: %s\n", tep_name);
4252         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4253         return 0;
4254 }
4255  * @endcode
4256  */
4257 int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_name);
4258
4259 /**
4260  * @fn int pkgmgrinfo_appinfo_get_zip_mount_file(pkgmgrinfo_appinfo_h handle, char **zip_mount_file)
4261  * @brief       This API gets zip mount file name associated with the package which contain given application
4262  *          If package is not "mount-installed", zip_mount_file is left as NULL pointer.
4263  *
4264  * @par This API is for package-manager client application
4265  * @par Sync (or) Async : Synchronous API
4266  *
4267  * @param[in] handle            pointer to the appinfo handle.
4268  * @param[out] zip_mount_file           pointer to hold zip mount file name
4269  * @return      0 if success, error code(<0) if fail
4270  * @retval      PMINFO_R_OK success
4271  * @retval      PMINFO_R_EINVAL invalid argument
4272  * @retval      PMINFO_R_ERROR  internal error
4273  * @pre pkgmgrinfo_appinfo_get_appinfo()
4274  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
4275  * @see pkgmgrinfo_appinfo_get_appid()
4276  * @code
4277 static int get_zip_mount_file(const char *appid)
4278 {
4279         int ret = 0;
4280         char *zip_mount_file = NULL;
4281         pkgmgrinfo_appinfo_h handle = NULL;
4282         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4283         if (ret != PMINFO_R_OK)
4284                 return -1;
4285         ret = pkgmgrinfo_appinfo_get_zip_mount_file(handle, &zip_mount_file);
4286         if (ret != PMINFO_R_OK) {
4287                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4288                 return -1;
4289         }
4290         printf("Mount file name is: %s\n", zip_mount_file);
4291         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4292         return 0;
4293 }
4294  * @endcode
4295  */
4296 int pkgmgrinfo_appinfo_get_zip_mount_file(pkgmgrinfo_appinfo_h handle, char **zip_mount_file);
4297
4298 /**
4299  * @fn int pkgmgrinfo_appinfo_get_root_path(pkgmgrinfo_appinfo_h handle, char **path)
4300  * @brief       This API gets the root path of application
4301  *
4302  * @par Sync (or) Async : Synchronous API
4303  *
4304  * @param[in] handle            pointer to appinfo handle
4305  * @param[out] path             pointer to hold root path of application
4306  * @return      0 if success, error code(<0) if fail
4307  * @retval      PMINFO_R_OK     success
4308  * @retval      PMINFO_R_EINVAL invalid argument
4309  * @retval      PMINFO_R_ERROR  internal error
4310  * @code
4311 static int get_root_path(const char *appid)
4312 {
4313         int ret = 0;
4314         char *path = 0;
4315         pkgmgrinfo_appinfo_h handle;
4316         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4317         if (ret != PMINFO_R_OK)
4318                 return -1;
4319
4320         ret = pkgmgrinfo_appinfo_get_root_path(handle, &path);
4321         if (ret != PMINFO_R_OK) {
4322                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4323                 return -1;
4324         }
4325         printf("path : %s\n", path);
4326         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4327
4328         return 0;
4329 }
4330  * @endcode
4331  */
4332 int pkgmgrinfo_appinfo_get_root_path(pkgmgrinfo_appinfo_h handle, char **root_path);
4333
4334 /**
4335  * @fn int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **api_version)
4336  * @brief       This API gets the application api_version from the application ID
4337  *
4338  * @par         This API is for package-manager client application
4339  * @par Sync (or) Async : Synchronous API
4340  *
4341  * @param[in]   handle  pointer to appinfo handle
4342  * @param[out] api_version              pointer to hold application api_version
4343  * @return      0 if success, error code(<0) if fail
4344  * @retval      PMINFO_R_OK     success
4345  * @retval      PMINFO_R_EINVAL invalid argument
4346  * @retval      PMINFO_R_ERROR  internal error
4347  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4348  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4349  * @see         pkgmgrinfo_appinfo_get_appid()
4350  * @code
4351 static int get_app_api_version(const char *appid)
4352 {
4353         int ret = 0;
4354         char *api_version = NULL;
4355         pkgmgrinfo_appinfo_h handle = NULL;
4356         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4357         if (ret != PMINFO_R_OK)
4358                 return -1;
4359         ret = pkgmgrinfo_appinfo_get_api_version(handle, &api_version);
4360         if (ret != PMINFO_R_OK) {
4361                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4362                 return -1;
4363         }
4364         printf("app api_version: %s\n", api_version);
4365         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4366         return 0;
4367 }
4368  * @endcode
4369  */
4370 int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **api_version);
4371
4372 /**
4373  * @fn int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *installed_time)
4374  * @brief       This API gets the installed_time of the application
4375  *
4376  * @par         This API is for package-manager client application
4377  * @par Sync (or) Async : Synchronous API
4378  *
4379  * @param[in] handle            pointer to the application info handle.
4380  * @param[out] installed_time           pointer to hold installed_time
4381  * @return      0 if success, error code(<0) if fail
4382  * @retval      PMINFO_R_OK     success
4383  * @retval      PMINFO_R_EINVAL invalid argument
4384  * @retval      PMINFO_R_ERROR  internal error
4385  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4386  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4387  * @see         pkgmgrinfo_appinfo_get_appid()
4388  * @see         pkgmgrinfo_appinfo_is_multiple()
4389  * @code
4390 static int get_app_installed_time(const char *appid)
4391 {
4392         int ret = 0;
4393         int installed_time = 0;
4394         pkgmgrinfo_appinfo_h handle = NULL;
4395         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4396         if (ret != PMINFO_R_OK)
4397                 return -1;
4398         ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time);
4399         if (ret != PMINFO_R_OK) {
4400                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4401                 return -1;
4402         }
4403         printf("installed_time: %d\n", installed_time);
4404         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4405         return 0;
4406 }
4407  * @endcode
4408  */
4409 int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *installed_time);
4410
4411 /**
4412  * @fn int pkgmgrinfo_appinfo_get_support_mode(pkgmgrinfo_appinfo_h  handle, int *support_mode)
4413  * @brief       This API gets the support_mode of the application
4414  *
4415  * @par         This API is for package-manager client application
4416  * @par Sync (or) Async : Synchronous API
4417  *
4418  * @param[in] handle            pointer to the application info handle.
4419  * @param[out] support_mode             pointer to hold app support_mode
4420  * @return      0 if success, error code(<0) if fail
4421  * @retval      PMINFO_R_OK     success
4422  * @retval      PMINFO_R_EINVAL invalid argument
4423  * @retval      PMINFO_R_ERROR  internal error
4424  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4425  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4426  * @see         pkgmgrinfo_appinfo_get_appid()
4427  * @code
4428 static int get_app_support_mode(const char *appid)
4429 {
4430         int ret = 0;
4431         int support_mode = 0;
4432         pkgmgrinfo_appinfo_h handle = NULL;
4433         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4434         if (ret != PMINFO_R_OK)
4435                 return -1;
4436         ret = pkgmgrinfo_appinfo_get_support_mode(handle, &support_mode);
4437         if (ret != PMINFO_R_OK) {
4438                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4439                 return -1;
4440         }
4441         printf("support_mode: %s\n", support_mode);
4442         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4443         return 0;
4444 }
4445  * @endcode
4446  */
4447 int pkgmgrinfo_appinfo_get_support_mode(pkgmgrinfo_appinfo_h handle, int *support_mode);
4448
4449
4450 /**
4451  * @fn  int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
4452                         pkgmgrinfo_app_category_list_cb category_func, void *user_data);
4453  * @brief       This API gets the list of category for a particular application
4454  *
4455  * @par         This API is for package-manager client application
4456  * @par Sync (or) Async : Synchronous API
4457  * @param[in]   handle          pointer to the application info handle.
4458  * @param[in]   category_func           callback function for list
4459  * @param[in] user_data user data to be passed to callback function
4460  * @return      0 if success, error code(<0) if fail
4461  * @retval      PMINFO_R_OK     success
4462  * @retval      PMINFO_R_EINVAL invalid argument
4463  * @retval      PMINFO_R_ERROR  internal error
4464  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4465  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4466  * @code
4467 int category_func(const char *name, void *user_data)
4468 {
4469         if (strcmp(name, (char *)user_data) == 0)
4470                 return -1;
4471         else
4472                 return 0;
4473 }
4474
4475 static int list_category(const char *appid, char *category)
4476 {
4477         int ret = 0;
4478         pkgmgrinfo_appinfo_h handle;
4479         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4480         if (ret != PMINFO_R_OK)
4481                 return -1;
4482         ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)category);
4483         if (ret != PMINFO_R_OK) {
4484                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4485                 return -1;
4486         }
4487         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4488         return 0;
4489 }
4490  * @endcode
4491  */
4492 int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
4493                         pkgmgrinfo_app_category_list_cb category_func, void *user_data);
4494
4495 /**
4496  * @fn  int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
4497                         pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
4498  * @brief       This API gets the list of metadata for a particular application
4499  *
4500  * @par         This API is for package-manager client application
4501  * @par Sync (or) Async : Synchronous API
4502  * @param[in]   handle          pointer to the application info handle.
4503  * @param[in]   metadata_func           callback function for list
4504  * @param[in] user_data user data to be passed to callback function
4505  * @return      0 if success, error code(<0) if fail
4506  * @retval      PMINFO_R_OK     success
4507  * @retval      PMINFO_R_EINVAL invalid argument
4508  * @retval      PMINFO_R_ERROR  internal error
4509  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4510  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4511  * @code
4512 int metadata_func(const char *key, const char *value, void *user_data)
4513 {
4514         if (strcmp(key, (char *)user_data) == 0) {
4515                 printf("Value is %s\n", value);
4516                 return -1;
4517         }
4518         else
4519                 return 0;
4520 }
4521
4522 static int list_metadata(const char *appid, char *key)
4523 {
4524         int ret = 0;
4525         pkgmgrinfo_appinfo_h handle;
4526         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4527         if (ret != PMINFO_R_OK)
4528                 return -1;
4529         ret = pkgmgrinfo_appinfo_foreach_metadata(handle, metadata_func, (void *)key);
4530         if (ret != PMINFO_R_OK) {
4531                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4532                 return -1;
4533         }
4534         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4535         return 0;
4536 }
4537  * @endcode
4538  */
4539 int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
4540                         pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data);
4541
4542 /**
4543  * @fn  int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
4544  *                      const char *operation,
4545  *                      pkgmgrinfo_pkg_privilege_list_cb privilege_func,
4546  *                      void *user_data);
4547  * @brief       This API gets the list of privileges for a particular
4548  *              appllication's app_control
4549  *
4550  * @par         This API is for package-manager client application
4551  * @par Sync (or) Async : Synchronous API
4552  * @param[in]   appid           application id
4553  * @param[in]   operation       operation of appcontrol
4554  * @param[in]   privilege_func  callback function for list
4555  * @param[in]   user_data       user data to be passed to callback function
4556  * @return      0 if success, error code(<0) if fail
4557  * @retval      PMINFO_R_OK     success
4558  * @retval      PMINFO_R_EINVAL invalid argument
4559  * @retval      PMINFO_R_ERROR  internal error
4560  */
4561 int pkgmgrinfo_appinfo_usr_foreach_appcontrol_privileges(const char *appid,
4562                 const char *operation,
4563                 pkgmgrinfo_pkg_privilege_list_cb privilege_func,
4564                 void *user_data, uid_t uid);
4565 int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
4566                 const char *operation,
4567                 pkgmgrinfo_pkg_privilege_list_cb privilege_func,
4568                 void *user_data);
4569
4570 /**
4571  * @fn  int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
4572                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
4573  * @fn  int pkgmgrinfo_usr_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
4574                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data, uid_t uid);
4575  * @brief       This API gets the list of app-control for a particular application
4576  *
4577  * @par         This API is for package-manager client application
4578  * @par Sync (or) Async : Synchronous API
4579  * @param[in]   handle          pointer to the application info handle.
4580  * @param[in]   appcontrol_func         callback function for list
4581  * @param[in] user_data user data to be passed to callback function
4582  * @param[in]   uid     the addressee user id of the instruction
4583  * @return      0 if success, error code(<0) if fail
4584  * @retval      PMINFO_R_OK     success
4585  * @retval      PMINFO_R_EINVAL invalid argument
4586  * @retval      PMINFO_R_ERROR  internal error
4587  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4588  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4589  * @code
4590 int appcontrol_func(const char *operation, const char *uri, const char *mime, void *user_data)
4591 {
4592         int i = 0;
4593         char **operation;
4594         char *compare_data = (char *)user_data;
4595         if (strcmp(operation, compare_data) == 0)
4596                 return -1;
4597         else
4598           return 0;
4599 }
4600
4601 static int check_operation(const char *appid, char *operation)
4602 {
4603         int ret = 0;
4604         pkgmgrinfo_appinfo_h handle;
4605         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4606         if (ret != PMINFO_R_OK)
4607                 return -1;
4608         ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, appcontrol_func, (void *)operation);
4609         if (ret != PMINFO_R_OK) {
4610                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4611                 return -1;
4612         }
4613         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4614         return 0;
4615 }
4616  * @endcode
4617  */
4618 int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
4619                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
4620
4621 int pkgmgrinfo_appinfo_foreach_remote_appcontrol(pkgmgrinfo_appinfo_h handle,
4622                         pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
4623
4624 /**
4625  * @brief
4626  */
4627 int pkgmgrinfo_appinfo_foreach_background_category(pkgmgrinfo_appinfo_h handle,
4628                 pkgmgrinfo_app_background_category_list_cb category_func, void *user_data);
4629
4630 /**
4631  * @fn  int pkgmgrinfo_appinfo_foreach_splash_screen(pkgmgrinfo_appinfo_h handle,
4632                         pkgmgrinfo_app_splash_screen_list_cb splash_screen_func, void *user_data);
4633  * @brief       This API gets the list of splashscreen for a particular application
4634  *
4635  * @par         This API is for package-manager client application
4636  * @par Sync (or) Async : Synchronous API
4637  * @param[in]   handle          pointer to the application info handle.
4638  * @param[in]   splash_screen_func              callback function for list
4639  * @param[in]   user_data       user data to be passed to callback function
4640  * @return      0 if success, error code(<0) if fail
4641  * @retval      PMINFO_R_OK     success
4642  * @retval      PMINFO_R_EINVAL invalid argument
4643  * @retval      PMINFO_R_ERROR  internal error
4644  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4645  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4646  * @code
4647  */
4648 int pkgmgrinfo_appinfo_foreach_splash_screen(pkgmgrinfo_appinfo_h handle,
4649                 pkgmgrinfo_app_splash_screen_list_cb splash_screen_func, void *user_data);
4650
4651 /**
4652  * @fn  int pkgmgrinfo_appinfo_foreach_res_control(pkgmgrinfo_appinfo_h handle,
4653                         pkgmgrinfo_app_res_control_list_cb res_control_func, void *user_data);
4654  * @brief       This API gets the list of resource control for a particular application
4655  *
4656  * @par         This API is for package-manager client application
4657  * @par Sync (or) Async : Synchronous API
4658  * @param[in]   handle                  pointer to the application info handle.
4659  * @param[in]   res_control_func        callback function for list
4660  * @param[in]   user_data               user data to be passed to callback function
4661  * @return      0 if success, error code(<0) if fail
4662  * @retval      PMINFO_R_OK     success
4663  * @retval      PMINFO_R_EINVAL invalid argument
4664  * @retval      PMINFO_R_ERROR  internal error
4665  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4666  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
4667  * @code
4668 int res_control_func(const char *res_type,
4669                 const char *min_res_version, const char *max_res_version,
4670                 const char *auto_close, void *user_data)
4671 {
4672         printf("res_type : %s\n", res_type);
4673         return 0;
4674 }
4675
4676 static int list_res_control(const char *appid, char *key)
4677 {
4678         int ret = 0;
4679         pkgmgrinfo_appinfo_h handle;
4680         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4681         if (ret != PMINFO_R_OK)
4682                 return -1;
4683         ret = pkgmgrinfo_appinfo_foreach_res_control(handle, res_control_func, NULL);
4684         if (ret != PMINFO_R_OK) {
4685                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4686                 return -1;
4687         }
4688         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4689         return 0;
4690 }
4691  * @endcode
4692  */
4693 int pkgmgrinfo_appinfo_foreach_res_control(pkgmgrinfo_appinfo_h handle,
4694                 pkgmgrinfo_app_res_control_list_cb res_control_func,
4695                 void *user_data);
4696
4697 /**
4698  * @fn int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay)
4699  * @brief       This API gets the application 'nodisplay' value from the app ID
4700  *
4701  * @par         This API is for package-manager client application
4702  * @par Sync (or) Async : Synchronous API
4703  *
4704  * @param[in]   handle  pointer to application info handle
4705  * @param[out] nodisplay                pointer to hold package nodisplay value
4706  * @return      0 if success, error code(<0) if fail
4707  * @retval      PMINFO_R_OK     success
4708  * @retval      PMINFO_R_EINVAL invalid argument
4709  * @retval      PMINFO_R_ERROR  internal error
4710  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4711  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4712  * @see         pkgmgrinfo_appinfo_get_appid()
4713  * @see         pkgmgrinfo_appinfo_is_multiple()
4714  * @code
4715 static int get_app_nodisplay(const char *appid)
4716 {
4717         int ret = 0;
4718         bool nodisplay;
4719         pkgmgrinfo_appinfo_h handle;
4720         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4721         if (ret != PMINFO_R_OK)
4722                 return -1;
4723         ret = pkgmgrinfo_appinfo_is_nodisplay(handle, &nodisplay);
4724         if (ret != PMINFO_R_OK) {
4725                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4726                 return -1;
4727         }
4728         printf("app nodisplay: %d\n", nodisplay);
4729         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4730         return 0;
4731 }
4732  * @endcode
4733  */
4734 int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h  handle, bool *nodisplay);
4735
4736 /**
4737  * @fn int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multiple)
4738  * @brief       This API gets the application 'multiple' value from the app ID
4739  *
4740  * @par         This API is for package-manager client application
4741  * @par Sync (or) Async : Synchronous API
4742  *
4743  * @param[in]   handle  pointer to application info handle
4744  * @param[out] multiple         pointer to hold package multiple value
4745  * @return      0 if success, error code(<0) if fail
4746  * @retval      PMINFO_R_OK     success
4747  * @retval      PMINFO_R_EINVAL invalid argument
4748  * @retval      PMINFO_R_ERROR  internal error
4749  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4750  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4751  * @see         pkgmgrinfo_appinfo_get_appid()
4752  * @see         pkgmgrinfo_appinfo_is_nodisplay()
4753  * @code
4754 static int get_app_multiple(const char *appid)
4755 {
4756         int ret = 0;
4757         bool multiple;
4758         pkgmgrinfo_appinfo_h handle;
4759         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4760         if (ret != PMINFO_R_OK)
4761                 return -1;
4762         ret = pkgmgrinfo_appinfo_is_multiple(handle, &multiple);
4763         if (ret != PMINFO_R_OK) {
4764                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4765                 return -1;
4766         }
4767         printf("app multiple: %d\n", multiple);
4768         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4769         return 0;
4770 }
4771  * @endcode
4772  */
4773 int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h  handle, bool *multiple);
4774
4775 /**
4776  * @fn int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
4777  * @brief       This API gets the application 'indicatordisplay' value. If true, indicator will be displayed during
4778  *              application launching effect. If fales, indicator will be hidden during application launching effect
4779  *
4780  * @par         This API is for package-manager client application
4781  * @par Sync (or) Async : Synchronous API
4782  *
4783  * @param[in]   handle  pointer to application info handle
4784  * @param[out]  indicator_disp contains indicator display status for application launching effect
4785  * @return      0 if success, error code(<0) if fail
4786  * @retval      PMINFO_R_OK     success
4787  * @retval      PMINFO_R_EINVAL invalid argument
4788  * @retval      PMINFO_R_ERROR  internal error
4789  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4790  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4791  * @see         pkgmgrinfo_appinfo_get_appid()
4792  * @see         pkgmgrinfo_appinfo_is_nodisplay()
4793  * @code
4794 static int get_app_indicator_display(const char *appid)
4795 {
4796         int ret = 0;
4797         bool indicator_disp;
4798         pkgmgrinfo_appinfo_h handle;
4799         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4800         if (ret != PMINFO_R_OK)
4801                 return -1;
4802         ret = pkgmgrinfo_appinfo_is_indicator_display_allowed(handle, &indicator_disp);
4803         if (ret != PMINFO_R_OK){
4804                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4805                 return -1;
4806         }
4807         printf("app indicator disp : %d\n", indicator_disp);
4808         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4809         return 0;
4810 }
4811  * @endcode
4812  */
4813 int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp);
4814
4815 /**
4816  * @fn int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h handle, bool *taskmanage)
4817  * @brief       This API gets the application 'taskmanage' value from the app ID
4818  *
4819  * @par         This API is for package-manager client application
4820  * @par Sync (or) Async : Synchronous API
4821  *
4822  * @param[in]   handle  pointer to application info handle
4823  * @param[out] taskmanage               pointer to hold package taskmanage value
4824  * @return      0 if success, error code(<0) if fail
4825  * @retval      PMINFO_R_OK     success
4826  * @retval      PMINFO_R_EINVAL invalid argument
4827  * @retval      PMINFO_R_ERROR  internal error
4828  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4829  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4830  * @see         pkgmgrinfo_appinfo_get_appid()
4831  * @see         pkgmgrinfo_appinfo_is_multiple()
4832  * @code
4833 static int get_app_taskmanage(const char *appid)
4834 {
4835         int ret = 0;
4836         bool taskmanage;
4837         pkgmgrinfo_appinfo_h handle;
4838         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4839         if (ret != PMINFO_R_OK)
4840                 return -1;
4841         ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &taskmanage);
4842         if (ret != PMINFO_R_OK) {
4843                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4844                 return -1;
4845         }
4846         printf("app taskmanage: %d\n", taskmanage);
4847         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4848         return 0;
4849 }
4850  * @endcode
4851  */
4852 int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h  handle, bool *taskmanage);
4853
4854 /**
4855  * @fn int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h handle, bool *enabled)
4856  * @brief       This API gets the application 'taskmanage' value from the app ID
4857  *
4858  * @par         This API is for package-manager client application
4859  * @par Sync (or) Async : Synchronous API
4860  *
4861  * @param[in]   handle  pointer to application info handle
4862  * @param[out] enabled          pointer to hold package enabled value
4863  * @return      0 if success, error code(<0) if fail
4864  * @retval      PMINFO_R_OK     success
4865  * @retval      PMINFO_R_EINVAL invalid argument
4866  * @retval      PMINFO_R_ERROR  internal error
4867  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4868  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4869  * @see         pkgmgrinfo_appinfo_get_appid()
4870  * @see         pkgmgrinfo_appinfo_is_multiple()
4871  * @code
4872 static int get_app_enabled(const char *appid)
4873 {
4874         int ret = 0;
4875         bool enabled;
4876         pkgmgrinfo_appinfo_h handle;
4877         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4878         if (ret != PMINFO_R_OK)
4879                 return -1;
4880         ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &enabled);
4881         if (ret != PMINFO_R_OK) {
4882                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4883                 return -1;
4884         }
4885         printf("app enabled: %d\n", enabled);
4886         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4887         return 0;
4888 }
4889  * @endcode
4890  */
4891 int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h  handle, bool *enabled);
4892
4893 /**
4894  * @fn int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h handle, bool *onboot)
4895  * @brief       This API gets the application 'onboot' value from the app ID
4896  *
4897  * @par         This API is for package-manager client application
4898  * @par Sync (or) Async : Synchronous API
4899  *
4900  * @param[in]   handle  pointer to application info handle
4901  * @param[out] onboot           pointer to hold package onboot value
4902  * @return      0 if success, error code(<0) if fail
4903  * @retval      PMINFO_R_OK     success
4904  * @retval      PMINFO_R_EINVAL invalid argument
4905  * @retval      PMINFO_R_ERROR  internal error
4906  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4907  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4908  * @see         pkgmgrinfo_appinfo_get_appid()
4909  * @see         pkgmgrinfo_appinfo_is_multiple()
4910  * @code
4911 static int get_app_onboot(const char *appid)
4912 {
4913         int ret = 0;
4914         bool onboot;
4915         pkgmgrinfo_appinfo_h handle;
4916         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4917         if (ret != PMINFO_R_OK)
4918                 return -1;
4919         ret = pkgmgrinfo_appinfo_is_onboot(handle, &onboot);
4920         if (ret != PMINFO_R_OK) {
4921                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4922                 return -1;
4923         }
4924         printf("app onboot: %d\n", onboot);
4925         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4926         return 0;
4927 }
4928  * @endcode
4929  */
4930 int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h  handle, bool *onboot);
4931
4932 /**
4933  * @fn int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h handle, bool *autorestart)
4934  * @brief       This API gets the application 'autorestart' value from the app ID
4935  *
4936  * @par         This API is for package-manager client application
4937  * @par Sync (or) Async : Synchronous API
4938  *
4939  * @param[in]   handle  pointer to application info handle
4940  * @param[out] autorestart              pointer to hold package autorestart value
4941  * @return      0 if success, error code(<0) if fail
4942  * @retval      PMINFO_R_OK     success
4943  * @retval      PMINFO_R_EINVAL invalid argument
4944  * @retval      PMINFO_R_ERROR  internal error
4945  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4946  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4947  * @see         pkgmgrinfo_appinfo_get_appid()
4948  * @see         pkgmgrinfo_appinfo_is_multiple()
4949  * @code
4950 static int get_app_autorestart(const char *appid)
4951 {
4952         int ret = 0;
4953         bool autorestart;
4954         pkgmgrinfo_appinfo_h handle;
4955         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4956         if (ret != PMINFO_R_OK)
4957                 return -1;
4958         ret = pkgmgrinfo_appinfo_is_autorestart(handle, &autorestart);
4959         if (ret != PMINFO_R_OK) {
4960                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
4961                 return -1;
4962         }
4963         printf("app autorestart: %d\n", autorestart);
4964         pkgmgrinfo_appinfo_destroy_appinfo(handle);
4965         return 0;
4966 }
4967  * @endcode
4968  */
4969 int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h  handle, bool *autorestart);
4970
4971 /**
4972  * @fn int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainapp)
4973  * @brief       This API gets the value for given application is main app or not from handle
4974  *
4975  * @par         This API is for package-manager client application
4976  * @par Sync (or) Async : Synchronous API
4977  *
4978  * @param[in]   handle  pointer to application info handle
4979  * @param[out] mainapp          pointer to hold package mainapp is or not
4980  * @return      0 if success, error code(<0) if fail
4981  * @retval      PMINFO_R_OK     success
4982  * @retval      PMINFO_R_EINVAL invalid argument
4983  * @retval      PMINFO_R_ERROR  internal error
4984  * @pre         pkgmgrinfo_appinfo_get_appinfo()
4985  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
4986  * @see         pkgmgrinfo_appinfo_get_appid()
4987  * @see         pkgmgrinfo_appinfo_is_multiple()
4988  * @code
4989 static int get_app_mainapp(const char *appid)
4990 {
4991         int ret = 0;
4992         bool mainapp;
4993         pkgmgrinfo_appinfo_h handle;
4994         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
4995         if (ret != PMINFO_R_OK)
4996                 return -1;
4997         ret = pkgmgrinfo_appinfo_is_mainapp(handle, &mainapp);
4998         if (ret != PMINFO_R_OK) {
4999                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5000                 return -1;
5001         }
5002         printf("mainapp: %d\n", mainapp);
5003         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5004         return 0;
5005 }
5006  * @endcode
5007  */
5008 int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainapp);
5009
5010
5011 /**
5012  * @fn int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload)
5013  * @brief       This API gets the value for given application is preload or not from handle
5014  *
5015  * @par         This API is for package-manager client application
5016  * @par Sync (or) Async : Synchronous API
5017  *
5018  * @param[in]   handle  pointer to application info handle
5019  * @param[out] preload          pointer to hold preload is or not
5020  * @return      0 if success, error code(<0) if fail
5021  * @retval      PMINFO_R_OK     success
5022  * @retval      PMINFO_R_EINVAL invalid argument
5023  * @retval      PMINFO_R_ERROR  internal error
5024  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5025  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5026  * @see         pkgmgrinfo_appinfo_get_appid()
5027  * @see         pkgmgrinfo_appinfo_is_multiple()
5028  * @code
5029 static int get_app_preload(const char *appid)
5030 {
5031         int ret = 0;
5032         bool preload = 0;
5033         pkgmgrinfo_appinfo_h handle = NULL;
5034         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5035         if (ret != PMINFO_R_OK)
5036                 return -1;
5037         ret = pkgmgrinfo_appinfo_is_preload(handle, &preload);
5038         if (ret != PMINFO_R_OK) {
5039                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5040                 return -1;
5041         }
5042         printf("preload: %d\n", preload);
5043         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5044         return 0;
5045 }
5046  * @endcode
5047  */
5048 int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload);
5049
5050 /**
5051  * @fn int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode)
5052  * @brief       This API gets the value for given application is submode or not from handle
5053  *
5054  * @par         This API is for package-manager client application
5055  * @par Sync (or) Async : Synchronous API
5056  *
5057  * @param[in]   handle  pointer to application info handle
5058  * @param[out] submode          pointer to hold submode is or not
5059  * @return      0 if success, error code(<0) if fail
5060  * @retval      PMINFO_R_OK     success
5061  * @retval      PMINFO_R_EINVAL invalid argument
5062  * @retval      PMINFO_R_ERROR  internal error
5063  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5064  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5065  * @see         pkgmgrinfo_appinfo_get_appid()
5066  * @see         pkgmgrinfo_appinfo_is_multiple()
5067  * @code
5068 static int get_app_submode(const char *appid)
5069 {
5070         int ret = 0;
5071         bool submode = 0;
5072         pkgmgrinfo_appinfo_h handle = NULL;
5073         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5074         if (ret != PMINFO_R_OK)
5075                 return -1;
5076         ret = pkgmgrinfo_appinfo_is_submode(handle, &submode);
5077         if (ret != PMINFO_R_OK) {
5078                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5079                 return -1;
5080         }
5081         printf("submode: %d\n", submode);
5082         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5083         return 0;
5084 }
5085  * @endcode
5086  */
5087 int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode);
5088
5089 /**
5090  * @fn int int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *process_pool)
5091  * @brief       This API gets the value for given application is process_pool or not from handle
5092  *
5093  * @par         This API is for package-manager client application
5094  * @par Sync (or) Async : Synchronous API
5095  *
5096  * @param[in]   handle  pointer to application info handle
5097  * @param[out] process_pool             pointer to hold process_pool is or not
5098  * @return      0 if success, error code(<0) if fail
5099  * @retval      PMINFO_R_OK     success
5100  * @retval      PMINFO_R_EINVAL invalid argument
5101  * @retval      PMINFO_R_ERROR  internal error
5102  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5103  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5104  * @see         pkgmgrinfo_appinfo_get_appid()
5105  * @code
5106 static int get_app_process_pool(const char *appid)
5107 {
5108         int ret = 0;
5109         bool process_pool = 0;
5110         pkgmgrinfo_appinfo_h handle = NULL;
5111         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5112         if (ret != PMINFO_R_OK)
5113                 return -1;
5114         ret = pkgmgrinfo_appinfo_is_process_pool(handle, &process_pool);
5115         if (ret != PMINFO_R_OK) {
5116                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5117                 return -1;
5118         }
5119         printf("process_pool: %d\n", process_pool);
5120         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5121         return 0;
5122 }
5123  * @endcode
5124  */
5125 int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *process_pool);
5126
5127 /**
5128  * @fn int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_installed_storage *storage)
5129  * @brief       This API gets the installed storage location of the application
5130  *
5131  * @par This API is for package-manager client application
5132  * @par Sync (or) Async : Synchronous API
5133  *
5134  * @param[in] handle            pointer to the application info handle.
5135  * @param[out] app_type         pointer to hold installed storage location
5136  * @return      0 if success, error code(<0) if fail
5137  * @retval      PMINFO_R_OK success
5138  * @retval      PMINFO_R_EINVAL invalid argument
5139  * @retval      PMINFO_R_ERROR  internal error
5140  * @pre pkgmgrinfo_appinfo_get_appinfo()
5141  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
5142  * @see pkgmgrinfo_appinfo_get_appid()
5143  * @code
5144 static int get_app_installed_location(const char *appid)
5145 {
5146         int ret = 0;
5147         pkgmgrinfo_installed_storage storage;
5148         pkgmgrinfo_appinfo_h handle = NULL;
5149         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5150         if (ret != PMINFO_R_OK)
5151                 return -1;
5152         ret = pkgmgrinfo_appinfo_get_installed_storage_location(handle, &storage);
5153         if (ret != PMINFO_R_OK) {
5154                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5155                 return -1;
5156         }
5157         printf("Installed storage location : %d\n", storage);
5158         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5159         return 0;
5160 }
5161  * @endcode
5162  */
5163 int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_installed_storage *storage);
5164
5165
5166 /**
5167  * @fn int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
5168  * @brief       This API checks if the application has the given category
5169  *
5170  * @par         This API is for package-manager client application
5171  * @par Sync (or) Async : Synchronous API
5172  *
5173  * @param[in]   handle  pointer to the application info handle
5174  * @param[in]   category        category
5175  * @param[out] exist            value Gets whether the application has the given category
5176  * @return      0 if success, error code(<0) if fail
5177  * @retval      PMINFO_R_OK     success
5178  * @retval      PMINFO_R_EINVAL invalid argument
5179  * @retval      PMINFO_R_ERROR  internal error
5180  * @code
5181 static int is_category_exist(const char *appid, const char *category)
5182 {
5183         int ret = 0;
5184         pkgmgrinfo_appinfo_h handle;
5185         bool exist = false;
5186
5187         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5188         if (ret != PMINFO_R_OK)
5189                 return -1;
5190
5191         ret = pkgmgrinfo_appinfo_is_category_exist(handle, category, &exist);
5192         if (ret != PMINFO_R_OK) {
5193                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5194                 return -1;
5195         }
5196
5197         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5198         return 0;
5199 }
5200  * @endcode
5201  */
5202 int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist);
5203
5204 /**
5205  * @fn int pkgmgrinfo_appinfo_is_ui_gadget(pkgmgrinfo_appinfo_h handle, bool *ui_gadget)
5206  * @brief       This API gets the application 'ui_gadget' value from the app ID
5207  *
5208  * @par         This API is for package-manager client application
5209  * @par Sync (or) Async : Synchronous API
5210  *
5211  * @param[in]   handle  pointer to application info handle
5212  * @param[out]  ui_gadget       pointer to hold package ui_gadget value
5213  * @return      0 if success, error code(<0) if fail
5214  * @retval      PMINFO_R_OK     success
5215  * @retval      PMINFO_R_EINVAL invalid argument
5216  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5217  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
5218  * @code
5219 static int get_app_ui_gadget(const char *appid)
5220 {
5221         int ret = 0;
5222         bool ui_gadget;
5223         pkgmgrinfo_appinfo_h handle = NULL;
5224         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5225         if (ret != PMINFO_R_OK)
5226                 return -1;
5227         ret = pkgmgrinfo_appinfo_is_ui_gadget(handle, &ui_gadget);
5228         if (ret != PMINFO_R_OK) {
5229                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5230                 return -1;
5231         }
5232         printf("app ui_gadget: %d\n", ui_gadget);
5233         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5234         return 0;
5235 }
5236  * @endcode
5237  */
5238 int pkgmgrinfo_appinfo_is_ui_gadget(pkgmgrinfo_appinfo_h handle, bool *ui_gadget);
5239
5240 /**
5241  * @fn int pkgmgrinfo_appinfo_is_support_disable(pkgmgrinfo_appinfo_h handle, bool *support_disable)
5242  * @brief       This API gets the application 'support_disable' value from the app ID
5243  *
5244  * @par         This API is for package-manager client application
5245  * @par Sync (or) Async : Synchronous API
5246  *
5247  * @param[in]   handle  pointer to application info handle
5248  * @param[out]  support_disable pointer to hold package support_disable value
5249  * @return      0 if success, error code(<0) if fail
5250  * @retval      PMINFO_R_OK     success
5251  * @retval      PMINFO_R_EINVAL invalid argument
5252  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5253  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
5254  * @code
5255 static int get_app_support_disable(const char *appid)
5256 {
5257         int ret = 0;
5258         bool support_disable;
5259         pkgmgrinfo_appinfo_h handle = NULL;
5260         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5261         if (ret != PMINFO_R_OK)
5262                 return -1;
5263         ret = pkgmgrinfo_appinfo_is_support_disable(handle, &support_disable);
5264         if (ret != PMINFO_R_OK) {
5265                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5266                 return -1;
5267         }
5268         printf("app support_disable: %d\n", support_disable);
5269         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5270         return 0;
5271 }
5272  * @endcode
5273  */
5274 int pkgmgrinfo_appinfo_is_support_disable(pkgmgrinfo_appinfo_h handle, bool *support_disable);
5275
5276 /**
5277  * @fn int pkgmgrinfo_appinfo_is_removable(pkgmgrinfo_appinfo_h handle, bool *removable)
5278  * @brief       This API gets the application 'removable' value from the app ID
5279  *
5280  * @par         This API is for package-manager client application
5281  * @par Sync (or) Async : Synchronous API
5282  *
5283  * @param[in]   handle  pointer to application info handle
5284  * @param[out]  removable       pointer to hold package removable value
5285  * @return      0 if success, error code(<0) if fail
5286  * @retval      PMINFO_R_OK     success
5287  * @retval      PMINFO_R_EINVAL invalid argument
5288  * @retval      PMINFO_R_ERROR  internal error
5289  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5290  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5291  * @see         pkgmgrinfo_appinfo_get_appid()
5292  * @code
5293 static int get_app_removable(const char *appid)
5294 {
5295         int ret = 0;
5296         bool removable;
5297         pkgmgrinfo_appinfo_h handle = NULL;
5298         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5299         if (ret != PMINFO_R_OK)
5300                 return -1;
5301         ret = pkgmgrinfo_appinfo_is_removable(handle, &removable);
5302         if (ret != PMINFO_R_OK) {
5303                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5304                 return -1;
5305         }
5306         printf("app removable: %d\n", removable);
5307         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5308         return 0;
5309 }
5310  * @endcode
5311  */
5312 int pkgmgrinfo_appinfo_is_removable(pkgmgrinfo_appinfo_h handle, bool *removable);
5313
5314 /**
5315  * @fn int pkgmgrinfo_appinfo_is_system(pkgmgrinfo_appinfo_h handle, bool *system)
5316  * @brief       This API gets the application 'system' value from the app ID
5317  *
5318  * @par         This API is for package-manager client application
5319  * @par Sync (or) Async : Synchronous API
5320  *
5321  * @param[in]   handle  pointer to application info handle
5322  * @param[out]  system  pointer to hold package system value
5323  * @return      0 if success, error code(<0) if fail
5324  * @retval      PMINFO_R_OK     success
5325  * @retval      PMINFO_R_EINVAL invalid argument
5326  * @retval      PMINFO_R_ERROR  internal error
5327  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5328  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5329  * @see         pkgmgrinfo_appinfo_get_appid()
5330  * @code
5331 static int get_app_system(const char *appid)
5332 {
5333         int ret = 0;
5334         bool system = false;
5335         pkgmgrinfo_appinfo_h handle = NULL;
5336         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5337         if (ret != PMINFO_R_OK)
5338                 return -1;
5339         ret = pkgmgrinfo_appinfo_is_system(handle, &system);
5340         if (ret != PMINFO_R_OK) {
5341                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5342                 return -1;
5343         }
5344         printf("app system: %d\n", system);
5345         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5346         return 0;
5347 }
5348  * @endcode
5349  */
5350 int pkgmgrinfo_appinfo_is_system(pkgmgrinfo_appinfo_h handle, bool *system);
5351
5352
5353 /**
5354  * @fn int pkgmgrinfo_appinfo_is_disabled(pkgmgrinfo_appinfo_h handle, bool *disabled)
5355  * @brief       This API gets the application 'is_disable' value from the app ID
5356  *
5357  * @par         This API is for package-manager client application
5358  * @par Sync (or) Async : Synchronous API
5359  *
5360  * @param[in]   handle  pointer to application info handle
5361  * @param[out]  disabled        pointer to hold application is_disabled value
5362  * @return      0 if success, error code(<0) if fail
5363  * @retval      PMINFO_R_OK     success
5364  * @retval      PMINFO_R_EINVAL invalid argument
5365  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5366  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
5367  * @code
5368 static int get_app_is_disable(const char *appid)
5369 {
5370         int ret = 0;
5371         bool is_disable;
5372         pkgmgrinfo_appinfo_h handle = NULL;
5373         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5374         if (ret != PMINFO_R_OK)
5375                 return -1;
5376         ret = pkgmgrinfo_appinfo_is_disabled(handle, &is_disable);
5377         if (ret != PMINFO_R_OK) {
5378                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5379                 return -1;
5380         }
5381         printf("app is_disable: %d\n", is_disable);
5382         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5383         return 0;
5384 }
5385  * @endcode
5386  */
5387 int pkgmgrinfo_appinfo_is_disabled(pkgmgrinfo_appinfo_h handle, bool *disabled);
5388
5389 /**
5390  * @fn int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global)
5391  * @brief       This API gets whether the given application is global application or user application
5392  *
5393  * @par         This API is for package-manager client application
5394  * @par Sync (or) Async : Synchronous API
5395  *
5396  * @param[in]   handle  pointer to application info handle
5397  * @param[in]   global  pointer to hold application global value
5398  * @return      0 if success, error code(<0) if fail
5399  * @retval      PMINFO_R_OK     success
5400  * @retval      PMINFO_R_EINVAL invalid argument
5401  * @retval      PMINFO_R_ERROR  internal error
5402  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5403  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
5404  * @see         pkgmgrinfo_appinfo_get_appid()
5405  static int get_app_is_global(const char *appid)
5406  {
5407          int ret = 0;
5408          bool global;
5409          pkgmgrinfo_appinfo_h handle = NULL;
5410          ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5411          if (ret != PMINFO_R_OK)
5412                  return -1;
5413          ret = pkgmgrinfo_appinfo_is_global(handle, &global);
5414          if (ret != PMINFO_R_OK) {
5415                  pkgmgrinfo_appinfo_destroy_appinfo(handle);
5416                  return -1;
5417          }
5418          printf("app is_global: %d\n", global);
5419          pkgmgrinfo_appinfo_destroy_appinfo(handle);
5420          return 0;
5421  }
5422   * @endcode
5423   */
5424 int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global);
5425
5426 /**
5427  * @fn int pkgmgrinfo_appinfo_get_splash_screen_display(pkgmgrinfo_appinfo_h handle, bool *splash_screen_display)
5428  * @brief       This API gets the application 'splash_screen_display' value from the app ID
5429  *
5430  * @par         This API is for package-manager client application
5431  * @par Sync (or) Async : Synchronous API
5432  *
5433  * @param[in]   handle          pointer to application info handle
5434  * @param[out]  splash_screen_display   pointer to hold package splash_screen_display value
5435  * @return      0 if success, error code(<0) if fail
5436  * @retval      PMINFO_R_OK     success
5437  * @retval      PMINFO_R_EINVAL invalid argument
5438  * @retval      PMINFO_R_ERROR  internal error
5439  */
5440 int pkgmgrinfo_appinfo_get_splash_screen_display(pkgmgrinfo_appinfo_h handle, bool *splash_screen_display);
5441
5442 /**
5443  * @fn int pkgmgrinfo_appinfo_get_setup_appid(pkgmgrinfo_appinfo_h handle, char **setup_appid)
5444  * @brief       This API gets the application 'setup_appid' value from the app ID
5445  *
5446  * @par         This API is for package-manager client application
5447  * @par Sync (or) Async : Synchronous API
5448  *
5449  * @param[in]   handle          pointer to application info handle
5450  * @param[out]  setup_appid     pointer to hold package setup_appid value
5451  * @return      0 if success, error code(<0) if fail
5452  * @retval      PMINFO_R_OK     success
5453  * @retval      PMINFO_R_EINVAL invalid argument
5454  * @retval      PMINFO_R_ERROR  internal error
5455  */
5456 int pkgmgrinfo_appinfo_get_setup_appid(pkgmgrinfo_appinfo_h handle, char **setup_appid);
5457
5458 /**
5459  * @fn int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle, bool *support_ambient)
5460  * @brief       This API gets the application 'support_ambient' value from the app ID
5461  *
5462  * @par         This API is for package-manager client application
5463  * @par Sync (or) Async : Synchronous API
5464  *
5465  * @param[in]   handle          pointer to application info handle
5466  * @param[out]  support_ambient pointer to hold package support_ambient value
5467  * @return      0 if success, error code(<0) if fail
5468  * @retval      PMINFO_R_OK     success
5469  * @retval      PMINFO_R_EINVAL invalid argument
5470  * @retval      PMINFO_R_ERROR  internal error
5471  */
5472 int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle, bool *support_ambient);
5473
5474 /**
5475  * @fn int pkgmgrinfo_appinfo_get_light_user_switch_mode(pkgmgrinfo_appinfo_h handle, char *mode)
5476  * @brief       This API gets the application 'light_user_switch_mode' value from the app ID
5477  *
5478  * @par         This API is for package-manager client application
5479  * @par Sync (or) Async : Synchronous API
5480  *
5481  * @param[in]   handle          pointer to application info handle
5482  * @param[out]  mode    pointer to hold package light_user_switch_mode value
5483  * @return      0 if success, error code(<0) if fail
5484  * @retval      PMINFO_R_OK     success
5485  * @retval      PMINFO_R_EINVAL invalid argument
5486  * @retval      PMINFO_R_ERROR  internal error
5487  */
5488 int pkgmgrinfo_appinfo_get_light_user_switch_mode(pkgmgrinfo_appinfo_h handle, char **mode);
5489
5490 /**
5491  * @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
5492  * @brief       This API destroys the application information handle freeing up all the resources
5493  *
5494  * @par         This API is for package-manager client application
5495  * @par Sync (or) Async : Synchronous API
5496  *
5497  * @param[in] handle            pointer to the application info handle.
5498  * @return      0 if success, error code(<0) if fail
5499  * @retval      PMINFO_R_OK     success
5500  * @retval      PMINFO_R_EINVAL invalid argument
5501  * @retval      PMINFO_R_ERROR  internal error
5502  * @pre         pkgmgrinfo_appinfo_get_appinfo()
5503  * @post                None
5504  * @see         pkgmgrinfo_appinfo_get_pkgid()
5505  * @see         pkgmgrinfo_appinfo_is_multiple()
5506  * @code
5507 static int get_app_type(const char *appid)
5508 {
5509         int ret = 0;
5510         char *type = NULL;
5511         pkgmgrinfo_appinfo_h handle;
5512         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
5513         if (ret != PMINFO_R_OK)
5514                 return -1;
5515         ret = pkgmgrinfo_appinfo_get_apptype(handle, &type);
5516         if (ret != PMINFO_R_OK) {
5517                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
5518                 return -1;
5519         }
5520         printf("apptype: %s\n", type);
5521         pkgmgrinfo_appinfo_destroy_appinfo(handle);
5522         return 0;
5523 }
5524  * @endcode
5525  */
5526 int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h  handle);
5527
5528 /**
5529  * @fn int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle)
5530  * @brief       This API creates the application information filter handle from db.  All filter properties will be ANDed.
5531  The query will search the entire application information collected from the manifest file of all the installed packages
5532  *
5533  * @par         This API is for package-manager client application
5534  * @par Sync (or) Async : Synchronous API
5535  *
5536  * @param[out] handle           pointer to the application info filter handle.
5537  * @return      0 if success, error code(<0) if fail
5538  * @retval      PMINFO_R_OK     success
5539  * @retval      PMINFO_R_EINVAL invalid argument
5540  * @retval      PMINFO_R_ERROR  internal error
5541  * @pre         None
5542  * @post                pkgmgrinfo_appinfo_filter_destroy()
5543  * @see         pkgmgrinfo_appinfo_filter_count()
5544  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
5545  * @code
5546 static int get_capp_count()
5547 {
5548         int ret = 0;
5549         int count = 0;
5550         pkgmgrinfo_appinfo_filter_h handle;
5551         ret = pkgmgrinfo_appinfo_filter_create(&handle);
5552         if (ret != PMINFO_R_OK)
5553                 return -1;
5554         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
5555         if (ret != PMINFO_R_OK) {
5556                 pkgmgrinfo_appinfo_filter_destroy(handle);
5557                 return -1;
5558         }
5559         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
5560         if (ret != PMINFO_R_OK) {
5561                 pkgmgrinfo_appinfo_filter_destroy(handle);
5562                 return -1;
5563         }
5564         printf("No of capp: %d\n", count);
5565         pkgmgrinfo_appinfo_filter_destroy(handle);
5566         return 0;
5567 }
5568  * @endcode
5569  */
5570 int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle);
5571
5572 /**
5573  * @fn int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle)
5574  * @brief       This API destroys the application information filter handle freeing up all the resources
5575  *
5576  * @par         This API is for package-manager client application
5577  * @par Sync (or) Async : Synchronous API
5578  *
5579  * @param[in] handle            pointer to the application info filter handle.
5580  * @return      0 if success, error code(<0) if fail
5581  * @retval      PMINFO_R_OK     success
5582  * @retval      PMINFO_R_EINVAL invalid argument
5583  * @retval      PMINFO_R_ERROR  internal error
5584  * @pre         pkgmgrinfo_appinfo_filter_create()
5585  * @post                None
5586  * @see         pkgmgrinfo_appinfo_filter_count()
5587  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
5588  * @code
5589 static int get_capp_count()
5590 {
5591         int ret = 0;
5592         int count = 0;
5593         pkgmgrinfo_appinfo_filter_h handle;
5594         ret = pkgmgrinfo_appinfo_filter_create(&handle);
5595         if (ret != PMINFO_R_OK)
5596                 return -1;
5597         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
5598         if (ret != PMINFO_R_OK) {
5599                 pkgmgrinfo_appinfo_filter_destroy(handle);
5600                 return -1;
5601         }
5602         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
5603         if (ret != PMINFO_R_OK) {
5604                 pkgmgrinfo_appinfo_filter_destroy(handle);
5605                 return -1;
5606         }
5607         printf("No of capp: %d\n", count);
5608         pkgmgrinfo_appinfo_filter_destroy(handle);
5609         return 0;
5610 }
5611  * @endcode
5612  */
5613 int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle);
5614
5615 /**
5616  * @fn int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle, const char *property, const bool value)
5617  * @brief       This API adds a boolean filter property to the filter handle
5618  *
5619  * @par         This API is for package-manager client application
5620  * @par Sync (or) Async : Synchronous API
5621  *
5622  * @param[in] handle            pointer to the application info filter handle.
5623  * @param[in] property          boolean property name.
5624  * @param[in] value             value corresponding to the property.
5625  * @return      0 if success, error code(<0) if fail
5626  * @retval      PMINFO_R_OK     success
5627  * @retval      PMINFO_R_EINVAL invalid argument
5628  * @retval      PMINFO_R_ERROR  internal error
5629  * @pre         pkgmgrinfo_appinfo_filter_create()
5630  * @post                pkgmgrinfo_appinfo_filter_destroy()
5631  * @see         pkgmgrinfo_appinfo_filter_count()
5632  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
5633  * @code
5634 static int get_taskmanageable_app_count()
5635 {
5636         int ret = 0;
5637         int count = 0;
5638         pkgmgrinfo_appinfo_filter_h handle;
5639         ret = pkgmgrinfo_appinfo_filter_create(&handle);
5640         if (ret != PMINFO_R_OK)
5641                 return -1;
5642         ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_TASKMANAGE, 1);
5643         if (ret != PMINFO_R_OK) {
5644                 pkgmgrinfo_appinfo_filter_destroy(handle);
5645                 return -1;
5646         }
5647         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
5648         if (ret != PMINFO_R_OK) {
5649                 pkgmgrinfo_appinfo_filter_destroy(handle);
5650                 return -1;
5651         }
5652         printf("No of taskmanageable apps: %d\n", count);
5653         pkgmgrinfo_appinfo_filter_destroy(handle);
5654         return 0;
5655 }
5656  * @endcode
5657  */
5658 int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
5659                 const char *property, const bool value);
5660
5661 /**
5662  * @fn int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle, const char *property, const int value)
5663  * @brief       This API adds an integer filter property to the filter handle
5664  *
5665  * @par         This API is for package-manager client application
5666  * @par Sync (or) Async : Synchronous API
5667  *
5668  * @param[in] handle            pointer to the application info filter handle.
5669  * @param[in] property          integer property name.
5670  * @param[in] value             value corresponding to the property.
5671  * @return      0 if success, error code(<0) if fail
5672  * @retval      PMINFO_R_OK     success
5673  * @retval      PMINFO_R_EINVAL invalid argument
5674  * @retval      PMINFO_R_ERROR  internal error
5675  * @pre         pkgmgrinfo_appinfo_filter_create()
5676  * @post                pkgmgrinfo_appinfo_filter_destroy()
5677  * @see         pkgmgrinfo_appinfo_filter_count()
5678  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
5679  * @code
5680 static int get_taskmanageable_app_count()
5681 {
5682         int ret = 0;
5683         int count = 0;
5684         pkgmgrinfo_appinfo_filter_h handle;
5685         ret = pkgmgrinfo_appinfo_filter_create(&handle);
5686         if (ret != PMINFO_R_OK)
5687                 return -1;
5688         ret = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_XXX, 10);
5689         if (ret != PMINFO_R_OK) {
5690                 pkgmgrinfo_appinfo_filter_destroy(handle);
5691                 return -1;
5692         }
5693         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
5694         if (ret != PMINFO_R_OK) {
5695                 pkgmgrinfo_appinfo_filter_destroy(handle);
5696                 return -1;
5697         }
5698         printf("No of apps: %d\n", count);
5699         pkgmgrinfo_appinfo_filter_destroy(handle);
5700         return 0;
5701 }
5702  * @endcode
5703  */
5704 int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
5705                 const char *property, const int value);
5706
5707 /**
5708  * @fn int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle, const char *property, const char *value)
5709  * @brief       This API adds a string filter property to the filter handle
5710  *
5711  * @par         This API is for package-manager client application
5712  * @par Sync (or) Async : Synchronous API
5713  *
5714  * @param[in] handle            pointer to the application info filter handle.
5715  * @param[in] property          string property name.
5716  * @param[in] value             value corresponding to the property.
5717  * @return      0 if success, error code(<0) if fail
5718  * @retval      PMINFO_R_OK     success
5719  * @retval      PMINFO_R_EINVAL invalid argument
5720  * @retval      PMINFO_R_ERROR  internal error
5721  * @pre         pkgmgrinfo_appinfo_filter_create()
5722  * @post                pkgmgrinfo_appinfo_filter_destroy()
5723  * @see         pkgmgrinfo_appinfo_filter_count()
5724  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
5725  * @code
5726 static int get_capp_count()
5727 {
5728         int ret = 0;
5729         int count = 0;
5730         pkgmgrinfo_appinfo_filter_h handle;
5731         ret = pkgmgrinfo_appinfo_filter_create(&handle);
5732         if (ret != PMINFO_R_OK)
5733                 return -1;
5734         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
5735         if (ret != PMINFO_R_OK) {
5736                 pkgmgrinfo_appinfo_filter_destroy(handle);
5737                 return -1;
5738         }
5739         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
5740         if (ret != PMINFO_R_OK) {
5741                 pkgmgrinfo_appinfo_filter_destroy(handle);
5742                 return -1;
5743         }
5744         printf("No of capp: %d\n", count);
5745         pkgmgrinfo_appinfo_filter_destroy(handle);
5746         return 0;
5747 }
5748  * @endcode
5749  */
5750 int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
5751                 const char *property, const char *value);
5752
5753 /**
5754  * @fn int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle, pkgmgrinfo_app_list_cb app_cb, void *user_data)
5755  * @brief       This API executes the user supplied callback function for each application that satisfy the filter conditions
5756  *
5757  * @par         This API is for package-manager client application
5758  * @par Sync (or) Async : Synchronous API
5759  *
5760  * @param[in] handle            pointer to the application info filter handle.
5761  * @param[in] app_cb            callback function.
5762  * @param[in] user_data         user data to be passed to the callback function
5763  * @return      0 if success, error code(<0) if fail
5764  * @retval      PMINFO_R_OK     success
5765  * @retval      PMINFO_R_EINVAL invalid argument
5766  * @retval      PMINFO_R_ERROR  internal error
5767  * @pre         pkgmgrinfo_appinfo_filter_create()
5768  * @post                pkgmgrinfo_appinfo_filter_destroy()
5769  * @see         pkgmgrinfo_appinfo_filter_count()
5770  * @code
5771 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
5772 {
5773         char *appid = NULL;
5774         pkgmgrinfo_appinfo_get_appid(handle, &appid);
5775         printf("appid : %s\n", appid);
5776         return 0;
5777 }
5778
5779 static int get_capp_list()
5780 {
5781         int ret = 0;
5782         pkgmgrinfo_appinfo_filter_h handle;
5783         ret = pkgmgrinfo_appinfo_filter_create(&handle);
5784         if (ret != PMINFO_R_OK)
5785                 return -1;
5786         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
5787         if (ret != PMINFO_R_OK) {
5788                 pkgmgrinfo_appinfo_filter_destroy(handle);
5789                 return -1;
5790         }
5791         ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, app_list_cb, NULL);
5792         if (ret != PMINFO_R_OK) {
5793                 pkgmgrinfo_appinfo_filter_destroy(handle);
5794                 return -1;
5795         }
5796         pkgmgrinfo_appinfo_filter_destroy(handle);
5797         return 0;
5798 }
5799  * @endcode
5800  */
5801 int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
5802                 pkgmgrinfo_app_list_cb app_cb, void *user_data);
5803 int pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
5804                 pkgmgrinfo_app_list_cb app_cb, void *user_data, uid_t uid);
5805
5806 /**
5807  * @fn int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count)
5808  * @fn int pkgmgrinfo_appinfo_usr_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count, uid_t uid)
5809  * @brief       This API counts the application that satisfy the filter conditions
5810  *
5811  * @par         This API is for package-manager client application
5812  * @par Sync (or) Async : Synchronous API
5813  *
5814  * @param[in] handle            pointer to the application info filter handle.
5815  * @param[in] count             pointer to store count value
5816  * @param[in]   uid     the addressee user id of the instruction
5817  * @return      0 if success, error code(<0) if fail
5818  * @retval      PMINFO_R_OK     success
5819  * @retval      PMINFO_R_EINVAL invalid argument
5820  * @retval      PMINFO_R_ERROR  internal error
5821  * @pre         pkgmgrinfo_appinfo_filter_create()
5822  * @post                pkgmgrinfo_appinfo_filter_destroy()
5823  * @see         pkgmgrinfo_appinfo_filter_foreach_appinfo()
5824  * @code
5825 static int get_capp_count()
5826 {
5827         int ret = 0;
5828         int count = 0;
5829         pkgmgrinfo_appinfo_filter_h handle;
5830         ret = pkgmgrinfo_appinfo_filter_create(&handle);
5831         if (ret != PMINFO_R_OK)
5832                 return -1;
5833         ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_TYPE, "capp");
5834         if (ret != PMINFO_R_OK) {
5835                 pkgmgrinfo_appinfo_filter_destroy(handle);
5836                 return -1;
5837         }
5838         ret = pkgmgrinfo_appinfo_filter_count(handle, &count);
5839         if (ret != PMINFO_R_OK) {
5840                 pkgmgrinfo_appinfo_filter_destroy(handle);
5841                 return -1;
5842         }
5843         printf("No of capp: %d\n", count);
5844         pkgmgrinfo_appinfo_filter_destroy(handle);
5845         return 0;
5846 }
5847  * @endcode
5848  */
5849 int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count);
5850 int pkgmgrinfo_appinfo_usr_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count, uid_t uid);
5851 /**
5852  * @fn int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle)
5853  * @brief       This API creates the application's metadata  information filter handle from db.
5854  *
5855  * @par         This API is for package-manager client application
5856  * @par Sync (or) Async : Synchronous API
5857  *
5858  * @param[out] handle           pointer to the application metadata info filter handle.
5859  * @return      0 if success, error code(<0) if fail
5860  * @retval      PMINFO_R_OK     success
5861  * @retval      PMINFO_R_EINVAL invalid argument
5862  * @retval      PMINFO_R_ERROR  internal error
5863  * @pre         None
5864  * @post                pkgmgrinfo_appinfo_metadata_filter_destroy()
5865  * @see         pkgmgrinfo_appinfo_metadata_filter_foreach()
5866  * @code
5867 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
5868 {
5869         char *appid = NULL;
5870         pkgmgrinfo_appinfo_get_appid(handle, &appid);
5871         printf("appid : %s\n", appid);
5872         return 0;
5873 }
5874
5875 static int get_app_list(const char *mkey, const char *mvalue)
5876 {
5877         int ret = 0;
5878         pkgmgrinfo_appinfo_metadata_filter_h handle;
5879         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
5880         if (ret != PMINFO_R_OK)
5881                 return -1;
5882         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
5883         if (ret != PMINFO_R_OK) {
5884                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
5885                 return -1;
5886         }
5887         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
5888         if (ret != PMINFO_R_OK) {
5889                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
5890                 return -1;
5891         }
5892         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
5893         return 0;
5894 }
5895  * @endcode
5896  */
5897 int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle);
5898
5899 /**
5900  * @fn int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle)
5901  * @brief       This API destroys the application's metadata  information filter handle.
5902  *
5903  * @par         This API is for package-manager client application
5904  * @par Sync (or) Async : Synchronous API
5905  *
5906  * @param[in] handle            pointer to the application metadata info filter handle.
5907  * @return      0 if success, error code(<0) if fail
5908  * @retval      PMINFO_R_OK     success
5909  * @retval      PMINFO_R_EINVAL invalid argument
5910  * @retval      PMINFO_R_ERROR  internal error
5911  * @pre         pkgmgrinfo_appinfo_metadata_filter_create()
5912  * @post                None
5913  * @see         pkgmgrinfo_appinfo_metadata_filter_foreach()
5914  * @code
5915 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
5916 {
5917         char *appid = NULL;
5918         pkgmgrinfo_appinfo_get_appid(handle, &appid);
5919         printf("appid : %s\n", appid);
5920         return 0;
5921 }
5922
5923 static int get_app_list(const char *mkey, const char *mvalue)
5924 {
5925         int ret = 0;
5926         pkgmgrinfo_appinfo_metadata_filter_h handle;
5927         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
5928         if (ret != PMINFO_R_OK)
5929                 return -1;
5930         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
5931         if (ret != PMINFO_R_OK) {
5932                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
5933                 return -1;
5934         }
5935         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
5936         if (ret != PMINFO_R_OK) {
5937                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
5938                 return -1;
5939         }
5940         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
5941         return 0;
5942 }
5943  * @endcode
5944  */
5945 int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle);
5946
5947 /**
5948  * @fn int pkgmgrinfo_appinfo_metadata_filter_add(pkgmgrinfo_appinfo_metadata_filter_h handle, const char *key, const char *value)
5949  * @brief       This API adds filter condition for the query API.  The query will search the entire application metadata  information collected from
5950  * the manifest file of all the installed packages. You can specify value as NULL to search based on key only.
5951  *
5952  * @par         This API is for package-manager client application
5953  * @par Sync (or) Async : Synchronous API
5954  *
5955  * @param[in] handle            pointer to the application metadata info filter handle.
5956  * @param[in] key                       pointer to metadata key
5957  * @param[in] value                     pointer to metadata value
5958  * @return      0 if success, error code(<0) if fail
5959  * @retval      PMINFO_R_OK     success
5960  * @retval      PMINFO_R_EINVAL invalid argument
5961  * @retval      PMINFO_R_ERROR  internal error
5962  * @pre         pkgmgrinfo_appinfo_metadata_filter_create()
5963  * @post                pkgmgrinfo_appinfo_metadata_filter_foreach(), pkgmgrinfo_appinfo_metadata_filter_destroy()
5964  * @see         pkgmgrinfo_appinfo_metadata_filter_foreach()
5965  * @code
5966 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
5967 {
5968         char *appid = NULL;
5969         pkgmgrinfo_appinfo_get_appid(handle, &appid);
5970         printf("appid : %s\n", appid);
5971         return 0;
5972 }
5973
5974 static int get_app_list(const char *mkey, const char *mvalue)
5975 {
5976         int ret = 0;
5977         pkgmgrinfo_appinfo_metadata_filter_h handle;
5978         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
5979         if (ret != PMINFO_R_OK)
5980                 return -1;
5981         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
5982         if (ret != PMINFO_R_OK) {
5983                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
5984                 return -1;
5985         }
5986         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
5987         if (ret != PMINFO_R_OK) {
5988                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
5989                 return -1;
5990         }
5991         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
5992         return 0;
5993 }
5994  * @endcode
5995  */
5996 int pkgmgrinfo_appinfo_metadata_filter_add(pkgmgrinfo_appinfo_metadata_filter_h handle,
5997                 const char *key, const char *value);
5998
5999 /**
6000  * @fn int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle, pkgmgrinfo_app_list_cb app_cb, void *user_data)
6001  * @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)
6002  * @brief       This API executes the filter query. The query will search the entire application metadata  information collected from
6003  * the manifest file of all the installed packages. For each application returned by the query, the callback will be called. If callback returns
6004  * negative value, no more callbacks will be called and API will return.
6005  *
6006  * @par         This API is for package-manager client application
6007  * @par Sync (or) Async : Synchronous API
6008  *
6009  * @param[in] handle            pointer to the application metadata info filter handle.
6010  * @param[in] app_cb            function pointer to callback
6011  * @param[in] user_data         pointer to user data
6012  * @param[in]   uid     the addressee user id of the instruction
6013  * @return      0 if success, error code(<0) if fail
6014  * @retval      PMINFO_R_OK     success
6015  * @retval      PMINFO_R_EINVAL invalid argument
6016  * @retval      PMINFO_R_ERROR  internal error
6017  * @pre         pkgmgrinfo_appinfo_metadata_filter_create()
6018  * @post                pkgmgrinfo_appinfo_metadata_filter_destroy()
6019  * @code
6020 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
6021 {
6022         char *appid = NULL;
6023         pkgmgrinfo_appinfo_get_appid(handle, &appid);
6024         printf("appid : %s\n", appid);
6025         return 0;
6026 }
6027
6028 static int get_app_list(const char *mkey, const char *mvalue)
6029 {
6030         int ret = 0;
6031         pkgmgrinfo_appinfo_metadata_filter_h handle;
6032         ret = pkgmgrinfo_appinfo_metadata_filter_create(&handle);
6033         if (ret != PMINFO_R_OK)
6034                 return -1;
6035         ret = pkgmgrinfo_appinfo_metadata_filter_add(handle, mkey, mvalue);
6036         if (ret != PMINFO_R_OK) {
6037                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
6038                 return -1;
6039         }
6040         ret = pkgmgrinfo_appinfo_metadata_filter_foreach(handle, app_list_cb, NULL);
6041         if (ret != PMINFO_R_OK) {
6042                 pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
6043                 return -1;
6044         }
6045         pkgmgrinfo_appinfo_metadata_filter_destroy(handle);
6046         return 0;
6047 }
6048  * @endcode
6049  */
6050 int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle,
6051                 pkgmgrinfo_app_list_cb app_cb, void *user_data);
6052 int pkgmgrinfo_appinfo_usr_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle,
6053                 pkgmgrinfo_app_list_cb app_cb, void *user_data, uid_t uid);
6054
6055 /**
6056  * @fn  int pkgmgrinfo_appinfo_foreach_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
6057                         pkgmgrinfo_app_control_list_cb_v2 appcontrol_func, void *user_data);
6058  * @fn  int pkgmgrinfo_appinfo_foreach_remote_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
6059                         pkgmgrinfo_app_control_list_cb_v2 appcontrol_func, void *user_data);
6060  * @brief       This API gets the list of app-control for a particular application
6061  *
6062  * @par         This API is for package-manager client application
6063  * @par Sync (or) Async : Synchronous API
6064  * @param[in]   handle          pointer to the application info handle.
6065  * @param[in]   appcontrol_func callback function for list
6066  * @param[in]   user_data       user data to be passed to callback function
6067  * @return      0 if success, error code(<0) if fail
6068  * @retval      PMINFO_R_OK     success
6069  * @retval      PMINFO_R_EINVAL invalid argument
6070  * @retval      PMINFO_R_ERROR  internal error
6071  * @pre         pkgmgrinfo_appinfo_get_appinfo()
6072  * @post        pkgmgrinfo_appinfo_destroy_appinfo()
6073  */
6074 int pkgmgrinfo_appinfo_foreach_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
6075                 pkgmgrinfo_app_control_list_cb_v2 appcontrol_func,
6076                 void *user_data);
6077 int pkgmgrinfo_appinfo_foreach_remote_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
6078                 pkgmgrinfo_app_control_list_cb_v2 appcontrol_func,
6079                 void *user_data);
6080 /**
6081  * @fn int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle)
6082  * @brief       This API creates the package cert information handle to get data from db.
6083  *
6084  * @par         This API is for package-manager client application
6085  * @par Sync (or) Async : Synchronous API
6086  *
6087  * @param[out] handle           pointer to the package cert handle.
6088  * @return      0 if success, error code(<0) if fail
6089  * @retval      PMINFO_R_OK     success
6090  * @retval      PMINFO_R_EINVAL invalid argument
6091  * @retval      PMINFO_R_ERROR  internal error
6092  * @pre         None
6093  * @post                pkgmgrinfo_pkginfo_destroy_certinfo()
6094  * @see         pkgmgrinfo_pkginfo_get_cert_value()
6095  * @see         pkgmgrinfo_pkginfo_load_certinfo()
6096  * @code
6097 static int get_cert_info(const char *pkgid)
6098 {
6099         int ret = 0;
6100         pkgmgrinfo_certinfo_h handle;
6101         char *auth_cert = NULL;
6102         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
6103         if (ret != PMINFO_R_OK)
6104                 return -1;
6105         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
6106         if (ret != PMINFO_R_OK) {
6107                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6108                 return -1;
6109         }
6110         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
6111         if (ret != PMINFO_R_OK) {
6112                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6113                 return -1;
6114         }
6115         printf("Author root certificate: %s\n", auth_root);
6116         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6117         return 0;
6118 }
6119  * @endcode
6120  */
6121 int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle);
6122
6123 /**
6124  * @fn int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle)
6125  * @brief       This API loads the package cert information handle with data from db.
6126  *
6127  * @par         This API is for package-manager client application
6128  * @par Sync (or) Async : Synchronous API
6129  *
6130  * @param[in] pkgid             pointer to the package ID.
6131  * @param[in] handle            pointer to the package cert handle.
6132  * @return      0 if success, error code(<0) if fail
6133  * @retval      PMINFO_R_OK     success
6134  * @retval      PMINFO_R_EINVAL invalid argument
6135  * @retval      PMINFO_R_ERROR  internal error
6136  * @pre         pkgmgrinfo_pkginfo_create_certinfo()
6137  * @post                pkgmgrinfo_pkginfo_destroy_certinfo()
6138  * @see         pkgmgrinfo_pkginfo_get_cert_value()
6139  * @code
6140 static int get_cert_info(const char *pkgid)
6141 {
6142         int ret = 0;
6143         pkgmgrinfo_certinfo_h handle;
6144         char *auth_cert = NULL;
6145         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
6146         if (ret != PMINFO_R_OK)
6147                 return -1;
6148         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
6149         if (ret != PMINFO_R_OK) {
6150                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6151                 return -1;
6152         }
6153         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
6154         if (ret != PMINFO_R_OK) {
6155                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6156                 return -1;
6157         }
6158         printf("Author root certificate: %s\n", auth_root);
6159         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6160         return 0;
6161 }
6162  * @endcode
6163  */
6164 int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle, uid_t uid);
6165
6166 /**
6167  * @fn int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value)
6168  * @brief       This API gets the package cert information from the handle
6169  *
6170  * @par         This API is for package-manager client application
6171  * @par Sync (or) Async : Synchronous API
6172  *
6173  * @param[in] handle            pointer to the package cert handle.
6174  * @param[in] cert_type         certificate type
6175  * @param[out] cert_value       pointer to hold certificate value
6176  * @return      0 if success, error code(<0) if fail
6177  * @retval      PMINFO_R_OK     success
6178  * @retval      PMINFO_R_EINVAL invalid argument
6179  * @retval      PMINFO_R_ERROR  internal error
6180  * @pre         pkgmgrinfo_pkginfo_create_certinfo()
6181  * @post                pkgmgrinfo_pkginfo_destroy_certinfo()
6182  * @see         pkgmgrinfo_pkginfo_load_certinfo()
6183  * @code
6184 static int get_cert_info(const char *pkgid)
6185 {
6186         int ret = 0;
6187         pkgmgrinfo_certinfo_h handle;
6188         char *auth_cert = NULL;
6189         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
6190         if (ret != PMINFO_R_OK)
6191                 return -1;
6192         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
6193         if (ret != PMINFO_R_OK) {
6194                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6195                 return -1;
6196         }
6197         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
6198         if (ret != PMINFO_R_OK) {
6199                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6200                 return -1;
6201         }
6202         printf("Author root certificate: %s\n", auth_root);
6203         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6204         return 0;
6205 }
6206  * @endcode
6207  */
6208 int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value);
6209
6210 /**
6211  * @fn int pkgmgrinfo_pkginfo_destroy_certinfo(pkgmgrinfo_certinfo_h handle)
6212  * @brief       This API destroys the package cert information handle freeing up all the resources
6213  *
6214  * @par         This API is for package-manager client application
6215  * @par Sync (or) Async : Synchronous API
6216  *
6217  * @param[in] handle            pointer to the package cert handle.
6218  * @return      0 if success, error code(<0) if fail
6219  * @retval      PMINFO_R_OK     success
6220  * @retval      PMINFO_R_EINVAL invalid argument
6221  * @retval      PMINFO_R_ERROR  internal error
6222  * @pre         pkgmgrinfo_pkginfo_create_certinfo()
6223  * @post                None
6224  * @see         pkgmgrinfo_pkginfo_load_certinfo()
6225  * @code
6226 static int get_cert_info(const char *pkgid)
6227 {
6228         int ret = 0;
6229         pkgmgrinfo_certinfo_h handle;
6230         char *auth_cert = NULL;
6231         ret = pkgmgrinfo_pkginfo_create_certinfo(&handle);
6232         if (ret != PMINFO_R_OK)
6233                 return -1;
6234         ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
6235         if (ret != PMINFO_R_OK) {
6236                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6237                 return -1;
6238         }
6239         ret = pkgmgrinfo_pkginfo_get_cert_value(handle, PMINFO_AUTHOR_ROOT_CERT, &auth_cert);
6240         if (ret != PMINFO_R_OK) {
6241                 pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6242                 return -1;
6243         }
6244         printf("Author root certificate: %s\n", auth_root);
6245         pkgmgrinfo_pkginfo_destroy_certinfo(handle);
6246         return 0;
6247 }
6248  * @endcode
6249  */
6250 int pkgmgrinfo_pkginfo_destroy_certinfo(pkgmgrinfo_certinfo_h handle);
6251
6252 /**
6253  * @fn int pkgmgrinfo_delete_certinfo(const char *pkgid)
6254  * @brief       This API deletes the package cert information from DB
6255  *
6256  * @par         This API is for package-manager client application
6257  * @par Sync (or) Async : Synchronous API
6258  *
6259  * @param[in] pkgid             pointer to the package ID.
6260  * @return      0 if success, error code(<0) if fail
6261  * @retval      PMINFO_R_OK     success
6262  * @retval      PMINFO_R_EINVAL invalid argument
6263  * @retval      PMINFO_R_ERROR  internal error
6264  * @pre         None
6265  * @post                None
6266  * @code
6267 static int delete_cert_info(const char *pkgid)
6268 {
6269         int ret = 0;
6270         ret = pkgmgrinfo_delete_certinfo(pkgid);
6271         if (ret != PMINFO_R_OK)
6272                 return -1;
6273         return 0;
6274 }
6275  * @endcode
6276  */
6277 int pkgmgrinfo_delete_certinfo(const char *pkgid);
6278 int pkgmgrinfo_delete_usr_certinfo(const char *pkgid, uid_t uid);
6279
6280 /**
6281  * @fn int pkgmgrinfo_create_certinfo_set_handle(pkgmgrinfo_instcertinfo_h *handle)
6282  * @brief       This API creates the package cert information handle to set data in db.
6283  *
6284  * @par         This API is for package-manager client application
6285  * @par Sync (or) Async : Synchronous API
6286  *
6287  * @param[out] handle           pointer to the package cert handle.
6288  * @return      0 if success, error code(<0) if fail
6289  * @retval      PMINFO_R_OK     success
6290  * @retval      PMINFO_R_EINVAL invalid argument
6291  * @retval      PMINFO_R_ERROR  internal error
6292  * @pre         None
6293  * @post                pkgmgrinfo_destroy_certinfo_set_handle()
6294  * @see         pkgmgrinfo_set_cert_value()
6295  * @see         pkgmgrinfo_save_certinfo()
6296  * @code
6297 static int set_cert_in_db(const char *pkgid)
6298 {
6299         int ret = 0;
6300         pkgmgrinfo_instcertinfo_h handle;
6301         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
6302         if (ret != PMINFO_R_OK)
6303                 return -1;
6304         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
6305         if (ret != PMINFO_R_OK) {
6306                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
6307                 return -1;
6308         }
6309         ret = pkgmgrinfo_save_certinfo(pkgid, handle);
6310         if (ret != PMINFO_R_OK) {
6311                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
6312                 return -1;
6313         }
6314         pkgmgrinfo_destroy_certinfo_set_handle(handle);
6315         return 0;
6316 }
6317  * @endcode
6318  */
6319 int pkgmgrinfo_create_certinfo_set_handle(pkgmgrinfo_instcertinfo_h *handle);
6320
6321 /**
6322  * @fn int pkgmgrinfo_set_cert_value(pkgmgrinfo_instcertinfo_h handle, pkgmgrinfo_instcert_type cert_type, char *cert_value)
6323  * @brief       This API sets the package cert information in the handle.
6324  *
6325  * @par         This API is for package-manager client application
6326  * @par Sync (or) Async : Synchronous API
6327  *
6328  * @param[in] handle            pointer to the package cert handle.
6329  * @param[in] cert_type         certificate type.
6330  * @param[in] cert_value        certificate value.
6331  * @return      0 if success, error code(<0) if fail
6332  * @retval      PMINFO_R_OK     success
6333  * @retval      PMINFO_R_EINVAL invalid argument
6334  * @retval      PMINFO_R_ERROR  internal error
6335  * @pre         pkgmgrinfo_create_certinfo_set_handle()
6336  * @post                pkgmgrinfo_destroy_certinfo_set_handle()
6337  * @see         pkgmgrinfo_save_certinfo()
6338  * @code
6339 static int set_cert_in_db(const char *pkgid)
6340 {
6341         int ret = 0;
6342         pkgmgrinfo_instcertinfo_h handle;
6343         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
6344         if (ret != PMINFO_R_OK)
6345                 return -1;
6346         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
6347         if (ret != PMINFO_R_OK) {
6348                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
6349                 return -1;
6350         }
6351         ret = pkgmgrinfo_save_certinfo(pkgid, handle);
6352         if (ret != PMINFO_R_OK) {
6353                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
6354                 return -1;
6355         }
6356         pkgmgrinfo_destroy_certinfo_set_handle(handle);
6357         return 0;
6358 }
6359  * @endcode
6360  */
6361 int pkgmgrinfo_set_cert_value(pkgmgrinfo_instcertinfo_h handle, pkgmgrinfo_instcert_type cert_type, char *cert_value);
6362
6363 /**
6364  * @fn int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle)
6365  * @brief       This API saves the package cert information in the DB.
6366  *
6367  * @par         This API is for package-manager client application
6368  * @par Sync (or) Async : Synchronous API
6369  *
6370  * @param[in] pkgid             pointer to the package ID.
6371  * @param[in] handle            pointer to the package cert handle.
6372  * @return      0 if success, error code(<0) if fail
6373  * @retval      PMINFO_R_OK     success
6374  * @retval      PMINFO_R_EINVAL invalid argument
6375  * @retval      PMINFO_R_ERROR  internal error
6376  * @pre         pkgmgrinfo_create_certinfo_set_handle()
6377  * @post                pkgmgrinfo_destroy_certinfo_set_handle()
6378  * @see         pkgmgrinfo_save_certinfo()
6379  * @code
6380 static int set_cert_in_db(const char *pkgid)
6381 {
6382         int ret = 0;
6383         pkgmgrinfo_instcertinfo_h handle;
6384         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
6385         if (ret != PMINFO_R_OK)
6386                 return -1;
6387         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
6388         if (ret != PMINFO_R_OK) {
6389                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
6390                 return -1;
6391         }
6392         ret = pkgmgrinfo_save_certinfo(pkgid, handle);
6393         if (ret != PMINFO_R_OK) {
6394                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
6395                 return -1;
6396         }
6397         pkgmgrinfo_destroy_certinfo_set_handle(handle);
6398         return 0;
6399 }
6400  * @endcode
6401  */
6402 int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle, uid_t uid);
6403
6404 /**
6405  * @fn int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle)
6406  * @brief       This API destroys the package cert information handle freeing up all the resources.
6407  *
6408  * @par         This API is for package-manager client application
6409  * @par Sync (or) Async : Synchronous API
6410  *
6411  * @param[in] handle            pointer to the package cert handle.
6412  * @return      0 if success, error code(<0) if fail
6413  * @retval      PMINFO_R_OK     success
6414  * @retval      PMINFO_R_EINVAL invalid argument
6415  * @retval      PMINFO_R_ERROR  internal error
6416  * @pre         pkgmgrinfo_create_certinfo_set_handle()
6417  * @post                None
6418  * @see         pkgmgrinfo_save_certinfo()
6419  * @code
6420 static int set_cert_in_db(const char *pkgid)
6421 {
6422         int ret = 0;
6423         pkgmgrinfo_instcertinfo_h handle;
6424         ret = pkgmgrinfo_create_certinfo_set_handle(&handle);
6425         if (ret != PMINFO_R_OK)
6426                 return -1;
6427         ret = pkgmgrinfo_set_cert_value(handle, PMINFO_SET_AUTHOR_ROOT_CERT, "author root certificate");
6428         if (ret != PMINFO_R_OK) {
6429                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
6430                 return -1;
6431         }
6432         ret = pkgmgrinfo_save_certinfo(pkgid, handle);
6433         if (ret != PMINFO_R_OK) {
6434                 pkgmgrinfo_destroy_certinfo_set_handle(handle);
6435                 return -1;
6436         }
6437         pkgmgrinfo_destroy_certinfo_set_handle(handle);
6438         return 0;
6439 }
6440  * @endcode
6441  */
6442 int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle);
6443
6444 /**
6445  * @fn int pkgmgrinfo_appinfo_is_guestmode_appstatus(pkgmgrinfo_appinfo_h handle, bool *status)
6446  * @brief       This API gets the application 'guest mode visibility' value from the DB
6447  *
6448  * @par         This API is for package-manager client application
6449  * @par Sync (or) Async : Synchronous API
6450  *
6451  * @param[in]   handle  pointer to application info handle
6452  * @param[out] status           pointer to hold app guest mode visibility value
6453  * @return      0 if success, error code(<0) if fail
6454  * @retval      PMINFO_R_OK     success
6455  * @retval      PMINFO_R_EINVAL invalid argument
6456  * @retval      PMINFO_R_ERROR  internal error
6457  * @pre         pkgmgrinfo_appinfo_get_appinfo()
6458  * @post                pkgmgrinfo_appinfo_destroy_appinfo()
6459  * @see         pkgmgrinfo_appinfo_get_appid()
6460  * @see         pkgmgrinfo_appinfo_is_multiple()
6461  * @code
6462 static int get_app_guestmode_visibility(const char *appid)
6463 {
6464         int ret = 0;
6465         bool status;
6466         pkgmgrinfo_appinfo_h handle;
6467         ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
6468         if (ret != PMINFO_R_OK)
6469                 return -1;
6470         ret = pkgmgrinfo_appinfo_is_guestmode_visibility(handle, &status);
6471         if (ret != PMINFO_R_OK) {
6472                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
6473                 return -1;
6474         }
6475         printf("app guest mode visibility: %d\n", status);
6476         pkgmgrinfo_appinfo_destroy_appinfo(handle);
6477         return 0;
6478 }
6479  * @endcode
6480  */
6481 int pkgmgrinfo_appinfo_is_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool *status);
6482
6483 /**
6484 * @fn int pkgmgrinfo_pkginfo_set_installed_storage(const char *pkgid, INSTALL_LOCATION location)
6485 * @brief         This API sets the package 'installed_storage' value in db
6486 *
6487 * @par  This API is for package-manager client application
6488 * @par Sync (or) Async : Synchronous API
6489 *
6490 * @param[in] pkgid              pointer to the package ID.
6491 * @param[in] location  package install location
6492 * @param[in] external_pkg_path  image path if pkg has installed at external storage
6493 * @return  0 if success, error code(<0) if fail
6494 * @retval  PMINFO_R_OK success
6495 * @retval  PMINFO_R_EINVAL       invalid argument
6496 * @retval  PMINFO_R_ERROR internal error
6497 * @code
6498 static int set_app_installed_storage(const char *appid, INSTALL_LOCATION location)
6499 {
6500         int ret = 0;
6501
6502         ret = pkgmgrinfo_pkginfo_set_installed_storage(handle, INSTALL_EXTERNAL);
6503         if (ret != PMINFO_R_OK) {
6504                 return -1;
6505         }
6506         return 0;
6507 }
6508 * @endcode
6509 */
6510 int pkgmgrinfo_pkginfo_set_installed_storage(const char *pkgid, INSTALL_LOCATION location, const char *external_pkg_path);
6511 int pkgmgrinfo_pkginfo_set_usr_installed_storage(const char *pkgid, INSTALL_LOCATION location, const char *external_pkg_path, uid_t uid);
6512
6513 /* version compare */
6514 int pkgmgrinfo_compare_package_version(const char *current_version,
6515                 const char *target_version, pkgmgrinfo_version_compare_type *res);
6516
6517 /**
6518  * @fn  int pkgmgrinfo_pkginfo_foreach_dependency(pkgmgrinfo_pkginfo_h handle,
6519                         pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
6520                         void *user_data);
6521  * @brief       This API gets the list of dependency of a particular package
6522  *
6523  * @par         This API is for package-manager client application
6524  * @par Sync (or) Async : Synchronous API
6525  * @param[in]   handle          pointer to the package info handle.
6526  * @param[in]   dependency_cb           callback function for list
6527  * @param[in] user_data user data to be passed to callback function
6528  * @return      0 if success, error code(<0) if fail
6529  * @retval      PMINFO_R_OK     success
6530  * @retval      PMINFO_R_EINVAL invalid argument
6531  * @retval      PMINFO_R_ERROR  internal error
6532  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
6533  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
6534  * @code
6535 int dependency_cb(const char *from const char *to, const char *type,
6536                 const char *required_version,void *user_data)
6537 {
6538         printf("this package %s %s", type, to);
6539         if (required_version)
6540                 printf("required version : %s", required_version);
6541         return 0;
6542 }
6543
6544 static int list_dependency(const char *package)
6545 {
6546         int ret = 0;
6547         pkgmgrinfo_pkginfo_h handle;
6548         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
6549         if (ret != PMINFO_R_OK)
6550                 return -1;
6551         ret = pkgmgrinfo_pkginfo_foreach_dependency(handle, dependency_cb, NULL);
6552         if (ret != PMINFO_R_OK) {
6553                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
6554                 return -1;
6555         }
6556         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
6557         return 0;
6558 }
6559  * @endcode
6560  */
6561 int pkgmgrinfo_pkginfo_foreach_dependency(pkgmgrinfo_pkginfo_h handle,
6562                 pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
6563                 void *user_data);
6564
6565 /**
6566  * @fn  int pkgmgrinfo_pkginfo_foreach_depends_on(pkgmgrinfo_pkginfo_h handle,
6567                         pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
6568                         void *user_data);
6569  * @brief       This API gets the list of packages which has dependency directly
6570  *              and indirectly of a particular package
6571  *
6572  * @par         This API is for package-manager client application
6573  * @par Sync (or) Async : Synchronous API
6574  * @param[in]   handle          pointer to the package info handle.
6575  * @param[in]   dependency_cb           callback function for list
6576  * @param[in] user_data user data to be passed to callback function
6577  * @return      0 if success, error code(<0) if fail
6578  * @retval      PMINFO_R_OK     success
6579  * @retval      PMINFO_R_EINVAL invalid argument
6580  * @retval      PMINFO_R_ERROR  internal error
6581  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
6582  * @post                pkgmgrinfo_pkginfo_destroy_pkginfo()
6583  * @code
6584 int dependency_cb(const char *from, const char *to, const char *type,
6585                 const char *required_version,void *user_data)
6586 {
6587         printf("%s %s %s package", from, to, type);
6588         if (required_version)
6589                 printf("required version : %s", required_version);
6590         return 0;
6591 }
6592
6593 static int list_depends_on(const char *package)
6594 {
6595         int ret = 0;
6596         pkgmgrinfo_pkginfo_h handle;
6597         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
6598         if (ret != PMINFO_R_OK)
6599                 return -1;
6600         ret = pkgmgrinfo_pkginfo_foreach_depends_on(handle, dependency_cb, NULL);
6601         if (ret != PMINFO_R_OK) {
6602                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
6603                 return -1;
6604         }
6605         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
6606         return 0;
6607 }
6608  * @endcode
6609  */
6610 int pkgmgrinfo_pkginfo_foreach_depends_on(pkgmgrinfo_pkginfo_h handle,
6611                 pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
6612                 void *user_data);
6613
6614 /**
6615  * @fn  int pkgmgrinfo_pkginfo_foreach_res_allowed_package(pkgmgrinfo_pkginfo_h handle,
6616                 pkgmgrinfo_res_allowed_package_list_cb res_allowed_package_cb,
6617                 void *user_data)
6618  * @brief       This API gets the list of allowed package for a particular package
6619  *
6620  * @par         This API is for package-manager client application
6621  * @par Sync (or) Async : Synchronous API
6622  * @param[in]   handle                  pointer to the package info handle.
6623  * @param[in]   res_allowed_package_cb  callback function for list
6624  * @param[in]   user_data               user data to be passed to callback function
6625  * @return      0 if success, error code(<0) if fail
6626  * @retval      PMINFO_R_OK     success
6627  * @retval      PMINFO_R_EINVAL invalid argument
6628  * @retval      PMINFO_R_ERROR  internal error
6629  * @pre         pkgmgrinfo_pkginfo_get_pkginfo()
6630  * @post        pkgmgrinfo_pkginfo_destroy_pkginfo()
6631  * @code
6632 int res_allowed_package_cb(const char *allowed_package,
6633                 required_privilege_h handle, void *user_data)
6634 {
6635         printf("allowed package : %s", allowed_package);
6636
6637         return 0;
6638 }
6639
6640 static int list_res_allowed_package(const char *package)
6641 {
6642         int ret = 0;
6643         pkgmgrinfo_pkginfo_h handle;
6644         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
6645         if (ret != PMINFO_R_OK)
6646                 return -1;
6647         ret = pkgmgrinfo_pkginfo_foreach_res_allowed_package(handle, res_allowed_package_cb, NULL);
6648         if (ret != PMINFO_R_OK) {
6649                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
6650                 return -1;
6651         }
6652         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
6653         return 0;
6654 }
6655  * @endcode
6656  */
6657 int pkgmgrinfo_pkginfo_foreach_res_allowed_package(pkgmgrinfo_pkginfo_h handle,
6658                 pkgmgrinfo_res_allowed_package_list_cb res_allowed_package_cb,
6659                 void *user_data);
6660
6661 /**
6662  * @fn  int pkgmgrinfo_pkginfo_foreach_required_privilege(
6663                 required_privilege_h handle,
6664                 pkgmgrinfo_pkg_privilege_list_cb privilege_func,
6665                 void *user_data)
6666  * @brief       This API gets the list of allowed package's required privileges
6667  *
6668  * @par         This API is for package-manager client application
6669  * @par Sync (or) Async : Synchronous API
6670  * @param[in]   handle                  pointer to the required privilege handle.
6671  * @param[in]   privilege_func          callback function for list
6672  * @param[in]   user_data               user data to be passed to callback function
6673  * @return      0 if success, error code(<0) if fail
6674  * @retval      PMINFO_R_OK     success
6675  * @retval      PMINFO_R_EINVAL invalid argument
6676  * @pre         pkgmgrinfo_pkginfo_foreach_res_allowed_package()
6677  * @post        None
6678  * @code
6679 int privilege_func(const char *privilege_name, void *user_data)
6680 {
6681         printf("required privilege : %s", privilege_name);
6682
6683         return 0;
6684 }
6685
6686 int res_allowed_package_cb(const char *allowed_package,
6687                 required_privilege_h handle, void *user_data)
6688 {
6689         int ret = 0;
6690         printf("allowed package : %s", allowed_package);
6691
6692         ret = pkgmgrinfo_pkginfo_foreach_required_privilege(handle, privilege_func, user_data);
6693         if (ret != PMINFO_R_OK)
6694                 return -1;
6695
6696         return 0;
6697 }
6698
6699 static int list_res_allowed_package(const char *package)
6700 {
6701         int ret = 0;
6702         pkgmgrinfo_pkginfo_h handle;
6703         ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
6704         if (ret != PMINFO_R_OK)
6705                 return -1;
6706         ret = pkgmgrinfo_pkginfo_foreach_res_allowed_package(handle, res_allowed_package_cb, NULL);
6707         if (ret != PMINFO_R_OK) {
6708                 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
6709                 return -1;
6710         }
6711         pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
6712         return 0;
6713 }
6714  * @endcode
6715  */
6716 int pkgmgrinfo_pkginfo_foreach_required_privilege(
6717                 required_privilege_h handle,
6718                 pkgmgrinfo_pkg_privilege_list_cb privilege_func,
6719                 void *user_data);
6720
6721 /**
6722  * @fn  int pkgmgrinfo_pkginfo_get_list_full(pkgmgrinfo_pkg_list_cb pkg_list_cb, int flag, void *user_data)
6723  * @brief       This API gets list of installed packages using flag that used for masking package's information
6724  *
6725  * @par         This API is for package-manager client application
6726  * @par Sync (or) Async : Synchronous API
6727  * @param[in]   pkg_list_cb     iteration function for list
6728  * @param[in]   flag    enum value of pkgmgrinfo_pkginfo_get_option used for masking package's information
6729  * @param[in]   user_data       user data to be passed to callback function
6730  * @return      0 if success, error code(<0) if fail
6731  * @retval      PMINFO_R_OK     success
6732  * @retval      PMINFO_R_EINVAL invalid argument
6733  * @retval      PMINFO_R_ERROR  internal error
6734  * @pre         None
6735  * @post        None
6736  * @see         pkgmgrinfo_pkginfo_get_option
6737  * @code
6738 int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
6739 {
6740         char *label1 = NULL;
6741         char *label2 = NULL;
6742         label1 = (char *)user_data;
6743         pkgmgrinfo_pkginfo_get_label(handle, &label2);
6744         if (strcmp(label1, label2) == 0)
6745                 return -1;
6746         else
6747                 return 0;
6748 }
6749
6750 static int list_pkgs()
6751 {
6752         int ret = 0;
6753         char *label = "helloworld";
6754         ret = pkgmgrinfo_pkginfo_get_list_full(pkg_list_cb, PMINFO_PKGINFO_GET_LABEL, (void *)name);
6755         if (ret != PMINFO_R_OK)
6756                 return -1;
6757         return 0;
6758 }
6759  * @endcode
6760  */
6761 int pkgmgrinfo_pkginfo_get_usr_list_full(pkgmgrinfo_pkg_list_cb pkg_list_cb,
6762                 int flag, void *user_data, uid_t uid);
6763 int pkgmgrinfo_pkginfo_get_list_full(pkgmgrinfo_pkg_list_cb pkg_list_cb,
6764                 int flag, void *user_data);
6765
6766 /**
6767  * @fn  int pkgmgrinfo_appinfo_get_installed_list_full(pkgmgrinfo_app_list_cb app_func, int flag, void *user_data)
6768  * @brief       This API gets list of installed applications from all packages using flag that used for masking application's information
6769  *
6770  * @par         This API is for package-manager client application
6771  * @par Sync (or) Async : Synchronous API
6772  * @param[in]   app_func        iteration function for list
6773  * @param[in]   flag    enum value of pkgmgrinfo_appinfo_get_option used for masking application's information
6774  * @param[in]   user_data       user data to be passed to callback function
6775  * @return      0 if success, error code(<0) if fail
6776  * @retval      PMINFO_R_OK     success
6777  * @retval      PMINFO_R_EINVAL invalid argument
6778  * @retval      PMINFO_R_ERROR  internal error
6779  * @pre         None
6780  * @post        None
6781  * @see         pkgmgrinfo_appinfo_get_option
6782  * @code
6783 int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
6784 {
6785         int ret = 0;
6786         char *label1 = NULL;
6787         char *label2 = NULL;
6788         label1 = (char *)user_data;
6789         ret = pkgmgrinfo_appinfo_get_label(handle, &label2);
6790         if (ret != PMINFO_R_OK) {
6791                 printf("pkgmgrinfo_appinfo_get_label fail");
6792                 return -1;
6793         }
6794         if (strcmp(label1, label2) == 0)
6795                 return -1;
6796         else
6797                 return 0;
6798 }
6799
6800 static int list_apps()
6801 {
6802         int ret = 0;
6803         char *label = "helloworld";
6804         ret = pkgmgrinfo_appinfo_get_installed_list_full(app_list_cb, PMINFO_APPINFO_GET_LABEL, (void *)label);
6805         if (ret != PMINFO_R_OK)
6806                 return -1;
6807         return 0;
6808 }
6809  * @endcode
6810  */
6811 int pkgmgrinfo_appinfo_get_usr_installed_list_full(
6812                 pkgmgrinfo_app_list_cb app_func, uid_t uid, int flag,
6813                 void *user_data);
6814 int pkgmgrinfo_appinfo_get_installed_list_full(
6815                 pkgmgrinfo_app_list_cb app_func, int flag, void *user_data);
6816
6817 /**
6818  * @fn int pkgmgrinfo_archiveinfo_get_archiveinfo(const char *path, pkgmgrinfo_archiveinfo_h *handle)
6819  * @brief       This API creates the package archive information handle from given path
6820  *
6821  * @par         This API is for package-manager client application
6822  * @par Sync (or) Async : Synchronous API
6823  *
6824  * @param[in]   path    path of package archive
6825  * @param[out]  handle  pointer to the package archive info handle
6826  * @return      0 if success, error code(<0) if fail
6827  * @retval      PMINFO_R_OK     success
6828  * @retval      PMINFO_R_EINVAL invalid argument
6829  * @retval      PMINFO_R_ERROR  internal error
6830  * @pre         None
6831  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
6832  * @code
6833 static int get_pkg_archive_type(const char *path)
6834 {
6835         int ret = 0;
6836         char *type = NULL;
6837         pkgmgrinfo_archiveinfo_h handle;
6838         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
6839         if (ret != PMINFO_R_OK)
6840                 return -1;
6841         ret = pkgmgrinfo_archiveinfo_get_type(handle, &type);
6842         if (ret != PMINFO_R_OK) {
6843                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6844                 return -1;
6845         }
6846         printf("pkg archive type: %s\n", type);
6847         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6848         return 0;
6849 }
6850  * @endcode
6851  */
6852 int pkgmgrinfo_archiveinfo_get_archiveinfo(const char *path,
6853                 pkgmgrinfo_archiveinfo_h *handle);
6854
6855 /**
6856  * @fn int pkgmgrinfo_archiveinfo_destroy_archiveinfo(pkgmgrinfo_archiveinfo_h handle)
6857  * @brief       This API destroys the package archive information handle freeing up all the resources
6858  *
6859  * @par         This API is for package-manager client application
6860  * @par Sync (or) Async : Synchronous API
6861  *
6862  * @param[in]   handle  pointer to the package archive info handle
6863  * @return      0 if success, error code(<0) if fail
6864  * @retval      PMINFO_R_OK     success
6865  * @retval      PMINFO_R_EINVAL invalid argument
6866  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
6867  * @post        None
6868  * @code
6869 static int get_pkg_archive_type(const char *path)
6870 {
6871         int ret = 0;
6872         char *type = NULL;
6873         pkgmgrinfo_archiveinfo_h handle;
6874         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
6875         if (ret != PMINFO_R_OK)
6876                 return -1;
6877         ret = pkgmgrinfo_archiveinfo_get_type(handle, &type);
6878         if (ret != PMINFO_R_OK) {
6879                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6880                 return -1;
6881         }
6882         printf("pkg archive type: %s\n", type);
6883         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6884         return 0;
6885 }
6886  * @endcode
6887  */
6888 int pkgmgrinfo_archiveinfo_destroy_archiveinfo(pkgmgrinfo_archiveinfo_h handle);
6889
6890 /**
6891  * @fn int pkgmgrinfo_archiveinfo_get_pkgid(pkgmgrinfo_archiveinfo_h handle, char **pkgid)
6892  * @brief       This API gets the package id from the package archive info handle
6893  *
6894  * @par         This API is for package-manager client application
6895  * @par Sync (or) Async : Synchronous API
6896  *
6897  * @param[in]   handle  pointer to package archive info handle
6898  * @param[out]  pkgid   pointer to hold package id
6899  * @return      0 if success, error code(<0) if fail
6900  * @retval      PMINFO_R_OK     success
6901  * @retval      PMINFO_R_EINVAL invalid argument
6902  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
6903  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
6904  * @code
6905 static int get_pkg_archive_id(const char *path)
6906 {
6907         int ret = 0;
6908         char *pkg_id = NULL;
6909         pkgmgrinfo_archiveinfo_h handle;
6910         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
6911         if (ret != PMINFO_R_OK)
6912                 return -1;
6913         ret = pkgmgrinfo_archiveinfo_get_pkgid(handle, &pkg_id);
6914         if (ret != PMINFO_R_OK) {
6915                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6916                 return -1;
6917         }
6918         printf("pkg archive id: %s\n", pkg_id);
6919         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6920         return 0;
6921 }
6922  * @endcode
6923  */
6924 int pkgmgrinfo_archiveinfo_get_pkgid(pkgmgrinfo_archiveinfo_h handle,
6925                 const char **pkgid);
6926
6927 /**
6928  * @fn int pkgmgrinfo_archiveinfo_get_type(pkgmgrinfo_archiveinfo_h handle, char **type)
6929  * @brief       This API gets the package type from the package archive info handle
6930  *
6931  * @par         This API is for package-manager client application
6932  * @par Sync (or) Async : Synchronous API
6933  *
6934  * @param[in]   handle  pointer to package archive info handle
6935  * @param[out]  type    pointer to hold package type
6936  * @return      0 if success, error code(<0) if fail
6937  * @retval      PMINFO_R_OK     success
6938  * @retval      PMINFO_R_EINVAL invalid argument
6939  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
6940  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
6941  * @code
6942 static int get_pkg_archive_type(const char *path)
6943 {
6944         int ret = 0;
6945         char *type = NULL;
6946         pkgmgrinfo_archiveinfo_h handle;
6947         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
6948         if (ret != PMINFO_R_OK)
6949                 return -1;
6950         ret = pkgmgrinfo_archiveinfo_get_type(handle, &type);
6951         if (ret != PMINFO_R_OK) {
6952                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6953                 return -1;
6954         }
6955         printf("pkg archive type: %s\n", type);
6956         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6957         return 0;
6958 }
6959  * @endcode
6960  */
6961 int pkgmgrinfo_archiveinfo_get_type(pkgmgrinfo_archiveinfo_h handle,
6962                 const char **type);
6963
6964 /**
6965  * @fn int pkgmgrinfo_archiveinfo_get_version(pkgmgrinfo_archiveinfo_h handle, char **version)
6966  * @brief       This API gets the package version from the package archive info handle
6967  *
6968  * @par         This API is for package-manager client application
6969  * @par Sync (or) Async : Synchronous API
6970  *
6971  * @param[in]   handle  pointer to package archive info handle
6972  * @param[out]  version pointer to hold package version
6973  * @return      0 if success, error code(<0) if fail
6974  * @retval      PMINFO_R_OK     success
6975  * @retval      PMINFO_R_EINVAL invalid argument
6976  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
6977  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
6978  * @code
6979 static int get_pkg_archive_version(const char *path)
6980 {
6981         int ret = 0;
6982         char *version = NULL;
6983         pkgmgrinfo_archiveinfo_h handle;
6984         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
6985         if (ret != PMINFO_R_OK)
6986                 return -1;
6987         ret = pkgmgrinfo_archiveinfo_get_version(handle, &version);
6988         if (ret != PMINFO_R_OK) {
6989                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6990                 return -1;
6991         }
6992         printf("pkg archive version: %s\n", version);
6993         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
6994         return 0;
6995 }
6996  * @endcode
6997  */
6998 int pkgmgrinfo_archiveinfo_get_version(pkgmgrinfo_archiveinfo_h handle,
6999                 const char **version);
7000
7001 /**
7002  * @fn int pkgmgrinfo_archiveinfo_get_api_version(pkgmgrinfo_archiveinfo_h handle, char **api_version)
7003  * @brief       This API gets the package api version from the package archive info handle
7004  *
7005  * @par         This API is for package-manager client application
7006  * @par Sync (or) Async : Synchronous API
7007  *
7008  * @param[in]   handle  pointer to package archive info handle
7009  * @param[out]  api_version     pointer to hold package api_version
7010  * @return      0 if success, error code(<0) if fail
7011  * @retval      PMINFO_R_OK     success
7012  * @retval      PMINFO_R_EINVAL invalid argument
7013  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
7014  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
7015  * @code
7016 static int get_pkg_archive_api_version(const char *path)
7017 {
7018         int ret = 0;
7019         char *api_version = NULL;
7020         pkgmgrinfo_archiveinfo_h handle;
7021         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
7022         if (ret != PMINFO_R_OK)
7023                 return -1;
7024         ret = pkgmgrinfo_archiveinfo_get_api_version(handle, &api_version);
7025         if (ret != PMINFO_R_OK) {
7026                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7027                 return -1;
7028         }
7029         printf("pkg archive api_version: %s\n", api_version);
7030         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7031         return 0;
7032 }
7033  * @endcode
7034  */
7035 int pkgmgrinfo_archiveinfo_get_api_version(pkgmgrinfo_archiveinfo_h handle,
7036                 const char **api_version);
7037
7038 /**
7039  * @fn int pkgmgrinfo_archiveinfo_get_description(pkgmgrinfo_archiveinfo_h handle, char **description)
7040  * @brief       This API gets the package description from the package archive info handle
7041  *
7042  * @par         This API is for package-manager client application
7043  * @par Sync (or) Async : Synchronous API
7044  *
7045  * @param[in]   handle  pointer to package archive info handle
7046  * @param[out]  description     pointer to hold package description
7047  * @return      0 if success, error code(<0) if fail
7048  * @retval      PMINFO_R_OK     success
7049  * @retval      PMINFO_R_EINVAL invalid argument
7050  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
7051  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
7052  * @code
7053 static int get_pkg_archive_description(const char *path)
7054 {
7055         int ret = 0;
7056         char *description = NULL;
7057         pkgmgrinfo_archiveinfo_h handle;
7058         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
7059         if (ret != PMINFO_R_OK)
7060                 return -1;
7061         ret = pkgmgrinfo_archiveinfo_get_description(handle, &description);
7062         if (ret != PMINFO_R_OK) {
7063                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7064                 return -1;
7065         }
7066         printf("pkg archive description: %s\n", description);
7067         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7068         return 0;
7069 }
7070  * @endcode
7071  */
7072 int pkgmgrinfo_archiveinfo_get_description(pkgmgrinfo_archiveinfo_h handle,
7073                 const char **description);
7074
7075 /**
7076  * @fn int pkgmgrinfo_archiveinfo_get_label(pkgmgrinfo_archiveinfo_h handle, char **label)
7077  * @brief       This API gets the package label from the package archive info handle
7078  *
7079  * @par         This API is for package-manager client application
7080  * @par Sync (or) Async : Synchronous API
7081  *
7082  * @param[in]   handle  pointer to package archive info handle
7083  * @param[out]  label   pointer to hold package label
7084  * @return      0 if success, error code(<0) if fail
7085  * @retval      PMINFO_R_OK     success
7086  * @retval      PMINFO_R_EINVAL invalid argument
7087  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
7088  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
7089  * @code
7090 static int get_pkg_archive_label(const char *path)
7091 {
7092         int ret = 0;
7093         char *label = NULL;
7094         pkgmgrinfo_archiveinfo_h handle;
7095         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
7096         if (ret != PMINFO_R_OK)
7097                 return -1;
7098         ret = pkgmgrinfo_archiveinfo_get_label(handle, &label);
7099         if (ret != PMINFO_R_OK) {
7100                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7101                 return -1;
7102         }
7103         printf("pkg archive label: %s\n", label);
7104         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7105         return 0;
7106 }
7107  * @endcode
7108  */
7109 int pkgmgrinfo_archiveinfo_get_label(pkgmgrinfo_archiveinfo_h handle,
7110                 const char **label);
7111
7112 /**
7113  * @fn int pkgmgrinfo_archiveinfo_get_author(pkgmgrinfo_archiveinfo_h handle, char **author)
7114  * @brief       This API gets the package author from the package archive info handle
7115  *
7116  * @par         This API is for package-manager client application
7117  * @par Sync (or) Async : Synchronous API
7118  *
7119  * @param[in]   handle  pointer to package archive info handle
7120  * @param[out]  author  pointer to hold package author
7121  * @return      0 if success, error code(<0) if fail
7122  * @retval      PMINFO_R_OK     success
7123  * @retval      PMINFO_R_EINVAL invalid argument
7124  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
7125  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
7126  * @code
7127 static int get_pkg_archive_author(const char *path)
7128 {
7129         int ret = 0;
7130         char *author = NULL;
7131         pkgmgrinfo_archiveinfo_h handle;
7132         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
7133         if (ret != PMINFO_R_OK)
7134                 return -1;
7135         ret = pkgmgrinfo_archiveinfo_get_author(handle, &author);
7136         if (ret != PMINFO_R_OK) {
7137                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7138                 return -1;
7139         }
7140         printf("pkg archive author: %s\n", author);
7141         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7142         return 0;
7143 }
7144  * @endcode
7145  */
7146 int pkgmgrinfo_archiveinfo_get_author(pkgmgrinfo_archiveinfo_h handle,
7147                 const char **author);
7148
7149 /**
7150  * @fn int pkgmgrinfo_archiveinfo_get_icon(pkgmgrinfo_archiveinfo_h handle, const unsigned char **icon, size_t *size)
7151  * @brief       This API gets the package icon and size from the package archive info handle
7152  *
7153  * @par         This API is for package-manager client application
7154  * @par Sync (or) Async : Synchronous API
7155  *
7156  * @param[in]   handle  pointer to package archive info handle
7157  * @param[out]  icon    pointer to hold package icon
7158  * @param[out]  size    pointer to hold size of package icon
7159  * @return      0 if success, error code(<0) if fail
7160  * @retval      PMINFO_R_OK     success
7161  * @retval      PMINFO_R_EINVAL invalid argument
7162  * @retval      PMINFO_R_ENOENT no result
7163  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
7164  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
7165  * @code
7166 static int get_pkg_archive_icon(const char *path)
7167 {
7168         int ret = 0;
7169         unsigned char *icon = NULL;
7170         size_t icon_size = 0;
7171         pkgmgrinfo_archiveinfo_h handle;
7172         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
7173         if (ret != PMINFO_R_OK)
7174                 return -1;
7175         ret = pkgmgrinfo_archiveinfo_get_icon(handle, &icon, &icon_size);
7176         if (ret != PMINFO_R_OK) {
7177                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7178                 return -1;
7179         }
7180         printf("pkg archive icon size : %zu\n", icon_size);
7181         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7182         return 0;
7183 }
7184  * @endcode
7185  */
7186 int pkgmgrinfo_archiveinfo_get_icon(pkgmgrinfo_archiveinfo_h handle,
7187                 const unsigned char **icon, size_t *size);
7188
7189 /**
7190  * @fn int pkgmgrinfo_archiveinfo_foreach_dependency(pkgmgrinfo_archiveinfo_h handle, pkgmgrinfo_dependency_cb callback, void *user_data)
7191  * @brief       This API retrieve the dependency information and invoke given callback for it.
7192  *
7193  * @par         This API is for package-manager client application
7194  * @par Sync (or) Async : Synchronous API
7195  *
7196  * @param[in]   handle  pointer to package archive info handle
7197  * @param[in]   callback        callback to be invoked for each retrieved dependency information
7198  * @param[in]   user_data       user data to be passed to callback
7199  * @return      0 if success, error code(<0) if fail
7200  * @retval      PMINFO_R_OK     success
7201  * @retval      PMINFO_R_EINVAL invalid argument
7202  * @retval      PMINFO_R_ERROR  internal error
7203  * @pre         pkgmgrinfo_archiveinfo_get_archiveinfo()
7204  * @post        pkgmgrinfo_archiveinfo_destroy_archiveinfo()
7205  * @code
7206 static int get_pkg_archive_dependency(const char *path, pkgmgrinfo_pkg_dependency_list_cb callback)
7207 {
7208         int ret = 0;
7209         size_t icon_size = 0;
7210         pkgmgrinfo_archiveinfo_h handle;
7211         ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle);
7212         if (ret != PMINFO_R_OK)
7213                 return -1;
7214         ret = pkgmgrinfo_archiveinfo_foreach_dependency(handle, callback, NULL);
7215         if (ret != PMINFO_R_OK) {
7216                 pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7217                 return -1;
7218         }
7219         pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle);
7220         return 0;
7221 }
7222  * @endcode
7223  */
7224 int pkgmgrinfo_archiveinfo_foreach_dependency(pkgmgrinfo_archiveinfo_h handle,
7225                 pkgmgrinfo_pkg_dependency_list_cb callback, void *user_data);
7226
7227 /**
7228  * @pkgmgrinfo client API end
7229 **/
7230
7231
7232 /** @} */
7233 #ifdef __cplusplus
7234 }
7235 #endif
7236 #endif                          /* __PKG_INFO_H__ */
7237 /**
7238  * @}
7239  * @}
7240  */