Create info file for uiscalability, uitheme
[platform/framework/native/installer.git] / inc / InstallerDefs.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file        InstallerDefs.h
19  */
20
21 #ifndef _INSTALLER_DEFS_H_
22 #define _INSTALLER_DEFS_H_
23
24 #include "InstallerUtil.h"
25
26 #define OSP_INSTALLER_VERSION "version=[20130702.1]"
27
28 #define DIR_BIN                         L"/bin"
29 #define DIR_INFO                        L"/info"
30 #define DIR_RES                         L"/res"
31 #define DIR_DATA                        L"/data"
32 #define DIR_ICONS                       L"/icons"
33 #define DIR_SHARED                      L"/shared"
34 #define DIR_LIB                         L"/lib"
35 #define DIR_SETTING                     L"/setting"
36 #define DIR_CONTENTS            L"/contents"
37 #define DIR_SHARED_RES          L"/shared/res"
38 #define DIR_SHARED_DATA         L"/shared/data"
39 #define DIR_SHARED_TRUSTED      L"/shared/trusted"
40 #define DIR_VIRTUAL_ROOT                L"/virtual-root"
41
42 #define SLP_DIR_BIN                     L"/bin"
43 #define SLP_DIR_RES                     L"/res"
44 #define SLP_DIR_DATA            L"/data"
45 #define SLP_APP_PATH            L"/opt/apps"
46
47 #define PATH_OPT_APPS           L"/opt/apps"
48 #define PATH_USR_APPS           L"/usr/apps"
49 #define PATH_OPT_USR            L"/opt/usr"
50 #define PATH_OPT_USR_APPS       L"/opt/usr/apps"
51
52 #define SLP_FONT_PATH           L"/opt/share/fonts"
53
54 #define DIR_DESKTOP                                     L"/opt/share/applications/%S.desktop"
55 #define PACKAGE_NAME_PREFIX_ORG         L"org.tizen."
56 #define PACKAGE_NAME_RULE_ORG           L"org.tizen.%ls#%s"
57
58 #define PACKAGE_NAME_RULE                       L"%ls.%s"
59
60 #define FILE_EXT_INFO                           L"info"
61 #define VERSION_INFO_FILE                       L"/info/version.info"
62 #define COMPAT_INFO_FILE                        L"/info/compat.info"
63 #define VIRTUAL_ROOT_INFO_FILE          L"/info/virtualroot.info"
64 #define UISCALABILITY_INFO_FILE         L"/uiscalability.info"
65 #define UITHEME_INFO_FILE                                       L"/uitheme.info"
66 #define WEBSERVICE_INFO_FILE            L"/info/webservice.info"
67 #define TYPE_INFO_FILE                          L"/info/type.info"
68 #define PACKAGE_XML_FILE                        L"/info/manifest.xml"
69
70 #define SIGNATURE1_XML_FILE                     L"/signature1.xml"
71 #define AUTHOR_SIGNATURE_XML_FILE       L"/author-signature.xml"
72
73 #define UISCALABILITY_INFO                      L"1 %ls %ls %ls"
74 #define UITHEME_INFO                                            L"1 %ls %ls"
75
76 #define CONFIG_PATH                                     L"/usr/etc/installer-config.ini"
77
78 #define UIAPP_LOADER_PATH                       "/usr/lib/osp/osp-ui-app-loader"                        // UiApp
79 #define SERVICEAPP_LOADER_PATH          "/usr/lib/osp/osp-service-app-loader"           // ServiceApp
80 #define SYSTEMSERIVCE_LOADER_PATH       "/usr/lib/osp/osp-system-service-loader"        // System Service
81 #define IME_PATH                                        "/opt/apps/scim/lib/scim-1.0/1.4.0/Helper"
82
83 #define SUB_MODE_APPCONTROL_NAME        L"_AppControl"
84
85 #define APP_OWNER_ID            5000
86 #define APP_GROUP_ID            5000
87
88 #define PACKAGE_ID_LENGTH       10
89 #define APP_DIR_LENGTH          20
90
91 #define TEST_ARG_COUNT          1
92 #define COMMAND_ARG_COUNT       3
93 #define TERMINATE_RETRY_COUNT   300
94
95 #define DIR_OSP_APPLICATIONS_TEMP                               L"/opt/usr/apps/__@@osp_tmp@@__"
96 #define DIR_INSTALL_LOGS                                                L"/opt/usr/apps/logs"
97
98 #define DIR_RO_PACKAGE_SYSTEM_MANIFEST                  L"/usr/share/packages/%ls.xml"
99 #define DIR_RW_PACKAGE_SYSTEM_MANIFEST                  L"/opt/share/packages/%ls.xml"
100
101 #define DIR_MEMORYCARD_OSP_APPLICATIONS                 L"/opt/storage/sdcard/apps"
102 #define DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP    L"/opt/storage/sdcard/apps/__@@osp_tmp@@__"
103
104 #define PERM_BASE                                                               (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)         // 0644
105 #define PERM_EXECUTE                                                    (S_IXUSR | S_IXGRP | S_IXOTH)
106 #define PERM_WRITE                                                              (S_IWUSR | S_IWGRP | S_IWOTH)
107
108 #define PERM_OWNER_ROOT                                                 0
109 #define PERM_OWNER_APP                                                  1
110
111 #define PERM_SMACK_0                                                    0
112 #define PERM_SMACK_1                                                    1
113 #define PERM_SMACK_2                                                    2
114 #define PERM_SMACK_3                                                    3
115
116 #define TIZEN_PRIVILEGE_WEB_SERVICE                             "http://tizen.org/privilege/web.service"
117 #define TIZEN_CATEGORY_IME                                              "http://tizen.org/category/ime"
118 #define TIZEN_CATEGORY_HOMESCREEN                               "http://tizen.org/category/homescreen"
119 #define TIZEN_CATEGORY_LOCKSCREEN                               "http://tizen.org/category/lockscreen"
120 #define TIZEN_CATEGORY_MENUSCREEN                               "http://tizen.org/category/menuscreen"
121 #define TIZEN_CATEGORY_ANTIVIRUS                                "http://tizen.org/category/antivirus"
122
123 // custom metadata
124 #define METADATA_FONT                                                   L"http://developer.samsung.com/tizen/metadata/font"
125 #define METADATA_SPLASH                                                 L"http://developer.samsung.com/tizen/metadata/splash"
126 #define METADATA_SPLASH_INDICATOR_DISPLAY               L"http://developer.samsung.com/tizen/metadata/splash/indicatordisplay"
127 #define METADATA_SPLASH_PORTRAIT                                L"http://developer.samsung.com/tizen/metadata/splash/portrait"
128 #define METADATA_SPLASH_LANDSCAPE                               L"http://developer.samsung.com/tizen/metadata/splash/landscape"
129
130 #define DIR_APPLICATIONS_TMP                                    "/opt/usr/apps/tmp"
131
132 #define INSTALLER_RDS_FILE_NAME                                 ".rds_delta"
133 #define INSTALLER_RDS_DELETE_STR                                "delete"
134 #define INSTALLER_RDS_ADD_STR                                   "add"
135 #define INSTALLER_RDS_MODIFY_STR                                "modify"
136
137 static const int INSTALLER_BLOCK_SIZE = 4096;
138 static const int SIGNATURE_FILE_NUMBER_DISTRIBUTOR = 1;
139 static const int SIGNATURE_FILE_NUMBER_DISTRIBUTOR2 = 2;
140
141 #define OSP_INSTALLER   "osp-installer"
142
143 #ifdef AppLog
144 #undef AppLog
145 #define AppLog(...)             AppLogTagInternal(OSP_INSTALLER, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
146                                                 InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, false, __VA_ARGS__);
147 #endif
148
149 #ifdef TryCatch
150 #undef TryCatch
151 #define TryCatch(condition, expr, ...) \
152         if (!(condition)) { \
153                 AppLogExceptionTag(OSP_INSTALLER, __VA_ARGS__); \
154                 expr; \
155                 InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, true, __VA_ARGS__); \
156                 goto CATCH;     \
157         } \
158         else {;}
159 #endif
160
161 #ifdef TryReturn
162 #undef TryReturn
163 #define TryReturn(condition, returnValue, ...)  \
164         if (!(condition)) { \
165                 AppLogExceptionTag(OSP_INSTALLER, __VA_ARGS__); \
166                 InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, true, __VA_ARGS__); \
167                 return returnValue;     \
168         } \
169         else {;}
170 #endif
171
172 enum InstallationSetStep
173 {
174         INSTALLER_STEP_REMOVE,
175         INSTALLER_STEP_SET,
176
177 };
178
179 enum InstallationState
180 {
181         INSTALLER_STATE_READY,
182         INSTALLER_STATE_RUNNING,
183
184 };
185
186 enum InstallationStep
187 {
188         INSTALLER_STEP_NONE = 0,
189         INSTALLER_STEP_INIT,
190         INSTALLER_STEP_CHECK_PACKAGE,
191         INSTALLER_STEP_DRM,
192         INSTALLER_STEP_PARSE_MANIFEST,
193         INSTALLER_STEP_CHECK_SYSTEM,
194         INSTALLER_STEP_UNPACK,
195         INSTALLER_STEP_LICENSE,
196         INSTALLER_STEP_PARSE_SIGNATURE,
197
198         INSTALLER_STEP_INIT_UNINSTALL,
199         INSTALLER_STEP_UNINSTALL,
200         INSTALLER_STEP_END,
201
202         INSTALLER_STEP_RDS_INIT,
203         INSTALLER_STEP_RDS,
204
205         INSTALLER_STEP_MAX,
206
207 };
208
209 enum InstallerType
210 {
211         INSTALLER_TYPE_INSTALLER,
212         INSTALLER_TYPE_PACKAGE,
213         INSTALLER_TYPE_DIRECTORY,
214         INSTALLER_TYPE_GUEST,
215         INSTALLER_TYPE_PRELOADED,
216         INSTALLER_TYPE_IDE,
217         INSTALLER_TYPE_RESTORATION,
218
219 };
220
221 enum InstallerOption
222 {
223         INSTALLER_OPTION_NONE = 0,
224         INSTALLER_OPTION_NORMAL = 1,
225         INSTALLER_OPTION_IDE = 2,
226         INSTALLER_OPTION_PRELOADED = 4,
227         INSTALLER_OPTION_HYBRID = 8,
228         INSTALLER_OPTION_NO_INPUT = 16,
229         INSTALLER_OPTION_FILELOG_ON = 32,
230         INSTALLER_OPTION_UPDATE_STDOUT = 64,
231         INSTALLER_OPTION_CSC = 128,
232         INSTALLER_OPTION_RESET_PRELOADED = 256,
233
234 };
235
236 enum InstallerError
237 {
238         INSTALLER_ERROR_NONE = 0,
239         INSTALLER_ERROR_PACKAGE_NOT_FOUND = 1,
240         INSTALLER_ERROR_PACKAGE_INVALID = 2,
241         INSTALLER_ERROR_PACKAGE_LOWER_VERSION = 3,
242         INSTALLER_ERROR_EXECUTABLE_NOT_FOUND = 4,
243         INSTALLER_ERROR_MANIFEST_NOT_FOUND = 11,
244         INSTALLER_ERROR_MANIFEST_INVALID = 12,
245         INSTALLER_ERROR_SIGNATURE_NOT_FOUND = 21,
246         INSTALLER_ERROR_SIGNATURE_INVALID = 22,
247         INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED = 23,
248         INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND = 31,
249         INSTALLER_ERROR_CERTIFICATE_INVALID = 32,
250         INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED = 33,
251         INSTALLER_ERROR_CERTIFICATE_EXPIRED = 34,
252         INSTALLER_ERROR_PRIVILEGE_INVALID = 41,
253         INSTALLER_ERROR_MENU_ICON_NOT_FOUND = 51,
254         INSTALLER_ERROR_FATAL_ERROR = 61,
255         INSTALLER_ERROR_OUT_OF_STORAGE = 62,
256         INSTALLER_ERROR_OUT_OF_MEMORY = 63,
257
258         INSTALLER_ERROR_USER_CANCEL = 141,
259         INSTALLER_ERROR_UNMOUNT_FAILED = 142,
260         INSTALLER_ERROR_INTERNAL_STATE = 143,
261         INSTALLER_ERROR_DATABASE = 144,
262         INSTALLER_ERROR_DRM = 145,
263 };
264
265 enum InstallerOperation
266 {
267         INSTALLER_OPERATION_INSTALL,
268         INSTALLER_OPERATION_UNINSTALL,
269         INSTALLER_OPERATION_REINSTALL,
270
271 };
272
273 enum RootCertificateType
274 {
275         ROOT_CERTIFICATE_NONE = 0,
276         ROOT_CERTIFICATE_DEVELOPER,
277         ROOT_CERTIFICATE_PUBLIC,
278         ROOT_CERTIFICATE_PARTNER,
279         ROOT_CERTIFICATE_PARTNER_OPERATOR,
280         ROOT_CERTIFICATE_PARTNER_MANUFACTURER,
281
282         ROOT_CERTIFICATE_CERT_SVC_PUBLIC = (1 << 6),
283         ROOT_CERTIFICATE_CERT_SVC_PARTNER = (1 << 7),
284         ROOT_CERTIFICATE_CERT_SVC_PARTNER_OPERATOR = (1 << 8),
285         ROOT_CERTIFICATE_CERT_SVC_PARTNER_MANUFACTURER = (1 << 9),
286         ROOT_CERTIFICATE_CERT_SVC_PLATFORM = (1 << 10),
287
288 };
289
290 enum SignatureFileType
291 {
292         SIGNATURE_FILE_TYPE_NONE,
293         SIGNATURE_FILE_TYPE_AUTHOR,
294         SIGNATURE_FILE_TYPE_DISTRIBUTOR,
295         SIGNATURE_FILE_TYPE_DISTRIBUTOR2,
296
297 };
298
299 enum
300 {
301         INSTALLER_MODE_INSTALL = 1,
302         INSTALLER_MODE_UNINSTALL = 2,
303         INSTALLER_MODE_RECURSIVE_DIRECTORY_INSTALL = 3,
304         INSTALLER_MODE_REINSTALL = 4,
305         INSTALLER_MODE_PARSE_CSC_STRING = 5,
306 };
307
308 enum CategoryType
309 {
310         CATEGORY_TYPE_NONE,
311         CATEGORY_TYPE_IME,
312         CATEGORY_TYPE_HOME_SCREEN,
313         CATEGORY_TYPE_LOCK_SCREEN,
314
315 };
316
317 enum InstallationStorage
318 {
319         INSTALLATION_STORAGE_NONE,
320         INSTALLATION_STORAGE_INTERNAL,
321         INSTALLATION_STORAGE_EXTERNAL,
322
323 };
324
325 enum InstallerRdsState
326 {
327         INSTALLER_RDS_STATE_NONE,
328         INSTALLER_RDS_STATE_DELETE,
329         INSTALLER_RDS_STATE_ADD,
330         INSTALLER_RDS_STATE_MODIFY,
331
332 };
333
334 typedef struct
335 {
336         const char* pDir;
337         int dirType;
338         int ownerIndex;
339         int modeIndex;
340         int smackIndex;
341
342 } RdsPermssions;
343
344 enum PermDirType
345 {
346         PERM_DIR_RES = 0,
347         PERM_DIR_DATA = 1,
348         PERM_DIR_BIN = 2,
349         PERM_DIR_INFO = 3,
350         PERM_DIR_LIB = 4,
351         PERM_DIR_SETTING = 5,
352         PERM_DIR_SHARED_RES = 6,
353         PERM_DIR_SHARED_DATA = 7,
354         PERM_DIR_SHARED_TRUSTED = 8,
355         PERM_DIR_SHARED = 9,
356         PERM_DIR_ROOT = 10,
357 };
358
359 enum PrivilegeLevel
360 {
361         PRIVILEGE_LEVEL_PUBLIC,
362         PRIVILEGE_LEVEL_PARTNER,
363         PRIVILEGE_LEVEL_PLATFORM,
364
365 };
366
367 #endif // _INSTALLER_DEFS_H_