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 * [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
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);
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
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);
94 * @brief : This API prepares the setup for upgradation of
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
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);
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
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);
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
137 int app2sd_client_usr_pre_app_uninstall(const char *pkgid, uid_t uid);
138 int app2sd_client_pre_app_uninstall(const char *pkgid);
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
150 int app2sd_client_usr_post_app_uninstall(const char *pkgid, uid_t uid);
151 int app2sd_client_post_app_uninstall(const char *pkgid);
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
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);
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
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);
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
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);
200 int app2sd_client_usr_force_clean(const char *pkgid, uid_t uid);
201 int app2sd_client_force_clean(const char *pkgid);
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.
209 API void app2ext_on_load(app2ext_interface *st_interface);