4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7 * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
24 #ifndef __PKGMGRINFO_PRIVATE_H__
25 #define __PKGMGRINFO_PRIVATE_H__
29 #include <sys/types.h>
33 #include <tzplatform_config.h>
35 #include "pkgmgrinfo_type.h"
36 #include "pkgmgrinfo_basic.h"
39 #define DEPRECATED __attribute__ ((__deprecated__))
43 #define API __attribute__ ((visibility("default")))
49 #define LOG_TAG "PKGMGR_INFO"
51 #define ASC_CHAR(s) (const char *)s
52 #define XML_CHAR(s) (const xmlChar *)s
54 #define MANIFEST_DB tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_parser.db")
55 #define MAX_QUERY_LEN 4096
56 #define MAX_CERT_TYPE 9
57 #define CERT_DB tzplatform_mkpath(TZ_SYS_DB, ".pkgmgr_cert.db")
58 #define PKG_TYPE_STRING_LEN_MAX 128
59 #define PKG_VERSION_STRING_LEN_MAX 128
60 #define PKG_VALUE_STRING_LEN_MAX 512
61 #define PKG_RW_PATH tzplatform_mkpath(TZ_USER_APP, "")
62 #define PKG_RO_PATH tzplatform_mkpath(TZ_SYS_RO_APP, "")
63 #define BLOCK_SIZE 4096 /*in bytes*/
68 #define PKG_SD_PATH tzplatform_mkpath3(TZ_SYS_STORAGE, "sdcard", "app2sd/")
69 #define PKG_INSTALLATION_PATH tzplatform_mkpath(TZ_USER_APP, "")
71 #define SERVICE_NAME "org.tizen.system.deviced"
72 #define PATH_NAME "/Org/Tizen/System/DeviceD/Mmc"
73 #define INTERFACE_NAME "org.tizen.system.deviced.Mmc"
74 #define METHOD_NAME "RequestMountApp2ext"
76 #define GET_DB(X) (X).dbHandle
78 /*String properties for filtering based on package info*/
79 typedef enum _pkgmgrinfo_pkginfo_filter_prop_str {
80 E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_STR = 101,
81 E_PMINFO_PKGINFO_PROP_PACKAGE_ID = E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_STR,
82 E_PMINFO_PKGINFO_PROP_PACKAGE_TYPE,
83 E_PMINFO_PKGINFO_PROP_PACKAGE_VERSION,
84 E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION,
85 E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE,
86 E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME,
87 E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL,
88 E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF,
89 E_PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE,
90 E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_STR = E_PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE
91 } pkgmgrinfo_pkginfo_filter_prop_str;
93 /*Boolean properties for filtering based on package info*/
94 typedef enum _pkgmgrinfo_pkginfo_filter_prop_bool {
95 E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_BOOL = 201,
96 E_PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE = E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_BOOL,
97 E_PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD,
98 E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY,
99 E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE,
100 E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING,
101 E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING,
102 E_PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE,
103 E_PMINFO_PKGINFO_PROP_PACKAGE_DISABLE,
104 E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL = E_PMINFO_PKGINFO_PROP_PACKAGE_DISABLE
105 } pkgmgrinfo_pkginfo_filter_prop_bool;
107 /*Integer properties for filtering based on package info*/
108 typedef enum _pkgmgrinfo_pkginfo_filter_prop_int {
109 E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_INT = 301,
110 E_PMINFO_PKGINFO_PROP_PACKAGE_SIZE = E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_INT,
111 E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_INT = E_PMINFO_PKGINFO_PROP_PACKAGE_SIZE
112 } pkgmgrinfo_pkginfo_filter_prop_int;
114 /*String properties for filtering based on app info*/
115 typedef enum _pkgmgrinfo_appinfo_filter_prop_str {
116 E_PMINFO_APPINFO_PROP_APP_MIN_STR = 401,
117 E_PMINFO_APPINFO_PROP_APP_ID = E_PMINFO_APPINFO_PROP_APP_MIN_STR,
118 E_PMINFO_APPINFO_PROP_APP_COMPONENT,
119 E_PMINFO_APPINFO_PROP_APP_EXEC,
120 E_PMINFO_APPINFO_PROP_APP_ICON,
121 E_PMINFO_APPINFO_PROP_APP_TYPE,
122 E_PMINFO_APPINFO_PROP_APP_OPERATION,
123 E_PMINFO_APPINFO_PROP_APP_URI,
124 E_PMINFO_APPINFO_PROP_APP_MIME,
125 E_PMINFO_APPINFO_PROP_APP_HWACCELERATION,
126 E_PMINFO_APPINFO_PROP_APP_CATEGORY,
127 E_PMINFO_APPINFO_PROP_APP_SCREENREADER,
128 E_PMINFO_APPINFO_PROP_APP_PACKAGE,
129 E_PMINFO_APPINFO_PROP_APP_INSTALLED_STORAGE,
130 E_PMINFO_APPINFO_PROP_APP_METADATA_KEY,
131 E_PMINFO_APPINFO_PROP_APP_METADATA_VALUE,
132 E_PMINFO_APPINFO_PROP_APP_MAX_STR = E_PMINFO_APPINFO_PROP_APP_METADATA_VALUE
133 } pkgmgrinfo_appinfo_filter_prop_str;
135 /*Boolean properties for filtering based on app info*/
136 typedef enum _pkgmgrinfo_appinfo_filter_prop_bool {
137 E_PMINFO_APPINFO_PROP_APP_MIN_BOOL = 501,
138 E_PMINFO_APPINFO_PROP_APP_NODISPLAY = E_PMINFO_APPINFO_PROP_APP_MIN_BOOL,
139 E_PMINFO_APPINFO_PROP_APP_MULTIPLE,
140 E_PMINFO_APPINFO_PROP_APP_ONBOOT,
141 E_PMINFO_APPINFO_PROP_APP_AUTORESTART,
142 E_PMINFO_APPINFO_PROP_APP_TASKMANAGE,
143 E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION,
144 E_PMINFO_APPINFO_PROP_APP_UI_GADGET,
145 E_PMINFO_APPINFO_PROP_APP_DISABLE,
146 E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE,
147 E_PMINFO_APPINFO_PROP_APP_MAX_BOOL = E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE
148 } pkgmgrinfo_appinfo_filter_prop_bool;
150 /*Integer properties for filtering based on app info*/
151 typedef enum _pkgmgrinfo_appinfo_filter_prop_int {
152 /*Currently No Fields*/
153 E_PMINFO_APPINFO_PROP_APP_MIN_INT = 601,
154 E_PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER = E_PMINFO_APPINFO_PROP_APP_MIN_INT,
155 E_PMINFO_APPINFO_PROP_APP_MAX_INT = E_PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER
156 } pkgmgrinfo_appinfo_filter_prop_int;
158 /*Integer properties for filtering based on app info*/
159 typedef enum _pkgmgrinfo_pkginfo_filter_prop_range {
160 /*Currently No Fields*/
161 E_PMINFO_PKGINFO_PROP_RANGE_MIN_INT = 701,
162 E_PMINFO_PKGINFO_PROP_RANGE_BASIC,
163 E_PMINFO_PKGINFO_PROP_RANGE_MAX_INT = E_PMINFO_PKGINFO_PROP_RANGE_BASIC
164 } pkgmgrinfo_pkginfo_filter_prop_range;
166 typedef enum _pkgmgrinfo_pkginfo_join_flag {
167 E_PMINFO_PKGINFO_JOIN_LOCALIZED_INFO = 0x0001,
168 E_PMINFO_PKGINFO_JOIN_PRIVILEGE_INFO = 0x0002,
169 } pkgmgrinfo_pkginfo_join_flag;
171 typedef enum _pkgmgrinfo_appinfo_join_flag {
172 E_PMINFO_APPINFO_JOIN_LOCALIZED_INFO = 0x0001,
173 E_PMINFO_APPINFO_JOIN_CATEGORY = 0x0002,
174 E_PMINFO_APPINFO_JOIN_APP_CONTROL = 0x0004,
175 E_PMINFO_APPINFO_JOIN_METADATA = 0x0008,
176 } pkgmgrinfo_appinfo_join_flag;
178 typedef struct _pkgmgr_pkginfo_x {
184 typedef struct _pkgmgr_appinfo_x {
187 pkgmgrinfo_app_component app_component;
188 application_x *app_info;
192 typedef struct _pkgmgrinfo_filter_x {
195 } pkgmgrinfo_filter_x;
197 typedef struct _pkgmgrinfo_node_x {
203 typedef struct _pkgmgrinfo_appcontrol_x {
212 } pkgmgrinfo_appcontrol_x;
214 typedef struct _db_handle {
219 extern __thread db_handle manifest_db;
220 extern __thread db_handle cert_db;
222 pkgmgrinfo_pkginfo_filter_prop_str _pminfo_pkginfo_convert_to_prop_str(const char *property);
223 pkgmgrinfo_pkginfo_filter_prop_int _pminfo_pkginfo_convert_to_prop_int(const char *property);
224 pkgmgrinfo_pkginfo_filter_prop_bool _pminfo_pkginfo_convert_to_prop_bool(const char *property);
226 pkgmgrinfo_appinfo_filter_prop_str _pminfo_appinfo_convert_to_prop_str(const char *property);
227 pkgmgrinfo_appinfo_filter_prop_int _pminfo_appinfo_convert_to_prop_int(const char *property);
228 pkgmgrinfo_appinfo_filter_prop_bool _pminfo_appinfo_convert_to_prop_bool(const char *property);
230 pkgmgrinfo_pkginfo_filter_prop_range _pminfo_pkginfo_convert_to_prop_range(const char *property);
232 int _check_create_cert_db(sqlite3 *certdb);
233 int __close_manifest_db(void);
234 int __open_manifest_db(uid_t uid, bool readonly);
235 int __close_cert_db(void);
236 int __open_cert_db(uid_t uid, bool readonly);
237 void _save_column_int(sqlite3_stmt *stmt, int idx, int *i);
238 void _save_column_str(sqlite3_stmt *stmt, int idx, char **str);
239 char *_get_system_locale(void);
240 int __get_filter_condition(gpointer data, char **condition, GList **param);
241 int _add_icon_info_into_list(const char *locale, char *value, GList **icon);
242 int _add_label_info_into_list(const char *locale, char *value, GList **label);
244 #define REGULAR_USER 5000
245 static inline uid_t _getuid(void)
247 uid_t uid = getuid();
249 if (uid < REGULAR_USER)
250 return tzplatform_getuid(TZ_SYS_GLOBALAPP_USER);
255 #endif /* __PKGMGRINFO_PRIVATE_H__ */