Clean up repository
[platform/core/appfw/app2sd.git] / plugin / app2sd / lib / app2sd_client_interface.h
1 /*
2  * app2ext
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Garima Shrivastava<garima.s@samsung.com>
7  *      Jyotsna Dhumale <jyotsna.a@samsung.com>
8  *      Venkatesha Sarpangala <sarpangala.v@samsung.com>
9  *
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
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
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.
21  *
22  */
23
24 #ifndef __APPTOSD_INTERFACE_H__
25 #define __APPTOSD_INTERFACE_H__
26
27 /**
28  * @file app2sd_client_interface.h
29  * @version 0.2
30  * @brief    This file declares API of app2sd library
31  */
32 /**
33  * @addtogroup APPLICATION_FRAMEWORK
34  * @{
35  *
36  * @defgroup app2sd
37  * @version    0.2
38  *
39  * @section    Header to use them:
40  * @code
41  * #include <app2sd_client_interface.h>
42  * @endcode
43  *
44  * @addtogroup app2sd
45  * @{
46  */
47
48
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52
53 #include "app2ext_interface.h"
54
55 /**
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
67  * @remark      None.
68  */
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);
73
74 /**
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
85  */
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);
90
91 /**
92  * @brief : This API prepares the setup for upgradation of
93  *               application package
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
101  * @remark      None.
102  */
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);
107
108 /**
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
119  */
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);
124 /**
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
130  * @remark      None.
131  */
132 int app2sd_client_usr_pre_app_uninstall(const char *pkgid, uid_t uid);
133 int app2sd_client_pre_app_uninstall(const char *pkgid);
134
135 /**
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
142  * @remark      None.
143  */
144 int app2sd_client_usr_post_app_uninstall(const char *pkgid, uid_t uid);
145 int app2sd_client_post_app_uninstall(const char *pkgid);
146
147 /**
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
158  * @remark      None.
159  */
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);
164
165 /**
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
171  * @remark      None.
172  */
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);
177
178 /**
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
185  * @remark      None.
186  */
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);
189
190 /**
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 disabked in SD card.
198  * @return      0 if success,  error code(>0) if fail
199  * @remark      None.
200  */
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);
203
204 int app2sd_client_usr_force_clean(const char *pkgid, uid_t uid);
205 int app2sd_client_force_clean(const char *pkgid);
206
207 /**
208  * @brief : This is the plug-in load function.
209  *      The plugin has to bind its functions to function pointers of storage handle
210  * @param[in/out] st_interface          Specifies the storage interface.
211  * @return      None
212 */
213 API void app2ext_on_load(app2ext_interface *st_interface);
214
215 #ifdef __cplusplus
216 }
217 #endif
218 #endif