1149f482639acfe85af5218814091092e4716acc
[platform/core/appfw/slp-pkgmgr.git] / client / include / package-manager.h
1 /*
2  * slp-pkgmgr
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
29
30
31 /**
32  * @file                package-manager.h
33  * @author              Sewook Park <sewook7.park@samsung.com>
34  * @version             0.1
35  * @brief               This file declares API of slp-pkgmgr library
36  *
37  * @addtogroup APPLICATION_FRAMEWORK
38  * @{
39  *
40   * @defgroup   PackageManager
41  * @section             Header to use them:
42  * @code
43  * #include "package-manager.h"
44  * @endcode
45  *
46  * @addtogroup PackageManager
47  * @{
48  */
49
50 #ifndef __PKG_MANAGER_H__
51 #define __PKG_MANAGER_H__
52
53 #include <errno.h>
54 #include <stdbool.h>
55 #include <stdio.h>
56 #include <sys/types.h>
57
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
62 #ifndef DEPRECATED
63 #define DEPRECATED      __attribute__ ((__deprecated__))
64 #endif
65
66 /**
67  * @mainpage
68  *
69  * This is package manager
70  *
71  * Packaeg manager is used to install/uninstall the packages.\n
72  * package includes dpkg, java, widget, etc. and it can be added\n
73  * Security is considered on current package manager\n
74  *
75  */
76
77 /**
78  * @file        package-manager.h
79  * @brief Package Manager header
80  *
81  * Generated by    Sewook Park <sewook7.park@samsung.com>
82  */
83
84
85
86 /**
87  * @addtogroup PackageManager
88  * @{
89  */
90
91 /**
92  * @brief pkgmgr info types.
93  */
94 #define PKGMGR_INFO_STR_PKGTYPE         "pkg_type"
95 #define PKGMGR_INFO_STR_PKGNAME         "pkg_name"
96 #define PKGMGR_INFO_STR_VERSION         "version"
97 #define PKGMGR_INFO_STR_INSTALLED_SIZE  "installed_size"
98 #define PKGMGR_INFO_STR_DATA_SIZE       "data_size"
99 #define PKGMGR_INFO_STR_APP_SIZE        "app_size"
100 #define PKGMGR_INFO_STR_INSTALLED_TIME  "installed_time"
101
102 /**
103  * @brief listening status type in pkgmgr.
104  */
105 #define PKGMGR_CLIENT_STATUS_ALL                                0x0FFF
106 #define PKGMGR_CLIENT_STATUS_INSTALL                            0x0001
107 #define PKGMGR_CLIENT_STATUS_UNINSTALL                          0x0002
108 #define PKGMGR_CLIENT_STATUS_UPGRADE                            0x0004
109 #define PKGMGR_CLIENT_STATUS_MOVE                               0x0008
110 #define PKGMGR_CLIENT_STATUS_CLEAR_DATA                         0x0010
111 #define PKGMGR_CLIENT_STATUS_INSTALL_PROGRESS                   0x0020
112 #define PKGMGR_CLIENT_STATUS_GET_SIZE                           0x0040
113 #define PKGMGR_CLIENT_STATUS_ENABLE_APP                         0x0080
114 #define PKGMGR_CLIENT_STATUS_DISABLE_APP                        0x0100
115 #define PKGMGR_CLIENT_STATUS_ENABLE_APP_SPLASH_SCREEN           0x0200
116 #define PKGMGR_CLIENT_STATUS_DISABLE_APP_SPLASH_SCREEN          0x0400
117 #define PKGMGR_CLIENT_STATUS_CLEAR_CACHE                        0x0800
118 #define PKGMGR_CLIENT_STATUS_RES_COPY                           0x1000
119 #define PKGMGR_CLIENT_STATUS_RES_CREATE_DIR                     0x2000
120 #define PKGMGR_CLIENT_STATUS_RES_REMOVE                         0x4000
121 #define PKGMGR_CLIENT_STATUS_RES_UNINSTALL                      0x8000
122
123 /** @} */
124
125 #define PKG_SIZE_INFO_TOTAL "__TOTAL__"
126 #define PKG_CLEAR_ALL_CACHE "__ALL__"
127 /**
128  * @brief Return values in pkgmgr.
129  */
130 typedef enum _pkgmgr_return_val {
131         PKGMGR_R_ESYSTEM = -9,          /**< Severe system error */
132         PKGMGR_R_EIO = -8,              /**< IO error */
133         PKGMGR_R_ENOMEM = -7,           /**< Out of memory */
134         PKGMGR_R_ENOPKG = -6,           /**< No such package */
135         PKGMGR_R_EPRIV = -5,            /**< Privilege denied */
136         PKGMGR_R_ETIMEOUT = -4,         /**< Timeout */
137         PKGMGR_R_EINVAL = -3,           /**< Invalid argument */
138         PKGMGR_R_ECOMM = -2,            /**< Comunication Error */
139         PKGMGR_R_ERROR = -1,            /**< General error */
140         PKGMGR_R_OK = 0                 /**< General success */
141 } pkgmgr_return_val;
142 /** @} */
143
144 /**
145  * @defgroup pkg_operate        APIs to install /uninstall / activate application
146  * @ingroup pkgmgr
147  * @brief
148  *      APIs to install /uninstall / activate application
149  *      - Install application using application package filepath
150  *      - Uninstall application using application package name
151  *      - Activate application using application package name
152  *
153  */
154
155
156 /**
157  * @addtogroup pkg_operate
158  * @{
159  */
160
161 typedef void pkgmgr_client;
162 typedef void pkgmgr_info;
163 typedef void pkgmgr_res_event_info;
164
165 typedef struct {
166         long long data_size;
167         long long cache_size;
168         long long app_size;
169         long long ext_data_size;
170         long long ext_cache_size;
171         long long ext_app_size;
172 } pkg_size_info_t;
173
174 typedef enum {
175         PM_UPDATEINFO_TYPE_NONE = 0,
176         PM_UPDATEINFO_TYPE_FORCE,
177         PM_UPDATEINFO_TYPE_OPTIONAL
178 } pkgmgr_updateinfo_type;
179
180 typedef struct {
181         char *pkgid;
182         char *version;
183         pkgmgr_updateinfo_type type;
184 } pkg_update_info_t;
185
186 typedef int (*pkgmgr_iter_fn)(const char *pkg_type, const char *pkgid,
187                                 const char *version, void *data);
188
189 typedef int (*pkgmgr_handler)(uid_t target_uid, int req_id, const char *pkg_type,
190                                 const char *pkgid, const char *key,
191                                 const char *val, const void *pmsg, void *data);
192
193 typedef int (*pkgmgr_app_handler)(uid_t target_uid, int req_id, const char *pkg_type,
194                                 const char *pkgid, const char *appid, const char *key,
195                                 const char *val, const void *pmsg, void *data);
196
197 typedef void (*pkgmgr_pkg_size_info_receive_cb)(pkgmgr_client *pc, const char *pkgid,
198                 const pkg_size_info_t *size_info, void *user_data);
199
200 typedef void (*pkgmgr_total_pkg_size_info_receive_cb)(pkgmgr_client *pc,
201                 const pkg_size_info_t *size_info, void *user_data);
202
203 typedef void (*pkgmgr_res_copy_handler)(uid_t target_uid, int req_id,
204                 const char *pkgid, const char *request_type, const char *status,
205                 pkgmgr_res_event_info *handle, void *user_data);
206
207 typedef enum {
208         PC_REQUEST = 0,
209         PC_LISTENING,
210         PC_BROADCAST,
211 } pkgmgr_client_type;
212
213 typedef enum {
214         PM_DEFAULT,
215         PM_QUIET
216 } pkgmgr_mode;
217
218 typedef enum {
219         PM_MOVE_TO_INTERNAL = 0,
220         PM_MOVE_TO_SDCARD = 1,
221         PM_MOVE_TO_EXTENDED = 2,
222 } pkgmgr_move_type;
223
224 typedef enum {
225         PM_REQUEST_MOVE = 0,
226         PM_REQUEST_GET_SIZE = 1,
227         PM_REQUEST_KILL_APP = 2,
228         PM_REQUEST_CHECK_APP = 3,
229         PM_REQUEST_MAX
230 } pkgmgr_request_service_type;
231
232 typedef enum {
233         /* sync, get data, total size for one requested pkgid */
234         PM_GET_TOTAL_SIZE = 0,
235         PM_GET_DATA_SIZE = 1,
236
237         /* async, get total used storage size */
238         PM_GET_ALL_PKGS = 2,
239
240         /* async, get a pkgid's data, total size for all installed pkg */
241         PM_GET_SIZE_INFO = 3,
242
243         /* deprecated */
244         PM_GET_TOTAL_AND_DATA = 4,
245         PM_GET_SIZE_FILE = 5,
246
247         /* async, get data, cache, app size based on "pkg_size_info_t" */
248         PM_GET_PKG_SIZE_INFO = 6,
249         PM_GET_TOTAL_PKG_SIZE_INFO = 7,
250         PM_GET_MAX
251 } pkgmgr_getsize_type;
252
253 typedef enum {
254         PM_RESTRICTION_MODE_ALL = 0x07,
255         PM_RESTRICTION_MODE_INSTALL = 0x01,
256         PM_RESTRICTION_MODE_UNINSTALL = 0x02,
257         PM_RESTRICTION_MODE_MOVE = 0x04,
258 } pkgmgr_restriction_mode;
259
260 /**
261  * @brief       This API creates pkgmgr client.
262  *
263  * This API is for package-manager client application.\n
264  *
265  * @param[in]   ctype   client type - PC_REQUEST, PC_LISTENING, PC_BROADCAST
266  * @return      pkgmgr_client object
267  * @retval      NULL    on failure creating an object
268 */
269 pkgmgr_client *pkgmgr_client_new(pkgmgr_client_type ctype);
270
271 /**
272  * @brief       This API deletes pkgmgr client.
273  *
274  * This API is for package-manager client application.\n
275  *
276  * @param[in]   pc      pkgmgr_client
277  * @return      Operation result;
278  * @retval      PKGMGR_R_OK     success
279  * @retval      PKGMGR_R_EINVAL invalid argument
280  * @retval      PKGMGR_R_ERROR  internal error
281 */
282 int pkgmgr_client_free(pkgmgr_client *pc);
283
284 /**
285  * @brief       This API set information to install tep package.
286  * @details     Use this API before calling installation API.
287  *
288  * This API is for package-manager client application.\n
289  *
290  * @param[in]   pc      pkgmgr_client
291  * @param[in]   tep_path        full path that tep file is located at
292  * @param[in]   tep_move        if TRUE, source file will be moved, else it will be copied
293  * @retval      PKGMGR_R_OK     success
294  * @retval      PKGMGR_R_EINVAL invalid argument
295 */
296 int pkgmgr_client_set_tep_path(pkgmgr_client *pc, const char *tep_path, bool tep_move);
297
298 /**
299  * @brief       This API installs packages.
300  *
301  * This API is for package-manager client application.\n
302  *
303  * @param[in]   pc              pkgmgr_client
304  * @param[in]   pkg_paths       full paths that package file is located
305  * @param[in]   n_pkgs          number of packages
306  * @param[in]   event_cb        user callback
307  * @param[in]   data            user data
308  * @return      request_id (>0) if success, error code(<0) if fail\n
309  * @retval      PKGMGR_R_OK     success
310  * @retval      PKGMGR_R_EINVAL invalid argument
311  * @retval      PKGMGR_R_ECOMM  communication error
312  */
313 int pkgmgr_client_install_packages(pkgmgr_client *pc,
314                 const char **pkg_paths, int n_pkgs, pkgmgr_handler event_cb,
315                 void *data);
316 int pkgmgr_client_usr_install_packages(pkgmgr_client *pc,
317                 const char **pkg_paths, int n_pkgs, pkgmgr_handler event_cb,
318                 void *data, uid_t uid);
319
320 /**
321  * @brief       This API installs package.
322  *
323  * This API is for package-manager client application.\n
324  *
325  * @param[in]   pc      pkgmgr_client
326  * @param[in]   pkg_type                package type
327  * @param[in]   descriptor_path full path that descriptor is located
328  * @param[in]   pkg_path                full path that package file is located
329  * @param[in]   optional_data   optional data which is used for installation
330  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
331  * @param[in]   event_cb        user callback
332  * @param[in]   data            user data
333  * @return      request_id (>0) if success, error code(<0) if fail\n
334  * @retval      PKGMGR_R_OK     success
335  * @retval      PKGMGR_R_EINVAL invalid argument
336  * @retval      PKGMGR_R_ECOMM  communication error
337 */
338 int pkgmgr_client_install(pkgmgr_client *pc, const char *pkg_type,
339                             const char *descriptor_path, const char *pkg_path,
340                             const char *optional_data, pkgmgr_mode mode,
341                             pkgmgr_handler event_cb, void *data);
342 int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type,
343                             const char *descriptor_path, const char *pkg_path,
344                             const char *optional_data, pkgmgr_mode mode,
345                             pkgmgr_handler event_cb, void *data, uid_t uid);
346
347 /**
348  * @brief       This API reinstalls package.
349  *
350  * This API is for package-manager client application.\n
351  *
352  * @param[in]   pc      pkgmgr_client
353  * @param[in]   pkg_type                package type
354  * @param[in]   pkg_path                full path that package file is located
355  * @param[in]   optional_data   optional data which is used for installation
356  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
357  * @param[in]   event_cb        user callback
358  * @param[in]   data            user data
359  * @return      request_id (>0) if success, error code(<0) if fail\n
360  * @retval      PKGMGR_R_OK     success
361  * @retval      PKGMGR_R_EINVAL invalid argument
362  * @retval      PKGMGR_R_ECOMM  communication error
363 */
364 int pkgmgr_client_reinstall(pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
365                             const char *optional_data, pkgmgr_mode mode,
366                             pkgmgr_handler event_cb, void *data);
367 int pkgmgr_client_usr_reinstall(pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
368                                   const char *optional_data, pkgmgr_mode mode,
369                               pkgmgr_handler event_cb, void *data, uid_t uid);
370
371 /**
372  * @brief       This API mount-installs packages.
373  *
374  * This API is for package-manager client application.\n
375  *
376  * @param[in]   pc              pkgmgr_client
377  * @param[in]   pkg_paths       full paths that package file is located
378  * @param[in]   n_pkgs          number of packages
379  * @param[in]   event_cb        user callback
380  * @param[in]   data            user data
381  * @return      request_id (>0) if success, error code(<0) if fail\n
382  * @retval      PKGMGR_R_OK     success
383  * @retval      PKGMGR_R_EINVAL invalid argument
384  * @retval      PKGMGR_R_ECOMM  communication error
385  */
386 int pkgmgr_client_mount_install_packages(pkgmgr_client *pc,
387                 const char **pkg_paths, int n_pkgs, pkgmgr_handler event_cb,
388                 void *data);
389 int pkgmgr_client_usr_mount_install_packages(pkgmgr_client *pc,
390                 const char **pkg_paths, int n_pkgs, pkgmgr_handler event_cb,
391                 void *data, uid_t uid);
392
393 /**
394  * @brief       This API mount-installs package.
395  *
396  * This API is for package-manager client application.\n
397  *
398  * @param[in]   pc      pkgmgr_client
399  * @param[in]   pkg_type                package type
400  * @param[in]   descriptor_path full path that descriptor is located
401  * @param[in]   pkg_path                full path that package file is located
402  * @param[in]   optional_data   optional data which is used for installation
403  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
404  * @param[in]   event_cb        user callback
405  * @param[in]   data            user data
406  * @return      request_id (>0) if success, error code(<0) if fail\n
407  * @retval      PKGMGR_R_OK     success
408  * @retval      PKGMGR_R_EINVAL invalid argument
409  * @retval      PKGMGR_R_ECOMM  communication error
410 */
411 int pkgmgr_client_mount_install(pkgmgr_client *pc, const char *pkg_type,
412                             const char *descriptor_path, const char *pkg_path,
413                             const char *optional_data, pkgmgr_mode mode,
414                             pkgmgr_handler event_cb, void *data);
415 int pkgmgr_client_usr_mount_install(pkgmgr_client *pc, const char *pkg_type,
416                             const char *descriptor_path, const char *pkg_path,
417                             const char *optional_data, pkgmgr_mode mode,
418                             pkgmgr_handler event_cb, void *data, uid_t uid);
419
420 /**
421  * @brief       This API uninstalls packages.
422  *
423  * This API is for package-manager client application.\n
424  *
425  * @param[in]   pc              pkgmgr_client
426  * @param[in]   pkgids          package ids
427  * @param[in]   n_pkgs          number of packages
428  * @param[in]   event_cb        user callback
429  * @param[in]   data            user data
430  * @return      request_id (>0) if success, error code(<0) if fail\n
431  * @retval      PKGMGR_R_OK     success
432  * @retval      PKGMGR_R_EINVAL invalid argument
433  * @retval      PKGMGR_R_ECOMM  communication error
434  */
435 int pkgmgr_client_uninstall_packages(pkgmgr_client *pc,
436                 const char **pkgids, int n_pkgs, pkgmgr_handler event_cb,
437                 void *data);
438 int pkgmgr_client_usr_uninstall_packages(pkgmgr_client *pc,
439                 const char **pkgids, int n_pkgs, pkgmgr_handler event_cb,
440                 void *data, uid_t uid);
441
442 /**
443  * @brief       This API uninstalls package.
444  *
445  * This API is for package-manager client application.\n
446  *
447  * @param[in]   pc      pkgmgr_client
448  * @param[in]   pkg_type                package type
449  * @param[in]   pkgid   package id
450  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
451  * @param[in]   event_cb        user callback
452  * @param[in]   data            user data
453  * @param[in]   uid     the addressee user id of the instruction
454  * @return      request_id (>0), error code(<0) if fail\n
455  * @retval      PKGMGR_R_OK     success
456  * @retval      PKGMGR_R_EINVAL invalid argument
457  * @retval      PKGMGR_R_ECOMM  communication error
458 */
459 int pkgmgr_client_uninstall(pkgmgr_client *pc, const char *pkg_type,
460                                 const char *pkgid, pkgmgr_mode mode,
461                                 pkgmgr_handler event_cb, void *data);
462 int pkgmgr_client_usr_uninstall(pkgmgr_client *pc, const char *pkg_type,
463                                 const char *pkgid, pkgmgr_mode mode,
464                                 pkgmgr_handler event_cb, void *data, uid_t uid);
465
466 /**
467  * @brief       This API moves installed package to SD card or vice versa.
468  *
469  * This API is for package-manager client application.\n
470  *
471  * @param[in]   pc      pkgmgr_client
472  * @param[in]   pkg_type                package type
473  * @param[in]   pkgid   application package id
474  * @param[in]   move_type               move type
475  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
476  * @param[in]   event_cb        user callback
477  * @param[in]   data    user data
478  * @param[in]   uid     the addressee user id of the instruction
479  * @retval      PKGMGR_R_OK     success
480  * @retval      PKGMGR_R_EINVAL invalid argument
481  * @retval      PKGMGR_R_ERROR  general error
482 */
483 int pkgmgr_client_move(pkgmgr_client *pc, const char *pkg_type,
484                                 const char *pkgid, pkgmgr_move_type move_type,
485                                 pkgmgr_handler event_cb, void *data);
486 int pkgmgr_client_usr_move(pkgmgr_client *pc, const char *pkg_type,
487                                 const char *pkgid, pkgmgr_move_type move_type,
488                                 pkgmgr_handler event_cb, void *data, uid_t uid);
489
490 /**
491  * @brief       This API registers the update information of given packages
492  *
493  * This API is for package-manager client application.\n
494  *
495  * @param[in]   pc      pkgmgr_client
496  * @param[in]   update_info     update information
497  * @param[in]   uid     the addressee user id of the instruction
498  * @retval      PKGMGR_R_OK     success
499  * @retval      PKGMGR_R_EINVAL invalid argument
500  * @retval      PKGMGR_R_ERROR  general error
501 */
502 int pkgmgr_client_register_pkg_update_info(pkgmgr_client *pc,
503                                 pkg_update_info_t *update_info);
504 int pkgmgr_client_usr_register_pkg_update_info(pkgmgr_client *pc,
505                                 pkg_update_info_t *update_info, uid_t uid);
506
507 /**
508  * @brief       This API unregisters update information of certain package.
509  *
510  * This API is for package-manager client application.\n
511  *
512  * @param[in]   pc      pkgmgr_client
513  * @param[in]   pkgid   package id
514  * @param[in]   uid     the addressee user id of the instruction
515  * @retval      PKGMGR_R_OK     success
516  * @retval      PKGMGR_R_EINVAL invalid argument
517  * @retval      PKGMGR_R_ERROR  general error
518 */
519 int pkgmgr_client_unregister_pkg_update_info(pkgmgr_client *pc, const char *pkgid);
520 int pkgmgr_client_usr_unregister_pkg_update_info(pkgmgr_client *pc,
521                                 const char *pkgid, uid_t uid);
522
523 /**
524  * @brief       This API unregister update information of all packages.
525  *
526  * This API is for package-manager client application.\n
527  *
528  * @param[in]   pc      pkgmgr_client
529  * @param[in]   uid     the addressee user id of the instruction
530  * @retval      PKGMGR_R_OK     success
531  * @retval      PKGMGR_R_EINVAL invalid argument
532  * @retval      PKGMGR_R_ERROR  general error
533 */
534 int pkgmgr_client_unregister_all_pkg_update_info(pkgmgr_client *pc);
535 int pkgmgr_client_usr_unregister_all_pkg_update_info(pkgmgr_client *pc,
536                                 uid_t uid);
537
538 /**
539  * @brief       This API activates package.
540  *
541  * This API is for package-manager client application.\n
542  *
543  * @param[in]   pc      pkgmgr_client
544  * @param[in]   pkg_type                package type
545  * @param[in]   pkgid   package id
546  * @return      request_id (>0) if success, error code(<0) if fail\n
547  * @retval      PKGMGR_R_OK     success
548  * @retval      PKGMGR_R_EINVAL invalid argument
549  * @retval      PKGMGR_R_ECOMM  communication error
550 */
551 int pkgmgr_client_activate(pkgmgr_client *pc, const char *pkg_type,
552                                 const char *pkgid);
553 int pkgmgr_client_usr_activate(pkgmgr_client *pc, const char *pkg_type,
554                                 const char *pkgid, uid_t uid);
555
556 /**
557  * @brief       This API activates multiple packages.
558  *
559  * This API is for package-manager client application.\n
560  *
561  * @param[in]   pc      pkgmgr_client
562  * @param[in]   pkg_type                package type
563  * @param[in]   pkgids  array of package ids
564  * @param[in]   n_pkgs  size of array
565  * @param[in]   event_cb        user callback
566  * @param[in]   data    user data
567  * @return      request_id (>0) if success, error code(<0) if fail\n
568  * @retval      PKGMGR_R_OK     success
569  * @retval      PKGMGR_R_EINVAL invalid argument
570  * @retval      PKGMGR_R_ECOMM  communication error
571 */
572 int pkgmgr_client_activate_packages(pkgmgr_client *pc, const char *pkg_type,
573                                 const char **pkgids, int n_pkgs,
574                                 pkgmgr_handler event_cb, void *data);
575 int pkgmgr_client_usr_activate_packages(pkgmgr_client *pc, const char *pkg_type,
576                                 const char **pkgids, int n_pkgs,
577                                 pkgmgr_handler event_cb, void *data, uid_t uid);
578
579 /**
580  * @brief       This API deactivates package.
581  *
582  * This API is for package-manager client application.\n
583  *
584  * @param[in]   pc      pkgmgr_client
585  * @param[in]   pkg_type                package type
586  * @param[in]   pkgid   package id
587  * @return      request_id (>0) if success, error code(<0) if fail\n
588  * @retval      PKGMGR_R_OK     success
589  * @retval      PKGMGR_R_EINVAL invalid argument
590  * @retval      PKGMGR_R_ECOMM  communication error
591 */
592 int pkgmgr_client_deactivate(pkgmgr_client *pc, const char *pkg_type,
593                                  const char *pkgid);
594 int pkgmgr_client_usr_deactivate(pkgmgr_client *pc, const char *pkg_type,
595                                  const char *pkgid, uid_t uid);
596
597 /**
598  * @brief       This API deactivates multiple packages.
599  *
600  * This API is for package-manager client application.\n
601  *
602  * @param[in]   pc      pkgmgr_client
603  * @param[in]   pkg_type                package type
604  * @param[in]   pkgids  array of package ids
605  * @param[in]   n_pkgs  size of array
606  * @param[in]   event_cb        user callback
607  * @param[in]   data    user data
608  * @return      request_id (>0) if success, error code(<0) if fail\n
609  * @retval      PKGMGR_R_OK     success
610  * @retval      PKGMGR_R_EINVAL invalid argument
611  * @retval      PKGMGR_R_ECOMM  communication error
612 */
613 int pkgmgr_client_deactivate_packages(pkgmgr_client *pc, const char *pkg_type,
614                                  const char **pkgids, int n_pkgs,
615                                  pkgmgr_handler event_cb, void *data);
616 int pkgmgr_client_usr_deactivate_packages(pkgmgr_client *pc, const char *pkg_type,
617                                  const char **pkgids, int n_pkgs,
618                                  pkgmgr_handler event_cb, void *data, uid_t uid);
619
620 /**
621  * @brief       This API deactivates app.
622  *
623  * This API is for package-manager client application.\n
624  *
625  * @param[in]   pc      pkgmgr_client
626  * @param[in]   appid   applicaiton id
627  * @param[in]   app_event_cb    user callback
628  * @param[in]   data    user data
629  * @return      request_id (>0) if success, error code(<0) if fail\n
630  * @retval      PKGMGR_R_OK     success
631  * @retval      PKGMGR_R_EINVAL invalid argument
632  * @retval      PKGMGR_R_ECOMM  communication error
633 */
634 int pkgmgr_client_deactivate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data);
635 int pkgmgr_client_usr_deactivate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
636
637 /**
638  * @brief       This API activates multiple apps.
639  *
640  * This API is for package-manager client application.\n
641  *
642  * @param[in]   pc      pkgmgr_client
643  * @param[in]   appids  array of application ids
644  * @param[in]   n_apps  size of array
645  * @param[in]   app_event_cb    user callback
646  * @param[in]   data    user data
647  * @return      request_id (>0) if success, error code(<0) if fail\n
648  * @retval      PKGMGR_R_OK     success
649  * @retval      PKGMGR_R_EINVAL invalid argument
650  * @retval      PKGMGR_R_ECOMM  communication error
651 */
652 int pkgmgr_client_activate_apps(pkgmgr_client *pc, const char **appids, int n_apps, pkgmgr_app_handler app_event_cb, void *data);
653 int pkgmgr_client_usr_activate_apps(pkgmgr_client *pc, const char **appids, int n_apps, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
654
655 /**
656  * @brief       This API deactivates multiple apps.
657  *
658  * This API is for package-manager client application.\n
659  *
660  * @param[in]   pc      pkgmgr_client
661  * @param[in]   appids  array of application ids
662  * @param[in]   n_apps  size of array
663  * @param[in]   app_event_cb    user callback
664  * @param[in]   data    user data
665  * @return      request_id (>0) if success, error code(<0) if fail\n
666  * @retval      PKGMGR_R_OK     success
667  * @retval      PKGMGR_R_EINVAL invalid argument
668  * @retval      PKGMGR_R_ECOMM  communication error
669 */
670 int pkgmgr_client_deactivate_apps(pkgmgr_client *pc, const char **appids, int n_apps, pkgmgr_app_handler app_event_cb, void *data);
671 int pkgmgr_client_usr_deactivate_apps(pkgmgr_client *pc, const char **appids, int n_apps, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
672
673 /**
674  * @brief       This API deactivates global app for user specified by uid.
675  *
676  * This API is for package-manager client application.\n
677  *
678  * @param[in]   pc      pkgmgr_client
679  * @param[in]   appid   applicaiton id
680  * @param[in]   app_event_cb    user callback
681  * @param[in]   uid     user id
682  * @param[in]   data    user data
683  * @return      request_id (>0) if success, error code(<0) if fail\n
684  * @retval      PKGMGR_R_OK     success
685  * @retval      PKGMGR_R_EINVAL invalid argument
686  * @retval      PKGMGR_R_ECOMM  communication error
687 */
688 int pkgmgr_client_deactivate_global_app_for_uid(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
689
690 /**
691  * @brief       This API activates app.
692  *
693  * This API is for package-manager client application.\n
694  *
695  * @param[in]   pc      pkgmgr_client
696  * @param[in]   appid   applicaiton id
697  * @param[in]   app_event_cb    user callback
698  * @param[in]   uid     user id
699  * @param[in]   data    user data
700  * @return      request_id (>0) if success, error code(<0) if fail\n
701  * @retval      PKGMGR_R_OK     success
702  * @retval      PKGMGR_R_EINVAL invalid argument
703  * @retval      PKGMGR_R_ECOMM  communication error
704 */
705 int pkgmgr_client_activate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data);
706 int pkgmgr_client_usr_activate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
707
708 /**
709  * @brief       This API activates global app for user specified by uid.
710  *
711  * This API is for package-manager client application.\n
712  *
713  * @param[in]   pc      pkgmgr_client
714  * @param[in]   appid   applicaiton id
715  * @param[in]   app_event_cb    user callback
716  * @param[in]   uid     user id
717  * @param[in]   data    user data
718  * @return      request_id (>0) if success, error code(<0) if fail\n
719  * @retval      PKGMGR_R_OK     success
720  * @retval      PKGMGR_R_EINVAL invalid argument
721  * @retval      PKGMGR_R_ECOMM  communication error
722 */
723 int pkgmgr_client_activate_global_app_for_uid(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
724
725 /**
726  * @brief       This API deletes application's private data.
727  *
728  * This API is for package-manager client application.\n
729  *
730  * @remarks     You should call this function with regular uid
731  * @param[in]   pc      pkgmgr_client
732  * @param[in]   pkg_type                package type
733  * @param[in]   pkgid   package id
734  * @param[in]   mode            installation mode  - PM_DEFAULT, PM_QUIET
735  * @return      request_id (>0) if success, error code(<0) if fail\n
736  * @retval      PKGMGR_R_OK     success
737  * @retval      PKGMGR_R_EINVAL invalid argument
738  * @retval      PKGMGR_R_ECOMM  communication error
739 */
740 int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
741                                 const char *pkgid, pkgmgr_mode mode);
742 int pkgmgr_client_usr_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
743                                 const char *pkgid, pkgmgr_mode mode, uid_t uid);
744 /**
745  * @brief       This API set status type to listen for the pkgmgr's broadcasting
746  *
747  * This API is for package-manager client application.\n
748  *
749  * @param[in]   pc      pkgmgr_client
750  * @param[in]   status_type     status type to listen
751  * @return      request_id (>0) if success, error code(<0) if fail\n
752  * @retval      PKGMGR_R_OK     success
753  * @retval      PKGMGR_R_EINVAL invalid argument
754 */
755 int pkgmgr_client_set_status_type(pkgmgr_client *pc, int status_type);
756
757 /**
758  * @brief       This API request to listen the pkgmgr's broadcasting
759  *
760  * This API is for package-manager client application.\n
761  *
762  * @param[in]   pc      pkgmgr_client
763  * @param[in]   event_cb        user callback
764  * @param[in]   data            user data
765  * @return      request_id (>0) if success, error code(<0) if fail\n
766  * @retval      PKGMGR_R_OK     success
767  * @retval      PKGMGR_R_EINVAL invalid argument
768 */
769 int pkgmgr_client_listen_status(pkgmgr_client *pc, pkgmgr_handler event_cb,
770                                     void *data);
771
772 /**
773  * @brief       This API request to listen the pkgmgr's broadcasting about apps
774  *
775  * This API is for package-manager client application.\n
776  *
777  * @param[in]   pc      pkgmgr_client
778  * @param[in]   event_cb        user callback
779  * @param[in]   data            user data
780  * @return      request_id (>0) if success, error code(<0) if fail\n
781  * @retval      PKGMGR_R_OK     success
782  * @retval      PKGMGR_R_EINVAL invalid argument
783 */
784 int pkgmgr_client_listen_app_status(pkgmgr_client *pc, pkgmgr_app_handler event_cb,
785                                     void *data);
786
787 /**
788  * @brief       This API request to listen the pkgmgr's broadcasting about resource copy
789  *
790  * This API is for package-manager client application.\n
791  *
792  * @param[in]   pc              pkgmgr_client
793  * @param[in]   event_cb        user callback
794  * @param[in]   data            user data
795  * @return      request_id (>0) if success, error code(<0) if fail\n
796  * @retval      PKGMGR_R_OK     success
797  * @retval      PKGMGR_R_EINVAL invalid argument
798  * @retval      PKGMGR_R_ENOMEM out of memory
799 */
800 int pkgmgr_client_listen_res_copy_status(pkgmgr_client *pc,
801                 pkgmgr_res_copy_handler event_cb, void *data);
802
803 /**
804  * @brief       This API request to stop listen the pkgmgr's broadcasting
805  *
806  * This API is for package-manager client application.\n
807  *
808  * @param[in]   pc      pkgmgr_client
809  * @return      0 if success, error code(<0) if fail\n
810  * @retval      PKGMGR_R_OK     success
811  * @retval      PKGMGR_R_EINVAL invalid argument
812  * @retval      PKGMGR_R_ERROR          internal error
813 */
814 int pkgmgr_client_remove_listen_status(pkgmgr_client *pc);
815
816 /**
817  * @brief       This API broadcasts pkgmgr's status
818  *
819  * This API is for package-manager client application.\n
820  *
821  * @param[in]   pc      pkgmgr_client
822  * @param[in]   pkg_type                package type
823  * @param[in]   pkgid   package id
824  * @param[in]   key             key to broadcast
825  * @param[in]   val             value to broadcast
826  * @return      0 if success, error code(<0) if fail\n
827  * @retval      PKGMGR_R_OK     success
828  * @retval      PKGMGR_R_EINVAL invalid argument
829 */
830 int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type,
831                                          const char *pkgid,  const char *key,
832                                          const char *val);
833
834 /**
835  * @brief       This API  gets the package's information.
836  *
837  *              This API is for package-manager client application.\n
838  *
839  * @param[in]   pkg_path                package file path to get infomation
840  * @return      package entry pointer if success, NULL if fail\n
841 */
842 pkgmgr_info *pkgmgr_client_check_pkginfo_from_file(const char *pkg_path);
843
844 /**
845  * @brief       This API  get package information value
846  *
847  *              This API is for package-manager client application.\n
848  *
849  * @param[in]   pkg_info                        pointer for package info entry
850  * @return      0 if success, error code(<0) if fail\n
851 */
852 int pkgmgr_client_free_pkginfo(pkgmgr_info *pkg_info);
853
854 /**
855  * @brief       This API requests service
856  *
857  * This API is for package-manager client application.\n
858  *
859  * @param[in]   service_type            pkgmgr_request_service_type
860  * @param[in]   service_mode            mode which is used for addtional mode selection
861  * @param[in]   pc                      pkgmgr_client
862  * @param[in]   pkg_type                package type
863  * @param[in]   pkgid                   package id
864  * @param[in]   custom_info             custom information which is used for addtional information
865  * @param[in]   event_cb                user callback
866  * @param[in]   data                    user data
867  * @return      request_id (>0) if success, error code(<0) if fail\n
868  * @retval      PKGMGR_R_OK     success
869  * @retval      PKGMGR_R_EINVAL invalid argument
870  * @retval      PKGMGR_R_ECOMM  communication error
871 */
872 int pkgmgr_client_request_service(pkgmgr_request_service_type service_type, int service_mode,
873                                         pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
874                                         const char *custom_info, pkgmgr_handler event_cb, void *data);
875 int pkgmgr_client_usr_request_service(pkgmgr_request_service_type service_type, int service_mode,
876                                         pkgmgr_client *pc, const char *pkg_type, const char *pkgid, uid_t uid,
877                                         const char *custom_info, pkgmgr_handler event_cb, void *data);
878 /**
879  * @brief       This API get package size
880  *
881  * This API is for package-manager client application.\n
882  *
883  * @param[in]   pc                              pkgmgr_client
884  * @param[in]   pkgid                   package id
885  * @param[in]   get_type                type for pkgmgr client request to get package size
886  * @param[in]   event_cb                user callback
887  * @param[in]   data                    user data
888  * @return      request_id (>0) if success, error code(<0) if fail\n
889  * @retval      PKGMGR_R_OK     success
890  * @retval      PKGMGR_R_EINVAL invalid argument
891  * @retval      PKGMGR_R_ECOMM  communication error
892 */
893 int pkgmgr_client_get_size(pkgmgr_client *pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data);
894 int pkgmgr_client_usr_get_size(pkgmgr_client *pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data, uid_t uid);
895
896 /**
897  * @brief               Gets the package size information.
898  * @details             The package size info is asynchronously obtained by the specified callback function.
899  *
900  * @param[in] pc                The pointer to pkgmgr_client instance
901  * @param[in] pkgid             The package ID
902  * @param[in] result_cb The asynchronous callback function to get the package size information
903  * @param[in] user_data User data to be passed to the callback function
904  *
905  * @return 0 on success, otherwise a negative error value
906  * @retval #PKGMGR_R_OK                 Successful
907  * @retval #PKGMGR_R_EINVAL             Invalid parameter
908  * @retval #PKGMGR_R_ERROR              Internal error
909  */
910 int pkgmgr_client_get_package_size_info(pkgmgr_client *pc, const char *pkgid, pkgmgr_pkg_size_info_receive_cb result_cb, void *user_data);
911 int pkgmgr_client_usr_get_package_size_info(pkgmgr_client *pc, const char *pkgid, pkgmgr_pkg_size_info_receive_cb result_cb, void *user_data, uid_t uid);
912
913 /**
914  * @brief               Gets the sum of the entire package size information.
915  * @details             The package size info is asynchronously obtained by the specified callback function.
916  *
917  * @param[in] pc                The pointer to pkgmgr_client instance
918  * @param[in] result_cb The asynchronous callback function to get the total package size information
919  * @param[in] user_data User data to be passed to the callback function
920  *
921  * @return 0 on success, otherwise a negative error value
922  * @retval #PKGMGR_R_OK                 Successful
923  * @retval #PKGMGR_R_EINVAL             Invalid parameter
924  * @retval #PKGMGR_R_ERROR              Internal error
925  */
926 int pkgmgr_client_get_total_package_size_info(pkgmgr_client *pc, pkgmgr_total_pkg_size_info_receive_cb result_cb, void *user_data);
927 int pkgmgr_client_usr_get_total_package_size_info(pkgmgr_client *pc, pkgmgr_total_pkg_size_info_receive_cb result_cb, void *user_data, uid_t uid);
928
929 /**
930  * @brief       This API removes cache directories
931  *
932  * This API is for package-manager client application.\n
933  *
934  * @remarks     You should call this function with regular uid
935  * @param[in]   pkgid                   package id
936  * @return      0 if success, error code(<0) if fail\n
937  * @retval      PKGMGR_R_OK     success
938  * @retval      PKGMGR_R_EINVAL invalid argument
939  * @retval      PKGMGR_R_EPRIV privilege denied
940  * @retval      PKGMGR_R_ERROR  internal error
941 */
942 int pkgmgr_client_clear_cache_dir(const char *pkgid);
943 int pkgmgr_client_usr_clear_cache_dir(const char *pkgid, uid_t uid);
944
945 /**
946  * @brief       This API removes all cache directories
947  *
948  * This API is for package-manager client application.\n
949  *
950  * @remarks     You should call this function with regular uid
951  * @return      0 if success, error code(<0) if fail\n
952  * @retval      PKGMGR_R_OK     success
953  * @retval      PKGMGR_R_EINVAL invalid argument
954  * @retval      PKGMGR_R_EPRIV privilege denied
955  * @retval      PKGMGR_R_ERROR  internal error
956 */
957 int pkgmgr_client_clear_all_cache_dir(void);
958 int pkgmgr_client_usr_clear_all_cache_dir(uid_t uid);
959
960 /**
961  * @brief       Generates request for getting license
962  *
963  * This API generates request for getting license.\n
964  *
965  * @remarks     You must release @a req_data and @a license_url by yourself.
966  * @param[in]   pc      The pointer to pkgmgr_client instance
967  * @param[in]   resp_data       The response data string of the purchase request
968  * @param[out]  req_data        License request data
969  * @param[out]  license_url     License acquisition url data
970  * @return      0 if success, error code(<0) if fail\n
971  * @retval      PKGMGR_R_OK     success
972  * @retval      PKGMGR_R_EINVAL invalid argument
973  * @retval      PKGMGR_R_ECOMM  communication error
974  * @retval      PKGMGR_R_EPRIV  privilege denied
975  * @retval      PKGMGR_R_ESYSTEM        severe system error
976  */
977 int pkgmgr_client_generate_license_request(pkgmgr_client *pc, const char *resp_data, char **req_data, char **license_url);
978
979 /**
980  * @brief       Registers encrypted license
981  *
982  * This API registers encrypted license.\n
983  *
984  * @param[in]   pc      The pointer to pkgmgr_client instance
985  * @param[in]   resp_data       The response data string of the purchase request
986  * @return      0 if success, error code(<0) if fail\n
987  * @retval      PKGMGR_R_OK     success
988  * @retval      PKGMGR_R_EINVAL invalid argument
989  * @retval      PKGMGR_R_ECOMM  communication error
990  * @retval      PKGMGR_R_EPRIV privilege denied
991  * @retval      PKGMGR_R_ESYSTEM        severe system error
992  */
993 int pkgmgr_client_register_license(pkgmgr_client *pc, const char *resp_data);
994
995 /**
996  * @brief       Decrypts contents which is encrypted
997  *
998  * This API decrypts contents which is encrypted.\n
999  *
1000  * @param[in]   pc      The pointer to pkgmgr_client instance
1001  * @param[in]   drm_file_path   The pointer to pkgmgr_client instance
1002  * @param[in]   decrypted_file_path     The pointer to pkgmgr_client instance
1003  * @return      0 if success, error code(<0) if fail\n
1004  * @retval      PKGMGR_R_OK     success
1005  * @retval      PKGMGR_R_EINVAL invalid argument
1006  * @retval      PKGMGR_R_ECOMM  communication error
1007  * @retval      PKGMGR_R_EPRIV privilege denied
1008  * @retval      PKGMGR_R_ESYSTEM        severe system error
1009  */
1010 int pkgmgr_client_decrypt_package(pkgmgr_client *pc, const char *drm_file_path, const char *decrypted_file_path);
1011
1012 /**
1013  * @brief       This API is enabled the splash screen
1014  *
1015  * This API is for package-manager client application.\n
1016  *
1017  * @param[in]   pc      pkgmgr_client
1018  * @param[in]   appid   applicaiton id
1019  * @return      request_id (>0) if success, error code(<0) if fail\n
1020  * @retval      PKGMGR_R_OK             success
1021  * @retval      PKGMGR_R_EINVAL         invalid argument
1022  * @retval      PKGMGR_R_ECOMM          communication error
1023  * @retval      PKGMGR_R_ENOMEM         out of memory
1024  */
1025 int pkgmgr_client_enable_splash_screen(pkgmgr_client *pc, const char *appid);
1026 int pkgmgr_client_usr_enable_splash_screen(pkgmgr_client *pc, const char *appid, uid_t uid);
1027
1028 /**
1029  * @brief       This API is disabled the splash screen
1030  *
1031  * This API is for package-manager client application.\n
1032  *
1033  * @param[in]   pc      pkgmgr_client
1034  * @param[in]   appid   applicaiton id
1035  * @return      request_id (>0) if success, error code(<0) if fail\n
1036  * @retval      PKGMGR_R_OK             success
1037  * @retval      PKGMGR_R_EINVAL         invalid argument
1038  * @retval      PKGMGR_R_ECOMM          communication error
1039  * @retval      PKGMGR_R_ENOMEM         out of memory
1040  */
1041 int pkgmgr_client_disable_splash_screen(pkgmgr_client *pc, const char *appid);
1042 int pkgmgr_client_usr_disable_splash_screen(pkgmgr_client *pc, const char *appid, uid_t uid);
1043
1044 /**
1045  * @brief       Set restriction mode
1046  *
1047  * This API set restriction mode bit.\n
1048  *
1049  * @param[in]   pc      The pointer to pkgmgr_client instance
1050  * @param[in]   mode    restriction mode bit
1051  * @return      0 if success, error code(<0) if fail\n
1052  * @retval      PKGMGR_R_OK     success
1053  * @retval      PKGMGR_R_EINVAL invalid argument
1054  * @retval      PKGMGR_R_ECOMM  communication error
1055  * @retval      PKGMGR_R_EPRIV privilege denied
1056  * @see pkgmgr_restriction_mode
1057  */
1058 int pkgmgr_client_set_restriction_mode(pkgmgr_client *pc, int mode);
1059 int pkgmgr_client_usr_set_restriction_mode(pkgmgr_client *pc, int mode, uid_t uid);
1060
1061 /**
1062  * @brief       Unset restriction mode
1063  *
1064  * This API unset restriction mode bit.\n
1065  *
1066  * @param[in]   pc      The pointer to pkgmgr_client instance
1067  * @param[in]   mode    restriction mode bit
1068  * @return      0 if success, error code(<0) if fail\n
1069  * @retval      PKGMGR_R_OK     success
1070  * @retval      PKGMGR_R_EINVAL invalid argument
1071  * @retval      PKGMGR_R_ECOMM  communication error
1072  * @retval      PKGMGR_R_EPRIV privilege denied
1073  * @see pkgmgr_restriction_mode
1074  */
1075 int pkgmgr_client_unset_restriction_mode(pkgmgr_client *pc, int mode);
1076 int pkgmgr_client_usr_unset_restriction_mode(pkgmgr_client *pc, int mode, uid_t uid);
1077
1078 /**
1079  * @brief       Get restriction mode
1080  *
1081  * This API gets restriction mode bit.\n
1082  *
1083  * @param[in]   pc      The pointer to pkgmgr_client instance
1084  * @param[out]  mode    restriction mode bit
1085  * @return      0 if success, error code(<0) if fail\n
1086  * @retval      PKGMGR_R_OK     success
1087  * @retval      PKGMGR_R_EINVAL invalid argument
1088  * @retval      PKGMGR_R_ECOMM  communication error
1089  * @retval      PKGMGR_R_EPRIV privilege denied
1090  * @see pkgmgr_restriction_mode
1091  */
1092 int pkgmgr_client_get_restriction_mode(pkgmgr_client *pc, int *mode);
1093 int pkgmgr_client_usr_get_restriction_mode(pkgmgr_client *pc, int *mode, uid_t uid);
1094
1095 /**
1096  * @brief       Set restriction mode bit for package specified.
1097  * @details     You can combine multiple status using OR operation which you want to restrict.
1098  *
1099  * This API sets restriction bit for pkg operation to not allow user to do it.\n
1100  *
1101  * @param[in]   pc      The pointer to pkgmgr_client instance
1102  * @param[in]   pkgid   pkgid  to be restricted
1103  * @param[in]  mode restriction mode bit
1104  * @return      0 if success, error code(<0) if fail\n
1105  * @retval      PKGMGR_R_OK     success
1106  * @retval      PKGMGR_R_EINVAL invalid argument
1107  * @retval      PKGMGR_R_ECOMM  communication error
1108  * @retval      PKGMGR_R_EPRIV privilege denied
1109  * @see pkgmgr_restriction_mode
1110  */
1111 int pkgmgr_client_set_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode);
1112 int pkgmgr_client_usr_set_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode, uid_t uid);
1113
1114 /**
1115  * @brief       Unset restriction mode bit for package specified
1116  * @details     You can combine multiple status using OR operation which you want to unset
1117  *
1118  * This API unsets restriction bit to remove restriction of pkg operation.
1119  *
1120  * @param[in]   pc      The pointer to pkgmgr_client instance
1121  * @param[in]   pkgid   pkg id to be remove in restriction.
1122  * @param[in]  mode restriction mode bit
1123  * @return      0 if success, error code(<0) if fail\n
1124  * @retval      PKGMGR_R_OK     success
1125  * @retval      PKGMGR_R_EINVAL invalid argument
1126  * @retval      PKGMGR_R_ECOMM  communication error
1127  * @retval      PKGMGR_R_EPRIV privilege denied
1128  * @see pkgmgr_restriction_mode
1129  */
1130 int pkgmgr_client_unset_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode);
1131 int pkgmgr_client_usr_unset_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode, uid_t uid);
1132
1133 /**
1134  * @brief       Get restriction bit of package operation
1135  *
1136  * This API gets restriction bit for restricted package operation.\n
1137  *
1138  * @param[in]   pc      The pointer to pkgmgr_client instance
1139  * @param[in]   pkgid   pkg id to be remove in restriction.
1140  * @param[out]  mode    restriction mode bit
1141  * @return      0 if success, error code(<0) if fail\n
1142  * @retval      PKGMGR_R_OK     success
1143  * @retval      PKGMGR_R_EINVAL invalid argument
1144  * @retval      PKGMGR_R_ECOMM  communication error
1145  * @retval      PKGMGR_R_EPRIV privilege denied
1146  * @see pkgmgr_restriction_mode
1147  */
1148 int pkgmgr_client_get_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int *mode);
1149 int pkgmgr_client_usr_get_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int *mode, uid_t uid);
1150
1151 /**
1152  * @brief       Change application's label
1153  *
1154  * This API sets label of application specified.\n
1155  *
1156  * @param[in]   pc      The pointer to pkgmgr_client instance
1157  * @param[in]   appid   app id to be changed.
1158  * @param[in]   label   application's label to change.
1159  * @param[out]  mode    restriction mode bit
1160  * @return      0 if success, error code(<0) if fail\n
1161  * @retval      PKGMGR_R_OK     success
1162  * @retval      PKGMGR_R_EINVAL invalid argument
1163  * @retval      PKGMGR_R_ECOMM  communication error
1164  */
1165 int pkgmgr_client_set_app_label(pkgmgr_client *pc, char *appid, char *label);
1166 int pkgmgr_client_usr_set_app_label(pkgmgr_client *pc, char *appid, char *label, uid_t uid);
1167
1168 /**
1169  * @brief       Change application's icon
1170  *
1171  * This API sets icon of application specified.\n
1172  *
1173  * @param[in]   pc              The pointer to pkgmgr_client instance
1174  * @param[in]   appid           app id to be changed.
1175  * @param[in]   icon_path       application's icon path to change.
1176  * @return      0 if success, error code(<0) if fail\n
1177  * @retval      PKGMGR_R_OK     success
1178  * @retval      PKGMGR_R_EINVAL invalid argument
1179  * @retval      PKGMGR_R_ECOMM  communication error
1180  */
1181 int pkgmgr_client_set_app_icon(pkgmgr_client *pc, char *appid, char *icon_path);
1182 int pkgmgr_client_usr_set_app_icon(pkgmgr_client *pc, char *appid, char *icon_path, uid_t uid);
1183
1184 /**
1185  * @brief       Set debug mode
1186  *
1187  * This API sets debug mode value for request.\n
1188  *
1189  * @param[in]   pc      The pointer to pkgmgr_client instance
1190  * @param[in]   debug_mode      indicates the request is debug mode or not
1191  * @return      0 if success, error code(<0) if fail\n
1192  * @retval      PKGMGR_R_OK     success
1193  * @retval      PKGMGR_R_EINVAL invalid argument
1194  */
1195 int pkgmgr_client_set_debug_mode(pkgmgr_client *pc, bool debug_mode);
1196
1197 /**
1198  * @brief       Set skip optimization
1199  *
1200  * This API sets skip optimization value for request.\n
1201  *
1202  * @param[in]   pc      The pointer to pkgmgr_client instance
1203  * @param[in]   skip_optimization       indicates the request is skip optimization or not
1204  * @return      0 if success, error code(<0) if fail\n
1205  * @retval      PKGMGR_R_OK     success
1206  * @retval      PKGMGR_R_EINVAL invalid argument
1207  */
1208 int pkgmgr_client_set_skip_optimization(pkgmgr_client *pc, bool skip_optimization);
1209
1210 /**
1211  * @brief       Migrate legacy external image which is generated under 3.0
1212  *
1213  * This API request the migration of external image.\n
1214  *
1215  * @param[in]   pc      The pointer to pkgmgr_client instance
1216  * @param[in]   pkgid   pkg id which have legacy image
1217  * @return      0 if success, error code(<0) if fail\n
1218  * @retval      PKGMGR_R_OK     success
1219  * @retval      PKGMGR_R_EINVAL invalid argument
1220  */
1221 int pkgmgr_client_usr_migrate_external_image(pkgmgr_client *pc, const char *pkgid, uid_t uid);
1222
1223 /**
1224  * @brief       Add resource path to copy
1225  *
1226  * This API adds path for resource copy request.\n
1227  *
1228  * @param[in]   pc              The pointer to pkgmgr_client instance
1229  * @param[in]   src_path        Path of a resource that client want to copy
1230  * @param[in]   dest_path       Destination path to copy source path, if dest_path is null it will be set to root path of the package's sharing resource directory
1231  * @return      0 if success, error code(<0) if fail\n
1232  * @retval      PKGMGR_R_OK     success
1233  * @retval      PKGMGR_R_EINVAL invalid argument
1234  * @retval      PKGMGR_R_ENOMEM out of memory
1235  */
1236 int pkgmgr_client_add_res_copy_path(pkgmgr_client *pc, const char *src_path, const char *dest_path);
1237
1238 /**
1239  * @brief       This API copy resources.
1240  *
1241  * This API is for package-manager client application.\n
1242  *
1243  * @param[in]   pc              pkgmgr_client
1244  * @param[in]   event_cb        user callback
1245  * @param[in]   data            user data
1246  * @return      request_id (>0) if success, error code(<0) if fail\n
1247  * @retval      PKGMGR_R_OK     success
1248  * @retval      PKGMGR_R_ECOMM  communication error
1249  * @retval      PKGMGR_R_EINVAL invalid argument
1250  * @retval      PKGMGR_R_ENOMEM out of memory
1251  * @retval      PKGMGR_R_EPRIV  privilege denied
1252 */
1253 int pkgmgr_client_res_copy(pkgmgr_client *pc, pkgmgr_res_copy_handler event_cb, void *user_data);
1254
1255 /**
1256  * @brief       Add directory path to create in the resource sharing directory of the package
1257  *
1258  * This API adds directory path for resource create directory request.\n
1259  *
1260  * @param[in]   pc              The pointer to pkgmgr_client instance
1261  * @param[in]   dir_path        Path of a directory that client want to create
1262  * @return      0 if success, error code(<0) if fail\n
1263  * @retval      PKGMGR_R_OK     success
1264  * @retval      PKGMGR_R_EINVAL invalid argument
1265  * @retval      PKGMGR_R_ENOMEM out of memory
1266  */
1267 int pkgmgr_client_add_res_create_dir_path(pkgmgr_client *pc, const char *dir_path);
1268
1269 /**
1270  * @brief       This API create directories in the resource sharing directory of the package
1271  *
1272  * This API is for package-manager client application.\n
1273  *
1274  * @param[in]   pc              pkgmgr_client
1275  * @param[in]   event_cb        user callback
1276  * @param[in]   data            user data
1277  * @return      request_id (>0) if success, error code(<0) if fail\n
1278  * @retval      PKGMGR_R_OK     success
1279  * @retval      PKGMGR_R_ECOMM  communication error
1280  * @retval      PKGMGR_R_EINVAL invalid argument
1281  * @retval      PKGMGR_R_ENOMEM out of memory
1282  * @retval      PKGMGR_R_EPRIV  privilege denied
1283 */
1284 int pkgmgr_client_res_create_dir(pkgmgr_client *pc, pkgmgr_res_copy_handler event_cb, void *user_data);
1285
1286 /**
1287  * @brief       Add resource path to remove
1288  *
1289  * This API adds path for resource remove request.\n
1290  *
1291  * @param[in]   pc              The pointer to pkgmgr_client instance
1292  * @param[in]   res_path        Path of a copied resource that client want to remove
1293  * @return      0 if success, error code(<0) if fail\n
1294  * @retval      PKGMGR_R_OK     success
1295  * @retval      PKGMGR_R_EINVAL invalid argument
1296  * @retval      PKGMGR_R_ENOMEM out of memory
1297  */
1298 int pkgmgr_client_add_res_remove_path(pkgmgr_client *pc, const char *res_path);
1299
1300 /**
1301  * @brief       This API removes resources.
1302  *
1303  * This API is for package-manager client application.\n
1304  *
1305  * @param[in]   pc              pkgmgr_client
1306  * @param[in]   event_cb        user callback
1307  * @param[in]   data            user data
1308  * @return      request_id (>0) if success, error code(<0) if fail\n
1309  * @retval      PKGMGR_R_OK     success
1310  * @retval      PKGMGR_R_ECOMM  communication error
1311  * @retval      PKGMGR_R_EINVAL invalid argument
1312  * @retval      PKGMGR_R_ENOMEM out of memory
1313  * @retval      PKGMGR_R_EPRIV  privilege denied
1314 */
1315 int pkgmgr_client_res_remove(pkgmgr_client *pc, pkgmgr_res_copy_handler event_cb, void *user_data);
1316
1317 /**
1318  * @brief       This API uninstall copied resources of the package.
1319  *
1320  * This API is for package-manager client application.\n
1321  *
1322  * @param[in]   pc              pkgmgr_client
1323  * @param[in]   pkgid           package id
1324  * @param[in]   event_cb        user callback
1325  * @param[in]   user_data       user data
1326  * @return      request_id (>0) if success, error code(<0) if fail\n
1327  * @retval      PKGMGR_R_OK     success
1328  * @retval      PKGMGR_R_ECOMM  communication error
1329  * @retval      PKGMGR_R_EINVAL invalid argument
1330  * @retval      PKGMGR_R_ENOMEM out of memory
1331  * @retval      PKGMGR_R_EPRIV  privilege denied
1332  */
1333 int pkgmgr_client_res_uninstall(pkgmgr_client *pc, const char *pkgid, pkgmgr_res_copy_handler event_cb, void *user_data);
1334 int pkgmgr_client_res_usr_uninstall(pkgmgr_client *pc, const char *pkgid, pkgmgr_res_copy_handler event_cb, void *user_data, uid_t uid);
1335
1336 /**
1337  * @brief       This API creates resource event info.
1338  *
1339  * This API is for package-manager client application.\n
1340  *
1341  * @return      resource event info object
1342  * @retval      NULL    on failure creating an object
1343 */
1344 pkgmgr_res_event_info *pkgmgr_res_event_info_new();
1345
1346 /**
1347  * @brief       This API delete resource event info.
1348  *
1349  * This API is for package-manager client application.\n
1350  *
1351  * @param[in]   info    resource event info
1352  * @return      Operation result;
1353  * @retval      PKGMGR_R_OK     success
1354  * @retval      PKGMGR_R_EINVAL invalid argument
1355  * @retval      PKGMGR_R_ERROR  internal error
1356 */
1357 int pkgmgr_res_event_info_free(pkgmgr_res_event_info *info);
1358
1359 /**
1360  * @brief       This API gets the error code from resource callback handle
1361  *
1362  * This API is for package-manager client application.\n
1363  *
1364  * @param[in]   handle          resource event information handle
1365  * @param[in]   error_code      error code about resource event
1366  * @retval      PKGMGR_R_OK     success
1367  * @retval      PKGMGR_R_EINVAL invalid argument
1368 */
1369 int pkgmgr_res_event_info_set_error_code(pkgmgr_res_event_info *handle, int error_code);
1370
1371 /**
1372  * @brief       This API gets the error code from resource callback handle
1373  *
1374  * This API is for package-manager client application.\n
1375  *
1376  * @param[in]   handle          resource event information handle
1377  * @param[out]  error_code      error code about resource event
1378  * @retval      PKGMGR_R_OK     success
1379  * @retval      PKGMGR_R_EINVAL invalid argument
1380 */
1381 int pkgmgr_res_event_info_get_error_code(pkgmgr_res_event_info *handle, int *error_code);
1382
1383 /** @} */
1384
1385
1386 #ifdef __cplusplus
1387 }
1388 #endif
1389 #endif                          /* __PKG_MANAGER_H__ */
1390 /**
1391  * @}
1392  * @}
1393  */