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