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