merge with master
authorJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:12:26 +0000 (01:12 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:12:26 +0000 (01:12 +0900)
inc/app2ext_interface.h
packaging/app2sd.spec
src/app2ext_interface.c

index fc11918..2d8ec43 100755 (executable)
@@ -396,6 +396,42 @@ if (ret == APP2EXT_SD_CARD) {
  */
 API int app2ext_get_app_location(const char *appname);
 
+/**
+ * @brief : This API enable the package which is located in external memory
+ * @param[in] pkgid    package id
+ * @return     error < 0  if pkg enable fail ,
+ @code
+ #include <app2ext_interface.h>
+int ret = -1;
+
+ret = app2ext_enable_external_pkg("com.samsung.calculator");
+if (ret < 0) {
+       printf("\n pkg is not enabled ");
+} else {
+       printf("\n pkg is enabled ");
+}
+ @endcode
+ */
+API int app2ext_enable_external_pkg(const char *pkgid);
+
+/**
+ * @brief : This API disable the package which is located in external memory
+ * @param[in] pkgid    package id
+ * @return     error < 0  if pkg enable fail ,
+ @code
+ #include <app2ext_interface.h>
+int ret = -1;
+
+ret = app2ext_disable_external_pkg("com.samsung.calculator");
+if (ret < 0) {
+       printf("\n pkg is not enabled ");
+} else {
+       printf("\n pkg is enabled ");
+}
+ @endcode
+ */
+API int app2ext_disable_external_pkg(const char *pkgid);
+
 #ifdef __cplusplus
 }
 #endif
index 012342c..51eb4d4 100755 (executable)
@@ -1,7 +1,7 @@
 Name:       app2sd
 Summary:    Application installation on external memory
 Version:    0.5
-Release:    8
+Release:    9
 Group:      TO_BE/FILLED_IN
 License:    Apache2.0
 Source0:    %{name}-%{version}.tar.gz
index a1dc9bf..1fd62c6 100755 (executable)
@@ -150,3 +150,63 @@ int app2ext_get_app_location(const char *appname)
                }
        }
 }
+
+int app2ext_enable_external_pkg(const char *pkgid)
+{
+       /*Validate the function parameter received */
+       if (pkgid == NULL) {
+               app2ext_print("invalid func parameters\n");
+               return -1;
+       }
+       FILE *fp = NULL;
+       app2ext_handle *app2_handle = NULL;
+       char app_mmc_path[FILENAME_MAX] = { 0, };
+       snprintf(app_mmc_path, FILENAME_MAX, "%s%s", APP2SD_PATH, pkgid);
+
+       /*check whether application is in external memory or not */
+       fp = fopen(app_mmc_path, "r");
+       if (fp != NULL) {
+               fclose(fp);
+               fp = NULL;
+
+               app2_handle = app2ext_init(APP2EXT_SD_CARD);
+               if (app2_handle == NULL) {
+                       app2ext_print("app2_handle : app2ext init failed\n");
+                       return -2;
+               }
+
+               app2_handle->interface.enable(pkgid);
+               app2ext_deinit(app2_handle);
+       }
+       return 0;
+}
+
+int app2ext_disable_external_pkg(const char *pkgid)
+{
+       /*Validate the function parameter received */
+       if (pkgid == NULL) {
+               app2ext_print("invalid func parameters\n");
+               return -1;
+       }
+       FILE *fp = NULL;
+       app2ext_handle *app2_handle = NULL;
+       char app_mmc_path[FILENAME_MAX] = { 0, };
+       snprintf(app_mmc_path, FILENAME_MAX, "%s%s", APP2SD_PATH, pkgid);
+
+       /*check whether application is in external memory or not */
+       fp = fopen(app_mmc_path, "r");
+       if (fp != NULL) {
+               fclose(fp);
+               fp = NULL;
+
+               app2_handle = app2ext_init(APP2EXT_SD_CARD);
+               if (app2_handle == NULL) {
+                       app2ext_print("app2_handle : app2ext init failed\n");
+                       return -2;
+               }
+
+               app2_handle->interface.disable(pkgid);
+               app2ext_deinit(app2_handle);
+       }
+       return 0;
+}