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 #ifndef __APPTOSD_INTERFACE_H__
25 #define __APPTOSD_INTERFACE_H__
28 * @file app2sd_client_interface.h
30 * @brief This file declares API of app2sd library
33 * @addtogroup APPLICATION_FRAMEWORK
39 * @section Header to use them:
41 * #include <app2sd_client_interface.h>
53 #include "app2ext_interface.h"
56 * @brief : This API prepares the setup for installation in SD card.
57 * It should be called before actual installation is done.
58 * @pre vfat type sd card must be present.
59 * @post Installation is done by package installer.
60 * Encryption password is saved in db TZ_SYS_DB/.app2sd.db
61 * @param[in] appname application package name
62 *This entry is parsed from application package control/manifest file.
63 * @param[in] dir_list directory structure of the application
64 * @param[in] size size of memory required by application(in MB).
65 *This entry is parsed from application package control/manifest file.
66 * @return 0 if success, error code(>0) if fail
69 int app2sd_client_usr_pre_app_install(const char *pkgid,
70 GList *dir_list, int size, uid_t uid);
71 int app2sd_client_pre_app_install(const char *pkgid,
72 GList *dir_list, int size);
75 * @brief : This API does post installation operations after
76 * the installation in SD card
77 * @param[in] appname application package name
78 * @param[in] install_status Status of installation of package
79 *[ enum app2ext_status].If package installation failed then
80 * install_status= APP2EXT_STATUS_FAILURE else if installation
81 * was successful then install_status = APP2EXT_ISTATUS_SUCCESS.
82 * @pre Installation should be done by package installer.
83 * @return 0 if success, error code(>0) if fail
84 * @remark @see enum app2sd_install_status
86 int app2sd_client_usr_post_app_install(const char *pkgid,
87 app2ext_status install_status, uid_t uid);
88 int app2sd_client_post_app_install(const char *pkgid,
89 app2ext_status install_status);
92 * @brief : This API prepares the setup for upgradation of
94 * @pre vfat type sd card must be present.
95 * @post Upgradation is done by package installer.
96 * @param[in] appname application package name
97 * @param[in] dir_list directory structure of the application
98 * @param[in] size size of memory required by application(in MB).
99 *This entry is parsed from application package control/manifest file.
100 * @return 0 if success, error code(>0) if fail
103 int app2sd_client_usr_pre_app_upgrade(const char *pkgid,
104 GList *dir_list, int size, uid_t uid);
105 int app2sd_client_pre_app_upgrade(const char *pkgid,
106 GList *dir_list, int size);
109 * @brief : This API does post upgradation operations after
110 * the installation in SD card
111 * @param[in] appname application package name
112 * @param[in] install_status Status of installation of package
113 *[ enum app2extl_status].If package upgradation failed then
114 * upgrade_status= APP2EXT_STATUS_FAILURE else if upgradation
115 * was successful then upgrade_status = APP2EXT_STATUS_SUCCESS.
116 * @pre Upgradation should be done by package installer.
117 * @return 0 if success, error code(>0) if fail
118 * @remark @see enum app2ext_status
120 int app2sd_client_usr_post_app_upgrade(const char *pkgid,
121 app2ext_status upgrade_status, uid_t uid);
122 int app2sd_client_post_app_upgrade(const char *pkgid,
123 app2ext_status upgrade_status);
125 * @brief: This API prepares the setup for uninstallation
126 * @pre Package must be installed in sdcard.
127 * @post Package is uninstalled by the package installer.
128 * @param[in] appname application package name
129 * @return 0 if success, error code(>0) if fail
132 int app2sd_client_usr_pre_app_uninstall(const char *pkgid, uid_t uid);
133 int app2sd_client_pre_app_uninstall(const char *pkgid);
136 * @brief This API removes the resources created during
137 app2sd setup.It is called after uninstallation.
138 * @pre Package must be uninstalled .
139 * @post Encryption password is removed from sqlite db.
140 * @param[in] appname application package name
141 * @return 0 if success, error code(>0) if fail
144 int app2sd_client_usr_post_app_uninstall(const char *pkgid, uid_t uid);
145 int app2sd_client_post_app_uninstall(const char *pkgid);
148 * @brief : This API prepare the move of the package from sd card
149 to internal memory and vice versa.
150 * @param[in] pkgid application package id
151 * @param[in] move_type Move type[enum app2ext_move_type]
152 * [sd card to internal/internal to sd card]
153 * @param[in] dir_list directory structure of the application
154 * @pre Package must be installed and its installation
155 * location should be known. Use dedicated API to get installation location.
156 * @post Package is moved to new location.
157 * @return 0 if success, error code(>0) if fail
160 int app2sd_client_usr_pre_move_installed_app(const char *pkgid,
161 GList *dir_list, app2ext_move_type move_type, uid_t uid);
162 int app2sd_client_pre_move_installed_app(const char *pkgid,
163 GList *dir_list, app2ext_move_type move_type);
166 * @brief : This API remove the resources created during the move.
167 * @param[in] pkgid application package id
168 * @param[in] move_type Move type[enum app2ext_move_type]
169 * [sd card to internal/internal to sd card]
170 * @return 0 if success, error code(>0) if fail
173 int app2sd_client_usr_post_move_installed_app(const char *pkgid,
174 app2ext_move_type move_type, uid_t uid);
175 int app2sd_client_post_move_installed_app(const char *pkgid,
176 app2ext_move_type move_type);
179 * @brief : This API Enables the application in sd card
180 for use. This API should be called by AUL.
181 * @param[in] pkgid application package id
182 * @pre Package must be installed
183 * @post application is enabled in SD card.
184 * @return 0 if success, error code(>0) if fail
187 int app2sd_client_usr_on_demand_setup_init(const char *pkgid, uid_t uid);
188 int app2sd_client_on_demand_setup_init(const char *pkgid);
191 * @brief : This API Disables the application in sd card
192 . This API should be called by Launchpad callback which will be registered
193 during app launch for exit action of the application
194 * @param[in] pkgid application package id
195 * @pre Package must be installed and enabled
196 * and application must be running in SD card
197 * @post application is disabled in SD card.
198 * @return 0 if success, error code(>0) if fail
201 int app2sd_client_usr_on_demand_setup_exit(const char *pkgid, uid_t uid);
202 int app2sd_client_on_demand_setup_exit(const char *pkgid);
204 int app2sd_client_usr_force_clean(const char *pkgid, uid_t uid);
205 int app2sd_client_force_clean(const char *pkgid);
208 * @brief : This API does pre operation for the migration of legacy external
209 * image for the compatability with tizen 3.0 platform.
210 * @param[in] pkgid application package id
211 * @return 0 if success, error code(>0) if fail
214 int app2sd_client_usr_pre_migrate_legacy(const char *pkgid, uid_t uid);
217 * @brief : This API does post operation for the migration of legacy external
218 * image for the compatability with tizen 3.0 platform.
219 * @param[in] pkgid application package id
220 * @return 0 if success, error code(>0) if fail
223 int app2sd_client_usr_post_migrate_legacy(const char *pkgid, uid_t uid);
226 * @brief : This API migrate all the legacy mount image in sd card to be comapatible
227 * with tizen 3.0 platform.
228 * @param[in] pkgid application package id
229 * @return 0 if success, error code(>0) if fail
232 int app2sd_client_migrate_legacy_all(void);
235 * @brief : This API get the external image name.
236 * @param[in] pkgid application package id
237 * @param[in] uid target user id
238 * @return the name of external image
239 * @remark the name should be freed after the use.
241 char *app2sd_client_usr_getname_image(const char *pkgid, uid_t uid);
244 * @brief : This is the plug-in load function.
245 * The plugin has to bind its functions to function pointers of storage handle
246 * @param[in/out] st_interface Specifies the storage interface.
249 API void app2ext_on_load(app2ext_interface *st_interface);