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