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