remove app2ext_get_app_location api 86/80586/7
authorjongmyeongko <jongmyeong.ko@samsung.com>
Tue, 19 Jul 2016 04:03:33 +0000 (13:03 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Thu, 28 Jul 2016 01:50:34 +0000 (10:50 +0900)
this is not useful and will not be supported.

Submit with:
        https://review.tizen.org/gerrit/#/c/80493/

Change-Id: Ic35753aa6902ff804c44f108b8258ea1723ff2b6
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
inc/app2ext_interface.h
src/app2ext_interface.c
test/src/test_app2ext.c

index 7bcf819..28e099f 100644 (file)
@@ -403,20 +403,6 @@ API app2ext_handle *app2ext_init(int storage_type);
 API int app2ext_deinit(app2ext_handle *handle);
 
 /**
- * @brief : This API returns the application location by refering to package manager DB
- *         This should be called to know location of an application package
- * @param[in] pkgid     package id
- * @param[in] uid       target user id of this instruction
- * @return      APP2EXT_SD_CARD if pkg is in SD card,
- *              APP2EXT_INTERNAL_MEM if pkg is in internal memory,
- *              APP2EXT_NOT_INSTALLED if there is no valid pkg path
- *              error < 0 if fail
- *@remarks see app2ext_install_location for more details
- */
-API int app2ext_get_app_location(const char *pkgid);
-API int app2ext_usr_get_app_location(const char *pkgid, uid_t uid);
-
-/**
  * @brief : This API enable the package which is located in external memory
  * @param[in] pkgid     package id
  * @param[in] uid       target user id of this instruction
index 4776f87..6595282 100644 (file)
@@ -105,86 +105,6 @@ int app2ext_deinit(app2ext_handle *handle)
        return 0;
 }
 
-/* use this api only to check external related file existing,
- * such as .mmc directory and image file under /sdcard/app2sd.
- */
-int app2ext_usr_get_app_location(const char *pkgid, uid_t uid)
-{
-       FILE *fp = NULL;
-       char loopback_device[FILENAME_MAX] = { 0, };
-       char application_path[FILENAME_MAX] = { 0, };
-       char application_mmc_path[FILENAME_MAX] = { 0, };
-       char *encoded_id = NULL;
-
-       /* validate the function parameter received */
-       if (pkgid == NULL) {
-               _E("invalid func parameters");
-               return -1;
-       }
-
-       if (_is_global(uid)) {
-               snprintf(application_path, FILENAME_MAX - 1, "%s/%s",
-                       tzplatform_getenv(TZ_SYS_RW_APP), pkgid);
-               snprintf(application_mmc_path, FILENAME_MAX - 1, "%s/%s/.mmc",
-                       tzplatform_getenv(TZ_SYS_RW_APP), pkgid);
-       } else {
-               tzplatform_set_user(uid);
-               snprintf(application_path, FILENAME_MAX - 1, "%s/%s",
-                       tzplatform_getenv(TZ_USER_APP), pkgid);
-               snprintf(application_mmc_path, FILENAME_MAX - 1, "%s/%s/.mmc",
-                       tzplatform_getenv(TZ_USER_APP), pkgid);
-               tzplatform_reset_user();
-       }
-       encoded_id = _app2sd_get_encoded_name(pkgid, uid);
-       if (encoded_id == NULL)
-               return -1;
-
-       snprintf(loopback_device, FILENAME_MAX - 1, "%s/%s",
-               APP2SD_PATH, encoded_id);
-       free(encoded_id);
-
-       /* check whether application is in external memory or not */
-       fp = fopen(loopback_device, "r");
-       if (fp != NULL) {
-               fclose(fp);
-               fp = NULL;
-               _D("sd card");
-               return APP2EXT_SD_CARD;
-       }
-
-       /* check whether application is in internal or not */
-       fp = fopen(application_path, "r");
-       if (fp == NULL) {
-               _D("app_dir_path open failed, " \
-                       "package not installed");
-               return APP2EXT_NOT_INSTALLED;
-       } else {
-               fclose(fp);
-               /* check whether the application is installed in SD card
-                * but SD card is not present
-                */
-               fp = fopen(application_mmc_path, "r");
-               if (fp == NULL) {
-                       _D("internal mem");
-                       return APP2EXT_INTERNAL_MEM;
-               } else {
-                       fclose(fp);
-                       _E("app_mmc_internal_path exists, " \
-                               "error mmc status");
-                       return -1;
-               }
-       }
-}
-
-int app2ext_get_app_location(const char *pkgid)
-{
-       int ret = 0;
-
-       ret = app2ext_usr_get_app_location(pkgid, getuid());
-
-       return ret;
-}
-
 int app2ext_usr_enable_external_pkg(const char *pkgid, uid_t uid)
 {
        FILE *fp = NULL;
index 9cc64e9..5c7c85b 100644 (file)
@@ -129,11 +129,8 @@ static void usage(void)
        printf("------------------------------------------------\n");
        printf("\n");
        printf("<MOVE PKG TEST>\n");
-       printf("(at target_user)$test_app2ext --move\n");
-       printf("------------------------------------------------\n");
-       printf("\n");
-       printf("<GET INSTALLED LOCATION (Ext/Internal)>\n");
-       printf("(at target_user)$test_app2ext --getlocation\n");
+       printf("(at target_user)$test_app2ext --move-to-ext\n");
+       printf("(at target_user)$test_app2ext --move-to-int\n");
        printf("------------------------------------------------\n");
        printf("\n");
        printf("<ENABLE(mount)/DISABLE(umount) TEST W/ Installed PKG>\n");
@@ -152,8 +149,8 @@ static void usage(void)
 #define OPTVAL_POST_UNINSTALL          1003
 #define OPTVAL_PRE_UPGRADE             1004
 #define OPTVAL_POST_UPGRADE            1005
-#define OPTVAL_MOVE                    1006
-#define OPTVAL_GET_LOCATION            1007
+#define OPTVAL_MOVE_TO_EXTERNAL                1006
+#define OPTVAL_MOVE_TO_INTERNAL                1007
 #define OPTVAL_ENABLE_APP              1008
 #define OPTVAL_DISABLE_APP             1009
 #define OPTVAL_ENABLE_FULL             1010
@@ -168,8 +165,8 @@ const struct option long_opts[] = {
        { "post-uninstall", 0, NULL, OPTVAL_POST_UNINSTALL },
        { "pre-upgrade", 0, NULL, OPTVAL_PRE_UPGRADE },
        { "post-upgrade", 0, NULL, OPTVAL_POST_UPGRADE },
-       { "move", 0, NULL, OPTVAL_MOVE },
-       { "getlocation", 0, NULL, OPTVAL_GET_LOCATION },
+       { "move-to-ext", 0, NULL, OPTVAL_MOVE_TO_EXTERNAL },
+       { "move-to-int", 0, NULL, OPTVAL_MOVE_TO_INTERNAL },
        { "enable", 0, NULL, OPTVAL_ENABLE_APP },
        { "disable", 0, NULL, OPTVAL_DISABLE_APP },
        { "enable-full", 0, NULL, OPTVAL_ENABLE_FULL },
@@ -450,13 +447,12 @@ static int post_app_upgrade()
        return ret;
 }
 
-static int app_move()
+static int app_move_to_external()
 {
        GList *dir_list = NULL;
        int ret = -1;
-       int ret_check = -1;
 
-       printf("app_move  %s\n", TEST_PKGNAME);
+       printf("app_move_to_external  %s\n", TEST_PKGNAME);
 
        dir_list = populate_dir_details();
        if (dir_list == NULL) {
@@ -464,54 +460,43 @@ static int app_move()
                return -1;
        }
 
-       ret = app2ext_usr_get_app_location(TEST_PKGNAME, getuid());
-       printf("return value = (%d)\n", ret);
-       if (ret == APP2EXT_SD_CARD) {
-               printf("pkg %s is in sd card\n", TEST_PKGNAME);
-               printf("pkg %s will be moved to internal memory\n", TEST_PKGNAME);
-               ret = handle->interface.client_pre_move(TEST_PKGNAME,
-                       dir_list, APP2EXT_MOVE_TO_PHONE);
-               print_error_code(__func__, ret);
-               ret = handle->interface.client_post_move(TEST_PKGNAME,
-                       APP2EXT_MOVE_TO_PHONE);
-               print_error_code(__func__, ret);
-               ret_check = app2ext_usr_get_app_location(TEST_PKGNAME, getuid());
-               if (ret_check == APP2EXT_INTERNAL_MEM)
-                       printf("pkg %s is moved to internal memory\n", TEST_PKGNAME);
-       } else if (ret == APP2EXT_INTERNAL_MEM) {
-               printf("pkg %s is in internal memory\n", TEST_PKGNAME);
-               printf("pkg %s will be moved to sd card\n", TEST_PKGNAME);
-               ret = handle->interface.client_pre_move(TEST_PKGNAME,
-                       dir_list, APP2EXT_MOVE_TO_EXT);
-               print_error_code(__func__, ret);
-               ret = handle->interface.client_post_move(TEST_PKGNAME,
-                       APP2EXT_MOVE_TO_EXT);
-               print_error_code(__func__, ret);
-               ret_check = app2ext_usr_get_app_location(TEST_PKGNAME, getuid());
-               if (ret_check == APP2EXT_SD_CARD)
-                       printf("pkg %s is moved to sd card\n", TEST_PKGNAME);
-       }  else {
-               ret = APP2EXT_ERROR_INVALID_PACKAGE;
-               printf("app_move failed (%s)\n", error_list[ret]);
-       }
+       printf("pkg %s will be moved to sd card\n", TEST_PKGNAME);
+       ret = handle->interface.client_pre_move(TEST_PKGNAME,
+               dir_list, APP2EXT_MOVE_TO_EXT);
+       print_error_code(__func__, ret);
+       ret = handle->interface.client_post_move(TEST_PKGNAME,
+               APP2EXT_MOVE_TO_EXT);
+       print_error_code(__func__, ret);
 
        clear_dir_list(dir_list);
 
        return ret;
 }
 
-static void app_get_location()
+static int app_move_to_internal()
 {
-       printf("app_get_location for pkg(%s)\n", TEST_PKGNAME);
+       GList *dir_list = NULL;
        int ret = -1;
 
-       ret = app2ext_usr_get_app_location(TEST_PKGNAME, getuid());
-       if (ret == APP2EXT_SD_CARD)
-               printf("pkg is in sd card\n");
-        else if (ret == APP2EXT_INTERNAL_MEM)
-               printf("pkg is in internal memory\n");
-        else
-               printf("pkg is not installed\n");
+       printf("app_move_to_internal  %s\n", TEST_PKGNAME);
+
+       dir_list = populate_dir_details();
+       if (dir_list == NULL) {
+               printf("Error in populating the directory list\n");
+               return -1;
+       }
+
+       printf("pkg %s will be moved to internal memory\n", TEST_PKGNAME);
+       ret = handle->interface.client_pre_move(TEST_PKGNAME,
+               dir_list, APP2EXT_MOVE_TO_PHONE);
+       print_error_code(__func__, ret);
+       ret = handle->interface.client_post_move(TEST_PKGNAME,
+               APP2EXT_MOVE_TO_PHONE);
+       print_error_code(__func__, ret);
+
+       clear_dir_list(dir_list);
+
+       return ret;
 }
 
 int main(int argc, char **argv)
@@ -565,11 +550,11 @@ int main(int argc, char **argv)
                case OPTVAL_POST_UPGRADE:
                        post_app_upgrade();
                        break;
-               case OPTVAL_MOVE:
-                       app_move();
+               case OPTVAL_MOVE_TO_EXTERNAL:
+                       app_move_to_external();
                        break;
-               case OPTVAL_GET_LOCATION:
-                       app_get_location();
+               case OPTVAL_MOVE_TO_INTERNAL:
+                       app_move_to_internal();
                        break;
                case OPTVAL_ENABLE_APP:
                        app_enable();