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