4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
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>
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
32 * @file package-manager.h
33 * @author Sewook Park <sewook7.park@samsung.com>
35 * @brief This file declares API of slp-pkgmgr library
37 * @addtogroup APPLICATION_FRAMEWORK
40 * @defgroup PackageManager
41 * @section Header to use them:
43 * #include "package-manager.h"
46 * @addtogroup PackageManager
50 #ifndef __PKG_MANAGER_H__
51 #define __PKG_MANAGER_H__
56 #include <sys/types.h>
63 #define DEPRECATED __attribute__ ((__deprecated__))
69 * This is package manager
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
78 * @file package-manager.h
79 * @brief Package Manager header
81 * Generated by Sewook Park <sewook7.park@samsung.com>
87 * @addtogroup PackageManager
92 * @brief pkgmgr info types.
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"
103 * @brief listening status type in pkgmgr.
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
121 #define PKG_SIZE_INFO_TOTAL "__TOTAL__"
122 #define PKG_CLEAR_ALL_CACHE "__ALL__"
124 * @brief Return values in pkgmgr.
126 typedef enum _pkgmgr_return_val {
127 PKGMGR_R_ESYSTEM = -9, /**< Severe system error */
128 PKGMGR_R_EIO = -8, /**< IO error */
129 PKGMGR_R_ENOMEM = -7, /**< Out of memory */
130 PKGMGR_R_ENOPKG = -6, /**< No such package */
131 PKGMGR_R_EPRIV = -5, /**< Privilege denied */
132 PKGMGR_R_ETIMEOUT = -4, /**< Timeout */
133 PKGMGR_R_EINVAL = -3, /**< Invalid argument */
134 PKGMGR_R_ECOMM = -2, /**< Comunication Error */
135 PKGMGR_R_ERROR = -1, /**< General error */
136 PKGMGR_R_OK = 0 /**< General success */
141 * @defgroup pkg_operate APIs to install /uninstall / activate application
144 * APIs to install /uninstall / activate application
145 * - Install application using application package filepath
146 * - Uninstall application using application package name
147 * - Activate application using application package name
153 * @addtogroup pkg_operate
157 typedef void pkgmgr_client;
158 typedef void pkgmgr_info;
162 long long cache_size;
164 long long ext_data_size;
165 long long ext_cache_size;
166 long long ext_app_size;
170 PM_UPDATEINFO_TYPE_NONE = 0,
171 PM_UPDATEINFO_TYPE_FORCE,
172 PM_UPDATEINFO_TYPE_OPTIONAL
173 } pkgmgr_updateinfo_type;
178 pkgmgr_updateinfo_type type;
181 typedef int (*pkgmgr_iter_fn)(const char *pkg_type, const char *pkgid,
182 const char *version, void *data);
184 typedef int (*pkgmgr_handler)(uid_t target_uid, int req_id, const char *pkg_type,
185 const char *pkgid, const char *key,
186 const char *val, const void *pmsg, void *data);
188 typedef int (*pkgmgr_app_handler)(uid_t target_uid, int req_id, const char *pkg_type,
189 const char *pkgid, const char *appid, const char *key,
190 const char *val, const void *pmsg, void *data);
192 typedef void (*pkgmgr_pkg_size_info_receive_cb)(pkgmgr_client *pc, const char *pkgid,
193 const pkg_size_info_t *size_info, void *user_data);
195 typedef void (*pkgmgr_total_pkg_size_info_receive_cb)(pkgmgr_client *pc,
196 const pkg_size_info_t *size_info, void *user_data);
202 } pkgmgr_client_type;
210 PM_MOVE_TO_INTERNAL = 0,
211 PM_MOVE_TO_SDCARD = 1,
216 PM_REQUEST_GET_SIZE = 1,
217 PM_REQUEST_KILL_APP = 2,
218 PM_REQUEST_CHECK_APP = 3,
220 } pkgmgr_request_service_type;
223 /* sync, get data, total size for one requested pkgid */
224 PM_GET_TOTAL_SIZE = 0,
225 PM_GET_DATA_SIZE = 1,
227 /* async, get total used storage size */
230 /* async, get a pkgid's data, total size for all installed pkg */
231 PM_GET_SIZE_INFO = 3,
234 PM_GET_TOTAL_AND_DATA = 4,
235 PM_GET_SIZE_FILE = 5,
237 /* async, get data, cache, app size based on "pkg_size_info_t" */
238 PM_GET_PKG_SIZE_INFO = 6,
239 PM_GET_TOTAL_PKG_SIZE_INFO = 7,
241 } pkgmgr_getsize_type;
244 PM_RESTRICTION_MODE_ALL = 0x07,
245 PM_RESTRICTION_MODE_INSTALL = 0x01,
246 PM_RESTRICTION_MODE_UNINSTALL = 0x02,
247 PM_RESTRICTION_MODE_MOVE = 0x04,
248 } pkgmgr_restriction_mode;
251 * @brief This API creates pkgmgr client.
253 * This API is for package-manager client application.\n
255 * @param[in] ctype client type - PC_REQUEST, PC_LISTENING, PC_BROADCAST
256 * @return pkgmgr_client object
257 * @retval NULL on failure creating an object
259 pkgmgr_client *pkgmgr_client_new(pkgmgr_client_type ctype);
262 * @brief This API deletes pkgmgr client.
264 * This API is for package-manager client application.\n
266 * @param[in] pc pkgmgr_client
267 * @return Operation result;
268 * @retval PKGMGR_R_OK success
269 * @retval PKGMGR_R_EINVAL invalid argument
270 * @retval PKGMGR_R_ERROR internal error
272 int pkgmgr_client_free(pkgmgr_client *pc);
275 * @brief This API set information to install tep package.
276 * @details Use this API before calling installation API.
278 * This API is for package-manager client application.\n
280 * @param[in] pc pkgmgr_client
281 * @param[in] tep_path full path that tep file is located at
282 * @param[in] tep_move if TRUE, source file will be moved, else it will be copied
283 * @retval PKGMGR_R_OK success
284 * @retval PKGMGR_R_EINVAL invalid argument
286 int pkgmgr_client_set_tep_path(pkgmgr_client *pc, const char *tep_path, bool tep_move);
289 * @brief This API installs package.
291 * This API is for package-manager client application.\n
293 * @param[in] pc pkgmgr_client
294 * @param[in] pkg_type package type
295 * @param[in] descriptor_path full path that descriptor is located
296 * @param[in] pkg_path full path that package file is located
297 * @param[in] optional_data optional data which is used for installation
298 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
299 * @param[in] event_cb user callback
300 * @param[in] data user data
301 * @return request_id (>0) if success, error code(<0) if fail\n
302 * @retval PKGMGR_R_OK success
303 * @retval PKGMGR_R_EINVAL invalid argument
304 * @retval PKGMGR_R_ECOMM communication error
306 int pkgmgr_client_install(pkgmgr_client *pc, const char *pkg_type,
307 const char *descriptor_path, const char *pkg_path,
308 const char *optional_data, pkgmgr_mode mode,
309 pkgmgr_handler event_cb, void *data);
310 int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type,
311 const char *descriptor_path, const char *pkg_path,
312 const char *optional_data, pkgmgr_mode mode,
313 pkgmgr_handler event_cb, void *data, uid_t uid);
315 * @brief This API reinstalls package.
317 * This API is for package-manager client application.\n
319 * @param[in] pc pkgmgr_client
320 * @param[in] pkg_type package type
321 * @param[in] pkg_path full path that package file is located
322 * @param[in] optional_data optional data which is used for installation
323 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
324 * @param[in] event_cb user callback
325 * @param[in] data user data
326 * @return request_id (>0) if success, error code(<0) if fail\n
327 * @retval PKGMGR_R_OK success
328 * @retval PKGMGR_R_EINVAL invalid argument
329 * @retval PKGMGR_R_ECOMM communication error
331 int pkgmgr_client_reinstall(pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
332 const char *optional_data, pkgmgr_mode mode,
333 pkgmgr_handler event_cb, void *data);
334 int pkgmgr_client_usr_reinstall(pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
335 const char *optional_data, pkgmgr_mode mode,
336 pkgmgr_handler event_cb, void *data, uid_t uid);
339 * @brief This API mount-installs package.
341 * This API is for package-manager client application.\n
343 * @param[in] pc pkgmgr_client
344 * @param[in] pkg_type package type
345 * @param[in] descriptor_path full path that descriptor is located
346 * @param[in] pkg_path full path that package file is located
347 * @param[in] optional_data optional data which is used for installation
348 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
349 * @param[in] event_cb user callback
350 * @param[in] data user data
351 * @return request_id (>0) if success, error code(<0) if fail\n
352 * @retval PKGMGR_R_OK success
353 * @retval PKGMGR_R_EINVAL invalid argument
354 * @retval PKGMGR_R_ECOMM communication error
356 int pkgmgr_client_mount_install(pkgmgr_client *pc, const char *pkg_type,
357 const char *descriptor_path, const char *pkg_path,
358 const char *optional_data, pkgmgr_mode mode,
359 pkgmgr_handler event_cb, void *data);
360 int pkgmgr_client_usr_mount_install(pkgmgr_client *pc, const char *pkg_type,
361 const char *descriptor_path, const char *pkg_path,
362 const char *optional_data, pkgmgr_mode mode,
363 pkgmgr_handler event_cb, void *data, uid_t uid);
366 * @brief This API uninstalls package.
368 * This API is for package-manager client application.\n
370 * @param[in] pc pkgmgr_client
371 * @param[in] pkg_type package type
372 * @param[in] pkgid package id
373 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
374 * @param[in] event_cb user callback
375 * @param[in] data user data
376 * @param[in] uid the addressee user id of the instruction
377 * @return request_id (>0), error code(<0) if fail\n
378 * @retval PKGMGR_R_OK success
379 * @retval PKGMGR_R_EINVAL invalid argument
380 * @retval PKGMGR_R_ECOMM communication error
382 int pkgmgr_client_uninstall(pkgmgr_client *pc, const char *pkg_type,
383 const char *pkgid, pkgmgr_mode mode,
384 pkgmgr_handler event_cb, void *data);
385 int pkgmgr_client_usr_uninstall(pkgmgr_client *pc, const char *pkg_type,
386 const char *pkgid, pkgmgr_mode mode,
387 pkgmgr_handler event_cb, void *data, uid_t uid);
390 * @brief This API moves installed package to SD card or vice versa.
392 * This API is for package-manager client application.\n
394 * @param[in] pc pkgmgr_client
395 * @param[in] pkg_type package type
396 * @param[in] pkgid application package id
397 * @param[in] move_type PM_MOVE_TO_INTERNAL or PM_MOVE_TO_SDCARD
398 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
399 * @param[in] event_cb user callback
400 * @param[in] data user data
401 * @param[in] uid the addressee user id of the instruction
402 * @retval PKGMGR_R_OK success
403 * @retval PKGMGR_R_EINVAL invalid argument
404 * @retval PKGMGR_R_ERROR general error
406 int pkgmgr_client_move(pkgmgr_client *pc, const char *pkg_type,
407 const char *pkgid, pkgmgr_move_type move_type,
408 pkgmgr_handler event_cb, void *data);
409 int pkgmgr_client_usr_move(pkgmgr_client *pc, const char *pkg_type,
410 const char *pkgid, pkgmgr_move_type move_type,
411 pkgmgr_handler event_cb, void *data, uid_t uid);
414 * @brief This API registers the update information of given packages
416 * This API is for package-manager client application.\n
418 * @param[in] pc pkgmgr_client
419 * @param[in] update_info update information
420 * @param[in] uid the addressee user id of the instruction
421 * @retval PKGMGR_R_OK success
422 * @retval PKGMGR_R_EINVAL invalid argument
423 * @retval PKGMGR_R_ERROR general error
425 int pkgmgr_client_register_pkg_update_info(pkgmgr_client *pc,
426 pkg_update_info_t *update_info);
427 int pkgmgr_client_usr_register_pkg_update_info(pkgmgr_client *pc,
428 pkg_update_info_t *update_info, uid_t uid);
431 * @brief This API unregisters update information of certain package.
433 * This API is for package-manager client application.\n
435 * @param[in] pc pkgmgr_client
436 * @param[in] pkgid package id
437 * @param[in] uid the addressee user id of the instruction
438 * @retval PKGMGR_R_OK success
439 * @retval PKGMGR_R_EINVAL invalid argument
440 * @retval PKGMGR_R_ERROR general error
442 int pkgmgr_client_unregister_pkg_update_info(pkgmgr_client *pc, const char *pkgid);
443 int pkgmgr_client_usr_unregister_pkg_update_info(pkgmgr_client *pc,
444 const char *pkgid, uid_t uid);
447 * @brief This API unregister update information of all packages.
449 * This API is for package-manager client application.\n
451 * @param[in] pc pkgmgr_client
452 * @param[in] uid the addressee user id of the instruction
453 * @retval PKGMGR_R_OK success
454 * @retval PKGMGR_R_EINVAL invalid argument
455 * @retval PKGMGR_R_ERROR general error
457 int pkgmgr_client_unregister_all_pkg_update_info(pkgmgr_client *pc);
458 int pkgmgr_client_usr_unregister_all_pkg_update_info(pkgmgr_client *pc,
462 * @brief This API activates package.
464 * This API is for package-manager client application.\n
466 * @param[in] pc pkgmgr_client
467 * @param[in] pkg_type package type
468 * @param[in] pkgid package id
469 * @return request_id (>0) if success, error code(<0) if fail\n
470 * @retval PKGMGR_R_OK success
471 * @retval PKGMGR_R_EINVAL invalid argument
472 * @retval PKGMGR_R_ECOMM communication error
474 int pkgmgr_client_activate(pkgmgr_client *pc, const char *pkg_type,
476 int pkgmgr_client_usr_activate(pkgmgr_client *pc, const char *pkg_type,
477 const char *pkgid, uid_t uid);
480 * @brief This API activates multiple packages.
482 * This API is for package-manager client application.\n
484 * @param[in] pc pkgmgr_client
485 * @param[in] pkg_type package type
486 * @param[in] pkgids array of package ids
487 * @param[in] n_pkgs size of array
488 * @param[in] event_cb user callback
489 * @param[in] data user data
490 * @return request_id (>0) if success, error code(<0) if fail\n
491 * @retval PKGMGR_R_OK success
492 * @retval PKGMGR_R_EINVAL invalid argument
493 * @retval PKGMGR_R_ECOMM communication error
495 int pkgmgr_client_activate_packages(pkgmgr_client *pc, const char *pkg_type,
496 const char **pkgids, int n_pkgs,
497 pkgmgr_handler event_cb, void *data);
498 int pkgmgr_client_usr_activate_packages(pkgmgr_client *pc, const char *pkg_type,
499 const char **pkgids, int n_pkgs,
500 pkgmgr_handler event_cb, void *data, uid_t uid);
503 * @brief This API deactivates package.
505 * This API is for package-manager client application.\n
507 * @param[in] pc pkgmgr_client
508 * @param[in] pkg_type package type
509 * @param[in] pkgid package id
510 * @return request_id (>0) if success, error code(<0) if fail\n
511 * @retval PKGMGR_R_OK success
512 * @retval PKGMGR_R_EINVAL invalid argument
513 * @retval PKGMGR_R_ECOMM communication error
515 int pkgmgr_client_deactivate(pkgmgr_client *pc, const char *pkg_type,
517 int pkgmgr_client_usr_deactivate(pkgmgr_client *pc, const char *pkg_type,
518 const char *pkgid, uid_t uid);
521 * @brief This API deactivates multiple packages.
523 * This API is for package-manager client application.\n
525 * @param[in] pc pkgmgr_client
526 * @param[in] pkg_type package type
527 * @param[in] pkgids array of package ids
528 * @param[in] n_pkgs size of array
529 * @param[in] event_cb user callback
530 * @param[in] data user data
531 * @return request_id (>0) if success, error code(<0) if fail\n
532 * @retval PKGMGR_R_OK success
533 * @retval PKGMGR_R_EINVAL invalid argument
534 * @retval PKGMGR_R_ECOMM communication error
536 int pkgmgr_client_deactivate_packages(pkgmgr_client *pc, const char *pkg_type,
537 const char **pkgids, int n_pkgs,
538 pkgmgr_handler event_cb, void *data);
539 int pkgmgr_client_usr_deactivate_packages(pkgmgr_client *pc, const char *pkg_type,
540 const char **pkgids, int n_pkgs,
541 pkgmgr_handler event_cb, void *data, uid_t uid);
544 * @brief This API deactivates app.
546 * This API is for package-manager client application.\n
548 * @param[in] pc pkgmgr_client
549 * @param[in] appid applicaiton id
550 * @param[in] app_event_cb user callback
551 * @param[in] data user data
552 * @return request_id (>0) if success, error code(<0) if fail\n
553 * @retval PKGMGR_R_OK success
554 * @retval PKGMGR_R_EINVAL invalid argument
555 * @retval PKGMGR_R_ECOMM communication error
557 int pkgmgr_client_deactivate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data);
558 int pkgmgr_client_usr_deactivate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
561 * @brief This API activates multiple apps.
563 * This API is for package-manager client application.\n
565 * @param[in] pc pkgmgr_client
566 * @param[in] appids array of application ids
567 * @param[in] n_apps size of array
568 * @param[in] app_event_cb user callback
569 * @param[in] data user data
570 * @return request_id (>0) if success, error code(<0) if fail\n
571 * @retval PKGMGR_R_OK success
572 * @retval PKGMGR_R_EINVAL invalid argument
573 * @retval PKGMGR_R_ECOMM communication error
575 int pkgmgr_client_activate_apps(pkgmgr_client *pc, const char **appids, int n_apps, pkgmgr_app_handler app_event_cb, void *data);
576 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);
579 * @brief This API deactivates multiple apps.
581 * This API is for package-manager client application.\n
583 * @param[in] pc pkgmgr_client
584 * @param[in] appids array of application ids
585 * @param[in] n_apps size of array
586 * @param[in] app_event_cb user callback
587 * @param[in] data user data
588 * @return request_id (>0) if success, error code(<0) if fail\n
589 * @retval PKGMGR_R_OK success
590 * @retval PKGMGR_R_EINVAL invalid argument
591 * @retval PKGMGR_R_ECOMM communication error
593 int pkgmgr_client_deactivate_apps(pkgmgr_client *pc, const char **appids, int n_apps, pkgmgr_app_handler app_event_cb, void *data);
594 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);
597 * @brief This API deactivates global app for user specified by uid.
599 * This API is for package-manager client application.\n
601 * @param[in] pc pkgmgr_client
602 * @param[in] appid applicaiton id
603 * @param[in] app_event_cb user callback
604 * @param[in] uid user id
605 * @param[in] data user data
606 * @return request_id (>0) if success, error code(<0) if fail\n
607 * @retval PKGMGR_R_OK success
608 * @retval PKGMGR_R_EINVAL invalid argument
609 * @retval PKGMGR_R_ECOMM communication error
611 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);
614 * @brief This API activates app.
616 * This API is for package-manager client application.\n
618 * @param[in] pc pkgmgr_client
619 * @param[in] appid applicaiton id
620 * @param[in] app_event_cb user callback
621 * @param[in] uid user id
622 * @param[in] data user data
623 * @return request_id (>0) if success, error code(<0) if fail\n
624 * @retval PKGMGR_R_OK success
625 * @retval PKGMGR_R_EINVAL invalid argument
626 * @retval PKGMGR_R_ECOMM communication error
628 int pkgmgr_client_activate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data);
629 int pkgmgr_client_usr_activate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
632 * @brief This API activates global app for user specified by uid.
634 * This API is for package-manager client application.\n
636 * @param[in] pc pkgmgr_client
637 * @param[in] appid applicaiton id
638 * @param[in] app_event_cb user callback
639 * @param[in] uid user id
640 * @param[in] data user data
641 * @return request_id (>0) if success, error code(<0) if fail\n
642 * @retval PKGMGR_R_OK success
643 * @retval PKGMGR_R_EINVAL invalid argument
644 * @retval PKGMGR_R_ECOMM communication error
646 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);
649 * @brief This API deletes application's private data.
651 * This API is for package-manager client application.\n
653 * @remarks You should call this function with regular uid
654 * @param[in] pc pkgmgr_client
655 * @param[in] pkg_type package type
656 * @param[in] pkgid package id
657 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
658 * @return request_id (>0) if success, error code(<0) if fail\n
659 * @retval PKGMGR_R_OK success
660 * @retval PKGMGR_R_EINVAL invalid argument
661 * @retval PKGMGR_R_ECOMM communication error
663 int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
664 const char *appid, pkgmgr_mode mode);
665 int pkgmgr_client_usr_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
666 const char *appid, pkgmgr_mode mode, uid_t uid);
668 * @brief This API set status type to listen for the pkgmgr's broadcasting
670 * This API is for package-manager client application.\n
672 * @param[in] pc pkgmgr_client
673 * @param[in] status_type status type to listen
674 * @return request_id (>0) if success, error code(<0) if fail\n
675 * @retval PKGMGR_R_OK success
676 * @retval PKGMGR_R_EINVAL invalid argument
678 int pkgmgr_client_set_status_type(pkgmgr_client *pc, int status_type);
681 * @brief This API request to listen the pkgmgr's broadcasting
683 * This API is for package-manager client application.\n
685 * @param[in] pc pkgmgr_client
686 * @param[in] 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
692 int pkgmgr_client_listen_status(pkgmgr_client *pc, pkgmgr_handler event_cb,
696 * @brief This API request to listen the pkgmgr's broadcasting about apps
698 * This API is for package-manager client application.\n
700 * @param[in] pc pkgmgr_client
701 * @param[in] event_cb user callback
702 * @param[in] data user data
703 * @return request_id (>0) if success, error code(<0) if fail\n
704 * @retval PKGMGR_R_OK success
705 * @retval PKGMGR_R_EINVAL invalid argument
707 int pkgmgr_client_listen_app_status(pkgmgr_client *pc, pkgmgr_app_handler event_cb,
711 * @brief This API request to stop listen the pkgmgr's broadcasting
713 * This API is for package-manager client application.\n
715 * @param[in] pc pkgmgr_client
716 * @return 0 if success, error code(<0) if fail\n
717 * @retval PKGMGR_R_OK success
718 * @retval PKGMGR_R_EINVAL invalid argument
719 * @retval PKGMGR_R_ERROR internal error
721 int pkgmgr_client_remove_listen_status(pkgmgr_client *pc);
724 * @brief This API broadcasts pkgmgr's status
726 * This API is for package-manager client application.\n
728 * @param[in] pc pkgmgr_client
729 * @param[in] pkg_type package type
730 * @param[in] pkgid package id
731 * @param[in] key key to broadcast
732 * @param[in] val value to broadcast
733 * @return 0 if success, error code(<0) if fail\n
734 * @retval PKGMGR_R_OK success
735 * @retval PKGMGR_R_EINVAL invalid argument
737 int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type,
738 const char *pkgid, const char *key,
742 * @brief This API gets the package's information.
744 * This API is for package-manager client application.\n
746 * @param[in] pkg_path package file path to get infomation
747 * @return package entry pointer if success, NULL if fail\n
749 pkgmgr_info *pkgmgr_client_check_pkginfo_from_file(const char *pkg_path);
752 * @brief This API get package information value
754 * This API is for package-manager client application.\n
756 * @param[in] pkg_info pointer for package info entry
757 * @return 0 if success, error code(<0) if fail\n
759 int pkgmgr_client_free_pkginfo(pkgmgr_info *pkg_info);
762 * @brief This API requests service
764 * This API is for package-manager client application.\n
766 * @param[in] service_type pkgmgr_request_service_type
767 * @param[in] service_mode mode which is used for addtional mode selection
768 * @param[in] pc pkgmgr_client
769 * @param[in] pkg_type package type
770 * @param[in] pkgid package id
771 * @param[in] custom_info custom information which is used for addtional information
772 * @param[in] event_cb user callback
773 * @param[in] data user data
774 * @return request_id (>0) if success, error code(<0) if fail\n
775 * @retval PKGMGR_R_OK success
776 * @retval PKGMGR_R_EINVAL invalid argument
777 * @retval PKGMGR_R_ECOMM communication error
779 int pkgmgr_client_request_service(pkgmgr_request_service_type service_type, int service_mode,
780 pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
781 const char *custom_info, pkgmgr_handler event_cb, void *data);
782 int pkgmgr_client_usr_request_service(pkgmgr_request_service_type service_type, int service_mode,
783 pkgmgr_client *pc, const char *pkg_type, const char *pkgid, uid_t uid,
784 const char *custom_info, pkgmgr_handler event_cb, void *data);
786 * @brief This API get package size
788 * This API is for package-manager client application.\n
790 * @param[in] pc pkgmgr_client
791 * @param[in] pkgid package id
792 * @param[in] get_type type for pkgmgr client request to get package size
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_ECOMM communication error
800 int pkgmgr_client_get_size(pkgmgr_client *pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data);
801 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);
804 * @brief Gets the package size information.
805 * @details The package size info is asynchronously obtained by the specified callback function.
807 * @param[in] pc The pointer to pkgmgr_client instance
808 * @param[in] pkgid The package ID
809 * @param[in] result_cb The asynchronous callback function to get the package size information
810 * @param[in] user_data User data to be passed to the callback function
812 * @return 0 on success, otherwise a negative error value
813 * @retval #PKGMGR_R_OK Successful
814 * @retval #PKGMGR_R_EINVAL Invalid parameter
815 * @retval #PKGMGR_R_ERROR Internal error
817 int pkgmgr_client_get_package_size_info(pkgmgr_client *pc, const char *pkgid, pkgmgr_pkg_size_info_receive_cb result_cb, void *user_data);
818 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);
821 * @brief Gets the sum of the entire package size information.
822 * @details The package size info is asynchronously obtained by the specified callback function.
824 * @param[in] pc The pointer to pkgmgr_client instance
825 * @param[in] result_cb The asynchronous callback function to get the total package size information
826 * @param[in] user_data User data to be passed to the callback function
828 * @return 0 on success, otherwise a negative error value
829 * @retval #PKGMGR_R_OK Successful
830 * @retval #PKGMGR_R_EINVAL Invalid parameter
831 * @retval #PKGMGR_R_ERROR Internal error
833 int pkgmgr_client_get_total_package_size_info(pkgmgr_client *pc, pkgmgr_total_pkg_size_info_receive_cb result_cb, void *user_data);
834 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);
837 * @brief Gets size information of each installed packages.
838 * @details The package size info is asynchronously obtained by callback function added by pkgmgr_client_listen_status.
840 * @return 0 on success, otherwise a negative error value
841 * @retval #PKGMGR_R_OK Successful
842 * @retval #PKGMGR_R_EINVAL Invalid parameter
843 * @retval #PKGMGR_R_ECOMM communication error
844 * @retval #PKGMGR_R_ERROR Internal error
846 int pkgmgr_client_request_size_info(void);
847 int pkgmgr_client_usr_request_size_info(uid_t uid);
850 * @brief This API removes cache directories
852 * This API is for package-manager client application.\n
854 * @remarks You should call this function with regular uid
855 * @param[in] pkgid package id
856 * @return 0 if success, error code(<0) if fail\n
857 * @retval PKGMGR_R_OK success
858 * @retval PKGMGR_R_EINVAL invalid argument
859 * @retval PKGMGR_R_EPRIV privilege denied
860 * @retval PKGMGR_R_ERROR internal error
862 int pkgmgr_client_clear_cache_dir(const char *pkgid);
863 int pkgmgr_client_usr_clear_cache_dir(const char *pkgid, uid_t uid);
866 * @brief This API removes all cache directories
868 * This API is for package-manager client application.\n
870 * @remarks You should call this function with regular uid
871 * @return 0 if success, error code(<0) if fail\n
872 * @retval PKGMGR_R_OK success
873 * @retval PKGMGR_R_EINVAL invalid argument
874 * @retval PKGMGR_R_EPRIV privilege denied
875 * @retval PKGMGR_R_ERROR internal error
877 int pkgmgr_client_clear_all_cache_dir(void);
878 int pkgmgr_client_usr_clear_all_cache_dir(uid_t uid);
881 * @brief Generates request for getting license
883 * This API generates request for getting license.\n
885 * @remarks You must release @a req_data and @a license_url by yourself.
886 * @param[in] pc The pointer to pkgmgr_client instance
887 * @param[in] resp_data The response data string of the purchase request
888 * @param[out] req_data License request data
889 * @param[out] license_url License acquisition url data
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 * @retval PKGMGR_R_ECOMM communication error
894 * @retval PKGMGR_R_EPRIV privilege denied
895 * @retval PKGMGR_R_ESYSTEM severe system error
897 int pkgmgr_client_generate_license_request(pkgmgr_client *pc, const char *resp_data, char **req_data, char **license_url);
900 * @brief Registers encrypted license
902 * This API registers encrypted license.\n
904 * @param[in] pc The pointer to pkgmgr_client instance
905 * @param[in] resp_data The response data string of the purchase request
906 * @return 0 if success, error code(<0) if fail\n
907 * @retval PKGMGR_R_OK success
908 * @retval PKGMGR_R_EINVAL invalid argument
909 * @retval PKGMGR_R_ECOMM communication error
910 * @retval PKGMGR_R_EPRIV privilege denied
911 * @retval PKGMGR_R_ESYSTEM severe system error
913 int pkgmgr_client_register_license(pkgmgr_client *pc, const char *resp_data);
916 * @brief Decrypts contents which is encrypted
918 * This API decrypts contents which is encrypted.\n
920 * @param[in] pc The pointer to pkgmgr_client instance
921 * @param[in] drm_file_path The pointer to pkgmgr_client instance
922 * @param[in] decrypted_file_path The pointer to pkgmgr_client instance
923 * @return 0 if success, error code(<0) if fail\n
924 * @retval PKGMGR_R_OK success
925 * @retval PKGMGR_R_EINVAL invalid argument
926 * @retval PKGMGR_R_ECOMM communication error
927 * @retval PKGMGR_R_EPRIV privilege denied
928 * @retval PKGMGR_R_ESYSTEM severe system error
930 int pkgmgr_client_decrypt_package(pkgmgr_client *pc, const char *drm_file_path, const char *decrypted_file_path);
933 * @brief This API is enabled the splash screen
935 * This API is for package-manager client application.\n
937 * @param[in] pc pkgmgr_client
938 * @param[in] appid applicaiton id
939 * @return request_id (>0) if success, error code(<0) if fail\n
940 * @retval PKGMGR_R_OK success
941 * @retval PKGMGR_R_EINVAL invalid argument
942 * @retval PKGMGR_R_ECOMM communication error
943 * @retval PKGMGR_R_ENOMEM out of memory
945 int pkgmgr_client_enable_splash_screen(pkgmgr_client *pc, const char *appid);
946 int pkgmgr_client_usr_enable_splash_screen(pkgmgr_client *pc, const char *appid, uid_t uid);
949 * @brief This API is disabled the splash screen
951 * This API is for package-manager client application.\n
953 * @param[in] pc pkgmgr_client
954 * @param[in] appid applicaiton id
955 * @return request_id (>0) if success, error code(<0) if fail\n
956 * @retval PKGMGR_R_OK success
957 * @retval PKGMGR_R_EINVAL invalid argument
958 * @retval PKGMGR_R_ECOMM communication error
959 * @retval PKGMGR_R_ENOMEM out of memory
961 int pkgmgr_client_disable_splash_screen(pkgmgr_client *pc, const char *appid);
962 int pkgmgr_client_usr_disable_splash_screen(pkgmgr_client *pc, const char *appid, uid_t uid);
965 * @brief Set restriction mode
967 * This API set restriction mode bit.\n
969 * @param[in] pc The pointer to pkgmgr_client instance
970 * @param[in] mode restriction mode bit
971 * @return 0 if success, error code(<0) if fail\n
972 * @retval PKGMGR_R_OK success
973 * @retval PKGMGR_R_EINVAL invalid argument
974 * @retval PKGMGR_R_ECOMM communication error
975 * @retval PKGMGR_R_EPRIV privilege denied
976 * @see pkgmgr_restriction_mode
978 int pkgmgr_client_set_restriction_mode(pkgmgr_client *pc, int mode);
979 int pkgmgr_client_usr_set_restriction_mode(pkgmgr_client *pc, int mode, uid_t uid);
982 * @brief Unset restriction mode
984 * This API unset restriction mode bit.\n
986 * @param[in] pc The pointer to pkgmgr_client instance
987 * @param[in] mode restriction mode bit
988 * @return 0 if success, error code(<0) if fail\n
989 * @retval PKGMGR_R_OK success
990 * @retval PKGMGR_R_EINVAL invalid argument
991 * @retval PKGMGR_R_ECOMM communication error
992 * @retval PKGMGR_R_EPRIV privilege denied
993 * @see pkgmgr_restriction_mode
995 int pkgmgr_client_unset_restriction_mode(pkgmgr_client *pc, int mode);
996 int pkgmgr_client_usr_unset_restriction_mode(pkgmgr_client *pc, int mode, uid_t uid);
999 * @brief Get restriction mode
1001 * This API gets restriction mode bit.\n
1003 * @param[in] pc The pointer to pkgmgr_client instance
1004 * @param[out] mode restriction mode bit
1005 * @return 0 if success, error code(<0) if fail\n
1006 * @retval PKGMGR_R_OK success
1007 * @retval PKGMGR_R_EINVAL invalid argument
1008 * @retval PKGMGR_R_ECOMM communication error
1009 * @retval PKGMGR_R_EPRIV privilege denied
1010 * @see pkgmgr_restriction_mode
1012 int pkgmgr_client_get_restriction_mode(pkgmgr_client *pc, int *mode);
1013 int pkgmgr_client_usr_get_restriction_mode(pkgmgr_client *pc, int *mode, uid_t uid);
1016 * @brief Set restriction mode bit for package specified.
1017 * @details You can combine multiple status using OR operation which you want to restrict.
1019 * This API sets restriction bit for pkg operation to not allow user to do it.\n
1021 * @param[in] pc The pointer to pkgmgr_client instance
1022 * @param[in] pkgid pkgid to be restricted
1023 * @param[in] mode restriction mode bit
1024 * @return 0 if success, error code(<0) if fail\n
1025 * @retval PKGMGR_R_OK success
1026 * @retval PKGMGR_R_EINVAL invalid argument
1027 * @retval PKGMGR_R_ECOMM communication error
1028 * @retval PKGMGR_R_EPRIV privilege denied
1029 * @see pkgmgr_restriction_mode
1031 int pkgmgr_client_set_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode);
1032 int pkgmgr_client_usr_set_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode, uid_t uid);
1035 * @brief Unset restriction mode bit for package specified
1036 * @details You can combine multiple status using OR operation which you want to unset
1038 * This API unsets restriction bit to remove restriction of pkg operation.
1040 * @param[in] pc The pointer to pkgmgr_client instance
1041 * @param[in] pkgid pkg id to be remove in restriction.
1042 * @param[in] mode restriction mode bit
1043 * @return 0 if success, error code(<0) if fail\n
1044 * @retval PKGMGR_R_OK success
1045 * @retval PKGMGR_R_EINVAL invalid argument
1046 * @retval PKGMGR_R_ECOMM communication error
1047 * @retval PKGMGR_R_EPRIV privilege denied
1048 * @see pkgmgr_restriction_mode
1050 int pkgmgr_client_unset_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode);
1051 int pkgmgr_client_usr_unset_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode, uid_t uid);
1054 * @brief Get restriction bit of package operation
1056 * This API gets restriction bit for restricted package operation.\n
1058 * @param[in] pc The pointer to pkgmgr_client instance
1059 * @param[in] pkgid pkg id to be remove in restriction.
1060 * @param[out] mode restriction mode bit
1061 * @return 0 if success, error code(<0) if fail\n
1062 * @retval PKGMGR_R_OK success
1063 * @retval PKGMGR_R_EINVAL invalid argument
1064 * @retval PKGMGR_R_ECOMM communication error
1065 * @retval PKGMGR_R_EPRIV privilege denied
1066 * @see pkgmgr_restriction_mode
1068 int pkgmgr_client_get_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int *mode);
1069 int pkgmgr_client_usr_get_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int *mode, uid_t uid);
1072 * @brief Change application's label
1074 * This API sets label of application specified.\n
1076 * @param[in] pc The pointer to pkgmgr_client instance
1077 * @param[in] appid app id to be changed.
1078 * @param[in] label application's label to change.
1079 * @param[out] mode restriction mode bit
1080 * @return 0 if success, error code(<0) if fail\n
1081 * @retval PKGMGR_R_OK success
1082 * @retval PKGMGR_R_EINVAL invalid argument
1083 * @retval PKGMGR_R_ECOMM communication error
1085 int pkgmgr_client_set_app_label(pkgmgr_client *pc, char *appid, char *label);
1086 int pkgmgr_client_usr_set_app_label(pkgmgr_client *pc, char *appid, char *label, uid_t uid);
1089 * @brief Set debug mode
1091 * This API sets debug mode value for request.\n
1093 * @param[in] pc The pointer to pkgmgr_client instance
1094 * @param[in] debug_mode indicates the request is debug mode or not
1095 * @return 0 if success, error code(<0) if fail\n
1096 * @retval PKGMGR_R_OK success
1097 * @retval PKGMGR_R_EINVAL invalid argument
1099 int pkgmgr_client_set_debug_mode(pkgmgr_client *pc, bool debug_mode);
1102 * @brief Migrate legacy external image which is generated under 3.0
1104 * This API request the migration of external image.\n
1106 * @param[in] pc The pointer to pkgmgr_client instance
1107 * @param[in] pkgid pkg id which have legacy image
1108 * @return 0 if success, error code(<0) if fail\n
1109 * @retval PKGMGR_R_OK success
1110 * @retval PKGMGR_R_EINVAL invalid argument
1112 int pkgmgr_client_usr_migrate_external_image(pkgmgr_client *pc, const char *pkgid, uid_t uid);
1120 #endif /* __PKG_MANAGER_H__ */