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