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.
25 * @file pkgmgr_parser_db.h
26 * @author Shobhit Srivastava <shobhit.s@samsung.com>
28 * @brief This file declares API to store/retrieve manifest data in DB
30 * @addtogroup APPLICATION_FRAMEWORK
33 * @defgroup PackageManagerParserDB
34 * @section Header Header file to include:
36 * #include <pkgmgr_parser_db.h>
42 #ifndef __PKGMGR_PARSER_DB_H__
43 #define __PKGMGR_PARSER_DB_H__
45 #include "pkgmgr_parser.h"
46 #include "pkgmgrinfo_type.h"
53 * @fn int pkgmgr_parser_insert_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid)
54 * @fn int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx)
55 * @brief This API inserts the parsed manifest info in db
57 * @par This API is for package-manager installer backends
58 * @par Sync (or) Async : Synchronous API
60 * @param[in] mfx pointer to manifest info
61 * @param[in] uid the addressee user id of the instruction
62 * @return 0 if success, error code(<0) if fail
65 * @see pkgmgr_parser_update_manifest_info_in_db()
66 * @see pkgmgr_parser_delete_manifest_info_from_db()
68 static int insert_manifest_data(manifest_x *mfx)
71 ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
78 int pkgmgr_parser_insert_manifest_info_in_db(manifest_x *mfx);
79 int pkgmgr_parser_insert_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid);
82 * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
83 * @fn int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx)
84 * @brief This API updates the manifest info in db
86 * @par This API is for package-manager installer backends
87 * @par Sync (or) Async : Synchronous API
89 * @param[in] mfx pointer to manifest info
90 * @param[in] uid the addressee user id of the instruction
91 * @return 0 if success, error code(<0) if fail
94 * @see pkgmgr_parser_insert_manifest_info_in_db()
95 * @see pkgmgr_parser_delete_manifest_info_from_db()
97 static int update_manifest_data(manifest_x *mfx)
100 ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
107 int pkgmgr_parser_update_manifest_info_in_db(manifest_x *mfx);
108 int pkgmgr_parser_update_manifest_info_in_usr_db(manifest_x *mfx, uid_t uid);
111 * @fn int pkgmgr_parser_update_tep_info_in_db(const char * pkgid, const char * tep_path)
112 * @fn int pkgmgr_parser_update_tep_info_in_usr_db(const char * pkgid, const char * tep_path,uid_t uid)
113 * @brief This API updates the tep info in db
115 * @par This API is for package-manager installer backends
116 * @par Sync (or) Async : Synchronous API
118 * @param[in] pkgid pointer to pkgid
119 * @param[in] tep_path path of tep file
120 * @return 0 if success, error code(<0) if fail
124 static int update_tep_data(const char *pkgid, *tep_path)
127 ret = pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
134 int pkgmgr_parser_update_tep_info_in_db(const char *pkgid, const char *tep_path);
135 int pkgmgr_parser_update_tep_info_in_usr_db(const char *pkgid, const char *tep_path, uid_t uid);
138 * @fn int pkgmgr_parser_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid)
139 * @fn int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx)
140 * @brief This API deletes the parsed manifest info from db
142 * @par This API is for package-manager installer backends
143 * @par Sync (or) Async : Synchronous API
145 * @param[in] mfx pointer to manifest info
146 * @param[in] uid the addressee user id of the instruction
147 * @return 0 if success, error code(<0) if fail
150 * @see pkgmgr_parser_update_manifest_info_in_db()
151 * @see pkgmgr_parser_insert_manifest_info_in_db()
153 static int delete_manifest_data(manifest_x *mfx)
156 ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
163 int pkgmgr_parser_delete_manifest_info_from_db(manifest_x *mfx);
164 int pkgmgr_parser_delete_manifest_info_from_usr_db(manifest_x *mfx, uid_t uid);
167 * @fn int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable)
168 * @brief This API updates disable info about global app for user specified by uid
170 * @par This API is for package-manager installer backends
171 * @par Sync (or) Async : Synchronous API
173 * @param[in] appid global application ID to be enabled or disabled
174 * @param[in] uid the addressee user id of the instruction
175 * @param[in]is_disable determine enable or disable of app
176 * @return 0 if success, error code(<0) if fail
180 static int disable_global_app_for_uid(const char *appid, uid_t uid)
183 ret = pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(appid, uid, 1);
190 int pkgmgr_parser_update_global_app_disable_for_uid_info_in_db(const char *appid, uid_t uid, int is_disable);
193 * @fn int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
194 * @brief This API updates disable info about app
196 * @par This API is for package-manager installer backends
197 * @par Sync (or) Async : Synchronous API
199 * @param[in] appid application ID to be enabled or disabled
200 * @param[in] is_disable determine enable or disable of app
201 * @return 0 if success, error code(<0) if fail
205 static int disable_app(const char *appid)
208 ret = pkgmgr_parser_update_app_disable_info_in_db(appid, 1);
215 int pkgmgr_parser_update_app_disable_info_in_db(const char *appid, int is_disable);
216 int pkgmgr_parser_update_app_disable_info_in_usr_db(const char *appid, uid_t uid, int is_disable);
219 * @fn int pkgmgr_parser_update_pkg_disable_info_in_db(const char *pkgid, int is_disable);
220 * @brief This API updates disable info about pkg
222 * @par This API is for package-manager installer backends
223 * @par Sync (or) Async : Synchronous API
225 * @param[in] pkgid package ID to be enabled or disabled
226 * @param[in] is_disable determine enable or disable of app
227 * @return 0 if success, error code(<0) if fail
231 static int disable_pkg(const char *pkgid)
234 ret = pkgmgr_parser_update_pkg_disable_info_in_db(pkgid, 1);
241 int pkgmgr_parser_update_pkg_disable_info_in_db(const char *pkgid, int is_disable);
242 int pkgmgr_parser_update_pkg_disable_info_in_usr_db(const char *pkgid, uid_t uid, int is_disable);
245 * @fn int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
246 * @brief This API updates splash screen display info about global app for user specified by uid
248 * @par This API is for package-manager installer backends
249 * @par Sync (or) Async : Synchronous API
251 * @param[in] appid global application ID to be enabled or disabled
252 * @param[in] uid user ID
253 * @param[in] flag determine enable or disable of app
254 * @return 0 if success, error code(<0) if fail
258 static int disable_global_app_splash_screen_for_uid(const char *appid, uid_t uid)
261 ret = pkgmgr_parser_update_global_app_splash_screen_info_in_usr_db(appid, uid, 1);
268 int pkgmgr_parser_update_global_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
271 * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag)
272 * @brief This API updates splash screen display info about app
274 * @par This API is for package-manager installer backends
275 * @par Sync (or) Async : Synchronous API
277 * @param[in] appid application ID to be enabled or disabled
278 * @param[in] flag determine enable or disable of app
279 * @return 0 if success, error code(<0) if fail
283 static int disable_app_splash_screen(const char *appid)
286 ret = pkgmgr_parser_update_app_splash_screen_info_in_db(appid, 1);
293 int pkgmgr_parser_update_app_splash_screen_display_info_in_db(const char *appid, int flag);
296 * @fn int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag)
297 * @brief This API updates splash screen display info about app for user specified by uid
299 * @par This API is for package-manager installer backends
300 * @par Sync (or) Async : Synchronous API
302 * @param[in] appid application ID to be enabled or disabled
303 * @param[in] uid user ID
304 * @param[in] flag determine enable or disable of app
305 * @return 0 if success, error code(<0) if fail
307 int pkgmgr_parser_update_app_splash_screen_display_info_in_usr_db(const char *appid, uid_t uid, int flag);
310 * @fn int pkgmgr_parser_update_app_label_info_in_db(const char *appid, const char *label)
311 * @brief This API updates label info of application
313 * @par This API is only for internal usage
314 * @par Sync (or) Async : Synchronous API
316 * @param[in] appid application ID to change label
317 * @param[in] label label to change
318 * @return 0 if success, error code(<0) if fail
320 int pkgmgr_parser_update_app_label_info_in_db(const char *appid, const char *label);
323 * @fn int pkgmgr_parser_update_app_label_info_in_usr_db(const char *appid, uid_t uid, const char *label)
324 * @brief This API updates label info of application for user specified by uid
326 * @par This API is only for internal usage
327 * @par Sync (or) Async : Synchronous API
329 * @param[in] appid application ID to change label
330 * @param[in] uid user ID
331 * @param[in] label label to change
332 * @return 0 if success, error code(<0) if fail
334 int pkgmgr_parser_update_app_label_info_in_usr_db(const char *appid, uid_t uid, const char *label);
337 * @fn int pkgmgr_parser_update_app_icon_info_in_db(const char *appid, const char *icon_path)
338 * @brief This API updates icon info of application
340 * @par This API is only for internal usage
341 * @par Sync (or) Async : Synchronous API
343 * @param[in] appid application ID to change label
344 * @param[in] icon_path icon path to change
345 * @return 0 if success, error code(<0) if fail
347 int pkgmgr_parser_update_app_icon_info_in_db(const char *appid, const char *icon_path);
350 * @fn int pkgmgr_parser_update_app_icon_info_in_usr_db(const char *appid, uid_t uid, const char *icon_path)
351 * @brief This API updates icon info of application for user specified by uid
353 * @par This API is only for internal usage
354 * @par Sync (or) Async : Synchronous API
356 * @param[in] appid application ID to change label
357 * @param[in] uid user ID
358 * @param[in] icon_path icon path to change
359 * @return 0 if success, error code(<0) if fail
361 int pkgmgr_parser_update_app_icon_info_in_usr_db(const char *appid, uid_t uid, const char *icon_path);
364 * @fn int pkgmgr_parser_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid)
365 * @brief This API registers update informations of given packages for user specified by uid
367 * @par This API is only for internal usage
368 * @par Sync (or) Async : Synchronous API
370 * @param[in] handle update information handle
371 * @param[in] uid user ID
372 * @return 0 if success, error code(<0) if fail
376 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
379 ret = pkgmgr_parser_register_pkg_update_info_in_usr_db(update_info, uid);
386 int pkgmgr_parser_register_pkg_update_info_in_usr_db(pkgmgrinfo_updateinfo_h handle, uid_t uid);
389 * @fn int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h update_info)
390 * @brief This API registers update informations of given packages
392 * @par This API is only for internal usage
393 * @par Sync (or) Async : Synchronous API
395 * @param[in] update_info update information handle
396 * @return 0 if success, error code(<0) if fail
400 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info)
403 ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info);
410 int pkgmgr_parser_register_pkg_update_info_in_db(pkgmgrinfo_updateinfo_h update_info);
413 * @fn int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid)
414 * @brief This API unregister update information of certain package for user specified by uid.
416 * @par This API is only for internal usage
417 * @par Sync (or) Async : Synchronous API
419 * @param[in] pkgid package ID
420 * @param[in] uid user ID
421 * @return 0 if success, error code(<0) if fail
425 static int register_pkg_update_info(pkgmgrinfo_updateinfo_h update_info, uid_t uid)
428 ret = pkgmgr_parser_register_pkg_update_info_in_db(update_info, uid);
435 int pkgmgr_parser_unregister_pkg_update_info_in_usr_db(const char *pkgid, uid_t uid);
438 * @fn int pkgmgr_parser_unregister_pkg_update_info_in_db(const char * pkgid)
439 * @brief This API unregister update information of certain package
441 * @par This API is only for internal usage
442 * @par Sync (or) Async : Synchronous API
444 * @param[in] pkgid package ID
445 * @return 0 if success, error code(<0) if fail
449 static int unregister_pkg_update_info(const char *pkgid)
452 ret = pkgmgr_parser_unregister_pkg_update_info_in_db(pkgid);
459 int pkgmgr_parser_unregister_pkg_update_info_in_db(const char *pkgid);
462 * @fn int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid)
463 * @brief This API unregister update information of all packages
465 * @par This API is only for internal usage
466 * @par Sync (or) Async : Synchronous API
468 * @param[in] uid user ID
469 * @return 0 if success, error code(<0) if fail
473 static int unregister_all_pkg_update_info(uid_t uid)
476 ret = pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid);
483 int pkgmgr_parser_unregister_all_pkg_update_info_in_usr_db(uid_t uid);
486 * @fn int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void)
487 * @brief This API unregisters update information of all packages
489 * @par This API is only for internal usage
490 * @par Sync (or) Async : Synchronous API
492 * @return 0 if success, error code(<0) if fail
496 static int unregister_all_pkg_update_info(void)
499 ret = pkgmgr_parser_unregister_all_pkg_update_info_in_db();
506 int pkgmgr_parser_unregister_all_pkg_update_info_in_db(void);
509 * @fn int pkgmgr_parser_register_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid)
510 * @brief This API registers package plugin execution information
512 * @par This API is only for internal usage
513 * @par Sync (or) Async : Synchronous API
515 * @param[in] mfx manifest structure pointer which contains plugin execution info
516 * @return 0 if success, error code(<0) if fail
520 static int register_pkg_plugin_info(manifest_x *mfx)
523 ret = pkgmgr_parser_register_pkg_plugin_info_in_db(mfx);
530 int pkgmgr_parser_register_pkg_plugin_info_in_db(manifest_x *mfx);
531 int pkgmgr_parser_register_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid);
534 * @fn int pkgmgr_parser_update_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid)
535 * @brief This API updates package plugin execution information
537 * @par This API is only for internal usage
538 * @par Sync (or) Async : Synchronous API
540 * @param[in] mfx manifest structure pointer which contains plugin execution info
541 * @return 0 if success, error code(<0) if fail
545 static int update_pkg_plugin_info(manifest_x *mfx)
548 ret = pkgmgr_parser_update_pkg_plugin_info_in_db(mfx);
555 int pkgmgr_parser_update_pkg_plugin_info_in_db(manifest_x *mfx);
556 int pkgmgr_parser_update_pkg_plugin_info_in_usr_db(manifest_x *mfx, uid_t uid);
559 * @fn int pkgmgr_parser_unregister_pkg_plugin_info_in_usr_db(const char *pkgid, uid_t uid)
560 * @brief This API unregisters package plugin execution information
562 * @par This API is only for internal usage
563 * @par Sync (or) Async : Synchronous API
565 * @param[in] pkgid package ID
566 * @return 0 if success, error code(<0) if fail
570 static int unregister_pkg_plugin_info(const char *pkgid)
573 ret = pkgmgr_parser_unregister_pkg_plugin_info_in_db(pkgid);
580 int pkgmgr_parser_unregister_pkg_plugin_info_in_db(const char *pkgid);
581 int pkgmgr_parser_unregister_pkg_plugin_info_in_usr_db(const char *pkgid, uid_t uid);
583 int pkgmgr_parser_create_and_initialize_db(uid_t uid);
585 int pkgmgr_parser_update_pending_cache(const char *pkgid);
591 #endif /* __PKGMGR_PARSER_DB_H__ */