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 pkgmgrinfo_pkgdbinfo_h handle = NULL;
221 rt = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
223 app2ext_print("pkgmgrinfo_create_pkgdbinfo[%s] fail.. \n", pkgid);
225 rt = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_EXTERNAL);
227 app2ext_print("fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_EXTERNAL);
229 rt =pkgmgrinfo_save_pkgdbinfo(handle);
231 app2ext_print("pkgmgrinfo_save_pkgdbinfo[%s] failed\n", pkgid);
233 rt =pkgmgrinfo_destroy_pkgdbinfo(handle);
235 app2ext_print("pkgmgrinfo_destroy_pkgdbinfo[%s] failed\n", pkgid);
241 int app2sd_on_demand_setup_init(const char *pkgid)
243 int ret = APP2EXT_SUCCESS;
244 char app_path[FILENAME_MAX] = { 0, };
245 char *device_node = NULL;
249 /*Validate the function parameter recieved */
252 ("App2Sd Error : Invalid function arguments to app launch setup\n");
253 return APP2EXT_ERROR_INVALID_ARGUMENTS;
256 /*Check whether MMC is present or not */
257 ret = _app2sd_check_mmc_status();
259 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
261 return APP2EXT_ERROR_MMC_STATUS;
264 /*check app entry is there in sd card or not. */
265 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH,
267 fp = fopen(app_path, "r+");
270 ("App2SD Error: App Entry is not present in SD Card\n");
271 return APP2EXT_ERROR_INVALID_PACKAGE;
274 result = (char *)_app2sd_find_associated_device(app_path);
275 /*process the string */
276 if ((result!=NULL) && strstr(result, "/dev") != NULL) {
277 app2ext_print("App2SD Error! Already associated\n");
280 return APP2EXT_ERROR_ALREADY_MOUNTED;
283 /*Do loopback setup */
284 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
285 if (device_node == NULL) {
287 ("App2Sd Error : loopback encryption setup failed\n");
288 return APP2EXT_ERROR_DO_LOSETUP;
293 _app2sd_mount_app_content(pkgid, device_node, MOUNT_TYPE_RD,
294 NULL, APP2SD_APP_LAUNCH);
296 app2ext_print("App2Sd Error : Re-mount failed\n");
301 return APP2EXT_ERROR_MOUNT_PATH;
310 int app2sd_on_demand_setup_exit(const char *pkgid)
312 int ret = APP2EXT_SUCCESS;
313 char app_path[FILENAME_MAX] = { 0, };
316 /*Validate the function parameter recieved */
319 ("App2Sd Error : Invalid function arguments to app launch setup\n");
320 return APP2EXT_ERROR_INVALID_ARGUMENTS;
323 /*Check whether MMC is present or not */
324 ret = _app2sd_check_mmc_status();
326 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
328 return APP2EXT_ERROR_MMC_STATUS;
330 /*check app entry is there in sd card or not. */
331 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH,
333 fp = fopen(app_path, "r+");
336 ("App2SD Error: App Entry is not present in SD Card\n");
337 return APP2EXT_ERROR_INVALID_PACKAGE;
340 ret = _app2sd_unmount_app_content(pkgid);
343 ("App2SD Error: Unable to unmount the SD application\n");
344 return APP2EXT_ERROR_UNMOUNT;
346 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
348 app2ext_print("App2SD Error: Unable to remove loopback setup\n");
349 return APP2EXT_ERROR_DELETE_LOOPBACK_DEVICE;
354 int app2sd_pre_app_uninstall(const char *pkgid)
356 int ret = APP2EXT_SUCCESS;
357 char app_path[FILENAME_MAX] = { 0, };
358 char *device_node = NULL;
361 /*Validate the function parameter recieved */
364 ("App2Sd Error : Invalid function arguments to app launch setup\n");
365 ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
368 /*Check whether MMC is present or not */
369 ret = _app2sd_check_mmc_status();
371 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
373 ret = APP2EXT_ERROR_MMC_STATUS;
376 /*check app entry is there in sd card or not. */
377 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH, pkgid);
378 fp = fopen(app_path, "r+");
381 ("App2SD Error: App Entry is not present in SD Card\n");
382 ret = APP2EXT_ERROR_INVALID_PACKAGE;
387 /*Get the associated device node for SD card applicationer */
388 device_node = _app2sd_find_associated_device_node(pkgid);
389 if (NULL == device_node) {
390 /*Do loopback setup */
391 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
393 if (device_node == NULL) {
395 ("App2Sd Error : loopback encryption setup failed\n");
396 ret = APP2EXT_ERROR_DO_LOSETUP;
401 _app2sd_mount_app_content(pkgid, device_node,
403 APP2SD_PRE_UNINSTALL);
406 app2ext_print("App2Sd Error : RW-mount failed\n");
411 ret = APP2EXT_ERROR_MOUNT_PATH;
417 _app2sd_mount_app_content(pkgid, device_node,
418 MOUNT_TYPE_RW_REMOUNT, NULL,
419 APP2SD_PRE_UNINSTALL);
422 app2ext_print("App2Sd Error : Re-mount failed\n");
427 ret = APP2EXT_ERROR_MOUNT_PATH;
437 if (ret != APP2EXT_SUCCESS)
438 app2ext_print("App2Sd Error : app2sd has [%d]error, but return success for uninstallation\n", ret);
439 return APP2EXT_SUCCESS;
443 * app2sd_post_app_uninstall_setup
444 * Uninstall Application and free all the allocated resources
445 * Called after dpkg remove, It deallocates dev node and loopback
447 int app2sd_post_app_uninstall(const char *pkgid)
449 char buf_dir[FILENAME_MAX] = { 0, };
450 int ret = APP2EXT_SUCCESS;
451 int ret1 = APP2EXT_SUCCESS;
452 /*Validate the function parameter recieved */
455 ("App2Sd Error : Invalid function arguments to Post Uninstall\n");
456 ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
459 /*Check whether MMC is present or not */
460 ret = _app2sd_check_mmc_status();
462 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
464 ret = APP2EXT_ERROR_MMC_STATUS;
467 /*Unmount the loopback encrypted pseudo device from the application installation path */
468 ret = _app2sd_unmount_app_content(pkgid);
470 app2ext_print("Unable to unmount the app content %d\n", ret);
471 ret = APP2EXT_ERROR_UNMOUNT;
474 /*Detach the loopback encryption setup for the application */
475 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
478 ("Unable to Detach the loopback encryption setup for the application");
479 ret = APP2EXT_ERROR_DETACH_LOOPBACK_DEVICE;
482 /*Delete the loopback device from the SD card */
483 ret = _app2sd_delete_loopback_device(pkgid);
486 ("App2Sd Error : Unable to delete the loopback device from the SD Card\n");
487 ret = APP2EXT_ERROR_DELETE_LOOPBACK_DEVICE;
490 memset((void *)&buf_dir, '\0', FILENAME_MAX);
491 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
492 ret1 = _app2sd_delete_directory(buf_dir);
495 ("App2Sd Error : Unable to delete the directory %s\n",
498 /*remove encryption password from DB */
499 ret = _app2sd_initialize_db();
501 app2ext_print("\n app2sd db initialize failed");
502 ret = APP2EXT_ERROR_SQLITE_REGISTRY;
505 ret = _app2sd_remove_password_from_db(pkgid);
507 app2ext_print("cannot remove password from db \n");
508 ret = APP2EXT_ERROR_SQLITE_REGISTRY;
513 if (ret != APP2EXT_SUCCESS)
514 app2ext_print("App2Sd Error : app2sd has [%d]error, but return success for uninstallation\n", ret);
515 return APP2EXT_SUCCESS;
518 int app2sd_move_installed_app(const char *pkgid, GList* dir_list,
519 app2ext_move_type move_type)
522 int pkgmgrinfo_ret = 0;
524 /*Validate function arguments*/
525 if (pkgid == NULL || dir_list == NULL
526 || move_type < APP2EXT_MOVE_TO_EXT
527 || move_type > APP2EXT_MOVE_TO_PHONE) {
528 app2ext_print("App2Sd Error : Invalid function arguments\n");
529 ret = APP2EXT_ERROR_INVALID_ARGUMENTS;
533 /*If move is completed, then update installed storage to pkgmgr_parser db*/
534 pkgmgrinfo_pkginfo_h info_handle = NULL;
535 pkgmgrinfo_installed_storage storage = PMINFO_INTERNAL_STORAGE;
536 pkgmgrinfo_ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &info_handle);
537 if (pkgmgrinfo_ret < 0) {
538 app2ext_print("App2Sd Error : pkgmgrinfo_pkginfo_get_pkginfo[%s] fail.. \n", pkgid);
540 pkgmgrinfo_ret = pkgmgrinfo_pkginfo_get_installed_storage(info_handle, &storage);
541 if (pkgmgrinfo_ret < 0) {
542 app2ext_print("App2Sd Error : pkgmgrinfo_pkginfo_get_installed_storage[%s] fail.. \n", pkgid);
545 if ((move_type == APP2EXT_MOVE_TO_EXT && storage == PMINFO_EXTERNAL_STORAGE)
546 || (move_type == APP2EXT_MOVE_TO_PHONE && storage == PMINFO_INTERNAL_STORAGE)) {
547 ret = APP2EXT_ERROR_PKG_EXISTS;
548 app2ext_print("App2Sd Error : PKG_EXISTS in [%d]STORAGE\n", storage);
549 pkgmgrinfo_pkginfo_destroy_pkginfo(info_handle);
552 app2ext_print("App2Sd Error : okokkokin [%d]STORAGE\n", storage);
554 pkgmgrinfo_pkginfo_destroy_pkginfo(info_handle);
556 ret = _app2sd_move_app(pkgid, move_type, dir_list);
558 app2ext_print("App2Sd Error : Unable to move application\n");
562 /*If move is completed, then update installed storage to pkgmgr_parser db*/
563 pkgmgrinfo_pkgdbinfo_h handle = NULL;
564 pkgmgrinfo_ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle);
565 if (pkgmgrinfo_ret < 0) {
566 app2ext_print("App2Sd Error : pkgmgrinfo_create_pkgdbinfo[%s] fail.. \n", pkgid);
569 if (move_type == APP2EXT_MOVE_TO_EXT) {
570 pkgmgrinfo_ret = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_EXTERNAL);
571 if (pkgmgrinfo_ret < 0) {
572 app2ext_print("App2Sd Error : fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_EXTERNAL);
575 pkgmgrinfo_ret = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, INSTALL_INTERNAL);
576 if (pkgmgrinfo_ret < 0) {
577 app2ext_print("App2Sd Error : fail to update installed location to db[%s, %s]\n", pkgid, INSTALL_INTERNAL);
580 pkgmgrinfo_ret =pkgmgrinfo_save_pkgdbinfo(handle);
581 if (pkgmgrinfo_ret < 0) {
582 app2ext_print("pkgmgrinfo_save_pkgdbinfo[%s] failed\n", pkgid);
584 pkgmgrinfo_ret =pkgmgrinfo_destroy_pkgdbinfo(handle);
585 if (pkgmgrinfo_ret < 0) {
586 app2ext_print("pkgmgrinfo_destroy_pkgdbinfo failed\n");
591 vconf_set_int(VCONFKEY_PKGMGR_STATUS, ret);
596 int app2sd_pre_app_upgrade(const char *pkgid, GList* dir_list,
599 int ret = APP2EXT_SUCCESS;
600 char app_path[FILENAME_MAX] = { 0, };
601 char *device_node = NULL;
602 unsigned long long curr_size = 0;
605 /*Validate function arguments*/
606 if (pkgid == NULL || dir_list == NULL || size<=0) {
608 ("App2Sd Error : Invalid function arguments \n");
609 return APP2EXT_ERROR_INVALID_ARGUMENTS;
611 /*Check whether MMC is present or not */
612 ret = _app2sd_check_mmc_status();
614 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
616 return APP2EXT_ERROR_MMC_STATUS;
618 /*check app entry is there in sd card or not. */
619 snprintf(app_path, FILENAME_MAX, "%s%s", APP2SD_PATH,
621 app2ext_print("App2Sd Log : Checking path %s\n", app_path);
622 fp = fopen(app_path, "r+");
625 ("App2SD Error: App Entry is not present in SD Card\n");
626 return APP2EXT_ERROR_INVALID_PACKAGE;
629 /*Get installed app size*/
630 curr_size = _app2sd_calculate_file_size(app_path);
631 curr_size = (curr_size/1024)/1024;
635 ("App2SD Error: App Entry is not present in SD Card\n");
636 return APP2EXT_ERROR_LOOPBACK_DEVICE_UNAVAILABLE;
638 if (curr_size<size) {
639 ret = _app2sd_update_loopback_device_size(pkgid, size, dir_list);
640 if(APP2EXT_SUCCESS !=ret) {
642 ("App2SD Error: _app2sd_update_loopback_device_size() failed\n");
647 /*Get the associated device node for SD card applicationer */
648 device_node = _app2sd_find_associated_device_node(pkgid);
649 if (NULL == device_node) {
650 /*Do loopback setup */
651 device_node = _app2sd_do_loopback_encryption_setup(pkgid);
652 if (device_node == NULL) {
654 ("App2Sd Error : loopback encryption setup failed\n");
655 return APP2EXT_ERROR_DO_LOSETUP;
659 _app2sd_mount_app_content(pkgid, device_node,
663 app2ext_print("App2Sd Error : Re-mount failed\n");
668 return APP2EXT_ERROR_MOUNT_PATH;
673 _app2sd_mount_app_content(pkgid, device_node,
674 MOUNT_TYPE_RW_REMOUNT, NULL,
677 app2ext_print("App2Sd Error : Re-mount failed\n");
682 return APP2EXT_ERROR_MOUNT_PATH;
694 int app2sd_post_app_upgrade(const char *pkgid,
695 app2ext_status install_status)
697 char *device_name = NULL;
698 int ret = APP2EXT_SUCCESS;
699 /*Validate the function parameter recieved */
700 if (pkgid == NULL || install_status < APP2EXT_STATUS_FAILED
701 || install_status > APP2EXT_STATUS_SUCCESS) {
702 app2ext_print("Invalid func parameters\n");
703 return APP2EXT_ERROR_INVALID_ARGUMENTS;
705 /*Check whether MMC is present or not */
706 ret = _app2sd_check_mmc_status();
708 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
710 return APP2EXT_ERROR_MMC_STATUS;
713 /*Get the associated device node for SD card applicationer */
714 device_name = _app2sd_find_associated_device_node(pkgid);
715 if (NULL == device_name) {
716 return APP2EXT_ERROR_FIND_ASSOCIATED_DEVICE_NODE;
718 ret = _app2sd_unmount_app_content(pkgid);
724 app2ext_print("Unable to unmount the app content %d\n", ret);
725 return APP2EXT_ERROR_UNMOUNT;
727 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
734 ("Unable to Detach the loopback encryption setup for the application");
735 return APP2EXT_ERROR_UNMOUNT;
746 * Reserved API for forced cleanup
749 int app2sd_force_cleanup(const char *pkgid){
750 char *device_name = NULL;
751 char buf_dir[FILENAME_MAX] = { 0, };
752 int ret = APP2EXT_SUCCESS;
755 /*Validate the function parameter recieved */
757 app2ext_print("invalid func parameters\n");
758 return APP2EXT_ERROR_INVALID_ARGUMENTS;
760 memset((void *)&buf_dir, '\0', FILENAME_MAX);
761 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP2SD_PATH, pkgid);
762 fp = fopen(buf_dir, "r+");
764 app2ext_print("\"%s\" not installed on SD Card\n", pkgid);
765 return APP2EXT_ERROR_INVALID_PACKAGE;
768 /*Check whether MMC is present or not */
769 ret = _app2sd_check_mmc_status();
771 app2ext_print("App2Sd Error : MMC not preset OR Not ready %d\n",
773 return APP2EXT_ERROR_MMC_STATUS;
776 /*Get the associated device node for SD card applicationer */
777 device_name = _app2sd_find_associated_device_node(pkgid);
778 if (NULL != device_name) {
781 ret = _app2sd_unmount_app_content(pkgid);
783 app2ext_print("Unable to unmount the app content %d\n", ret);
784 return APP2EXT_ERROR_UNMOUNT;
786 ret = _app2sd_remove_loopback_encryption_setup(pkgid);
789 ("Unable to Detach the loopback encryption setup for the application");
790 return APP2EXT_ERROR_UNMOUNT;
794 memset((void *)&buf_dir, '\0', FILENAME_MAX);
795 snprintf(buf_dir, FILENAME_MAX, "%s%s", APP_INSTALLATION_PATH, pkgid);
796 ret = _app2sd_delete_directory(buf_dir);
799 ("App2Sd Error : Unable to delete the directory %s\n",
803 /*remove passwrd from DB*/
804 ret = _app2sd_initialize_db();
806 app2ext_print("\n app2sd db initialize failed");
807 return APP2EXT_ERROR_SQLITE_REGISTRY;
809 ret = _app2sd_remove_password_from_db(pkgid);
811 app2ext_print("cannot remove password from db \n");
812 return APP2EXT_ERROR_SQLITE_REGISTRY;
818 /* This is the plug-in load function. The plugin has to bind its functions to function pointers of handle
819 @param[in/out] st_interface Specifies the storage interface.
822 app2ext_on_load(app2ext_interface *st_interface)
825 st_interface->pre_install= app2sd_pre_app_install;
826 st_interface->post_install= app2sd_post_app_install;
827 st_interface->pre_uninstall= app2sd_pre_app_uninstall;
828 st_interface->post_uninstall= app2sd_post_app_uninstall;
829 st_interface->pre_upgrade= app2sd_pre_app_upgrade;
830 st_interface->post_upgrade= app2sd_post_app_upgrade;
831 st_interface->move= app2sd_move_installed_app;
832 st_interface->enable= app2sd_on_demand_setup_init;
833 st_interface->disable= app2sd_on_demand_setup_exit;