Release version 0.7.23
[platform/core/appfw/app2sd.git] / inc / app2ext_interface.h
index e145191..0c6a38e 100644 (file)
@@ -102,7 +102,8 @@ typedef enum app2sd_cmd_t {
        APP2SD_APP_LAUNCH,
        APP2SD_APP_TERMINATE,
        APP2SD_MOVE_APP_TO_MMC,
-       APP2SD_MOVE_APP_TO_PHONE
+       APP2SD_MOVE_APP_TO_PHONE,
+       APP2SD_MIGRATE_LEGACY
 } app2sd_cmd;
 
 /**
@@ -155,7 +156,15 @@ typedef enum app2ext_error_t {
        APP2EXT_ERROR_MEMORY_ALLOC_FAILED,
        APP2EXT_ERROR_OPERATION_NOT_PERMITTED,
        APP2EXT_ERROR_SAME_LOOPBACK_DEVICE_EXISTS,
-       APP2EXT_ERROR_PKGMGR_ERROR
+       APP2EXT_ERROR_PKGMGR_ERROR,
+       APP2EXT_ERROR_KILLAPP_ERROR,
+       APP2EXT_ERROR_NOENTRY,
+       APP2EXT_ERROR_SETUP_DMCRYPT_DEVICE,
+       APP2EXT_ERROR_OPEN_DMCRYPT_DEVICE,
+       APP2EXT_ERROR_CLOSE_DMCRYPT_DEVICE,
+       APP2EXT_ERROR_FIND_ASSOCIATED_DMCRYPT_DEVICE_NODE,
+       APP2EXT_ERROR_DMCRYPT_DEVICE_UNAVAILABLE,
+       APP2EXT_ERROR_ENUM_MAX
 } app2ext_error;
 
 /**
@@ -271,9 +280,13 @@ typedef int (*app2ext_client_post_uninstall)(const char *appname);
  *                              [Enum: APP2EXT_MOVE_TO_EXT, APP2EXT_MOVE_TO_PHONE]
  * @return      0 if success, error code(>0) if fail
  */
-typedef int (*app2ext_client_usr_move)(const char *appname, GList* dir_list,
+typedef int (*app2ext_client_usr_pre_move)(const char *appname, GList* dir_list,
                app2ext_move_type move_type, uid_t uid);
-typedef int (*app2ext_client_move)(const char *appname, GList* dir_list,
+typedef int (*app2ext_client_pre_move)(const char *appname, GList* dir_list,
+               app2ext_move_type move_type);
+typedef int (*app2ext_client_usr_post_move)(const char *appname,
+               app2ext_move_type move_type, uid_t uid);
+typedef int (*app2ext_client_post_move)(const char *appname,
                app2ext_move_type move_type);
 
 /**
@@ -316,7 +329,61 @@ typedef int (*app2ext_client_usr_force_clean)(const char *pkgid, uid_t uid);
 typedef int (*app2ext_client_force_clean)(const char *pkgid);
 
 /**
- * This structure defines the app2ext interfaces. Plugins have to implement these functions
+ * @brief : This function type is for a function that is implemented by plugin
+ * and called before migration of legacy mount image.
+ *
+ * @param[in]   pkgid           application package name which is to be migrated
+ * @return      0 if success, error code(>0) if fail
+ */
+typedef int (*app2ext_client_usr_pre_migrate_legacy)(const char *pkgid,
+               uid_t uid);
+
+/**
+ * @brief : This function type is for a function that is implemented by plugin
+ * and called after migration of legacy mount image.
+ *
+ * @param[in]   pkgid           application package name which is to be migrated
+ * @return      0 if success, error code(>0) if fail
+ */
+typedef int (*app2ext_client_usr_post_migrate_legacy)(const char *pkgid,
+               uid_t uid);
+
+/**
+ * @brief : This function type is for a function that is implemented by plugin
+ * and called to migrate legacy mount image.
+ *
+ * @param[in]   pkgid           application package name which is to be migrated
+ * @return      0 if success, error code(>0) if fail
+ */
+typedef int (*app2ext_client_migrate_legacy_all)(void);
+
+/**
+ * @brief : This function type is for a function that is implemented by plugin
+ * and called to get the external image name.
+ *
+ * @param[in]   pkgid           application package name
+ * @param[in]   uid           target user id
+ * @return      the name of external image
+ * @remark     the name should be freed after the use.
+ */
+typedef char *(*app2ext_client_usr_getname_image)(const char *pkgid,
+               uid_t uid);
+
+/**
+ * @brief : This function type is for a function that is implemented by plugin
+ * and called to get the external image path.
+ *
+ * @param[in]   pkgid           application package name
+ * @param[in]   uid           target user id
+ * @return      the path of external image
+ * @remark     the path should be freed after the use.
+ */
+typedef char *(*app2ext_client_usr_get_image_path)(const char *pkgid,
+               uid_t uid);
+
+/**
+ * This structure defines the app2ext interfaces.
+ * Plugins have to implement these functions
  */
 typedef struct app2ext_interface_t {
        /* for library function */
@@ -331,7 +398,9 @@ typedef struct app2ext_interface_t {
        app2ext_client_disable                  client_disable;
        app2ext_client_enable_full_pkg          client_enable_full_pkg;
        app2ext_client_disable_full_pkg         client_disable_full_pkg;
-       app2ext_client_move                     client_move;
+       app2ext_client_pre_move                 client_pre_move;
+       app2ext_client_post_move                client_post_move;
+       app2ext_client_migrate_legacy_all       client_migrate_legacy_all;
 
        app2ext_client_usr_pre_install          client_usr_pre_install;
        app2ext_client_usr_post_install         client_usr_post_install;
@@ -342,7 +411,12 @@ typedef struct app2ext_interface_t {
        app2ext_client_usr_force_clean          client_usr_force_clean;
        app2ext_client_usr_enable               client_usr_enable;
        app2ext_client_usr_disable              client_usr_disable;
-       app2ext_client_usr_move                 client_usr_move;
+       app2ext_client_usr_pre_move             client_usr_pre_move;
+       app2ext_client_usr_post_move            client_usr_post_move;
+       app2ext_client_usr_getname_image        client_usr_getname_image;
+       app2ext_client_usr_pre_migrate_legacy   client_usr_pre_migrate_legacy;
+       app2ext_client_usr_post_migrate_legacy  client_usr_post_migrate_legacy;
+       app2ext_client_usr_get_image_path       client_usr_get_image_path;
 } app2ext_interface;
 
 /**
@@ -388,20 +462,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
@@ -435,6 +495,30 @@ API int app2ext_usr_force_clean_pkg(const char *pkgid, uid_t uid);
 API int app2ext_enable_all_external_pkgs(void);
 API int app2ext_disable_all_external_pkgs(void);
 
+/**
+ * @brief : This API migrate all legacy entries which are located in external memory
+ * @return      error < 0 if fail to migrate legacy
+ */
+API int app2ext_migrate_legacy_all(void);
+
+/**
+ * @brief : This API get the external image name
+ * @param[in]   pkgid           application package name
+ * @param[in]   uid           target user id
+ * @return      the name of external image
+ * @remark     the name should be freed after the use.
+ */
+API char *app2ext_usr_getname_image(const char *pkgid, uid_t uid);
+
+/**
+ * @brief : This API get the external image path
+ * @param[in]   pkgid           application package name
+ * @param[in]   uid           target user id
+ * @return      the path of external image
+ * @remark     the path should be freed after the use.
+ */
+API char *app2ext_usr_get_image_path(const char *pkgid, uid_t uid);
+
 #ifdef __cplusplus
 }
 #endif