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