4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Garima Shrivastava<garima.s@samsung.com>
7 * Jyotsna Dhumale <jyotsna.a@samsung.com>
8 * Venkatesha Sarpangala <sarpangala.v@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
24 #include <app2sd_internals.h>
25 #include <app2sd_interface.h>
27 #include <sys/types.h>
29 #include <pkgmgr-info.h>
32 #define MAX_BUF_LEN 1024
33 #define APP2SD_TMP_PATH "/opt/usr/apps/tmp"
35 int app2sd_pre_app_install(const char *pkgid, GList* dir_list,
40 char *device_node = NULL;
44 /*Validate the function parameter recieved */
45 if (pkgid == NULL || dir_list == NULL || size <= 0) {
46 app2ext_print("App2Sd Error : Invalid function arguments\n");
47 return APP2EXT_ERROR_INVALID_ARGUMENTS;
49 /*Check whether MMC is present or not */
50 ret = _app2sd_check_mmc_status();
52 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
54 return APP2EXT_ERROR_MMC_STATUS;
56 /*Find available free memory in the MMC card */
57 ret = _app2sd_get_available_free_memory(MMC_PATH,
60 app2ext_print("App2Sd Error : Unable to get available free memory in MMC %d\n", ret);
61 return APP2EXT_ERROR_MMC_STATUS;
63 /*If avaialalbe free memory in MMC is less than required size + 5MB , return error */
64 if ((size + PKG_BUF_SIZE + MEM_BUF_SIZE) > free_mmc_mem) {
65 app2ext_print("Insufficient memory in MMC for application installation %d\n", ret);
66 return APP2EXT_ERROR_MMC_INSUFFICIENT_MEMORY;
68 /*Create a loopback device */
69 ret = _app2sd_create_loopback_device(pkgid, (size+PKG_BUF_SIZE));
71 app2ext_print("App2Sd Error : Package already present\n");
72 char buf_dir[FILENAME_MAX] = { 0, };
73 memset((void *)&buf_dir, '\0', FILENAME_MAX);
74 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
75 ret = _app2sd_delete_directory(buf_dir);
78 ("App2Sd Error : Unable to delete the directory %s\n",
82 /*Perform Loopback encryption setup */
83 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
85 app2ext_print("App2Sd Error : Loopback encryption setup failed\n");
86 _app2sd_delete_loopback_device(pkgid);
87 return APP2EXT_ERROR_DO_LOSETUP;
89 /*Check whether loopback device is associated with device node or not */
90 devi = _app2sd_find_associated_device_node(pkgid);
92 app2ext_print("App2Sd Error : finding associated device node failed\n");
93 ret = APP2EXT_ERROR_DO_LOSETUP;
97 /*Format the loopback file system */
98 ret = _app2sd_create_file_system(device_node);
100 app2ext_print("App2Sd Error : creating FS failed failed\n");
101 ret = APP2EXT_ERROR_CREATE_FS;
105 /*Mount the loopback encrypted pseudo device on application installation path as with Read Write permission */
106 ret =_app2sd_mount_app_content(pkgid, device_node, MOUNT_TYPE_RW,
107 dir_list, APP2SD_PRE_INSTALL);
109 app2ext_print("App2Sd Error : mounting dev path to app install path failed\n");
110 ret = APP2EXT_ERROR_MOUNT_PATH;
115 ret = APP2EXT_SUCCESS;
121 result = _app2sd_detach_loop_device(device_node);
126 _app2sd_delete_loopback_device(pkgid);
140 int app2sd_post_app_install(const char *pkgid,
141 app2ext_status install_status)
143 char *device_name = NULL;
144 char buf_dir[FILENAME_MAX] = { 0, };
145 int ret = APP2EXT_SUCCESS;
146 /*Validate the function parameter recieved */
147 if (pkgid == NULL || install_status < APP2EXT_STATUS_FAILED
148 || install_status > APP2EXT_STATUS_SUCCESS) {
149 app2ext_print("Invalid func parameters\n");
150 return APP2EXT_ERROR_INVALID_ARGUMENTS;
153 /*Check whether MMC is present or not */
154 ret = _app2sd_check_mmc_status();
156 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
158 return APP2EXT_ERROR_MMC_STATUS;
161 /*Get the associated device node for SD card applicationer */
162 device_name = _app2sd_find_associated_device_node(pkgid);
163 if (NULL == device_name) {
164 return APP2EXT_ERROR_FIND_ASSOCIATED_DEVICE_NODE;
166 ret = _app2sd_unmount_app_content(pkgid);
172 app2ext_print("Unable to unmount the app content %d\n", ret);
173 return APP2EXT_ERROR_UNMOUNT;
175 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
182 ("Unable to Detach the loopback encryption setup for the application");
183 return APP2EXT_ERROR_UNMOUNT;
190 /*Take appropriate action based on installation
191 status of application package */
192 if (install_status == APP2EXT_STATUS_FAILED) {
193 /*Delete the loopback device from the SD card */
194 ret = _app2sd_delete_loopback_device(pkgid);
197 ("App2Sd Error : Unable to delete the loopback device from the SD Card\n");
198 return APP2EXT_ERROR_DELETE_LOOPBACK_DEVICE;
200 ret = _app2sd_remove_password_from_db(pkgid);
204 ("App2Sd Error : Unable to delete the password\n");
207 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
209 ret = _app2sd_delete_directory(buf_dir);
213 ("App2Sd Error : Unable to delete the directory %s\n",
218 /*If the status is success, then update installed storage to pkgmgr_parser db*/
220 rt = pkgmgrinfo_pkginfo_set_installed_storage(pkgid, INSTALL_EXTERNAL);
222 app2ext_print("fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_EXTERNAL);
228 int app2sd_on_demand_setup_init(const char *pkgid)
230 int ret = APP2EXT_SUCCESS;
231 char app_path[FILENAME_MAX] = { 0, };
232 char *device_node = NULL;
236 /*Validate the function parameter recieved */
239 ("App2Sd Error : Invalid function arguments to app launch setup\n");
240 return APP2EXT_ERROR_INVALID_ARGUMENTS;
243 /*Check whether MMC is present or not */
244 ret = _app2sd_check_mmc_status();
246 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
248 return APP2EXT_ERROR_MMC_STATUS;
251 /*check app entry is there in sd card or not. */
252 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH,
254 fp = fopen(app_path, "r+");
257 ("App2SD Error: App Entry is not present in SD Card\n");
258 return APP2EXT_ERROR_INVALID_PACKAGE;
261 result = (char *)_app2sd_find_associated_device(app_path);
262 /*process the string */
263 if ((result!=NULL) && strstr(result, "/dev") != NULL) {
264 app2ext_print("App2SD Error! Already associated\n");
267 return APP2EXT_ERROR_ALREADY_MOUNTED;
270 /*Do loopback setup */
271 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
272 if (device_node == NULL) {
274 ("App2Sd Error : loopback encryption setup failed\n");
275 return APP2EXT_ERROR_DO_LOSETUP;
280 _app2sd_mount_app_content(pkgid, device_node, MOUNT_TYPE_RD,
281 NULL, APP2SD_APP_LAUNCH);
283 app2ext_print("App2Sd Error : Re-mount failed\n");
288 return APP2EXT_ERROR_MOUNT_PATH;
297 int app2sd_on_demand_setup_exit(const char *pkgid)
299 int ret = APP2EXT_SUCCESS;
300 char app_path[FILENAME_MAX] = { 0, };
303 /*Validate the function parameter recieved */
306 ("App2Sd Error : Invalid function arguments to app launch setup\n");
307 return APP2EXT_ERROR_INVALID_ARGUMENTS;
310 /*Check whether MMC is present or not */
311 ret = _app2sd_check_mmc_status();
313 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
315 return APP2EXT_ERROR_MMC_STATUS;
317 /*check app entry is there in sd card or not. */
318 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH,
320 fp = fopen(app_path, "r+");
323 ("App2SD Error: App Entry is not present in SD Card\n");
324 return APP2EXT_ERROR_INVALID_PACKAGE;
327 ret = _app2sd_unmount_app_content(pkgid);
330 ("App2SD Error: Unable to unmount the SD application\n");
331 return APP2EXT_ERROR_UNMOUNT;
333 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
335 app2ext_print("App2SD Error: Unable to remove loopback setup\n");
336 return APP2EXT_ERROR_DELETE_LOOPBACK_DEVICE;
341 int app2sd_pre_app_uninstall(const char *pkgid)
343 int ret = APP2EXT_SUCCESS;
344 char app_path[FILENAME_MAX] = { 0, };
345 char *device_node = NULL;
348 /*Validate the function parameter recieved */
351 ("App2Sd Error : Invalid function arguments to app launch setup\n");
352 ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
355 /*Check whether MMC is present or not */
356 ret = _app2sd_check_mmc_status();
358 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
360 ret = APP2EXT_ERROR_MMC_STATUS;
363 /*check app entry is there in sd card or not. */
364 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH, pkgid);
365 fp = fopen(app_path, "r+");
368 ("App2SD Error: App Entry is not present in SD Card\n");
369 ret = APP2EXT_ERROR_INVALID_PACKAGE;
374 /*Get the associated device node for SD card applicationer */
375 device_node = _app2sd_find_associated_device_node(pkgid);
376 if (NULL == device_node) {
377 /*Do loopback setup */
378 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
380 if (device_node == NULL) {
382 ("App2Sd Error : loopback encryption setup failed\n");
383 ret = APP2EXT_ERROR_DO_LOSETUP;
388 _app2sd_mount_app_content(pkgid, device_node,
390 APP2SD_PRE_UNINSTALL);
393 app2ext_print("App2Sd Error : RW-mount failed\n");
398 ret = APP2EXT_ERROR_MOUNT_PATH;
404 _app2sd_mount_app_content(pkgid, device_node,
405 MOUNT_TYPE_RW_REMOUNT, NULL,
406 APP2SD_PRE_UNINSTALL);
409 app2ext_print("App2Sd Error : Re-mount failed\n");
414 ret = APP2EXT_ERROR_MOUNT_PATH;
424 if (ret != APP2EXT_SUCCESS)
425 app2ext_print("App2Sd Error : app2sd has [%d]error, but return success for uninstallation\n", ret);
430 * app2sd_post_app_uninstall_setup
431 * Uninstall Application and free all the allocated resources
432 * Called after dpkg remove, It deallocates dev node and loopback
434 int app2sd_post_app_uninstall(const char *pkgid)
436 char buf_dir[FILENAME_MAX] = { 0, };
437 int ret = APP2EXT_SUCCESS;
438 int ret1 = APP2EXT_SUCCESS;
439 /*Validate the function parameter recieved */
442 ("App2Sd Error : Invalid function arguments to Post Uninstall\n");
443 ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
446 /*Check whether MMC is present or not */
447 ret = _app2sd_check_mmc_status();
449 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
451 ret = APP2EXT_ERROR_MMC_STATUS;
454 /*Unmount the loopback encrypted pseudo device from the application installation path */
455 ret = _app2sd_unmount_app_content(pkgid);
457 app2ext_print("Unable to unmount the app content %d\n", ret);
458 ret = APP2EXT_ERROR_UNMOUNT;
461 /*Detach the loopback encryption setup for the application */
462 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
465 ("Unable to Detach the loopback encryption setup for the application");
466 ret = APP2EXT_ERROR_DETACH_LOOPBACK_DEVICE;
469 /*Delete the loopback device from the SD card */
470 ret = _app2sd_delete_loopback_device(pkgid);
473 ("App2Sd Error : Unable to delete the loopback device from the SD Card\n");
474 ret = APP2EXT_ERROR_DELETE_LOOPBACK_DEVICE;
477 memset((void *)&buf_dir, '\0', FILENAME_MAX);
478 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
479 ret1 = _app2sd_delete_directory(buf_dir);
482 ("App2Sd Error : Unable to delete the directory %s\n",
485 /*remove encryption password from DB */
486 ret = _app2sd_initialize_db();
488 app2ext_print("\n app2sd db initialize failed");
489 ret = APP2EXT_ERROR_SQLITE_REGISTRY;
492 ret = _app2sd_remove_password_from_db(pkgid);
494 app2ext_print("cannot remove password from db \n");
495 ret = APP2EXT_ERROR_SQLITE_REGISTRY;
500 if (ret != APP2EXT_SUCCESS)
501 app2ext_print("App2Sd Error : app2sd has [%d]error, but return success for uninstallation\n", ret);
505 int app2sd_move_installed_app(const char *pkgid, GList* dir_list,
506 app2ext_move_type move_type)
509 int pkgmgrinfo_ret = 0;
511 /*Validate function arguments*/
512 if (pkgid == NULL || dir_list == NULL
513 || move_type < APP2EXT_MOVE_TO_EXT
514 || move_type > APP2EXT_MOVE_TO_PHONE) {
515 app2ext_print("App2Sd Error : Invalid function arguments\n");
516 ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
520 /*If move is completed, then update installed storage to pkgmgr_parser db*/
521 pkgmgrinfo_pkginfo_h info_handle = NULL;
522 pkgmgrinfo_installed_storage storage = PMINFO_INTERNAL_STORAGE;
523 pkgmgrinfo_ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &info_handle);
524 if (pkgmgrinfo_ret < 0) {
525 app2ext_print("App2Sd Error : pkgmgrinfo_pkginfo_get_pkginfo[%s] fail.. \n", pkgid);
527 pkgmgrinfo_ret = pkgmgrinfo_pkginfo_get_installed_storage(info_handle, &storage);
528 if (pkgmgrinfo_ret < 0) {
529 app2ext_print("App2Sd Error : pkgmgrinfo_pkginfo_get_installed_storage[%s] fail.. \n", pkgid);
532 if ((move_type == APP2EXT_MOVE_TO_EXT && storage == PMINFO_EXTERNAL_STORAGE)
533 || (move_type == APP2EXT_MOVE_TO_PHONE && storage == PMINFO_INTERNAL_STORAGE)) {
534 ret = APP2EXT_ERROR_PKG_EXISTS;
535 app2ext_print("App2Sd Error : PKG_EXISTS in [%d]STORAGE\n", storage);
536 pkgmgrinfo_pkginfo_destroy_pkginfo(info_handle);
539 app2ext_print("App2Sd info : pkgid[%s] move to STORAGE[%d]\n", pkgid, storage);
541 pkgmgrinfo_pkginfo_destroy_pkginfo(info_handle);
543 ret = _app2sd_move_app(pkgid, move_type, dir_list);
545 app2ext_print("App2Sd Error : Unable to move application\n");
549 /*If move is completed, then update installed storage to pkgmgr_parser db*/
550 if (move_type == APP2EXT_MOVE_TO_EXT) {
551 pkgmgrinfo_ret = pkgmgrinfo_pkginfo_set_installed_storage(pkgid, INSTALL_EXTERNAL);
552 if (pkgmgrinfo_ret < 0) {
553 app2ext_print("App2Sd Error : fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_EXTERNAL);
556 pkgmgrinfo_ret = pkgmgrinfo_pkginfo_set_installed_storage(pkgid, INSTALL_INTERNAL);
557 if (pkgmgrinfo_ret < 0) {
558 app2ext_print("App2Sd Error : fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_INTERNAL);
563 // vconf_set_int(VCONFKEY_PKGMGR_STATUS, ret);
564 _app2sd_make_result_info_file(pkgid, ret);
569 int app2sd_pre_app_upgrade(const char *pkgid, GList* dir_list,
572 int ret = APP2EXT_SUCCESS;
573 char app_path[FILENAME_MAX] = { 0, };
574 char *device_node = NULL;
575 unsigned long long curr_size = 0;
578 /*Validate function arguments*/
579 if (pkgid == NULL || dir_list == NULL || size<=0) {
581 ("App2Sd Error : Invalid function arguments \n");
582 return APP2EXT_ERROR_INVALID_ARGUMENTS;
584 /*Check whether MMC is present or not */
585 ret = _app2sd_check_mmc_status();
587 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
589 return APP2EXT_ERROR_MMC_STATUS;
591 /*check app entry is there in sd card or not. */
592 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH,
594 app2ext_print("App2Sd Log : Checking path %s\n", app_path);
595 fp = fopen(app_path, "r+");
598 ("App2SD Error: App Entry is not present in SD Card\n");
599 return APP2EXT_ERROR_INVALID_PACKAGE;
602 /*Get installed app size*/
603 curr_size = _app2sd_calculate_file_size(app_path);
604 curr_size = (curr_size/1024)/1024;
608 ("App2SD Error: App Entry is not present in SD Card\n");
609 return APP2EXT_ERROR_LOOPBACK_DEVICE_UNAVAILABLE;
611 if (curr_size<size) {
612 ret = _app2sd_update_loopback_device_size(pkgid, size, dir_list);
613 if(APP2EXT_SUCCESS !=ret) {
615 ("App2SD Error: _app2sd_update_loopback_device_size() failed\n");
620 /*Get the associated device node for SD card applicationer */
621 device_node = _app2sd_find_associated_device_node(pkgid);
622 if (NULL == device_node) {
623 /*Do loopback setup */
624 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
625 if (device_node == NULL) {
627 ("App2Sd Error : loopback encryption setup failed\n");
628 return APP2EXT_ERROR_DO_LOSETUP;
632 _app2sd_mount_app_content(pkgid, device_node,
636 app2ext_print("App2Sd Error : Re-mount failed\n");
641 return APP2EXT_ERROR_MOUNT_PATH;
646 _app2sd_mount_app_content(pkgid, device_node,
647 MOUNT_TYPE_RW_REMOUNT, NULL,
650 app2ext_print("App2Sd Error : Re-mount failed\n");
655 return APP2EXT_ERROR_MOUNT_PATH;
667 int app2sd_post_app_upgrade(const char *pkgid,
668 app2ext_status install_status)
670 char *device_name = NULL;
671 int ret = APP2EXT_SUCCESS;
672 /*Validate the function parameter recieved */
673 if (pkgid == NULL || install_status < APP2EXT_STATUS_FAILED
674 || install_status > APP2EXT_STATUS_SUCCESS) {
675 app2ext_print("Invalid func parameters\n");
676 return APP2EXT_ERROR_INVALID_ARGUMENTS;
678 /*Check whether MMC is present or not */
679 ret = _app2sd_check_mmc_status();
681 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
683 return APP2EXT_ERROR_MMC_STATUS;
686 /*Get the associated device node for SD card applicationer */
687 device_name = _app2sd_find_associated_device_node(pkgid);
688 if (NULL == device_name) {
689 return APP2EXT_ERROR_FIND_ASSOCIATED_DEVICE_NODE;
691 ret = _app2sd_unmount_app_content(pkgid);
697 app2ext_print("Unable to unmount the app content %d\n", ret);
698 return APP2EXT_ERROR_UNMOUNT;
700 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
707 ("Unable to Detach the loopback encryption setup for the application");
708 return APP2EXT_ERROR_UNMOUNT;
719 * Reserved API for forced cleanup
722 int app2sd_force_cleanup(const char *pkgid){
723 char *device_name = NULL;
724 char buf_dir[FILENAME_MAX] = { 0, };
725 int ret = APP2EXT_SUCCESS;
728 /*Validate the function parameter recieved */
730 app2ext_print("invalid func parameters\n");
731 return APP2EXT_ERROR_INVALID_ARGUMENTS;
733 memset((void *)&buf_dir, '\0', FILENAME_MAX);
734 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP2SD_PATH, pkgid);
735 fp = fopen(buf_dir, "r+");
737 app2ext_print("\"%s\" not installed on SD Card\n", pkgid);
738 return APP2EXT_ERROR_INVALID_PACKAGE;
741 /*Check whether MMC is present or not */
742 ret = _app2sd_check_mmc_status();
744 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
746 return APP2EXT_ERROR_MMC_STATUS;
749 /*Get the associated device node for SD card applicationer */
750 device_name = _app2sd_find_associated_device_node(pkgid);
751 if (NULL != device_name) {
754 ret = _app2sd_unmount_app_content(pkgid);
756 app2ext_print("Unable to unmount the app content %d\n", ret);
757 return APP2EXT_ERROR_UNMOUNT;
759 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
762 ("Unable to Detach the loopback encryption setup for the application");
763 return APP2EXT_ERROR_UNMOUNT;
767 memset((void *)&buf_dir, '\0', FILENAME_MAX);
768 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
769 ret = _app2sd_delete_directory(buf_dir);
772 ("App2Sd Error : Unable to delete the directory %s\n",
776 /*remove passwrd from DB*/
777 ret = _app2sd_initialize_db();
779 app2ext_print("\n app2sd db initialize failed");
780 return APP2EXT_ERROR_SQLITE_REGISTRY;
782 ret = _app2sd_remove_password_from_db(pkgid);
784 app2ext_print("cannot remove password from db \n");
785 return APP2EXT_ERROR_SQLITE_REGISTRY;
791 int app2sd_force_clean(const char *pkgid)
793 char buf_dir[FILENAME_MAX] = { 0, };
794 int ret = APP2EXT_SUCCESS;
796 /*Validate the function parameter recieved */
798 app2ext_print("Invalid func parameters\n");
799 return APP2EXT_ERROR_INVALID_ARGUMENTS;
801 app2ext_print("star force_clean [%s]", pkgid);
804 /*Unmount the loopback encrypted pseudo device from the application installation path */
805 ret = _app2sd_unmount_app_content(pkgid);
807 app2ext_print("Unable to unmount the app content %d\n", ret);
810 /*Detach the loopback encryption setup for the application */
811 ret = _app2sd_remove_all_loopback_encryption_setups(pkgid);
813 app2ext_print("Unable to Detach the loopback encryption setup for the application");
816 /*Delete the loopback device from the SD card */
817 ret = _app2sd_delete_loopback_device(pkgid);
819 app2ext_print("Unable to Detach the loopback encryption setup for the application");
823 memset((void *)&buf_dir, '\0', FILENAME_MAX);
824 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
826 _app2sd_delete_symlink(buf_dir);
828 /*remove passwrd from DB*/
829 ret = _app2sd_initialize_db();
831 app2ext_print("\n app2sd db initialize failed");
833 ret = _app2sd_remove_password_from_db(pkgid);
835 app2ext_print("cannot remove password from db \n");
838 app2ext_print("finish force_clean");
842 /* This is the plug-in load function. The plugin has to bind its functions to function pointers of handle
843 @param[in/out] st_interface Specifies the storage interface.
846 app2ext_on_load(app2ext_interface *st_interface)
849 st_interface->pre_install= app2sd_pre_app_install;
850 st_interface->post_install= app2sd_post_app_install;
851 st_interface->pre_uninstall= app2sd_pre_app_uninstall;
852 st_interface->post_uninstall= app2sd_post_app_uninstall;
853 st_interface->pre_upgrade= app2sd_pre_app_upgrade;
854 st_interface->post_upgrade= app2sd_post_app_upgrade;
855 st_interface->move= app2sd_move_installed_app;
856 st_interface->force_clean= app2sd_force_clean;
857 st_interface->enable= app2sd_on_demand_setup_init;
858 st_interface->disable= app2sd_on_demand_setup_exit;