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