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