fix missing encoded_id related change & code clearing.
[platform/core/appfw/app2sd.git] / plugin / app2sd / inc / 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  *                              [Ex: com.samsung.calculator]
63  *This entry is parsed from application package control/manifest file.
64  * @param[in] dir_list          directory structure of the application
65  * @param[in] size      size of memory required by application(in MB).
66  *This entry is parsed from application package control/manifest file.
67  * @return      0 if success,  error code(>0) if fail
68  * @remark      None.
69  */
70 int app2sd_client_usr_pre_app_install(const char *pkgid,
71                 GList* dir_list, int size, uid_t uid);
72 int app2sd_client_pre_app_install(const char *pkgid,
73                 GList* dir_list, int size);
74
75 /**
76  * @brief : This API does post installation operations after
77  *              the installation in SD card
78  * @param[in] appname           application package name
79  *                              [Ex: com.samsung.calculator]
80  * @param[in] install_status    Status of installation of package
81  *[ enum app2ext_status].If package installation failed then
82  * install_status= APP2EXT_STATUS_FAILURE else if installation
83  * was successful then install_status = APP2EXT_ISTATUS_SUCCESS.
84  * @pre         Installation should be done by package installer.
85  * @return      0 if success,  error code(>0) if fail
86  * @remark      @see enum app2sd_install_status
87  */
88 int app2sd_client_usr_post_app_install(const char *pkgid,
89                 app2ext_status install_status, uid_t uid);
90 int app2sd_client_post_app_install(const char *pkgid,
91                 app2ext_status install_status);
92
93 /**
94  * @brief : This API prepares the setup for upgradation of
95  *               application package
96  * @pre                 vfat type sd card must be present.
97  * @post                Upgradation is done by package installer.
98  * @param[in] appname           application package name
99  *                              [Ex: com.samsung.calculator]
100  * @param[in] dir_list          directory structure of the application
101  * @param[in] size      size of memory required by application(in MB).
102  *This entry is parsed from application package control/manifest file.
103  * @return      0 if success,  error code(>0) if fail
104  * @remark      None.
105  */
106 int app2sd_client_usr_pre_app_upgrade(const char *pkgid,
107                 GList* dir_list, int size, uid_t uid);
108 int app2sd_client_pre_app_upgrade(const char *pkgid,
109                 GList* dir_list, int size);
110
111 /**
112  * @brief : This API does post upgradation operations after
113  *              the installation in SD card
114  * @param[in] appname           application package name
115  *                              [Ex: com.samsung.calculator]
116  * @param[in] install_status    Status of installation of package
117  *[ enum app2extl_status].If package upgradation failed then
118  * upgrade_status= APP2EXT_STATUS_FAILURE else if upgradation
119  * was successful then upgrade_status = APP2EXT_STATUS_SUCCESS.
120  * @pre         Upgradation should be done by package installer.
121  * @return      0 if success,  error code(>0) if fail
122  * @remark      @see enum app2ext_status
123  */
124 int app2sd_client_usr_post_app_upgrade(const char *pkgid,
125                 app2ext_status upgrade_status, uid_t uid);
126 int app2sd_client_post_app_upgrade(const char *pkgid,
127                 app2ext_status upgrade_status);
128 /**
129  * @brief: This API prepares the setup for uninstallation
130  * @pre                 Package must be installed in sdcard.
131  * @post        Package is uninstalled by the package installer.
132  * @param[in] appname           application package name
133  *                              [Ex: com.samsung.calculator]
134  * @return      0 if success,  error code(>0) if fail
135  * @remark      None.
136  */
137 int app2sd_client_usr_pre_app_uninstall(const char *pkgid, uid_t uid);
138 int app2sd_client_pre_app_uninstall(const char *pkgid);
139
140 /**
141  * @brief This API removes the resources created during
142  app2sd setup.It is called after uninstallation.
143  * @pre                 Package must be uninstalled .
144  * @post                Encryption password is removed from sqlite db.
145  * @param[in] appname           application package name
146  *                              [Ex: com.samsung.calculator]
147  * @return      0 if success,  error code(>0) if fail
148  * @remark      None.
149  */
150 int app2sd_client_usr_post_app_uninstall(const char *pkgid, uid_t uid);
151 int app2sd_client_post_app_uninstall(const char *pkgid);
152
153 /**
154  * @brief : This API moves the package from sd card
155  to internal memory and vice versa.
156  * @param[in] pkgid             application package id
157  *                              [Ex: com.samsung.calculator]
158  * @param[in] move_type         Move type[enum app2ext_move_type]
159  *                      [sd card to internal/internal to sd card]
160  * @param[in] dir_list          directory structure of the application
161  * @pre                 Package must be installed and its installation
162  * location should be known. Use dedicated API to get installation location.
163  * @post        Package is moved to new location.
164  * @return      0 if success,  error code(>0) if fail
165  * @remark      None.
166  */
167 int app2sd_client_usr_move_installed_app(const char *pkgid,
168                 GList* dir_list, app2ext_move_type move_type, uid_t uid);
169 int app2sd_client_move_installed_app(const char *pkgid,
170                 GList* dir_list, app2ext_move_type move_type);
171
172 /**
173  * @brief : This API Enables the application in sd card
174  for use. This API should be called by AUL.
175  * @param[in] pkgid             application package id
176 *                               [Ex: com.samsung.calculator]
177  * @pre                 Package must be installed
178  * @post        application is enabled in SD card.
179  * @return      0 if success,  error code(>0) if fail
180  * @remark      None.
181  */
182 int app2sd_client_usr_on_demand_setup_init(const char *pkgid, uid_t uid);
183 int app2sd_client_on_demand_setup_init(const char *pkgid);
184
185 /**
186  * @brief : This API Disables the application in sd card
187  . This API should be called by Launchpad callback which will be registered
188   during app launch for exit action of the application
189  * @param[in] pkgid             application package id
190 *                               [Ex: com.samsung.calculator]
191  * @pre                 Package must be installed and enabled
192  *                      and application must be running in SD card
193  * @post        application is disabked in SD card.
194  * @return      0 if success,  error code(>0) if fail
195  * @remark      None.
196  */
197 int app2sd_client_usr_on_demand_setup_exit(const char *pkgid, uid_t uid);
198 int app2sd_client_on_demand_setup_exit(const char *pkgid);
199
200 int app2sd_client_usr_force_clean(const char *pkgid, uid_t uid);
201 int app2sd_client_force_clean(const char *pkgid);
202
203 /**
204  * @brief : This is the plug-in load function.
205           The plugin has to bind its functions to function pointers of storage handle
206  * @param[in/out] st_interface          Specifies the storage interface.
207  * @return      None
208 */
209 API void app2ext_on_load(app2ext_interface *st_interface);
210
211 #ifdef __cplusplus
212 }
213 #endif
214 #endif