2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
20 internal static partial class Interop
22 internal static partial class ApplicationManager
24 internal enum ErrorCode
26 None = Tizen.Internals.Errors.ErrorCode.None,
27 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
28 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
29 IoError = Tizen.Internals.Errors.ErrorCode.IoError,
30 NoSuchApp = -0x01110000 | 0x01,
31 DbFailed = -0x01110000 | 0x03,
32 InvalidPackage = -0x01110000 | 0x04,
33 AppNoRunning = -0x01110000 | 0x05,
34 RequestFailed = -0x01110000 | 0x06,
35 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied
38 internal enum AppContextEvent
44 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
45 internal delegate void AppManagerAppContextEventCallback(IntPtr handle, AppContextEvent state, IntPtr userData);
46 //void(* app_manager_app_context_event_cb)(app_context_h app_context, app_context_event_e event, void *user_data)
48 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
49 internal delegate bool AppManagerAppInfoCallback(IntPtr handle, IntPtr userData);
50 //bool(* app_manager_app_info_cb )(app_info_h app_info, void *user_data)
52 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
53 internal delegate bool AppManagerAppContextCallback(IntPtr handle, IntPtr userData);
54 //bool(* app_manager_app_context_cb)(app_context_h app_context, void *user_data)
56 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
57 internal delegate bool AppInfoFilterCallback(IntPtr handle, IntPtr userData);
58 //bool(* app_info_filter_cb )(app_info_h app_info, void *user_data)
60 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
61 internal delegate bool AppInfoMetadataCallback(string key, string value, IntPtr userData);
62 //bool(* app_info_metadata_cb )(const char *metadata_key, const char *metadata_value, void *user_data)
64 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_set_app_context_event_cb")]
65 internal static extern ErrorCode AppManagerSetAppContextEvent(AppManagerAppContextEventCallback callback, IntPtr userData);
66 //int app_manager_set_app_context_event_cb( app_manager_app_context_event_cb callback, void * user_data)
68 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_unset_app_context_event_cb")]
69 internal static extern void AppManagerUnSetAppContextEvent();
70 //void app_manager_unset_app_context_event_cb (void);
72 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_foreach_app_context")]
73 internal static extern ErrorCode AppManagerForeachAppContext(AppManagerAppContextCallback callback, IntPtr userData);
74 //int app_manager_foreach_app_context(app_manager_app_context_cb callback, void *user_data)
76 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_context")]
77 internal static extern ErrorCode AppManagerGetAppContext(string applicationId, out IntPtr handle);
78 //int app_manager_get_app_context(const char* app_id, app_context_h *app_context);
80 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_id")]
81 internal static extern ErrorCode AppManagerGetAppId(int processId, out string applicationId);
82 //int app_manager_get_app_id (pid_t pid, char **appid);
84 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_is_running")]
85 internal static extern ErrorCode AppManagerIsRunning(string applicationId, out bool running);
86 //int app_manager_is_running (const char *appid, bool *running);
88 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_resume_app")]
89 internal static extern ErrorCode AppManagerResumeApp(IntPtr handle);
90 //int app_manager_resume_app (app_context_h handle);
92 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_request_terminate_bg_app")]
93 internal static extern ErrorCode AppManagerRequestTerminateBgApp(IntPtr handle);
94 //int app_manager_request_terminate_bg_app (app_context_h handle);
96 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_foreach_app_info")]
97 internal static extern ErrorCode AppManagerForeachAppInfo(AppManagerAppInfoCallback callback, IntPtr userData);
98 //int app_manager_foreach_app_info(app_manager_app_info_cb callback, void *user_data)
100 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_info")]
101 internal static extern ErrorCode AppManagerGetAppInfo(string applicationId, out IntPtr handle);
102 //int app_manager_get_app_info(const char * app_id, app_info_h * app_info)
104 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_shared_data_path")]
105 internal static extern ErrorCode AppManagerGetSharedDataPath(string applicationId, out string path);
106 //int app_manager_get_shared_data_path (const char *appid, char **path);
108 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_shared_resource_path")]
109 internal static extern ErrorCode AppManagerGetSharedResourcePath(string applicationId, out string path);
110 //int app_manager_get_shared_resource_path (const char *appid, char **path);
112 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_shared_trusted_path")]
113 internal static extern ErrorCode AppManagerGetSharedTrustedPath(string applicationId, out string path);
114 //int app_manager_get_shared_trusted_path (const char *appid, char **path);
116 [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_external_shared_data_path")]
117 internal static extern ErrorCode AppManagerGetExternalSharedDataPath(string applicationId, out string path);
118 //int app_manager_get_external_shared_data_path (const char *appid, char **path);
120 [DllImport(Libraries.AppManager, EntryPoint = "app_context_destroy")]
121 internal static extern ErrorCode AppContextDestroy(IntPtr handle);
122 //int app_context_destroy(app_context_h app_context)
124 [DllImport(Libraries.AppManager, EntryPoint = "app_context_get_app_id")]
125 internal static extern ErrorCode AppContextGetAppId(IntPtr handle, out string applicationId);
126 //int app_context_get_app_id(app_context_h app_context, char **app_id)
128 [DllImport(Libraries.AppManager, EntryPoint = "app_context_get_pid")]
129 internal static extern ErrorCode AppContextGetPid(IntPtr handle, out int processId);
130 //int app_context_get_pid (app_context_h app_context, pid_t *pid)
132 [DllImport(Libraries.AppManager, EntryPoint = "app_context_is_terminated")]
133 internal static extern ErrorCode AppContextIsTerminated(IntPtr handle, out bool terminated);
134 //int app_context_is_terminated (app_context_h app_context, bool *terminated);
136 [DllImport(Libraries.AppManager, EntryPoint = "app_context_is_equal")]
137 internal static extern ErrorCode AppContextIsEqual(IntPtr first, IntPtr second, out bool equal);
138 //int app_context_is_equal (app_context_h lhs, app_context_h rhs, bool *equal);
140 [DllImport(Libraries.AppManager, EntryPoint = "app_context_clone")]
141 internal static extern ErrorCode AppContextClone(out IntPtr destination, IntPtr source);
142 //int app_context_clone (app_context_h *clone, app_context_h app_context);
144 [DllImport(Libraries.AppManager, EntryPoint = "app_info_create")]
145 internal static extern ErrorCode AppInfoCreate(string applicationId, out IntPtr handle);
146 //int app_info_create (const char *app_id, app_info_h *app_info);
148 [DllImport(Libraries.AppManager, EntryPoint = "app_info_destroy")]
149 internal static extern ErrorCode AppInfoDestroy(IntPtr handle);
150 //int app_info_destroy (app_info_h app_info);
152 [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_app_id")]
153 internal static extern ErrorCode AppInfoGetAppId(IntPtr handle, out string applicationId);
154 //int app_info_get_app_id (app_info_h app_info, char **app_id);
156 [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_exec")]
157 internal static extern ErrorCode AppInfoGetExec(IntPtr handle, out string exec);
158 //int app_info_get_exec (app_info_h app_info, char **exec);
160 [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_label")]
161 internal static extern ErrorCode AppInfoGetLabel(IntPtr handle, out string label);
162 //int app_info_get_label (app_info_h app_info, char **label);
164 [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_localed_label")]
165 internal static extern ErrorCode AppInfoGetLocaledLabel(string applicationId, string locale, out string label);
166 //int app_info_get_localed_label (const char *app_id, const char *locale, char **label);
168 [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_icon")]
169 internal static extern ErrorCode AppInfoGetIcon(IntPtr handle, out string path);
170 //int app_info_get_icon (app_info_h app_info, char **path)
172 [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_package")]
173 internal static extern ErrorCode AppInfoGetPackage(IntPtr handle, out string package);
174 //int app_info_get_package (app_info_h app_info, char **package)
176 [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_type")]
177 internal static extern ErrorCode AppInfoGetType(IntPtr handle, out string type);
178 //int app_info_get_type (app_info_h app_info, char **type)
180 [DllImport(Libraries.AppManager, EntryPoint = "app_info_foreach_metadata")]
181 internal static extern ErrorCode AppInfoForeachMetadata(IntPtr handle, AppInfoMetadataCallback callback, IntPtr userData);
182 //int app_info_foreach_metadata(app_info_h app_info, app_info_metadata_cb callback, void *user_data)
184 [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_nodisplay")]
185 internal static extern ErrorCode AppInfoIsNodisplay(IntPtr handle, out bool noDisplay);
186 //int app_info_is_nodisplay (app_info_h app_info, bool *nodisplay)
188 [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_equal")]
189 internal static extern ErrorCode AppInfoIsEqual(IntPtr first, IntPtr second, out bool equal);
190 //int app_info_is_equal (app_info_h lhs, app_info_h rhs, bool *equal)
192 [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_enabled")]
193 internal static extern ErrorCode AppInfoIsEnabled(IntPtr handle, out bool enabled);
194 //int app_info_is_enabled (app_info_h app_info, bool *enabled)
196 [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_onboot")]
197 internal static extern ErrorCode AppInfoIsOnBoot(IntPtr handle, out bool onBoot);
198 //int app_info_is_onboot (app_info_h app_info, bool *onboot)
200 [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_preload")]
201 internal static extern ErrorCode AppInfoIsPreLoad(IntPtr handle, out bool preLoaded);
202 //int app_info_is_preload (app_info_h app_info, bool *preload)
204 [DllImport(Libraries.AppManager, EntryPoint = "app_info_clone")]
205 internal static extern ErrorCode AppInfoClone(out IntPtr destination, IntPtr source);
206 //int app_info_clone(app_info_h * clone, app_info_h app_info)
208 [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_create")]
209 internal static extern ErrorCode AppInfoFilterCreate(out IntPtr handle);
210 //int app_info_filter_create(app_info_filter_h * handle)
212 [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_destroy")]
213 internal static extern ErrorCode AppInfoFilterDestroy(IntPtr handle);
214 //int app_info_filter_destroy(app_info_filter_h handle)
216 [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_add_bool")]
217 internal static extern ErrorCode AppInfoFilterAddBool(IntPtr handle, string property, bool value);
218 //int app_info_filter_add_bool(app_info_filter_h handle, const char *property, const bool value)
220 [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_add_string")]
221 internal static extern ErrorCode AppInfoFilterAddString(IntPtr handle, string property, string value);
222 //int app_info_filter_add_string(app_info_filter_h handle, const char *property, const char *value)
224 [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_count_appinfo")]
225 internal static extern ErrorCode AppInfoFilterCountAppinfo(IntPtr handle, out int count);
226 //int app_info_filter_count_appinfo(app_info_filter_h handle, int *count)
228 [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_foreach_appinfo")]
229 internal static extern ErrorCode AppInfoFilterForeachAppinfo(IntPtr handle, AppInfoFilterCallback callback, IntPtr userData);
230 //int app_info_filter_foreach_appinfo(app_info_filter_h handle, app_info_filter_cb callback, void * user_data)
232 [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_create")]
233 internal static extern ErrorCode AppInfoMetadataFilterCreate(out IntPtr handle);
234 //int app_info_metadata_filter_create (app_info_metadata_filter_h *handle)
236 [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_destroy")]
237 internal static extern ErrorCode AppInfoMetadataFilterDestroy(IntPtr handle);
238 //int app_info_metadata_filter_destroy (app_info_metadata_filter_h handle)
240 [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_add")]
241 internal static extern ErrorCode AppInfoMetadataFilterAdd(IntPtr handle, string key, string value);
242 //int app_info_metadata_filter_add (app_info_metadata_filter_h handle, const char *key, const char *value)
244 [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_foreach")]
245 internal static extern ErrorCode AppInfoMetadataFilterForeach(IntPtr handle, AppInfoFilterCallback callback, IntPtr userData);
246 //int app_info_metadata_filter_foreach (app_info_metadata_filter_h handle, app_info_filter_cb callback, void *user_data)