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 /* For multi-user support */
33 #include <tzplatform_config.h>
35 #define MAX_BUF_LEN 1024
36 #define APP2SD_TMP_PATH tzplatform_mkpath(TZ_USER_APP, "tmp")
38 int app2sd_pre_app_install(const char *pkgid, GList* dir_list,
43 char *device_node = NULL;
47 /*Validate the function parameter recieved */
48 if (pkgid == NULL || dir_list == NULL || size <= 0) {
49 app2ext_print("App2Sd Error : Invalid function arguments\n");
50 return APP2EXT_ERROR_INVALID_ARGUMENTS;
52 /*Check whether MMC is present or not */
53 ret = _app2sd_check_mmc_status();
55 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
57 return APP2EXT_ERROR_MMC_STATUS;
59 /*Find available free memory in the MMC card */
60 ret = _app2sd_get_available_free_memory(MMC_PATH,
63 app2ext_print("App2Sd Error : Unable to get available free memory in MMC %d\n", ret);
64 return APP2EXT_ERROR_MMC_STATUS;
66 /*If avaialalbe free memory in MMC is less than required size + 5MB , return error */
67 if ((size + PKG_BUF_SIZE + MEM_BUF_SIZE) > free_mmc_mem) {
68 app2ext_print("Insufficient memory in MMC for application installation %d\n", ret);
69 return APP2EXT_ERROR_MMC_INSUFFICIENT_MEMORY;
71 /*Create a loopback device */
72 ret = _app2sd_create_loopback_device(pkgid, (size+PKG_BUF_SIZE));
74 app2ext_print("App2Sd Error : Package already present\n");
75 char buf_dir[FILENAME_MAX] = { 0, };
76 memset((void *)&buf_dir, '\0', FILENAME_MAX);
77 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
78 ret = _app2sd_delete_directory(buf_dir);
81 ("App2Sd Error : Unable to delete the directory %s\n",
85 /*Perform Loopback encryption setup */
86 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
88 app2ext_print("App2Sd Error : Loopback encryption setup failed\n");
89 _app2sd_delete_loopback_device(pkgid);
90 return APP2EXT_ERROR_DO_LOSETUP;
92 /*Check whether loopback device is associated with device node or not */
93 devi = _app2sd_find_associated_device_node(pkgid);
95 app2ext_print("App2Sd Error : finding associated device node failed\n");
96 ret = APP2EXT_ERROR_DO_LOSETUP;
100 /*Format the loopback file system */
101 ret = _app2sd_create_file_system(device_node);
103 app2ext_print("App2Sd Error : creating FS failed failed\n");
104 ret = APP2EXT_ERROR_CREATE_FS;
108 /*Mount the loopback encrypted pseudo device on application installation path as with Read Write permission */
109 ret =_app2sd_mount_app_content(pkgid, device_node, MOUNT_TYPE_RW,
110 dir_list, APP2SD_PRE_INSTALL);
112 app2ext_print("App2Sd Error : mounting dev path to app install path failed\n");
113 ret = APP2EXT_ERROR_MOUNT_PATH;
118 ret = APP2EXT_SUCCESS;
124 result = _app2sd_detach_loop_device(device_node);
129 _app2sd_delete_loopback_device(pkgid);
143 int app2sd_post_app_install(const char *pkgid,
144 app2ext_status install_status)
146 char *device_name = NULL;
147 char buf_dir[FILENAME_MAX] = { 0, };
148 int ret = APP2EXT_SUCCESS;
149 /*Validate the function parameter recieved */
150 if (pkgid == NULL || install_status < APP2EXT_STATUS_FAILED
151 || install_status > APP2EXT_STATUS_SUCCESS) {
152 app2ext_print("Invalid func parameters\n");
153 return APP2EXT_ERROR_INVALID_ARGUMENTS;
156 /*Check whether MMC is present or not */
157 ret = _app2sd_check_mmc_status();
159 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
161 return APP2EXT_ERROR_MMC_STATUS;
164 /*Get the associated device node for SD card applicationer */
165 device_name = _app2sd_find_associated_device_node(pkgid);
166 if (NULL == device_name) {
167 return APP2EXT_ERROR_FIND_ASSOCIATED_DEVICE_NODE;
169 ret = _app2sd_unmount_app_content(pkgid);
175 app2ext_print("Unable to unmount the app content %d\n", ret);
176 return APP2EXT_ERROR_UNMOUNT;
178 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
185 ("Unable to Detach the loopback encryption setup for the application");
186 return APP2EXT_ERROR_UNMOUNT;
193 /*Take appropriate action based on installation
194 status of application package */
195 if (install_status == APP2EXT_STATUS_FAILED) {
196 /*Delete the loopback device from the SD card */
197 ret = _app2sd_delete_loopback_device(pkgid);
200 ("App2Sd Error : Unable to delete the loopback device from the SD Card\n");
201 return APP2EXT_ERROR_DELETE_LOOPBACK_DEVICE;
203 ret = _app2sd_remove_password_from_db(pkgid);
207 ("App2Sd Error : Unable to delete the password\n");
210 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
212 ret = _app2sd_delete_directory(buf_dir);
216 ("App2Sd Error : Unable to delete the directory %s\n",
221 /*If the status is success, then update installed storage to pkgmgr_parser db*/
223 pkgmgrinfo_pkgdbinfo_h handle = NULL;
224 rt = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
226 app2ext_print("pkgmgrinfo_create_pkgdbinfo[%s] fail.. \n", pkgid);
228 rt = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_EXTERNAL);
230 app2ext_print("fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_EXTERNAL);
232 rt =pkgmgrinfo_save_pkgdbinfo(handle);
234 app2ext_print("pkgmgrinfo_save_pkgdbinfo[%s] failed\n", pkgid);
236 rt =pkgmgrinfo_destroy_pkgdbinfo(handle);
238 app2ext_print("pkgmgrinfo_destroy_pkgdbinfo[%s] failed\n", pkgid);
244 int app2sd_on_demand_setup_init(const char *pkgid)
246 int ret = APP2EXT_SUCCESS;
247 char app_path[FILENAME_MAX] = { 0, };
248 char *device_node = NULL;
252 /*Validate the function parameter recieved */
255 ("App2Sd Error : Invalid function arguments to app launch setup\n");
256 return APP2EXT_ERROR_INVALID_ARGUMENTS;
259 /*Check whether MMC is present or not */
260 ret = _app2sd_check_mmc_status();
262 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
264 return APP2EXT_ERROR_MMC_STATUS;
267 /*check app entry is there in sd card or not. */
268 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH,
270 fp = fopen(app_path, "r+");
273 ("App2SD Error: App Entry is not present in SD Card\n");
274 return APP2EXT_ERROR_INVALID_PACKAGE;
277 result = (char *)_app2sd_find_associated_device(app_path);
278 /*process the string */
279 if ((result!=NULL) && strstr(result, "/dev") != NULL) {
280 app2ext_print("App2SD Error! Already associated\n");
283 return APP2EXT_ERROR_ALREADY_MOUNTED;
286 /*Do loopback setup */
287 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
288 if (device_node == NULL) {
290 ("App2Sd Error : loopback encryption setup failed\n");
291 return APP2EXT_ERROR_DO_LOSETUP;
296 _app2sd_mount_app_content(pkgid, device_node, MOUNT_TYPE_RD,
297 NULL, APP2SD_APP_LAUNCH);
299 app2ext_print("App2Sd Error : Re-mount failed\n");
304 return APP2EXT_ERROR_MOUNT_PATH;
313 int app2sd_on_demand_setup_exit(const char *pkgid)
315 int ret = APP2EXT_SUCCESS;
316 char app_path[FILENAME_MAX] = { 0, };
319 /*Validate the function parameter recieved */
322 ("App2Sd Error : Invalid function arguments to app launch setup\n");
323 return APP2EXT_ERROR_INVALID_ARGUMENTS;
326 /*Check whether MMC is present or not */
327 ret = _app2sd_check_mmc_status();
329 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
331 return APP2EXT_ERROR_MMC_STATUS;
333 /*check app entry is there in sd card or not. */
334 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH,
336 fp = fopen(app_path, "r+");
339 ("App2SD Error: App Entry is not present in SD Card\n");
340 return APP2EXT_ERROR_INVALID_PACKAGE;
343 ret = _app2sd_unmount_app_content(pkgid);
346 ("App2SD Error: Unable to unmount the SD application\n");
347 return APP2EXT_ERROR_UNMOUNT;
349 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
351 app2ext_print("App2SD Error: Unable to remove loopback setup\n");
352 return APP2EXT_ERROR_DELETE_LOOPBACK_DEVICE;
357 int app2sd_pre_app_uninstall(const char *pkgid)
359 int ret = APP2EXT_SUCCESS;
360 char app_path[FILENAME_MAX] = { 0, };
361 char *device_node = NULL;
364 /*Validate the function parameter recieved */
367 ("App2Sd Error : Invalid function arguments to app launch setup\n");
368 ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
371 /*Check whether MMC is present or not */
372 ret = _app2sd_check_mmc_status();
374 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
376 ret = APP2EXT_ERROR_MMC_STATUS;
379 /*check app entry is there in sd card or not. */
380 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH, pkgid);
381 fp = fopen(app_path, "r+");
384 ("App2SD Error: App Entry is not present in SD Card\n");
385 ret = APP2EXT_ERROR_INVALID_PACKAGE;
390 /*Get the associated device node for SD card applicationer */
391 device_node = _app2sd_find_associated_device_node(pkgid);
392 if (NULL == device_node) {
393 /*Do loopback setup */
394 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
396 if (device_node == NULL) {
398 ("App2Sd Error : loopback encryption setup failed\n");
399 ret = APP2EXT_ERROR_DO_LOSETUP;
404 _app2sd_mount_app_content(pkgid, device_node,
406 APP2SD_PRE_UNINSTALL);
409 app2ext_print("App2Sd Error : RW-mount failed\n");
414 ret = APP2EXT_ERROR_MOUNT_PATH;
420 _app2sd_mount_app_content(pkgid, device_node,
421 MOUNT_TYPE_RW_REMOUNT, NULL,
422 APP2SD_PRE_UNINSTALL);
425 app2ext_print("App2Sd Error : Re-mount failed\n");
430 ret = APP2EXT_ERROR_MOUNT_PATH;
440 if (ret != APP2EXT_SUCCESS)
441 app2ext_print("App2Sd Error : app2sd has [%d]error, but return success for uninstallation\n", ret);
442 return APP2EXT_SUCCESS;
446 * app2sd_post_app_uninstall_setup
447 * Uninstall Application and free all the allocated resources
448 * Called after dpkg remove, It deallocates dev node and loopback
450 int app2sd_post_app_uninstall(const char *pkgid)
452 char buf_dir[FILENAME_MAX] = { 0, };
453 int ret = APP2EXT_SUCCESS;
454 int ret1 = APP2EXT_SUCCESS;
455 /*Validate the function parameter recieved */
458 ("App2Sd Error : Invalid function arguments to Post Uninstall\n");
459 ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
462 /*Check whether MMC is present or not */
463 ret = _app2sd_check_mmc_status();
465 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
467 ret = APP2EXT_ERROR_MMC_STATUS;
470 /*Unmount the loopback encrypted pseudo device from the application installation path */
471 ret = _app2sd_unmount_app_content(pkgid);
473 app2ext_print("Unable to unmount the app content %d\n", ret);
474 ret = APP2EXT_ERROR_UNMOUNT;
477 /*Detach the loopback encryption setup for the application */
478 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
481 ("Unable to Detach the loopback encryption setup for the application");
482 ret = APP2EXT_ERROR_DETACH_LOOPBACK_DEVICE;
485 /*Delete the loopback device from the SD card */
486 ret = _app2sd_delete_loopback_device(pkgid);
489 ("App2Sd Error : Unable to delete the loopback device from the SD Card\n");
490 ret = APP2EXT_ERROR_DELETE_LOOPBACK_DEVICE;
493 memset((void *)&buf_dir, '\0', FILENAME_MAX);
494 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
495 ret1 = _app2sd_delete_directory(buf_dir);
498 ("App2Sd Error : Unable to delete the directory %s\n",
501 /*remove encryption password from DB */
502 ret = _app2sd_initialize_db();
504 app2ext_print("\n app2sd db initialize failed");
505 ret = APP2EXT_ERROR_SQLITE_REGISTRY;
508 ret = _app2sd_remove_password_from_db(pkgid);
510 app2ext_print("cannot remove password from db \n");
511 ret = APP2EXT_ERROR_SQLITE_REGISTRY;
516 if (ret != APP2EXT_SUCCESS)
517 app2ext_print("App2Sd Error : app2sd has [%d]error, but return success for uninstallation\n", ret);
518 return APP2EXT_SUCCESS;
521 int app2sd_move_installed_app(const char *pkgid, GList* dir_list,
522 app2ext_move_type move_type)
525 int pkgmgrinfo_ret = 0;
527 /*Validate function arguments*/
528 if (pkgid == NULL || dir_list == NULL
529 || move_type < APP2EXT_MOVE_TO_EXT
530 || move_type > APP2EXT_MOVE_TO_PHONE) {
531 app2ext_print("App2Sd Error : Invalid function arguments\n");
532 ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
536 /*If move is completed, then update installed storage to pkgmgr_parser db*/
537 pkgmgrinfo_pkginfo_h info_handle = NULL;
538 pkgmgrinfo_installed_storage storage = PMINFO_INTERNAL_STORAGE;
539 pkgmgrinfo_ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &info_handle);
540 if (pkgmgrinfo_ret < 0) {
541 app2ext_print("App2Sd Error : pkgmgrinfo_pkginfo_get_pkginfo[%s] fail.. \n", pkgid);
543 pkgmgrinfo_ret = pkgmgrinfo_pkginfo_get_installed_storage(info_handle, &storage);
544 if (pkgmgrinfo_ret < 0) {
545 app2ext_print("App2Sd Error : pkgmgrinfo_pkginfo_get_installed_storage[%s] fail.. \n", pkgid);
548 if ((move_type == APP2EXT_MOVE_TO_EXT && storage == PMINFO_EXTERNAL_STORAGE)
549 || (move_type == APP2EXT_MOVE_TO_PHONE && storage == PMINFO_INTERNAL_STORAGE)) {
550 ret = APP2EXT_ERROR_PKG_EXISTS;
551 app2ext_print("App2Sd Error : PKG_EXISTS in [%d]STORAGE\n", storage);
552 pkgmgrinfo_pkginfo_destroy_pkginfo(info_handle);
555 app2ext_print("App2Sd info : STORAGE Move[%d] is success\n", storage);
557 pkgmgrinfo_pkginfo_destroy_pkginfo(info_handle);
559 ret = _app2sd_move_app(pkgid, move_type, dir_list);
561 app2ext_print("App2Sd Error : Unable to move application\n");
565 /*If move is completed, then update installed storage to pkgmgr_parser db*/
566 pkgmgrinfo_pkgdbinfo_h handle = NULL;
567 pkgmgrinfo_ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
568 if (pkgmgrinfo_ret < 0) {
569 app2ext_print("App2Sd Error : pkgmgrinfo_create_pkgdbinfo[%s] fail.. \n", pkgid);
572 if (move_type == APP2EXT_MOVE_TO_EXT) {
573 pkgmgrinfo_ret = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_EXTERNAL);
574 if (pkgmgrinfo_ret < 0) {
575 app2ext_print("App2Sd Error : fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_EXTERNAL);
578 pkgmgrinfo_ret = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_INTERNAL);
579 if (pkgmgrinfo_ret < 0) {
580 app2ext_print("App2Sd Error : fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_INTERNAL);
583 pkgmgrinfo_ret =pkgmgrinfo_save_pkgdbinfo(handle);
584 if (pkgmgrinfo_ret < 0) {
585 app2ext_print("pkgmgrinfo_save_pkgdbinfo[%s] failed\n", pkgid);
587 pkgmgrinfo_ret =pkgmgrinfo_destroy_pkgdbinfo(handle);
588 if (pkgmgrinfo_ret < 0) {
589 app2ext_print("pkgmgrinfo_destroy_pkgdbinfo failed\n");
594 vconf_set_int(VCONFKEY_PKGMGR_STATUS, ret);
599 int app2sd_pre_app_upgrade(const char *pkgid, GList* dir_list,
602 int ret = APP2EXT_SUCCESS;
603 char app_path[FILENAME_MAX] = { 0, };
604 char *device_node = NULL;
605 unsigned long long curr_size = 0;
608 /*Validate function arguments*/
609 if (pkgid == NULL || dir_list == NULL || size<=0) {
611 ("App2Sd Error : Invalid function arguments \n");
612 return APP2EXT_ERROR_INVALID_ARGUMENTS;
614 /*Check whether MMC is present or not */
615 ret = _app2sd_check_mmc_status();
617 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
619 return APP2EXT_ERROR_MMC_STATUS;
621 /*check app entry is there in sd card or not. */
622 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH,
624 app2ext_print("App2Sd Log : Checking path %s\n", app_path);
625 fp = fopen(app_path, "r+");
628 ("App2SD Error: App Entry is not present in SD Card\n");
629 return APP2EXT_ERROR_INVALID_PACKAGE;
632 /*Get installed app size*/
633 curr_size = _app2sd_calculate_file_size(app_path);
634 curr_size = (curr_size/1024)/1024;
638 ("App2SD Error: App Entry is not present in SD Card\n");
639 return APP2EXT_ERROR_LOOPBACK_DEVICE_UNAVAILABLE;
641 if (curr_size<size) {
642 ret = _app2sd_update_loopback_device_size(pkgid, size, dir_list);
643 if(APP2EXT_SUCCESS !=ret) {
645 ("App2SD Error: _app2sd_update_loopback_device_size() failed\n");
650 /*Get the associated device node for SD card applicationer */
651 device_node = _app2sd_find_associated_device_node(pkgid);
652 if (NULL == device_node) {
653 /*Do loopback setup */
654 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
655 if (device_node == NULL) {
657 ("App2Sd Error : loopback encryption setup failed\n");
658 return APP2EXT_ERROR_DO_LOSETUP;
662 _app2sd_mount_app_content(pkgid, device_node,
666 app2ext_print("App2Sd Error : Re-mount failed\n");
671 return APP2EXT_ERROR_MOUNT_PATH;
676 _app2sd_mount_app_content(pkgid, device_node,
677 MOUNT_TYPE_RW_REMOUNT, NULL,
680 app2ext_print("App2Sd Error : Re-mount failed\n");
685 return APP2EXT_ERROR_MOUNT_PATH;
697 int app2sd_post_app_upgrade(const char *pkgid,
698 app2ext_status install_status)
700 char *device_name = NULL;
701 int ret = APP2EXT_SUCCESS;
702 /*Validate the function parameter recieved */
703 if (pkgid == NULL || install_status < APP2EXT_STATUS_FAILED
704 || install_status > APP2EXT_STATUS_SUCCESS) {
705 app2ext_print("Invalid func parameters\n");
706 return APP2EXT_ERROR_INVALID_ARGUMENTS;
708 /*Check whether MMC is present or not */
709 ret = _app2sd_check_mmc_status();
711 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
713 return APP2EXT_ERROR_MMC_STATUS;
716 /*Get the associated device node for SD card applicationer */
717 device_name = _app2sd_find_associated_device_node(pkgid);
718 if (NULL == device_name) {
719 return APP2EXT_ERROR_FIND_ASSOCIATED_DEVICE_NODE;
721 ret = _app2sd_unmount_app_content(pkgid);
727 app2ext_print("Unable to unmount the app content %d\n", ret);
728 return APP2EXT_ERROR_UNMOUNT;
730 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
737 ("Unable to Detach the loopback encryption setup for the application");
738 return APP2EXT_ERROR_UNMOUNT;
749 * Reserved API for forced cleanup
752 int app2sd_force_cleanup(const char *pkgid){
753 char *device_name = NULL;
754 char buf_dir[FILENAME_MAX] = { 0, };
755 int ret = APP2EXT_SUCCESS;
758 /*Validate the function parameter recieved */
760 app2ext_print("invalid func parameters\n");
761 return APP2EXT_ERROR_INVALID_ARGUMENTS;
763 memset((void *)&buf_dir, '\0', FILENAME_MAX);
764 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP2SD_PATH, pkgid);
765 fp = fopen(buf_dir, "r+");
767 app2ext_print("\"%s\" not installed on SD Card\n", pkgid);
768 return APP2EXT_ERROR_INVALID_PACKAGE;
771 /*Check whether MMC is present or not */
772 ret = _app2sd_check_mmc_status();
774 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
776 return APP2EXT_ERROR_MMC_STATUS;
779 /*Get the associated device node for SD card applicationer */
780 device_name = _app2sd_find_associated_device_node(pkgid);
781 if (NULL != device_name) {
784 ret = _app2sd_unmount_app_content(pkgid);
786 app2ext_print("Unable to unmount the app content %d\n", ret);
787 return APP2EXT_ERROR_UNMOUNT;
789 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
792 ("Unable to Detach the loopback encryption setup for the application");
793 return APP2EXT_ERROR_UNMOUNT;
797 memset((void *)&buf_dir, '\0', FILENAME_MAX);
798 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
799 ret = _app2sd_delete_directory(buf_dir);
802 ("App2Sd Error : Unable to delete the directory %s\n",
806 /*remove passwrd from DB*/
807 ret = _app2sd_initialize_db();
809 app2ext_print("\n app2sd db initialize failed");
810 return APP2EXT_ERROR_SQLITE_REGISTRY;
812 ret = _app2sd_remove_password_from_db(pkgid);
814 app2ext_print("cannot remove password from db \n");
815 return APP2EXT_ERROR_SQLITE_REGISTRY;
821 /* This is the plug-in load function. The plugin has to bind its functions to function pointers of handle
822 @param[in/out] st_interface Specifies the storage interface.
825 app2ext_on_load(app2ext_interface *st_interface)
828 st_interface->pre_install= app2sd_pre_app_install;
829 st_interface->post_install= app2sd_post_app_install;
830 st_interface->pre_uninstall= app2sd_pre_app_uninstall;
831 st_interface->post_uninstall= app2sd_post_app_uninstall;
832 st_interface->pre_upgrade= app2sd_pre_app_upgrade;
833 st_interface->post_upgrade= app2sd_post_app_upgrade;
834 st_interface->move= app2sd_move_installed_app;
835 st_interface->enable= app2sd_on_demand_setup_init;
836 st_interface->disable= app2sd_on_demand_setup_exit;