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