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,
212 PM_MOVE_TO_EXTENDED = 2,
217 PM_REQUEST_GET_SIZE = 1,
218 PM_REQUEST_KILL_APP = 2,
219 PM_REQUEST_CHECK_APP = 3,
221 } pkgmgr_request_service_type;
224 /* sync, get data, total size for one requested pkgid */
225 PM_GET_TOTAL_SIZE = 0,
226 PM_GET_DATA_SIZE = 1,
228 /* async, get total used storage size */
231 /* async, get a pkgid's data, total size for all installed pkg */
232 PM_GET_SIZE_INFO = 3,
235 PM_GET_TOTAL_AND_DATA = 4,
236 PM_GET_SIZE_FILE = 5,
238 /* async, get data, cache, app size based on "pkg_size_info_t" */
239 PM_GET_PKG_SIZE_INFO = 6,
240 PM_GET_TOTAL_PKG_SIZE_INFO = 7,
242 } pkgmgr_getsize_type;
245 PM_RESTRICTION_MODE_ALL = 0x07,
246 PM_RESTRICTION_MODE_INSTALL = 0x01,
247 PM_RESTRICTION_MODE_UNINSTALL = 0x02,
248 PM_RESTRICTION_MODE_MOVE = 0x04,
249 } pkgmgr_restriction_mode;
252 * @brief This API creates pkgmgr client.
254 * This API is for package-manager client application.\n
256 * @param[in] ctype client type - PC_REQUEST, PC_LISTENING, PC_BROADCAST
257 * @return pkgmgr_client object
258 * @retval NULL on failure creating an object
260 pkgmgr_client *pkgmgr_client_new(pkgmgr_client_type ctype);
263 * @brief This API deletes pkgmgr client.
265 * This API is for package-manager client application.\n
267 * @param[in] pc pkgmgr_client
268 * @return Operation result;
269 * @retval PKGMGR_R_OK success
270 * @retval PKGMGR_R_EINVAL invalid argument
271 * @retval PKGMGR_R_ERROR internal error
273 int pkgmgr_client_free(pkgmgr_client *pc);
276 * @brief This API set information to install tep package.
277 * @details Use this API before calling installation API.
279 * This API is for package-manager client application.\n
281 * @param[in] pc pkgmgr_client
282 * @param[in] tep_path full path that tep file is located at
283 * @param[in] tep_move if TRUE, source file will be moved, else it will be copied
284 * @retval PKGMGR_R_OK success
285 * @retval PKGMGR_R_EINVAL invalid argument
287 int pkgmgr_client_set_tep_path(pkgmgr_client *pc, const char *tep_path, bool tep_move);
290 * @brief This API installs package.
292 * This API is for package-manager client application.\n
294 * @param[in] pc pkgmgr_client
295 * @param[in] pkg_type package type
296 * @param[in] descriptor_path full path that descriptor is located
297 * @param[in] pkg_path full path that package file is located
298 * @param[in] optional_data optional data which is used for installation
299 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
300 * @param[in] event_cb user callback
301 * @param[in] data user data
302 * @return request_id (>0) if success, error code(<0) if fail\n
303 * @retval PKGMGR_R_OK success
304 * @retval PKGMGR_R_EINVAL invalid argument
305 * @retval PKGMGR_R_ECOMM communication error
307 int pkgmgr_client_install(pkgmgr_client *pc, const char *pkg_type,
308 const char *descriptor_path, const char *pkg_path,
309 const char *optional_data, pkgmgr_mode mode,
310 pkgmgr_handler event_cb, void *data);
311 int pkgmgr_client_usr_install(pkgmgr_client *pc, const char *pkg_type,
312 const char *descriptor_path, const char *pkg_path,
313 const char *optional_data, pkgmgr_mode mode,
314 pkgmgr_handler event_cb, void *data, uid_t uid);
316 * @brief This API reinstalls package.
318 * This API is for package-manager client application.\n
320 * @param[in] pc pkgmgr_client
321 * @param[in] pkg_type package type
322 * @param[in] pkg_path full path that package file is located
323 * @param[in] optional_data optional data which is used for installation
324 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
325 * @param[in] event_cb user callback
326 * @param[in] data user data
327 * @return request_id (>0) if success, error code(<0) if fail\n
328 * @retval PKGMGR_R_OK success
329 * @retval PKGMGR_R_EINVAL invalid argument
330 * @retval PKGMGR_R_ECOMM communication error
332 int pkgmgr_client_reinstall(pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
333 const char *optional_data, pkgmgr_mode mode,
334 pkgmgr_handler event_cb, void *data);
335 int pkgmgr_client_usr_reinstall(pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
336 const char *optional_data, pkgmgr_mode mode,
337 pkgmgr_handler event_cb, void *data, uid_t uid);
340 * @brief This API mount-installs package.
342 * This API is for package-manager client application.\n
344 * @param[in] pc pkgmgr_client
345 * @param[in] pkg_type package type
346 * @param[in] descriptor_path full path that descriptor is located
347 * @param[in] pkg_path full path that package file is located
348 * @param[in] optional_data optional data which is used for installation
349 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
350 * @param[in] event_cb user callback
351 * @param[in] data user data
352 * @return request_id (>0) if success, error code(<0) if fail\n
353 * @retval PKGMGR_R_OK success
354 * @retval PKGMGR_R_EINVAL invalid argument
355 * @retval PKGMGR_R_ECOMM communication error
357 int pkgmgr_client_mount_install(pkgmgr_client *pc, const char *pkg_type,
358 const char *descriptor_path, const char *pkg_path,
359 const char *optional_data, pkgmgr_mode mode,
360 pkgmgr_handler event_cb, void *data);
361 int pkgmgr_client_usr_mount_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, uid_t uid);
367 * @brief This API uninstalls package.
369 * This API is for package-manager client application.\n
371 * @param[in] pc pkgmgr_client
372 * @param[in] pkg_type package type
373 * @param[in] pkgid package id
374 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
375 * @param[in] event_cb user callback
376 * @param[in] data user data
377 * @param[in] uid the addressee user id of the instruction
378 * @return request_id (>0), error code(<0) if fail\n
379 * @retval PKGMGR_R_OK success
380 * @retval PKGMGR_R_EINVAL invalid argument
381 * @retval PKGMGR_R_ECOMM communication error
383 int pkgmgr_client_uninstall(pkgmgr_client *pc, const char *pkg_type,
384 const char *pkgid, pkgmgr_mode mode,
385 pkgmgr_handler event_cb, void *data);
386 int pkgmgr_client_usr_uninstall(pkgmgr_client *pc, const char *pkg_type,
387 const char *pkgid, pkgmgr_mode mode,
388 pkgmgr_handler event_cb, void *data, uid_t uid);
391 * @brief This API moves installed package to SD card or vice versa.
393 * This API is for package-manager client application.\n
395 * @param[in] pc pkgmgr_client
396 * @param[in] pkg_type package type
397 * @param[in] pkgid application package id
398 * @param[in] move_type move type
399 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
400 * @param[in] event_cb user callback
401 * @param[in] data user data
402 * @param[in] uid the addressee user id of the instruction
403 * @retval PKGMGR_R_OK success
404 * @retval PKGMGR_R_EINVAL invalid argument
405 * @retval PKGMGR_R_ERROR general error
407 int pkgmgr_client_move(pkgmgr_client *pc, const char *pkg_type,
408 const char *pkgid, pkgmgr_move_type move_type,
409 pkgmgr_handler event_cb, void *data);
410 int pkgmgr_client_usr_move(pkgmgr_client *pc, const char *pkg_type,
411 const char *pkgid, pkgmgr_move_type move_type,
412 pkgmgr_handler event_cb, void *data, uid_t uid);
415 * @brief This API registers the update information of given packages
417 * This API is for package-manager client application.\n
419 * @param[in] pc pkgmgr_client
420 * @param[in] update_info update information
421 * @param[in] uid the addressee user id of the instruction
422 * @retval PKGMGR_R_OK success
423 * @retval PKGMGR_R_EINVAL invalid argument
424 * @retval PKGMGR_R_ERROR general error
426 int pkgmgr_client_register_pkg_update_info(pkgmgr_client *pc,
427 pkg_update_info_t *update_info);
428 int pkgmgr_client_usr_register_pkg_update_info(pkgmgr_client *pc,
429 pkg_update_info_t *update_info, uid_t uid);
432 * @brief This API unregisters update information of certain package.
434 * This API is for package-manager client application.\n
436 * @param[in] pc pkgmgr_client
437 * @param[in] pkgid package id
438 * @param[in] uid the addressee user id of the instruction
439 * @retval PKGMGR_R_OK success
440 * @retval PKGMGR_R_EINVAL invalid argument
441 * @retval PKGMGR_R_ERROR general error
443 int pkgmgr_client_unregister_pkg_update_info(pkgmgr_client *pc, const char *pkgid);
444 int pkgmgr_client_usr_unregister_pkg_update_info(pkgmgr_client *pc,
445 const char *pkgid, uid_t uid);
448 * @brief This API unregister update information of all packages.
450 * This API is for package-manager client application.\n
452 * @param[in] pc pkgmgr_client
453 * @param[in] uid the addressee user id of the instruction
454 * @retval PKGMGR_R_OK success
455 * @retval PKGMGR_R_EINVAL invalid argument
456 * @retval PKGMGR_R_ERROR general error
458 int pkgmgr_client_unregister_all_pkg_update_info(pkgmgr_client *pc);
459 int pkgmgr_client_usr_unregister_all_pkg_update_info(pkgmgr_client *pc,
463 * @brief This API activates package.
465 * This API is for package-manager client application.\n
467 * @param[in] pc pkgmgr_client
468 * @param[in] pkg_type package type
469 * @param[in] pkgid package id
470 * @return request_id (>0) if success, error code(<0) if fail\n
471 * @retval PKGMGR_R_OK success
472 * @retval PKGMGR_R_EINVAL invalid argument
473 * @retval PKGMGR_R_ECOMM communication error
475 int pkgmgr_client_activate(pkgmgr_client *pc, const char *pkg_type,
477 int pkgmgr_client_usr_activate(pkgmgr_client *pc, const char *pkg_type,
478 const char *pkgid, uid_t uid);
481 * @brief This API activates multiple packages.
483 * This API is for package-manager client application.\n
485 * @param[in] pc pkgmgr_client
486 * @param[in] pkg_type package type
487 * @param[in] pkgids array of package ids
488 * @param[in] n_pkgs size of array
489 * @param[in] event_cb user callback
490 * @param[in] data user data
491 * @return request_id (>0) if success, error code(<0) if fail\n
492 * @retval PKGMGR_R_OK success
493 * @retval PKGMGR_R_EINVAL invalid argument
494 * @retval PKGMGR_R_ECOMM communication error
496 int pkgmgr_client_activate_packages(pkgmgr_client *pc, const char *pkg_type,
497 const char **pkgids, int n_pkgs,
498 pkgmgr_handler event_cb, void *data);
499 int pkgmgr_client_usr_activate_packages(pkgmgr_client *pc, const char *pkg_type,
500 const char **pkgids, int n_pkgs,
501 pkgmgr_handler event_cb, void *data, uid_t uid);
504 * @brief This API deactivates package.
506 * This API is for package-manager client application.\n
508 * @param[in] pc pkgmgr_client
509 * @param[in] pkg_type package type
510 * @param[in] pkgid package id
511 * @return request_id (>0) if success, error code(<0) if fail\n
512 * @retval PKGMGR_R_OK success
513 * @retval PKGMGR_R_EINVAL invalid argument
514 * @retval PKGMGR_R_ECOMM communication error
516 int pkgmgr_client_deactivate(pkgmgr_client *pc, const char *pkg_type,
518 int pkgmgr_client_usr_deactivate(pkgmgr_client *pc, const char *pkg_type,
519 const char *pkgid, uid_t uid);
522 * @brief This API deactivates multiple packages.
524 * This API is for package-manager client application.\n
526 * @param[in] pc pkgmgr_client
527 * @param[in] pkg_type package type
528 * @param[in] pkgids array of package ids
529 * @param[in] n_pkgs size of array
530 * @param[in] event_cb user callback
531 * @param[in] data user data
532 * @return request_id (>0) if success, error code(<0) if fail\n
533 * @retval PKGMGR_R_OK success
534 * @retval PKGMGR_R_EINVAL invalid argument
535 * @retval PKGMGR_R_ECOMM communication error
537 int pkgmgr_client_deactivate_packages(pkgmgr_client *pc, const char *pkg_type,
538 const char **pkgids, int n_pkgs,
539 pkgmgr_handler event_cb, void *data);
540 int pkgmgr_client_usr_deactivate_packages(pkgmgr_client *pc, const char *pkg_type,
541 const char **pkgids, int n_pkgs,
542 pkgmgr_handler event_cb, void *data, uid_t uid);
545 * @brief This API deactivates app.
547 * This API is for package-manager client application.\n
549 * @param[in] pc pkgmgr_client
550 * @param[in] appid applicaiton id
551 * @param[in] app_event_cb user callback
552 * @param[in] data user data
553 * @return request_id (>0) if success, error code(<0) if fail\n
554 * @retval PKGMGR_R_OK success
555 * @retval PKGMGR_R_EINVAL invalid argument
556 * @retval PKGMGR_R_ECOMM communication error
558 int pkgmgr_client_deactivate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data);
559 int pkgmgr_client_usr_deactivate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
562 * @brief This API activates multiple apps.
564 * This API is for package-manager client application.\n
566 * @param[in] pc pkgmgr_client
567 * @param[in] appids array of application ids
568 * @param[in] n_apps size of array
569 * @param[in] app_event_cb user callback
570 * @param[in] data user data
571 * @return request_id (>0) if success, error code(<0) if fail\n
572 * @retval PKGMGR_R_OK success
573 * @retval PKGMGR_R_EINVAL invalid argument
574 * @retval PKGMGR_R_ECOMM communication error
576 int pkgmgr_client_activate_apps(pkgmgr_client *pc, const char **appids, int n_apps, pkgmgr_app_handler app_event_cb, void *data);
577 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);
580 * @brief This API deactivates multiple apps.
582 * This API is for package-manager client application.\n
584 * @param[in] pc pkgmgr_client
585 * @param[in] appids array of application ids
586 * @param[in] n_apps size of array
587 * @param[in] app_event_cb user callback
588 * @param[in] data user data
589 * @return request_id (>0) if success, error code(<0) if fail\n
590 * @retval PKGMGR_R_OK success
591 * @retval PKGMGR_R_EINVAL invalid argument
592 * @retval PKGMGR_R_ECOMM communication error
594 int pkgmgr_client_deactivate_apps(pkgmgr_client *pc, const char **appids, int n_apps, pkgmgr_app_handler app_event_cb, void *data);
595 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);
598 * @brief This API deactivates global app for user specified by uid.
600 * This API is for package-manager client application.\n
602 * @param[in] pc pkgmgr_client
603 * @param[in] appid applicaiton id
604 * @param[in] app_event_cb user callback
605 * @param[in] uid user id
606 * @param[in] data user data
607 * @return request_id (>0) if success, error code(<0) if fail\n
608 * @retval PKGMGR_R_OK success
609 * @retval PKGMGR_R_EINVAL invalid argument
610 * @retval PKGMGR_R_ECOMM communication error
612 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);
615 * @brief This API activates app.
617 * This API is for package-manager client application.\n
619 * @param[in] pc pkgmgr_client
620 * @param[in] appid applicaiton id
621 * @param[in] app_event_cb user callback
622 * @param[in] uid user id
623 * @param[in] data user data
624 * @return request_id (>0) if success, error code(<0) if fail\n
625 * @retval PKGMGR_R_OK success
626 * @retval PKGMGR_R_EINVAL invalid argument
627 * @retval PKGMGR_R_ECOMM communication error
629 int pkgmgr_client_activate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data);
630 int pkgmgr_client_usr_activate_app(pkgmgr_client *pc, const char *appid, pkgmgr_app_handler app_event_cb, void *data, uid_t uid);
633 * @brief This API activates global app for user specified by uid.
635 * This API is for package-manager client application.\n
637 * @param[in] pc pkgmgr_client
638 * @param[in] appid applicaiton id
639 * @param[in] app_event_cb user callback
640 * @param[in] uid user id
641 * @param[in] data user data
642 * @return request_id (>0) if success, error code(<0) if fail\n
643 * @retval PKGMGR_R_OK success
644 * @retval PKGMGR_R_EINVAL invalid argument
645 * @retval PKGMGR_R_ECOMM communication error
647 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);
650 * @brief This API deletes application's private data.
652 * This API is for package-manager client application.\n
654 * @remarks You should call this function with regular uid
655 * @param[in] pc pkgmgr_client
656 * @param[in] pkg_type package type
657 * @param[in] pkgid package id
658 * @param[in] mode installation mode - PM_DEFAULT, PM_QUIET
659 * @return request_id (>0) if success, error code(<0) if fail\n
660 * @retval PKGMGR_R_OK success
661 * @retval PKGMGR_R_EINVAL invalid argument
662 * @retval PKGMGR_R_ECOMM communication error
664 int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
665 const char *appid, pkgmgr_mode mode);
666 int pkgmgr_client_usr_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
667 const char *appid, pkgmgr_mode mode, uid_t uid);
669 * @brief This API set status type to listen for the pkgmgr's broadcasting
671 * This API is for package-manager client application.\n
673 * @param[in] pc pkgmgr_client
674 * @param[in] status_type status type to listen
675 * @return request_id (>0) if success, error code(<0) if fail\n
676 * @retval PKGMGR_R_OK success
677 * @retval PKGMGR_R_EINVAL invalid argument
679 int pkgmgr_client_set_status_type(pkgmgr_client *pc, int status_type);
682 * @brief This API request to listen the pkgmgr's broadcasting
684 * This API is for package-manager client application.\n
686 * @param[in] pc pkgmgr_client
687 * @param[in] event_cb user callback
688 * @param[in] data user data
689 * @return request_id (>0) if success, error code(<0) if fail\n
690 * @retval PKGMGR_R_OK success
691 * @retval PKGMGR_R_EINVAL invalid argument
693 int pkgmgr_client_listen_status(pkgmgr_client *pc, pkgmgr_handler event_cb,
697 * @brief This API request to listen the pkgmgr's broadcasting about apps
699 * This API is for package-manager client application.\n
701 * @param[in] pc pkgmgr_client
702 * @param[in] event_cb user callback
703 * @param[in] data user data
704 * @return request_id (>0) if success, error code(<0) if fail\n
705 * @retval PKGMGR_R_OK success
706 * @retval PKGMGR_R_EINVAL invalid argument
708 int pkgmgr_client_listen_app_status(pkgmgr_client *pc, pkgmgr_app_handler event_cb,
712 * @brief This API request to stop listen the pkgmgr's broadcasting
714 * This API is for package-manager client application.\n
716 * @param[in] pc pkgmgr_client
717 * @return 0 if success, error code(<0) if fail\n
718 * @retval PKGMGR_R_OK success
719 * @retval PKGMGR_R_EINVAL invalid argument
720 * @retval PKGMGR_R_ERROR internal error
722 int pkgmgr_client_remove_listen_status(pkgmgr_client *pc);
725 * @brief This API broadcasts pkgmgr's status
727 * This API is for package-manager client application.\n
729 * @param[in] pc pkgmgr_client
730 * @param[in] pkg_type package type
731 * @param[in] pkgid package id
732 * @param[in] key key to broadcast
733 * @param[in] val value to broadcast
734 * @return 0 if success, error code(<0) if fail\n
735 * @retval PKGMGR_R_OK success
736 * @retval PKGMGR_R_EINVAL invalid argument
738 int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type,
739 const char *pkgid, const char *key,
743 * @brief This API gets the package's information.
745 * This API is for package-manager client application.\n
747 * @param[in] pkg_path package file path to get infomation
748 * @return package entry pointer if success, NULL if fail\n
750 pkgmgr_info *pkgmgr_client_check_pkginfo_from_file(const char *pkg_path);
753 * @brief This API get package information value
755 * This API is for package-manager client application.\n
757 * @param[in] pkg_info pointer for package info entry
758 * @return 0 if success, error code(<0) if fail\n
760 int pkgmgr_client_free_pkginfo(pkgmgr_info *pkg_info);
763 * @brief This API requests service
765 * This API is for package-manager client application.\n
767 * @param[in] service_type pkgmgr_request_service_type
768 * @param[in] service_mode mode which is used for addtional mode selection
769 * @param[in] pc pkgmgr_client
770 * @param[in] pkg_type package type
771 * @param[in] pkgid package id
772 * @param[in] custom_info custom information which is used for addtional information
773 * @param[in] event_cb user callback
774 * @param[in] data user data
775 * @return request_id (>0) if success, error code(<0) if fail\n
776 * @retval PKGMGR_R_OK success
777 * @retval PKGMGR_R_EINVAL invalid argument
778 * @retval PKGMGR_R_ECOMM communication error
780 int pkgmgr_client_request_service(pkgmgr_request_service_type service_type, int service_mode,
781 pkgmgr_client *pc, const char *pkg_type, const char *pkgid,
782 const char *custom_info, pkgmgr_handler event_cb, void *data);
783 int pkgmgr_client_usr_request_service(pkgmgr_request_service_type service_type, int service_mode,
784 pkgmgr_client *pc, const char *pkg_type, const char *pkgid, uid_t uid,
785 const char *custom_info, pkgmgr_handler event_cb, void *data);
787 * @brief This API get package size
789 * This API is for package-manager client application.\n
791 * @param[in] pc pkgmgr_client
792 * @param[in] pkgid package id
793 * @param[in] get_type type for pkgmgr client request to get package size
794 * @param[in] event_cb user callback
795 * @param[in] data user data
796 * @return request_id (>0) if success, error code(<0) if fail\n
797 * @retval PKGMGR_R_OK success
798 * @retval PKGMGR_R_EINVAL invalid argument
799 * @retval PKGMGR_R_ECOMM communication error
801 int pkgmgr_client_get_size(pkgmgr_client *pc, const char *pkgid, pkgmgr_getsize_type get_type, pkgmgr_handler event_cb, void *data);
802 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);
805 * @brief Gets the package size information.
806 * @details The package size info is asynchronously obtained by the specified callback function.
808 * @param[in] pc The pointer to pkgmgr_client instance
809 * @param[in] pkgid The package ID
810 * @param[in] result_cb The asynchronous callback function to get the package size information
811 * @param[in] user_data User data to be passed to the callback function
813 * @return 0 on success, otherwise a negative error value
814 * @retval #PKGMGR_R_OK Successful
815 * @retval #PKGMGR_R_EINVAL Invalid parameter
816 * @retval #PKGMGR_R_ERROR Internal error
818 int pkgmgr_client_get_package_size_info(pkgmgr_client *pc, const char *pkgid, pkgmgr_pkg_size_info_receive_cb result_cb, void *user_data);
819 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);
822 * @brief Gets the sum of the entire package size information.
823 * @details The package size info is asynchronously obtained by the specified callback function.
825 * @param[in] pc The pointer to pkgmgr_client instance
826 * @param[in] result_cb The asynchronous callback function to get the total package size information
827 * @param[in] user_data User data to be passed to the callback function
829 * @return 0 on success, otherwise a negative error value
830 * @retval #PKGMGR_R_OK Successful
831 * @retval #PKGMGR_R_EINVAL Invalid parameter
832 * @retval #PKGMGR_R_ERROR Internal error
834 int pkgmgr_client_get_total_package_size_info(pkgmgr_client *pc, pkgmgr_total_pkg_size_info_receive_cb result_cb, void *user_data);
835 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);
838 * @brief This API removes cache directories
840 * This API is for package-manager client application.\n
842 * @remarks You should call this function with regular uid
843 * @param[in] pkgid package id
844 * @return 0 if success, error code(<0) if fail\n
845 * @retval PKGMGR_R_OK success
846 * @retval PKGMGR_R_EINVAL invalid argument
847 * @retval PKGMGR_R_EPRIV privilege denied
848 * @retval PKGMGR_R_ERROR internal error
850 int pkgmgr_client_clear_cache_dir(const char *pkgid);
851 int pkgmgr_client_usr_clear_cache_dir(const char *pkgid, uid_t uid);
854 * @brief This API removes all cache directories
856 * This API is for package-manager client application.\n
858 * @remarks You should call this function with regular uid
859 * @return 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_EPRIV privilege denied
863 * @retval PKGMGR_R_ERROR internal error
865 int pkgmgr_client_clear_all_cache_dir(void);
866 int pkgmgr_client_usr_clear_all_cache_dir(uid_t uid);
869 * @brief Generates request for getting license
871 * This API generates request for getting license.\n
873 * @remarks You must release @a req_data and @a license_url by yourself.
874 * @param[in] pc The pointer to pkgmgr_client instance
875 * @param[in] resp_data The response data string of the purchase request
876 * @param[out] req_data License request data
877 * @param[out] license_url License acquisition url data
878 * @return 0 if success, error code(<0) if fail\n
879 * @retval PKGMGR_R_OK success
880 * @retval PKGMGR_R_EINVAL invalid argument
881 * @retval PKGMGR_R_ECOMM communication error
882 * @retval PKGMGR_R_EPRIV privilege denied
883 * @retval PKGMGR_R_ESYSTEM severe system error
885 int pkgmgr_client_generate_license_request(pkgmgr_client *pc, const char *resp_data, char **req_data, char **license_url);
888 * @brief Registers encrypted license
890 * This API registers encrypted license.\n
892 * @param[in] pc The pointer to pkgmgr_client instance
893 * @param[in] resp_data The response data string of the purchase request
894 * @return 0 if success, error code(<0) if fail\n
895 * @retval PKGMGR_R_OK success
896 * @retval PKGMGR_R_EINVAL invalid argument
897 * @retval PKGMGR_R_ECOMM communication error
898 * @retval PKGMGR_R_EPRIV privilege denied
899 * @retval PKGMGR_R_ESYSTEM severe system error
901 int pkgmgr_client_register_license(pkgmgr_client *pc, const char *resp_data);
904 * @brief Decrypts contents which is encrypted
906 * This API decrypts contents which is encrypted.\n
908 * @param[in] pc The pointer to pkgmgr_client instance
909 * @param[in] drm_file_path The pointer to pkgmgr_client instance
910 * @param[in] decrypted_file_path The pointer to pkgmgr_client instance
911 * @return 0 if success, error code(<0) if fail\n
912 * @retval PKGMGR_R_OK success
913 * @retval PKGMGR_R_EINVAL invalid argument
914 * @retval PKGMGR_R_ECOMM communication error
915 * @retval PKGMGR_R_EPRIV privilege denied
916 * @retval PKGMGR_R_ESYSTEM severe system error
918 int pkgmgr_client_decrypt_package(pkgmgr_client *pc, const char *drm_file_path, const char *decrypted_file_path);
921 * @brief This API is enabled the splash screen
923 * This API is for package-manager client application.\n
925 * @param[in] pc pkgmgr_client
926 * @param[in] appid applicaiton id
927 * @return request_id (>0) if success, error code(<0) if fail\n
928 * @retval PKGMGR_R_OK success
929 * @retval PKGMGR_R_EINVAL invalid argument
930 * @retval PKGMGR_R_ECOMM communication error
931 * @retval PKGMGR_R_ENOMEM out of memory
933 int pkgmgr_client_enable_splash_screen(pkgmgr_client *pc, const char *appid);
934 int pkgmgr_client_usr_enable_splash_screen(pkgmgr_client *pc, const char *appid, uid_t uid);
937 * @brief This API is disabled the splash screen
939 * This API is for package-manager client application.\n
941 * @param[in] pc pkgmgr_client
942 * @param[in] appid applicaiton id
943 * @return request_id (>0) if success, error code(<0) if fail\n
944 * @retval PKGMGR_R_OK success
945 * @retval PKGMGR_R_EINVAL invalid argument
946 * @retval PKGMGR_R_ECOMM communication error
947 * @retval PKGMGR_R_ENOMEM out of memory
949 int pkgmgr_client_disable_splash_screen(pkgmgr_client *pc, const char *appid);
950 int pkgmgr_client_usr_disable_splash_screen(pkgmgr_client *pc, const char *appid, uid_t uid);
953 * @brief Set restriction mode
955 * This API set restriction mode bit.\n
957 * @param[in] pc The pointer to pkgmgr_client instance
958 * @param[in] mode restriction mode bit
959 * @return 0 if success, error code(<0) if fail\n
960 * @retval PKGMGR_R_OK success
961 * @retval PKGMGR_R_EINVAL invalid argument
962 * @retval PKGMGR_R_ECOMM communication error
963 * @retval PKGMGR_R_EPRIV privilege denied
964 * @see pkgmgr_restriction_mode
966 int pkgmgr_client_set_restriction_mode(pkgmgr_client *pc, int mode);
967 int pkgmgr_client_usr_set_restriction_mode(pkgmgr_client *pc, int mode, uid_t uid);
970 * @brief Unset restriction mode
972 * This API unset restriction mode bit.\n
974 * @param[in] pc The pointer to pkgmgr_client instance
975 * @param[in] mode restriction mode bit
976 * @return 0 if success, error code(<0) if fail\n
977 * @retval PKGMGR_R_OK success
978 * @retval PKGMGR_R_EINVAL invalid argument
979 * @retval PKGMGR_R_ECOMM communication error
980 * @retval PKGMGR_R_EPRIV privilege denied
981 * @see pkgmgr_restriction_mode
983 int pkgmgr_client_unset_restriction_mode(pkgmgr_client *pc, int mode);
984 int pkgmgr_client_usr_unset_restriction_mode(pkgmgr_client *pc, int mode, uid_t uid);
987 * @brief Get restriction mode
989 * This API gets restriction mode bit.\n
991 * @param[in] pc The pointer to pkgmgr_client instance
992 * @param[out] mode restriction mode bit
993 * @return 0 if success, error code(<0) if fail\n
994 * @retval PKGMGR_R_OK success
995 * @retval PKGMGR_R_EINVAL invalid argument
996 * @retval PKGMGR_R_ECOMM communication error
997 * @retval PKGMGR_R_EPRIV privilege denied
998 * @see pkgmgr_restriction_mode
1000 int pkgmgr_client_get_restriction_mode(pkgmgr_client *pc, int *mode);
1001 int pkgmgr_client_usr_get_restriction_mode(pkgmgr_client *pc, int *mode, uid_t uid);
1004 * @brief Set restriction mode bit for package specified.
1005 * @details You can combine multiple status using OR operation which you want to restrict.
1007 * This API sets restriction bit for pkg operation to not allow user to do it.\n
1009 * @param[in] pc The pointer to pkgmgr_client instance
1010 * @param[in] pkgid pkgid to be restricted
1011 * @param[in] mode restriction mode bit
1012 * @return 0 if success, error code(<0) if fail\n
1013 * @retval PKGMGR_R_OK success
1014 * @retval PKGMGR_R_EINVAL invalid argument
1015 * @retval PKGMGR_R_ECOMM communication error
1016 * @retval PKGMGR_R_EPRIV privilege denied
1017 * @see pkgmgr_restriction_mode
1019 int pkgmgr_client_set_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode);
1020 int pkgmgr_client_usr_set_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode, uid_t uid);
1023 * @brief Unset restriction mode bit for package specified
1024 * @details You can combine multiple status using OR operation which you want to unset
1026 * This API unsets restriction bit to remove restriction of pkg operation.
1028 * @param[in] pc The pointer to pkgmgr_client instance
1029 * @param[in] pkgid pkg id to be remove in restriction.
1030 * @param[in] mode restriction mode bit
1031 * @return 0 if success, error code(<0) if fail\n
1032 * @retval PKGMGR_R_OK success
1033 * @retval PKGMGR_R_EINVAL invalid argument
1034 * @retval PKGMGR_R_ECOMM communication error
1035 * @retval PKGMGR_R_EPRIV privilege denied
1036 * @see pkgmgr_restriction_mode
1038 int pkgmgr_client_unset_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode);
1039 int pkgmgr_client_usr_unset_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int mode, uid_t uid);
1042 * @brief Get restriction bit of package operation
1044 * This API gets restriction bit for restricted package operation.\n
1046 * @param[in] pc The pointer to pkgmgr_client instance
1047 * @param[in] pkgid pkg id to be remove in restriction.
1048 * @param[out] mode restriction mode bit
1049 * @return 0 if success, error code(<0) if fail\n
1050 * @retval PKGMGR_R_OK success
1051 * @retval PKGMGR_R_EINVAL invalid argument
1052 * @retval PKGMGR_R_ECOMM communication error
1053 * @retval PKGMGR_R_EPRIV privilege denied
1054 * @see pkgmgr_restriction_mode
1056 int pkgmgr_client_get_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int *mode);
1057 int pkgmgr_client_usr_get_pkg_restriction_mode(pkgmgr_client *pc, const char *pkgid, int *mode, uid_t uid);
1060 * @brief Change application's label
1062 * This API sets label of application specified.\n
1064 * @param[in] pc The pointer to pkgmgr_client instance
1065 * @param[in] appid app id to be changed.
1066 * @param[in] label application's label to change.
1067 * @param[out] mode restriction mode bit
1068 * @return 0 if success, error code(<0) if fail\n
1069 * @retval PKGMGR_R_OK success
1070 * @retval PKGMGR_R_EINVAL invalid argument
1071 * @retval PKGMGR_R_ECOMM communication error
1073 int pkgmgr_client_set_app_label(pkgmgr_client *pc, char *appid, char *label);
1074 int pkgmgr_client_usr_set_app_label(pkgmgr_client *pc, char *appid, char *label, uid_t uid);
1077 * @brief Change application's icon
1079 * This API sets icon of application specified.\n
1081 * @param[in] pc The pointer to pkgmgr_client instance
1082 * @param[in] appid app id to be changed.
1083 * @param[in] icon_path application's icon path to change.
1084 * @return 0 if success, error code(<0) if fail\n
1085 * @retval PKGMGR_R_OK success
1086 * @retval PKGMGR_R_EINVAL invalid argument
1087 * @retval PKGMGR_R_ECOMM communication error
1089 int pkgmgr_client_set_app_icon(pkgmgr_client *pc, char *appid, char *icon_path);
1090 int pkgmgr_client_usr_set_app_icon(pkgmgr_client *pc, char *appid, char *icon_path, uid_t uid);
1093 * @brief Set debug mode
1095 * This API sets debug mode value for request.\n
1097 * @param[in] pc The pointer to pkgmgr_client instance
1098 * @param[in] debug_mode indicates the request is debug mode or not
1099 * @return 0 if success, error code(<0) if fail\n
1100 * @retval PKGMGR_R_OK success
1101 * @retval PKGMGR_R_EINVAL invalid argument
1103 int pkgmgr_client_set_debug_mode(pkgmgr_client *pc, bool debug_mode);
1106 * @brief Set skip optimization
1108 * This API sets skip optimization value for request.\n
1110 * @param[in] pc The pointer to pkgmgr_client instance
1111 * @param[in] skip_optimization indicates the request is skip optimization or not
1112 * @return 0 if success, error code(<0) if fail\n
1113 * @retval PKGMGR_R_OK success
1114 * @retval PKGMGR_R_EINVAL invalid argument
1116 int pkgmgr_client_set_skip_optimization(pkgmgr_client *pc, bool skip_optimization);
1119 * @brief Migrate legacy external image which is generated under 3.0
1121 * This API request the migration of external image.\n
1123 * @param[in] pc The pointer to pkgmgr_client instance
1124 * @param[in] pkgid pkg id which have legacy image
1125 * @return 0 if success, error code(<0) if fail\n
1126 * @retval PKGMGR_R_OK success
1127 * @retval PKGMGR_R_EINVAL invalid argument
1129 int pkgmgr_client_usr_migrate_external_image(pkgmgr_client *pc, const char *pkgid, uid_t uid);
1137 #endif /* __PKG_MANAGER_H__ */