Add aul_widget_instance_get_content()
[platform/core/appfw/aul-1.git] / include / aul.h
1 /*
2  *  aul
3  *
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #pragma once
21
22 #include <errno.h>
23 #include <bundle.h>
24 #include <sys/types.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /**
31  * @brief Return values in AUL.
32  */
33 typedef enum _aul_return_val {
34         AUL_R_EREJECTED = -14,          /**< App disable for mode */
35         AUL_R_ENOAPP = -13,             /**< Failed to find app ID or pkg ID */
36         AUL_R_EHIDDENFORGUEST = -11,    /**< App hidden for guest mode */
37         AUL_R_ENOLAUNCHPAD = -10,       /**< no launchpad */
38         AUL_R_ETERMINATING = -9,        /**< application terminating */
39         AUL_R_EILLACC = -8,             /**< Illegal Access */
40         AUL_R_LOCAL = -7,               /**< Launch by himself */
41         AUL_R_ETIMEOUT = -6,            /**< Timeout */
42         AUL_R_ECANCELED = -5,           /**< Operation canceled */
43         AUL_R_EINVAL = -4,              /**< Invalid argument */
44         AUL_R_ECOMM = -3,               /**< Comunication Error */
45         AUL_R_ENOINIT = -2,             /**< AUL handler NOT initialized */
46         AUL_R_ERROR = -1,               /**< General error */
47         AUL_R_OK = 0                    /**< General success */
48 } aul_return_val;
49
50 enum app_status {
51         STATUS_LAUNCHING,
52         STATUS_CREATED,
53         STATUS_FOCUS,
54         STATUS_VISIBLE,
55         STATUS_BG,
56         STATUS_DYING,
57         STATUS_HOME,
58         STATUS_NORESTART,
59         STATUS_SERVICE,
60         STATUS_TERMINATE,
61 };
62
63 typedef enum _aul_type {
64         AUL_START,
65         AUL_RESUME,
66         AUL_TERMINATE,
67         AUL_TERMINATE_BGAPP,
68         AUL_PAUSE,
69         AUL_WAKE,
70         AUL_SUSPEND,
71         AUL_WIDGET_CONTENT,
72 } aul_type;
73
74 typedef enum aul_widget_lifecycle_event {
75         AUL_WIDGET_LIFE_CYCLE_EVENT_APP_DEAD = 0,
76         AUL_WIDGET_LIFE_CYCLE_EVENT_CREATE  = 1,    /**< The widget is created */
77         AUL_WIDGET_LIFE_CYCLE_EVENT_DESTROY = 2,    /**< The widget is destroyed */
78         AUL_WIDGET_LIFE_CYCLE_EVENT_PAUSE   = 3,    /**< The widget is paused */
79         AUL_WIDGET_LIFE_CYCLE_EVENT_RESUME  = 4    /**< The widget is resumed */
80 } aul_widget_lifecycle_event_e;
81
82 typedef enum aul_widget_instance_event {
83         AUL_WIDGET_INSTANCE_EVENT_CREATE = 0,
84         AUL_WIDGET_INSTANCE_EVENT_DESTROY = 1,
85         AUL_WIDGET_INSTANCE_EVENT_TERMINATE = 2,
86         AUL_WIDGET_INSTANCE_EVENT_PAUSE = 3,
87         AUL_WIDGET_INSTANCE_EVENT_RESUME = 4,
88         AUL_WIDGET_INSTANCE_EVENT_UPDATE = 5,
89         AUL_WIDGET_INSTANCE_EVENT_PERIOD_CHANGED = 6,
90         AUL_WIDGET_INSTANCE_EVENT_SIZE_CHANGED = 7,
91         AUL_WIDGET_INSTANCE_EVENT_EXTRA_UPDATED = 8,
92         AUL_WIDGET_INSTANCE_EVENT_FAULT = 9,
93         AUL_WIDGET_INSTANCE_EVENT_APP_RESTART_REQUEST = 10
94 } aul_widget_instance_event_e;
95
96 /** AUL public key - To check caller's secuirty */
97 #define AUL_K_CALLER_PID        "__AUL_CALLER_PID__"
98 /** AUL public key - To check callee's secuirty */
99 #define AUL_K_CALLEE_PID        "__AUL_CALLEE_PID__"
100 /** AUL public key - added for multiuser mode */
101 #define AUL_K_CALLER_UID        "__AUL_CALLER_UID__"
102 /** AUL public key - added for multiuser mode */
103 #define AUL_K_CALLEE_UID        "__AUL_CALLEE_UID__"
104 /** AUL public key - added for multiuser mode */
105 #define AUL_K_TARGET_UID        "__AUL_TARGET_UID__"
106 /** AUL public key - To check caller's secuirty */
107 #define AUL_K_CALLER_APPID      "__AUL_CALLER_APPID__"
108 /** AUL public key - To check caller's secuirty */
109 #define AUL_K_CALLEE_APPID      "__AUL_CALLEE_APPID__"
110 /** AUL public key - To find argv0 */
111 #define AUL_K_ARGV0             "__AUL_ARGV0__"
112 /** AUL public key - To measure launching time */
113 #define AUL_K_STARTTIME         "__AUL_STARTTIME__"
114 /** AUL public key - To support launching based on mime type */
115 #define AUL_K_MIME_TYPE         "__AUL_MIME_TYPE__"
116 /** AUL public key - To support launching based on mime type */
117 #define AUL_K_UNALIASED_MIME_TYPE               "__AUL_UNALIASED_MIME_TYPE__"
118 /** AUL public key - To support launching based on mime type */
119 #define AUL_K_MIME_CONTENT      "__AUL_MIME_CONTENT__"
120 /** AUL public key - To support launching based on service */
121 #define AUL_K_SERVICE_NAME              "__AUL_SERVICE_NAME__"
122 /** AUL public key - To force launch app selector instead of lauchingn default app */
123 #define AUL_K_FORCE_LAUNCH_APP_SELECTOR "__AUL_FORCE_LAUNCH_APP_SELECTOR__"
124 /** AUL public key - To support debug argument */
125 #define AUL_K_DEBUG     "__AUL_DEBUG__"
126 /** AUL public key - To support SDK */
127 #define AUL_K_SDK       "__AUL_SDK__"
128 /** AUL public key - To support Media key */
129 #define AUL_K_MULTI_KEY "__AUL_MULTI_KEY__"
130 /** AUL public key - To support Media key */
131 #define AUL_K_MULTI_KEY_EVENT   "__AUL_MULTI_KEY_EVENT__"
132 /** AUL public bundle value */
133 #define AUL_K_PRIVACY_APPID             "__AUL_PRIVACY_APPID__"
134 /** AUL public bundle value - To support Media key*/
135 #define AUL_V_KEY_PRESSED       "__AUL_KEY_PRESSED__"
136 /** AUL public bundle value - To support Media key*/
137 #define AUL_V_KEY_RELEASED      "__AUL_KEY_RELEASED__"
138 /** AUL public key - To support rua stat */
139 #define AUL_SVC_K_RUA_STAT_CALLER "__K_RUA_STAT_CALLER__"
140 #define AUL_SVC_K_RUA_STAT_TAG    "__K_RUA_STAT_TAG__"
141 /** AUL public key - To support rua delete */
142 #define AUL_K_RUA_PKGNAME "__K_RUA_PKGNAME"
143 /** AUL public key - To support rua delete */
144 #define AUL_K_RUA_APPPATH "__K_RUA_APPPATH"
145 /** AUL public key - To support rua add */
146 #define AUL_K_RUA_ARG "__K_RUA_ARG"
147 /** AUL public key - To support rua add */
148 #define AUL_K_RUA_TIME "__K_RUA_TIME"
149
150
151 /** AUL internal private key */
152 #define AUL_K_PKG_NAME          "__AUL_PKG_NAME__"
153 /** AUL internal private key */
154 #define AUL_K_WAIT_RESULT       "__AUL_WAIT_RESULT__"
155 /** AUL internal private key */
156 #define AUL_K_SEND_RESULT       "__AUL_SEND_RESULT__"
157 /** AUL internal private key */
158 #define AUL_K_TASK_MANAGE       "__AUL_TASK_MANAGE__"
159 /** AUL internal private key */
160 #define AUL_K_APP_TYPE          "__AUL_APP_TYPE__"
161 /** AUL internal private key - To check original caller's identity */
162 #define AUL_K_ORG_CALLER_PID    "__AUL_ORG_CALLER_PID__"
163 /** AUL internal private key - To check forwarded callee app's pid */
164 #define AUL_K_FWD_CALLEE_PID    "__AUL_FWD_CALLEE_PID__"
165 /** AUL internal private key */
166 #define AUL_K_NO_CANCEL        "__AUL_NO_CANCEL__"
167 /** AUL internal private key */
168 #define AUL_K_EXEC              "__AUL_EXEC__"
169 /** AUL internal private key */
170 #define AUL_K_MULTIPLE          "__AUL_MULTIPLE__"
171 /** AUL internal private key */
172 #define AUL_K_PACKAGETYPE       "__AUL_PACKAGETYPE__"
173 /** AUL internal private key */
174 #define AUL_K_HWACC             "__AUL_HWACC__"
175 /** AUL internal private key */
176 #define AUL_K_APPID             "__AUL_APPID__"
177 /** AUL internal private key */
178 #define AUL_K_PID               "__AUL_PID__"
179 /** AUL internal private key */
180 #define AUL_K_WID               "__AUL_WID__"
181 /** AUL internal private key */
182 #define AUL_K_LEADER_PID        "__AUL_LEADER_PID__"
183 /** AUL internal private key - To support data control */
184 #define AUL_K_DATA_CONTROL_TYPE   "__AUL_DATA_CONTROL_TYPE__"
185 /** AUL internal private key */
186 #define AUL_K_PKGID             "__AUL_PKGID_"
187 /** AUL internal private key */
188 #define AUL_K_INTERNAL_POOL "__AUL_INTERNAL_POOL__"
189 /** AUL internal private key */
190 #define AUL_TEP_PATH            "_AUL_TEP_PATH_"
191 /** AUL internal private key */
192 #define AUL_K_COMP_TYPE         "__AUL_COMP_TYPE__"
193 /** AUL internal private key */
194 #define AUL_K_LOADER_ID         "__AUL_LOADER_ID__"
195 /** AUL internal private key */
196 #define AUL_K_LOADER_PATH       "__AUL_LOADER_PATH__"
197 /** AUL internal private key */
198 #define AUL_K_LOADER_EXTRA      "__AUL_LOADER_EXTRA__"
199 /** AUL internal private key */
200 #define AUL_K_LOADER_NAME       "__AUL_LOADER_NAME__"
201 /** AUL internal private key */
202 #define AUL_K_WAYLAND_DISPLAY   "__AUL_WAYLAND_DISPLAY__"
203 /** AUL internal private key */
204 #define AUL_K_WAYLAND_WORKING_DIR "__AUL_WAYLAND_WORKING_DIR__"
205 /** AUL internal private key */
206 #define AUL_K_COM_SENDER_PID    "__AUL_COM_SENDER_PID__"
207 /** AUL internal private key */
208 #define AUL_K_COM_ENDPOINT      "__AUL_COM_ENDPOINT__"
209 /** AUL internal private key */
210 #define AUL_K_COM_PRIVILEGE     "__AUL_COM_PRIVILEGE__"
211 /** AUL internal private key */
212 #define AUL_K_COM_PROPAGATE     "__AUL_COM_PROPAGATE__"
213 /** AUL internal private key */
214 #define AUL_K_COM_FILTER        "__AUL_COM_FILTER__"
215 /** AUL internal private key */
216 #define AUL_K_COM_RESULT        "__AUL_COM_RESULT__"
217 /** AUL internal private key */
218 #define AUL_K_ROOT_PATH         "__AUL_ROOT_PATH__"
219 /** AUL internal private key */
220 #define AUL_K_SEQ_NUM           "__AUL_SEQ_NUM__"
221 /** AUL internal private key */
222 #define AUL_K_API_VERSION       "__AUL_API_VERSION__"
223 /** AUL internal private key */
224 #define AUL_K_ALLOWED_BG        "__AUL_ALLOWED_BG__"
225 /** AUL internal private key */
226 #define AUL_K_OWNER_PID         "__AUL_OWNER_PID__"
227 /** AUL internal private key */
228 #define AUL_K_CHILD_PID         "__AUL_CHILD_PID__"
229 /** AUL internal private key */
230 #define AUL_K_WIDGET_VIEWER     "__AUL_WIDGET_VIEWER__"
231 /** AUL internal private key */
232 #define AUL_K_WIDGET_ID         "__AUL_WIDGET_ID__"
233 /** AUL internal private key */
234 #define AUL_K_WIDGET_INSTANCE_ID        "__AUL_WIDGET_INSTANCE_ID__"
235 /** AUL internal private key */
236 #define AUL_K_WIDGET_STATUS             "__AUL_WIDGET_STATUS__"
237 /** AUL internal private key */
238 #define AUL_K_WIDGET_CONTENT_INFO       "__AUL_WIDGET_CONTENT_INFO__"
239 /** AUL internal private key */
240 #define AUL_K_TARGET_PID        "__AUL_TARGET_PID__"
241 /** AUL internal private key */
242 #define AUL_K_ALIAS_APPID       "__AUL_ALIAS_APPID__"
243 /** AUL internal private key */
244 #define AUL_K_ORG_APPID         "__AUL_ORG_APPID__"
245 /** AUL internal private key */
246 #define AUL_K_STATUS            "__AUL_STATUS__"
247 /** AUL internal private key */
248 #define AUL_K_IS_SUBAPP         "__AUL_IS_SUBAPP__"
249
250 /**
251  * @brief       This is callback function for aul_launch_init
252  * @param[in]   type    event's type received from system
253  * @param[in]   b       In case of RESET events, bundle which is received from peer
254  * @param[in]   data    user-supplied data
255  */
256 typedef int (*aul_handler_fn)(aul_type type, bundle *b, void *data);
257
258 /**
259  * @par Description:
260  *      This API install your AUL handler and setup AUL internal connection.
261  * @par Purpose:
262  *      AUL receive START(RESET), RESUME, TERMINATE events from system.\n
263  *      This API use to handle the events. \n
264  * @par Typical use case:
265  *      In general, you need not use this API.
266  *      If you use AppCore, you should NOT use this API.
267  *      AppCore will set default aul_handler.
268  *
269  * @param[in]   handler         aul main callback handler function
270  * @param[in]   data            user-supplied data for start_handler
271  * @return      0 if success, negative value(<0) if fail\n
272  * @retval      AUL_R_OK        - success
273  * @retval      AUL_R_ECANCELD  - aul handler was installed already by others
274  * @retval      AUL_R_ECOMM     - error to create internal ipc
275  * @retval      AUL_R_ERROR     - error to attach glib main loop
276  *
277  * @warning     If you use AppCore, you should NOT use this API.\n
278  *              You need glib main loop.\n
279  * @pre
280  *      you must have aul handler to use this API.
281  *      aul_luanch_init register aul handler.
282  * @code
283  * #include <aul.h>
284  * #include <bundle.h>
285  *
286  * static int aul_handler(aul_type type, bundle *kb,void *data)
287  * {
288  *      switch(type)
289  *      {
290  *              case AUL_START:
291  *                      // process RESET event
292  *                      break;
293  *              case AUL_RESUME:
294  *                      // process RESUME event
295  *                      break;
296  *              case AUL_TERMINATE:
297  *                      // preocess TERMINATE event
298  *                      break;
299  *      }
300  *      return 0;
301  * }
302  *
303  * static GMainLoop *mainloop = NULL;
304  *
305  * int main(int argc, char **argv)
306  * {
307  *      aul_launch_init(aul_handler,NULL);
308  *      aul_launch_argv_handler(argc, argv);
309  *
310  *      mainloop = g_main_loop_new(NULL, FALSE);
311  *      g_main_loop_run(mainloop);
312  * }
313  *
314  * @endcode
315  * @remark
316  *      This API is only available in User Session.
317 */
318 int aul_launch_init(aul_handler_fn handler, void *data);
319
320 /**
321  * @par Description:
322  *      This API create internal RESET events with given argc, argv \n
323  * @par Purpose:
324  *      This API's purpose is to generate reset event.
325  *      If you want to generate local RESET events with argument vector format, use this API
326  * @par Typical use case:
327  *      In general, you need not use this API.
328  *      AppCore use this API to create internal reset event.
329  *
330  * @param[in]   argc    # of args
331  * @param[in]   argv    list of arg strings
332  * @return      0 if success, negative value(<0) if fail
333  * @retval      AUL_R_OK        - success
334  * @retval      AUL_R_ENOINIT   - aul handler was NOT yet installed
335  * @retval      AUL_R_ECANCLED  - error to create internal bundle with given argc,argv.
336  * @retval      AUL_R_ERROR     - general error
337  *
338  * @pre
339  *      you must have aul handler to use this API.
340  *      aul_luanch_init register aul handler.
341  * @see
342  *      aul_launch_init
343  * @code
344  * #include <aul.h>
345  * #include <bundle.h>
346  *
347  * int send_local_reset_event()
348  * {
349  *      int argc=3;
350  *      char* argv[4];
351  *      argv[0] = "local.app";
352  *      argv[1] = "event_type";
353  *      argv[2] = "my_reset";
354  *      argv[3] = NULL;
355  *      aul_launch_argv_handler(argc,argv);
356  * }
357  *
358  * @endcode
359  * @remark
360  *      If you use AppCore, you NEED NOT use this API.
361  *      This API is only available in User Session.
362 */
363 int aul_launch_argv_handler(int argc, char **argv);
364
365 /**
366  * @par Description:
367  *      This API creates internal RESET events with given bundle \n
368  * @par Purpose:
369  *  This API's purpose is to generate reset event.
370  *  If you want to generate local RESET events with argument vector format, first use
371  *  bundle_import_from_argv to create a bundle from the argument vector and then use this API
372  *  Eventually, this API will replace aul_launch_argv_handler().
373  * @par Typical use case:
374  *      In general, you need not use this API.
375  *      AppCore use this API to create internal reset event.
376  *
377  * @param[in]   b       bundle
378  * @return      0 if success, negative value(<0) if fail
379  * @retval      AUL_R_OK        - success
380  * @retval      AUL_R_ENOINIT   - aul handler was NOT yet installed
381  * @retval      AUL_R_ERROR     - general error
382  *
383  * @pre
384  *      you must have aul handler to use this API.
385  *      aul_luanch_init register aul handler.
386  * @post
387  *      None
388  * @see
389  *      aul_launch_init, bundle_import_from_argv
390  * @code
391  * #include <aul.h>
392  * #include <bundle.h>
393  *
394  * int send_local_reset_event()
395  * {
396  *  bundle* b;
397  *      int argc=3;
398  *      char* argv[4];
399  *      argv[0] = "local.app";
400  *      argv[1] = "event_type";
401  *      argv[2] = "my_reset";
402  *      argv[3] = NULL;
403  *
404  *      b = bundle_import_from_argv(argc,argv);
405  *      aul_launch_local(b);
406  * }
407  *
408  * @endcode
409  * @remark
410  *      If you use AppCore, you NEED NOT to use this API.
411  *      This API is only available in User Session.
412 */
413 int aul_launch_local(bundle *b);
414
415 /**
416  * @par Description:
417  *      This API launches application with the given bundle.
418  *  If the application is not running or a multiple-instance one, this API launches with the given bundle.
419  *      If the application is running, this API sends a RESET event to the App.
420  *      While the application is running, if the application cannot receive the RESET event,
421  *      this API returns a general error(AUL_R_ERROR).\n
422  * @par Purpose:
423  *      This API is for caller.
424  *      This API's purpose is to launch/reset application with given bundle.
425  * @par Typical use case:
426  *      If you know the target application's pkgname and bundle types,
427  *      you can use this API to launch/reset the application.
428  *
429  * @param[in]   pkgname         package name to be run as callee
430  * @param[in]   kb              bundle to be passed to callee
431  * @return      callee's pid if success, negative value(<0) if fail
432  * @retval      AUL_R_OK        - success
433  * @retval      AUL_R_EINVAL    - invaild package name
434  * @retval      AUL_R_ECOM      - internal AUL IPC error
435  * @retval      AUL_R_ERROR     - general error
436  *
437  * @see
438  *      aul_open_app
439  * @code
440  * #include <aul.h>
441  * #include <bundle.h>
442  *
443  * int launch_inhouse_contact_app()
444  * {
445  *      bundle *b;
446  *      b = bundle_create();
447  *      bundle_add(b,"type","SIM");
448  *      aul_launch_app("org.tizen.contact",b);
449  * }
450  *
451  * @endcode
452  * @remark
453  *      This API is only available in User Session.
454  */
455 int aul_launch_app(const char *appid, bundle *kb);
456
457 /**
458  * @par Description:
459  *      This API launches application with the given bundle.
460  *  If the application is not running or a multiple-instance one, this API launches with the given bundle.
461  *      If the application is running, this API sends a RESET event to the App.
462  *      While the application is running, if the application cannot receive the RESET event,
463  *      this API returns a general error(AUL_R_ERROR).\n
464  * @par Purpose:
465  *      This API is for caller.
466  *      This API's purpose is to launch/reset application with given bundle.
467  * @par Typical use case:
468  *      If you know the target application's pkgname and bundle types,
469  *      you can use this API to launch/reset the application.
470  *
471  * @param[in]   pkgname         package name to be run as callee
472  * @param[in]   kb              bundle to be passed to callee
473  * @param[in]   uid             User ID to launch
474  * @return      callee's pid if success, negative value(<0) if fail
475  * @retval      AUL_R_OK        - success
476  * @retval      AUL_R_EINVAL    - invaild package name
477  * @retval      AUL_R_ECOM      - internal AUL IPC error
478  * @retval      AUL_R_ERROR     - general error
479  *
480  * @see
481  *      aul_open_app
482  * @remark
483  *      This API is also available in System Session.
484  */
485 int aul_launch_app_for_uid(const char *appid, bundle *kb, uid_t uid);
486
487 /**
488  * @par Description:
489  *  This API launches application, as menu screen launches the app.
490  *  Thus, if the applocation is running, this API sends a RESUME event to the app.
491  *  If the application is not running, this API launches the app.
492  *  While the application is running, if the application cannot receive the RESUME event,
493  *  AUL tries to raise the application's default window.
494  *
495  * @par Purpose:
496  *      This API is for caller.
497  *      This API's purpose is to resume/launch application
498  * @par Typical use case:
499  *      If you only want to show application with previous state or default state, Use this API.
500  *
501  * @param[in]   pkgname         package name to be resume as callee
502  * @return      callee's pid if success, negative value(<0) if fail
503  * @retval      AUL_R_OK        - success
504  * @retval      AUL_R_EINVAL    - invaild package name
505  * @retval      AUL_R_ECOM      - internal AUL IPC error
506  * @retval      AUL_R_ERROR     - general error
507  *
508  * @see
509  *      aul_launch_app, aul_app_is_running, aul_resume_pid
510  * @code
511  * #include <aul.h>
512  * #include <bundle.h>
513  *
514  * int open_inhouse_contact_app()
515  * {
516  *      if(aul_app_is_running("org.tizen.contact"))
517  *              aul_open_app("org.tizen.contact");
518  * }
519  *
520  * @endcode
521  * @remark
522  *      If you don't want to launch the app,
523  *      you should check app's running state with aul_app_is_running.
524  *      This API will launch the application if the application is not running.
525  *      This API is only available in User Session.
526 */
527 int aul_open_app(const char *appid);
528
529 /**
530  * @par Description:
531  *  This API launches application, as menu screen launches the app.
532  *  Thus, if the applocation is running, this API sends a RESUME event to the app.
533  *  If the application is not running, this API launches the app.
534  *  While the application is running, if the application cannot receive the RESUME event,
535  *  AUL tries to raise the application's default window.
536  *
537  * @par Purpose:
538  *      This API is for caller.
539  *      This API's purpose is to resume/launch application
540  * @par Typical use case:
541  *      If you only want to show application with previous state or default state, Use this API.
542  *
543  * @param[in]   pkgname         package name to be resume as callee
544  * @param[in]   uid             User ID
545  * @return      callee's pid if success, negative value(<0) if fail
546  * @retval      AUL_R_OK        - success
547  * @retval      AUL_R_EINVAL    - invaild package name
548  * @retval      AUL_R_ECOM      - internal AUL IPC error
549  * @retval      AUL_R_ERROR     - general error
550  *
551  * @remark
552  *      If you don't want to launch the app,
553  *      you should check app's running state with aul_app_is_running.
554  *      This API will launch the application if the application is not running.
555  *      This API is only available to System user.
556  */
557 int aul_open_app_for_uid(const char *appid, uid_t uid);
558
559 /**
560  * @par Description:
561  *      This API trigger to resume application
562  *      If the application is running, this API send a resume event to the App.
563  *      If the application is not running, this API returns fail.
564  *      Although the application is running, if the application cannot receive resume event,
565  *      AUL try to raise the application's default windows.
566  * @par Purpose:
567  *      This API is for caller.
568  *      This API's purpose is to send resume event.
569  * @par Typical use case:
570  *      If you only want to show application with previous state or default state, Use this API.
571  *
572  * @param[in]   pkgname         package name to be resume as callee
573  * @return      callee's pid if success, negative value(<0) if fail
574  * @retval      AUL_R_OK        - success
575  * @retval      AUL_R_EINVAL    - invaild package name
576  * @retval      AUL_R_ECOM      - internal AUL IPC error
577  * @retval      AUL_R_ERROR     - general error
578  *
579  * @see
580  *      aul_launch_app, aul_app_is_running, aul_resume_pid
581  * @deprecated
582  *  This function will be deprecated. Use aul_open_add() instead.
583  * @code
584  * #include <aul.h>
585  * #include <bundle.h>
586  *
587  * int resume_inhouse_contact_app()
588  * {
589  *      if(aul_app_is_running("org.tizen.contact"))
590  *              aul_resume_app("org.tizen.contact");
591  * }
592  *
593  * @endcode
594  * @remark
595  *      If you don't want to launch the app,
596  *      you should check app's running state with aul_app_is_running.
597  *      This API will launch the application if the application is not running.
598  *      If you want to only resume without launching in multiple instance application model,
599  *      you should use aul_resume_pid.
600  *      This API is only available in User Session.
601 */
602 int aul_resume_app(const char *appid);
603
604 /**
605  * @par Description:
606  *      This API trigger to resume application
607  *      If the application is running, this API send a resume event to the App.
608  *      If the application is not running, this API returns fail.
609  *      Although the application is running, if the application cannot receive resume event,
610  *      AUL try to raise the application's default windows.
611  * @par Purpose:
612  *      This API is for caller.
613  *      This API's purpose is to send resume event.
614  * @par Typical use case:
615  *      If you only want to show application with previous state or default state, Use this API.
616  *
617  * @param[in]   pkgname         package name to be resume as callee
618  * @param[in]   uid             User ID
619  * @return      callee's pid if success, negative value(<0) if fail
620  * @retval      AUL_R_OK        - success
621  * @retval      AUL_R_EINVAL    - invaild package name
622  * @retval      AUL_R_ECOM      - internal AUL IPC error
623  * @retval      AUL_R_ERROR     - general error
624  *
625  * @remark
626  *      If you don't want to launch the app,
627  *      you should check app's running state with aul_app_is_running.
628  *      This API will launch the application if the application is not running.
629  *      If you want to only resume without launching in multiple instance application model,
630  *      you should use aul_resume_pid.
631  *      This API is only available to System user.
632  */
633 int aul_resume_app_for_uid(const char *appid, uid_t uid);
634
635 /**
636  * @par Description:
637  *      This API trigger to resume application
638  *      If the application is running, this API send a resume event to the App.
639  *      If the application is not running, this API return AUL_R_ERROR.
640  *      Although the application is running, if the application cannot receive resume event,
641  *      AUL try to raise the application's default windows.
642  * @par Purpose:
643  *      This API is for caller.
644  *      This API's purpose is to send resume event.
645  * @par Typical use case:
646  *      In multiple application model, If you want to only resume specific application, Use this API
647  *
648  * @param[in]   pid     application's pid to be resumed
649  * @return      0 if success, negative value(<0) if fail
650  * @retval      AUL_R_OK        - success
651  * @retval      AUL_R_EINVAL    - invaild pid
652  * @retval      AUL_R_ECOM      - internal AUL IPC error
653  * @retval      AUL_R_ERROR     - general error (include application is not running)
654  * @warning     This API need to require root or inhouse permisssion \n
655  *              If you have not the permission, this API return AUL_R_ERROR. \n
656  * @see
657  *      aul_launch_app
658  * @code
659  * #include <aul.h>
660  * #include <bundle.h>
661  *
662  * int iterfunc(const aul_app_info *info, void *data)
663  * {
664  *      if(strcmp(info->pkg_name,"org.tizen.contact")==0)
665  *              aul_resume_pid(info->pid);
666  * }
667  *
668  * int iterate_running_apps()
669  * {
670  *      return aul_app_get_running_app_info(iterfunc,NULL);
671  * }
672  *
673  * @endcode
674  * @remark
675  *      This API is only available in User Session.
676 */
677 int aul_resume_pid(int pid);
678
679 /**
680  * @par Description:
681  *      This API trigger to resume application
682  *      If the application is running, this API send a resume event to the App.
683  *      If the application is not running, this API return AUL_R_ERROR.
684  *      Although the application is running, if the application cannot receive resume event,
685  *      AUL try to raise the application's default windows.
686  * @par Purpose:
687  *      This API is for caller.
688  *      This API's purpose is to send resume event.
689  * @par Typical use case:
690  *      In multiple application model, If you want to only resume specific application, Use this API
691  *
692  * @param[in]   pid     application's pid to be resumed
693  * @param[in]   uid     User ID
694  * @return      0 if success, negative value(<0) if fail
695  * @retval      AUL_R_OK        - success
696  * @retval      AUL_R_EINVAL    - invaild pid
697  * @retval      AUL_R_ECOM      - internal AUL IPC error
698  * @retval      AUL_R_ERROR     - general error (include application is not running)
699  * @warning     This API need to require root or inhouse permisssion \n
700  *              If you have not the permission, this API return AUL_R_ERROR. \n
701  * @remark
702  *      This API is only available to System user.
703 */
704 int aul_resume_pid_for_uid(int pid, uid_t uid);
705
706 /**
707  * @par Description:
708  *      This API trigger to terminate application
709  *
710  *      If the application is running, this API send a terminate event to the App. \n
711  *      If the app cannot receive the event, AUL kill forcely the application.\n
712  * @par Purpose:
713  *      This API's purpose is to kill application
714  * @par Typical use case:
715  *      In general, Application like Task Manager use this API.
716  *
717  *              This API need to require root or inhouse permisssion. \n
718  *
719  * @param[in]   pid     application's pid to be terminated
720  * @return      0 if success, negative value(<0) if fail
721  * @retval      AUL_R_OK        - success
722  * @retval      AUL_R_EINVAL    - invaild pid
723  * @retval      AUL_R_ECOM      - internal AUL IPC error
724  * @retval      AUL_R_ERROR     - general error
725  * @warning     This API need to require root or inhouse permisssion. \n
726  *
727  * @code
728  * #include <aul.h>
729  * #include <bundle.h>
730  *
731  * int iterfunc(const aul_app_info *info, void *data)
732  * {
733  *      if(strcmp(info->pkg_name,"org.tizen.contact")==0)
734  *              aul_terminate_pid(info->pid);
735  * }
736  *
737  * int iterate_running_apps()
738  * {
739  *      return aul_app_get_running_app_info(iterfunc,NULL);
740  * }
741  *
742  * @endcode
743  * @remark
744  *      If you have not the permission, this API return AUL_R_ERROR. \n
745  *      This API is only available in User Session.
746 */
747 int aul_terminate_pid(int pid);
748
749 /**
750  * @par Description:
751  *      This API trigger to terminate application
752  *
753  *      If the application is running, this API send a terminate event to the App. \n
754  *      If the app cannot receive the event, AUL kill forcely the application.\n
755  * @par Purpose:
756  *      This API's purpose is to kill application
757  * @par Typical use case:
758  *      In general, Application like Task Manager use this API.
759  *
760  *              This API need to require root or inhouse permisssion. \n
761  *
762  * @param[in]   pid     application's pid to be terminated
763  * @param[in]   uid     User ID
764  * @return      0 if success, negative value(<0) if fail
765  * @retval      AUL_R_OK        - success
766  * @retval      AUL_R_EINVAL    - invaild pid
767  * @retval      AUL_R_ECOM      - internal AUL IPC error
768  * @retval      AUL_R_ERROR     - general error
769  * @warning     This API need to require root or inhouse permisssion. \n
770  *
771  * @remark
772  *      If you have not the permission, this API return AUL_R_ERROR. \n
773  *      This API is only available to System user.
774  */
775 int aul_terminate_pid_for_uid(int pid, uid_t uid);
776
777 /**
778  * @par Description:
779  *      This API trigger to terminate application asynchronously
780  *
781  *      If the application is running, this API send a terminate event to the App. \n
782  *      If the app cannot receive the event, AUL kill forcely the application.\n
783  * @par Purpose:
784  *      This API's purpose is to kill application
785  * @par Typical use case:
786  *      In general, Application like Task Manager use this API.
787  *
788  *              This API need to require root or inhouse permisssion. \n
789  *
790  * @param[in]   pid     application's pid to be terminated
791  * @return      0 if success, negative value(<0) if fail
792  * @retval      AUL_R_OK        - success
793  * @retval      AUL_R_EINVAL    - invaild pid
794  * @retval      AUL_R_ECOM      - internal AUL IPC error
795  * @retval      AUL_R_ERROR     - general error
796  * @warning     This API need to require root or inhouse permisssion. \n
797  * @remark
798  *      If you have not the permission, this API return AUL_R_ERROR. \n
799  *      This API is only available in User Session.
800 */
801 int aul_terminate_pid_async(int pid);
802
803 /**
804  * @par Description:
805  *      This API trigger to terminate application asynchronously
806  *
807  *      If the application is running, this API send a terminate event to the App. \n
808  *      If the app cannot receive the event, AUL kill forcely the application.\n
809  * @par Purpose:
810  *      This API's purpose is to kill application
811  * @par Typical use case:
812  *      In general, Application like Task Manager use this API.
813  *
814  *              This API need to require root or inhouse permisssion. \n
815  *
816  * @param[in]   pid     application's pid to be terminated
817  * @param[in]   uid     User ID
818  * @return      0 if success, negative value(<0) if fail
819  * @retval      AUL_R_OK        - success
820  * @retval      AUL_R_EINVAL    - invaild pid
821  * @retval      AUL_R_ECOM      - internal AUL IPC error
822  * @retval      AUL_R_ERROR     - general error
823  * @warning     This API need to require root or inhouse permisssion. \n
824  * @remark
825  *      If you have not the permission, this API return AUL_R_ERROR. \n
826  *      This API is only available to System user.
827  */
828 int aul_terminate_pid_async_for_uid(int pid, uid_t uid);
829
830 /**
831  * @par Description:
832  *      This API trigger to terminate application synchronously
833  *
834  *      If the application is running, this API sends a terminate event to the application. \n
835  *      And then, this API waits until the application is terminated successfully. \n
836  *      If the app cannot receive the event, AUL kill forcely the application. \n
837  * @par Purpose:
838  *      This API's purpose is to kill application
839  * @par Typical use case:
840  *      In general, Application like Task Manager use this API.
841  *
842  *              This API need to require root or platform level permisssion. \n
843  *
844  * @param[in]   pid     application's pid to be terminated
845  * @return      0 if success, negative value(<0) if fail
846  * @retval      AUL_R_OK        - success
847  * @retval      AUL_R_EINVAL    - invaild pid
848  * @retval      AUL_R_ECOM      - internal AUL IPC error
849  * @retval      AUL_R_ERROR     - general error
850  * @warning     This API need to require root or platform level permisssion. \n
851  * @remark
852  *      If you have not the permission, this API return AUL_R_ERROR. \n
853  *      This API is only available in User Session.
854 */
855 int aul_terminate_pid_sync(int pid);
856
857 /**
858  * @par Description:
859  *      This API trigger to terminate application synchronously
860  *
861  *      If the application is running, this API send a terminate event to the application. \n
862  *      And then, this API waits until the application is terminated successfully. \n
863  *      If the app cannot receive the event, AUL kill forcely the application. \n
864  * @par Purpose:
865  *      This API's purpose is to kill application
866  * @par Typical use case:
867  *      In general, Application like Task Manager use this API.
868  *
869  *              This API need to require root or platform level permisssion. \n
870  *
871  * @param[in]   pid     application's pid to be terminated
872  * @param[in]   uid     User ID
873  * @return      0 if success, negative value(<0) if fail
874  * @retval      AUL_R_OK        - success
875  * @retval      AUL_R_EINVAL    - invaild pid
876  * @retval      AUL_R_ECOM      - internal AUL IPC error
877  * @retval      AUL_R_ERROR     - general error
878  * @warning     This API need to require root or platform level permisssion. \n
879  * @remark
880  *      If you have not the permission, this API return AUL_R_ERROR. \n
881  *      This API is only available to System user.
882  */
883 int aul_terminate_pid_sync_for_uid(int pid, uid_t uid);
884
885 /**
886  *@brief Running application's information structure retrieved by AUL
887  */
888 typedef struct _aul_app_info {
889         int pid;                /**< app's pid if running*/
890         char *pkg_name;         /**< application id */
891         char *app_path;         /**< application excutable path */
892         char *appid;
893         char *pkgid;            /**< package id */
894         int status;             /**< app's status */
895         int is_sub_app;         /**< state whether sub app of app group */
896 } aul_app_info;
897
898 /**
899  * @brief iterator function running with aul_app_get_running_app_info
900  * @param[out]  ainfo   aul_app_info retreived by aul_app_get_running_app_info
901  * @param[out]  data    user-supplied data
902 */
903 typedef int (*aul_app_info_iter_fn)(const aul_app_info *ainfo, void *data);
904
905 /**
906  * @par Description:
907  *      This API ask a application is running by application package name.
908  * @par Purpose:
909  *      To know whether some application is running or not, use this API
910  * @par Typical use case:
911  *      For example, If you want to know browser application running,
912  *      you can check it by using this API.
913  *
914  * @param[in]   pkgname application package name
915  * @return      true / false
916  * @retval      1       app_name is running now.
917  * @retval      0       app_name is NOT running now.
918  *
919  * @code
920  * #include <aul.h>
921  *
922  * int is_running_browser_app()
923  * {
924  *      return aul_app_is_running("org.tizen.browser");
925  * }
926  *
927  * @endcode
928  * @remark
929  *      This API is only available in User Session.
930  *
931  */
932 int aul_app_is_running(const char *appid);
933
934 /**
935  * @par Description:
936  *      This API ask a application is running by application package name.
937  * @par Purpose:
938  *      To know whether some application is running or not, use this API
939  * @par Typical use case:
940  *      For example, If you want to know browser application running,
941  *      you can check it by using this API.
942  *
943  * @param[in]   pkgname application package name
944  * @param[in]   uid     User ID
945  * @return      true / false
946  * @retval      1       app_name is running now.
947  * @retval      0       app_name is NOT running now.
948  *
949  * @endcode
950  * @remark
951  *      This API is only available to System User.
952  */
953 int aul_app_is_running_for_uid(const char *appid, uid_t uid);
954
955 /**
956  * @par Description:
957  *      This API use to get running application list.
958  *      This API call iter_fn with each aul_app_info of running apps when running application is found.
959  * @par Purpose:
960  *      If you want to get running application list, use this API
961  * @par Typical use case:
962  *      In general, this API is used by task manager appllication. (running application list viewer)
963  *
964  * @param[in]   iter_fn         iterator function
965  * @param[in]   data            user-supplied data for iter_fn
966  * @return      0 if success, negative value(<0) if fail
967  * @retval      AUL_R_OK        - success
968  * @retval      AUL_R_ERROR     - internal error
969  *
970  * @code
971  * #include <aul.h>
972  *
973  * int iterfunc(const aul_app_info* info, void* data)
974  * {
975  *      printf("\t==========================\n");
976  *      printf("\t pkg_name: %s\n", info->appid);
977  *      printf("\t app_path: %s\n", info->app_path);
978  *      printf("\t running pid: %d\n", info->pid);
979  *      printf("\t==========================\n");
980  *      return 0;
981  * }
982  *
983  * int iterate_running_apps()
984  * {
985  *      return aul_app_get_running_app_info(iterfunc,NULL);
986  * }
987  *
988  * @endcode
989  * @remark
990  *      This API should use if you want to know running application which has desktop files.
991  *      If you want to get all process list, you must iterate process information by using proc filesystem
992  *      Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
993  *      This API is only available in User Session.
994  */
995 int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
996
997 /**
998  * @par Description:
999  *      This API use to get running application list.
1000  *      This API call iter_fn with each aul_app_info of running apps when running application is found.
1001  * @par Purpose:
1002  *      If you want to get running application list, use this API
1003  * @par Typical use case:
1004  *      In general, this API is used by task manager appllication. (running application list viewer)
1005  *
1006  * @param[in]   iter_fn         iterator function
1007  * @param[in]   data            user-supplied data for iter_fn
1008  * @param[in]   uid             User ID
1009  * @return      0 if success, negative value(<0) if fail
1010  * @retval      AUL_R_OK        - success
1011  * @retval      AUL_R_ERROR     - internal error
1012  *
1013  * @remark
1014  *      This API should use if you want to know running application which has desktop files.
1015  *      If you want to get all process list, you must iterate process information by using proc filesystem
1016  *      Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
1017  *      This API is only available to System user.
1018  */
1019 int aul_app_get_running_app_info_for_uid(aul_app_info_iter_fn iter_fn, void *data, uid_t uid);
1020
1021 /**
1022  * @par Description:
1023  *      This API use to get all running application list, including sub app.
1024  *      This API call iter_fn with each aul_app_info of running apps when running application is found.
1025  * @par Purpose:
1026  *      If you want to get all running application list, use this API
1027  * @par Typical use case:
1028  *      In general, this API is used by task manager application. (running application list viewer)
1029  *
1030  * @param[in]   iter_fn         iterator function
1031  * @param[in]   data            user-supplied data for iter_fn
1032  * @return      0 if success, negative value(<0) if fail
1033  * @retval      AUL_R_OK        - success
1034  * @retval      AUL_R_ERROR     - internal error
1035  *
1036  * @code
1037  * #include <aul.h>
1038  *
1039  * int iterfunc_status(const aul_app_info *info, void *data)
1040  * {
1041  *      printf("\t==========================\n");
1042  *      printf("\t pid: %d\n", info->pid);
1043  *      printf("\t appid: %s\n", info->appid);
1044  *      printf("\t app_path: %s\n", info->app_path);
1045  *      printf("\t pkgid: %s\n", info->pkgid);
1046  *      printf("\t status: %d\n", info->status);
1047  *      printf("\t is_sub_app : %d\n", info->is_sub_app);
1048  *      printf("\t==========================\n");
1049  *      return 0;
1050  * }
1051  *
1052  * int iterate_running_apps()
1053  * {
1054  *      return aul_app_get_all_running_app_info(iterfunc_status,NULL);
1055  * }
1056  *
1057  * @endcode
1058  * @remark
1059  *      This API should use if you want to know running application which has desktop files.
1060  *      If you want to get all process list, you must iterate process information by using proc filesystem
1061  *      Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
1062  *      This API is only available in User Session.
1063  */
1064 int aul_app_get_all_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
1065
1066 /**
1067  * @par Description:
1068  *      This API use to get all running application list, including sub app.
1069  *      This API call iter_fn with each aul_app_info of running apps when running application is found.
1070  * @par Purpose:
1071  *      If you want to get all running application list, use this API
1072  * @par Typical use case:
1073  *      In general, this API is used by task manager application. (running application list viewer)
1074  *
1075  * @param[in]   iter_fn         iterator function
1076  * @param[in]   data            user-supplied data for iter_fn
1077  * @param[in]   uid             User ID
1078  * @return      0 if success, negative value(<0) if fail
1079  * @retval      AUL_R_OK        - success
1080  * @retval      AUL_R_ERROR     - internal error
1081  *
1082  * @remark
1083  *      This API should use if you want to know running application which has desktop files.
1084  *      If you want to get all process list, you must iterate process information by using proc filesystem
1085  *      Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
1086  *      This API is only available to System user.
1087  */
1088 int aul_app_get_all_running_app_info_for_uid(aul_app_info_iter_fn iter_fn, void *data, uid_t uid);
1089
1090 /**
1091  * @par Description:
1092  *      This API get application package name by pid
1093  * @par Purpose:
1094  *      If you want to get package name of running application, use this API
1095  * @par Typical use case:
1096  *      In general, You can use this API when you want to know caller's information.
1097  *
1098  * @param[in]   pid             given pid
1099  * @param[out]  pkgname         pkgname to be get
1100  * @param[in]   len             length of pkgname
1101  * @return      0 if success, negative value(<0) if fail
1102  * @retval      AUL_R_OK        - success
1103  * @retval      AUL_R_ERROR     - no such a package name
1104  * @code
1105  * #include <aul.h>
1106  * #include <bundle.h>
1107  *
1108  * static int app_reset(bundle *b, void *data)
1109  * {
1110  *      int pid;
1111  *      char appname[255];
1112  *
1113  *      pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
1114  *      aul_app_get_pkgname_bypid(pid, appname, sizeof(appname));
1115  * }
1116  *
1117  * @endcode
1118  * @remark
1119  *      This API is only available in User Session.
1120 */
1121 int aul_app_get_pkgname_bypid(int pid, char *pkgname, int len);
1122
1123 /**
1124  * @par Description:
1125  *      This API get application pkgid by pid
1126  * @par Purpose:
1127  *      If you want to get pkgid of running application, use this API
1128  * @par Typical use case:
1129  *      In general, You can use this API when you want to know caller's information.
1130  *
1131  * @param[in]   pid             given pid
1132  * @param[out]  pkgid           package id
1133  * @param[in]   len             length of pkgid
1134  * @return      0 if success, negative value(<0) if fail
1135  * @retval      AUL_R_OK        - success
1136  * @retval      AUL_R_ERROR     - no such a appid
1137  *
1138  * @code
1139  * #include <aul.h>
1140  * #include <bundle.h>
1141  *
1142  * static int app_reset(bundle *b, void *data)
1143  * {
1144  *      int pid;
1145  *      char pkgid[255];
1146  *
1147  *      pid = atoi(bundle_get_val(b, AUL_K_CALLER_PID));
1148  *      aul_app_get_pkgid_bypid(pid, pkgid, sizeof(pkgid));
1149  * }
1150  *
1151  * @endcode
1152  * @remark
1153  *      This API is only available in User Session.
1154 */
1155 int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len);
1156
1157 /**
1158  * @par Description:
1159  *      This API get application pkgid by pid
1160  * @par Purpose:
1161  *      If you want to get pkgid of running application, use this API
1162  * @par Typical use case:
1163  *      In general, You can use this API when you want to know caller's information.
1164  *
1165  * @param[in]   pid             given pid
1166  * @param[out]  pkgid           package id
1167  * @param[in]   len             length of pkgid
1168  * @param[in]   uid             User ID
1169  * @return      0 if success, negative value(<0) if fail
1170  * @retval      AUL_R_OK        - success
1171  * @retval      AUL_R_ERROR     - no such a appid
1172  *
1173  * @remark
1174  *      This API is also available to System user.
1175 */
1176 int aul_app_get_pkgid_bypid_for_uid(int pid, char *pkgid, int len, uid_t uid);
1177
1178 /**
1179  * @par Description:
1180  *      This API get application appid by pid
1181  * @par Purpose:
1182  *      If you want to get appid of running application, use this API
1183  * @par Typical use case:
1184  *      In general, You can use this API when you want to know caller's information.
1185  *
1186  * @param[in]   pid             given pid
1187  * @param[out]  appid           application id
1188  * @param[in]   len             length of pkgname
1189  * @return      0 if success, negative value(<0) if fail
1190  * @retval      AUL_R_OK        - success
1191  * @retval      AUL_R_ERROR     - no such a appid
1192  * @code
1193  * #include <aul.h>
1194  * #include <bundle.h>
1195  *
1196  * static int app_reset(bundle *b, void *data)
1197  * {
1198  *      int pid;
1199  *      char appid[255];
1200  *
1201  *      pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
1202  *      aul_app_get_appid_bypid(pid, appid, sizeof(appid));
1203  * }
1204  *
1205  * @endcode
1206  * @remark
1207  *      This API is only available in User Session.
1208 */
1209 int aul_app_get_appid_bypid(int pid, char *appid, int len);
1210
1211 /**
1212  * @par Description:
1213  *      This API get application appid by pid
1214  * @par Purpose:
1215  *      If you want to get appid of running application, use this API
1216  * @par Typical use case:
1217  *      In general, You can use this API when you want to know caller's information.
1218  *
1219  * @param[in]   pid             given pid
1220  * @param[out]  appid           application id
1221  * @param[in]   len             length of pkgname
1222  * @param[in]   uid             User ID
1223  * @return      0 if success, negative value(<0) if fail
1224  * @retval      AUL_R_OK        - success
1225  * @retval      AUL_R_ERROR     - no such a appid
1226  * @remark
1227  *      This API is also available to System user.
1228 */
1229 int aul_app_get_appid_bypid_for_uid(int pid, char *appid, int len, uid_t uid);
1230
1231 /**
1232  * @par Description:
1233  *      This API launch application associated with given filename
1234  * @par Purpose:
1235  *      This API is for caller.
1236  *      This API launch application based on mime type.
1237  *      This API find mime_type associated with file name,
1238  *      and then find default app associated with found mime_type
1239  *      and then launch the app with filename argument.
1240  * @par Typical use case:
1241  *      You can launch application to process given filename.
1242  *      That is, Even if you don't know the specific application's pkgname,
1243  *      you can launch the applicaiton processing given filename .
1244  *      For example, If you want to process image file, you can simply launch image viewer.
1245  *      At that time, you can use this APIs like aul_open_file("myimage.jpg");
1246  *
1247  * @param[in]   filename        filename
1248  * @return      callee's pid or 0 if success, negative value if fail\n
1249  *              (when no found default app, return 0)
1250  * @retval      AUL_R_OK        - success
1251  * @retval      AUL_R_EINVAL    - invalid argument(filename)
1252  * @retval      AUL_R_ECOM      - internal AUL IPC error
1253  * @retval      AUL_R_ERROR     - general error
1254  *
1255  * @code
1256  * #include <aul.h>
1257  *
1258  * int view_image_file(char *filename)
1259  * {
1260  *      aul_open_file(filename);
1261  * }
1262  *
1263  * @endcode
1264  * @remark
1265  *      This API is only available in User Session.
1266  *
1267  */
1268 int aul_open_file(const char* filename);
1269
1270 /**
1271  * @par Description:
1272  *      This API launch application associated with given specific mimetype
1273  * @par Purpose:
1274  *      This API is for caller.
1275  *      This API launch application based on mime type like aul_open_file API.
1276  *      But, This API don't find mime_type associated with file name.
1277  *      This API use mimetype given by user. By using given mimetype, find default application.
1278  *      and then launch the app with filename argument.
1279  * @par Typical use case:
1280  *      Some files cannot extract exact mimetype automatically.
1281  *      For example, To know mime type of files with DRM lock, first we should unlock DRM file.
1282  *      In this case, You can use this API.
1283  *      First, unlock DRM file, and extract mimetype from unlock file by using aul_get_mime_from_file,
1284  *      and then, use this API with DRM file and extracted mime type.
1285  *
1286  * @param[in]   filename        filename
1287  * @param[in]   mimetype        specific mimetype
1288  * @return      callee's pid or 0 if success, negative value if fail\n
1289  *              (when no found default app, return 0)
1290  * @retval      AUL_R_OK        - success
1291  * @retval      AUL_R_EINVAL    - invalid argument(filename,mimetype)
1292  * @retval      AUL_R_ECOM      - internal AUL IPC error
1293  * @retval      AUL_R_ERROR     - general error
1294  *
1295  * @see
1296  *      aul_open_file, aul_get_mime_from_file
1297  * @code
1298  * #include <aul.h>
1299  *
1300  * int view_drm_image_file(char *drm_filename)
1301  * {
1302  *      char* mimetype;
1303  *      // you must implement this function
1304  *      mimetype = get_mimetype_from_drmfile(drm_filename);
1305  *
1306  *      aul_open_file_with_mimetype(drm_filename,mimetype);
1307  * }
1308  *
1309  * @endcode
1310  * @remark
1311  *      This API is only available in User Session.
1312  */
1313 int aul_open_file_with_mimetype(const char *filename, const char *mimetype);
1314
1315 /**
1316  * @par Description:
1317  *      This API launch application associated with content like "http://www.samsung.com"
1318  * @par Purpose:
1319  *      This API is for caller.
1320  *      This API launch application based on mime type.
1321  *      This API find mime_type associated with content,
1322  *      and then find default app associated with found mime_type,
1323  *      and then launch the app with content argument.
1324  * @par Typical use case:
1325  *      You can launch application to process given content.
1326  *      That is, Even if you don't know the specific application's pkgname,
1327  *      you can launch the applicaiton processing given content.
1328  *      For example, If you want to process URL "http://www.samsung.com",
1329  *      you can simply launch browser.
1330  *      At that time, you can use this APIs like aul_open_content("http://www.samsung.com");
1331  *
1332  * @param[in]   content         content
1333  * @return      callee's pid or 0 if success, negative value if fail\n
1334  *              (when no found default app, return 0)
1335  * @retval      AUL_R_OK        - success
1336  * @retval      AUL_R_EINVAL    - invalid argument(content)
1337  * @retval      AUL_R_ECOM      - internal AUL IPC error
1338  * @retval      AUL_R_ERROR     - general error or no found mimetype
1339  *
1340  * @code
1341  * #include <aul.h>
1342  *
1343  * int view_url(char *url)
1344  * {
1345  *      aul_open_content(url);
1346  * }
1347  *
1348  * @endcode
1349  * @remark
1350  *      This API is only available in User Session.
1351  *
1352  */
1353 int aul_open_content(const char* content);
1354
1355 /**
1356  * @par Description:
1357  *       This API get the default application(appid) associated with MIME type
1358  * @par Purpose:
1359  *      This API use to get default application associteted with mimetype
1360  *      In general, Setting Application need this API.
1361  * @par Typical use case:
1362  *      Setting Application show mapping of default application / mimetype
1363  *
1364  * @param[in]   mimetype        a mime type
1365  * @param[out]  defapp          a application appid of the app
1366  * @param[in]   len             length of defapp
1367  * @return      0 if success, negative value if fail
1368  * @retval      AUL_R_OK        - success
1369  * @retval      AUL_R_EINVAL    - invalid argument(mimetype)
1370  * @retval      AUL_R_ERROR     - general error or no found mimetype
1371  *
1372  * @see
1373  *      aul_set_defapp_with_mime
1374  * @code
1375  * #include <aul.h>
1376  *
1377  * void get_text_html_defapp()
1378  * {
1379  *      char appname[255];
1380  *      aul_get_defapp_from_mime("text/html",appname,sizeof(appname));
1381  * }
1382  *
1383  * @endcode
1384  * @remark
1385  *      This API is only available in User Session.
1386  *
1387  */
1388 int aul_get_defapp_from_mime(const char *mimetype, char *defapp, int len);
1389
1390 /**
1391  * @par Description:
1392  *       This API set the default application(appid) associated with MIME type
1393  * @par Purpose:
1394  *      This API use to change default application associteted with mimetype
1395  *      In general, Setting Application or Installer need this API.
1396  * @par Typical use case:
1397  *      Default Application associated with mimetype can be changed by Setting Application or installer
1398  *      So, application to process specific mimetype can be substituted.
1399  *
1400  * @param[in]   mimetype        a mime type
1401  * @param[in]   defapp          a application appid of the app to be set
1402  * @return      0 if success, negative value if fail
1403  * @retval      AUL_R_OK        - success
1404  * @retval      AUL_R_EINVAL    - invalid argument(mimetype)
1405  * @retval      AUL_R_ERROR     - general error
1406  *
1407  * @see
1408  *      aul_get_defapp_from_mime
1409  * @code
1410  * #include <aul.h>
1411  *
1412  * void set_text_html_defapp()
1413  * {
1414  *      aul_set_defapp_with_mime("text/html","org.tizen.browser");
1415  * }
1416  *
1417  * @endcode
1418  * @remark
1419  *      This API is only available in User Session.
1420 */
1421 int aul_set_defapp_with_mime(const char *mimetype, const char *defapp);
1422
1423 /**
1424  * @par Description:
1425  *      This API get the mimetype associated with filename
1426  * @par Purpose:
1427  *      This API use to get mimetype associteted with given filename
1428  *      In general, This API use when you want to know only mimetype given filename.
1429  * @par Typical use case:
1430  *      For example, In trasfering data through bluetooth,
1431  *      additional information like mimetype should be added.
1432  *      In such situation, You can get mimetype by using this API.
1433  *
1434  * @param[in]   filename        file name
1435  * @param[out]  mimetype        a mime type
1436  * @param[in]   len             length of mimetype
1437  * @return      0 if success, negative value if fail
1438  * @retval      AUL_R_OK        - success
1439  * @retval      AUL_R_EINVAL    - invalid argument(filename)
1440  * @retval      AUL_R_ERROR     - general error
1441  *
1442  * @code
1443  * #include <aul.h>
1444  *
1445  * void get_mimetype()
1446  * {
1447  *      char mimetype[255];
1448  *      aul_get_mime_from_file("image.jpg",mimetype,sizeof(mimetype));
1449  * }
1450  *
1451  * @endcode
1452  * @remark
1453  *      This API is only available in User Session.
1454  */
1455 int aul_get_mime_from_file(const char *filename, char *mimetype, int len);
1456
1457 /**
1458  * @par Description:
1459  *      This API get the mimetype associated with given content
1460  * @par Purpose:
1461  *      This API use to get mimetype associteted with given content
1462  *      In general, This API use when you want to know only mimetype given content
1463  * @par Typical use case:
1464  *      For example, In trasfering data through bluetooth,
1465  *      additional information like mimetype should be added.
1466  *      In such situation, You can get mimetype by using this API.
1467  *
1468  * @param[in]   content         content string like "011-0000-0000"
1469  * @param[out]  mimetype        a mime type
1470  * @param[in]   len             length of mimetype
1471  * @return      0 if success, negative value if fail
1472  * @retval      AUL_R_OK        - success
1473  * @retval      AUL_R_EINVAL    - invalid argument(content)
1474  * @retval      AUL_R_ERROR     - general error
1475  *
1476  * @code
1477  * #include <aul.h>
1478  *
1479  * void get_mimetype()
1480  * {
1481  *      char mimetype[255];
1482  *      aul_get_mime_from_content("http://www.samsung.com",mimetype,sizeof(mimetype));
1483  * }
1484  *
1485  * @endcode
1486  * @remark
1487  *      This API is only available in User Session.
1488 */
1489 int aul_get_mime_from_content(const char *content, char *mimetype, int len);
1490
1491 /**
1492  * @par Description:
1493  *      This API get the icon's name associated with given mimetype
1494  * @par Purpose:
1495  *      This API use to get icon's name associteted with given mimetype
1496  * @par Typical use case:
1497  *      If you want to show mimetype's icon, use this API.
1498  *
1499  * @param[in]   mimetype        a mime type
1500  * @param[out]  iconname        icon's name
1501  * @param[in]   len             length of iconname
1502  * @return      0 if success, negative value if fail
1503  * @retval      AUL_R_OK        - success
1504  * @retval      AUL_R_EINVAL    - invalid argument(content)
1505  * @retval      AUL_R_ERROR     - general error (no such mime type)
1506  *
1507  * @code
1508  * #include <aul.h>
1509  *
1510  * void get_mime_icon()
1511  * {
1512  *      char icon[255];
1513  *      aul_get_mime_icon("text/html",icon,sizeof(icon));
1514  * }
1515  *
1516  * @endcode
1517  * @remark
1518  *      This API is only available in User Session.
1519  */
1520 int aul_get_mime_icon(const char *mimetype, char *iconname, int len);
1521
1522 /**
1523  * @par Description:
1524  *      This API get the extensions associated with given mimetype
1525  * @par Purpose:
1526  *      This API use to get extensions associteted with given mimetype
1527  * @par Typical use case:
1528  *      In general, user is not familiar with mimetype(text/html),
1529  *      user is familiar with extenstions(*.html, *.htm)
1530  *      So, To show mimetype information to user, use this API
1531  *
1532  * @param[in]   mimetype        a mime type
1533  * @param[out]  extlist         extentions (ex> mpeg,mpg,mpe)
1534  * @param[in]   len             length of extlist
1535  * @return      0 if success, negative value if fail
1536  * @retval      AUL_R_OK        - success
1537  * @retval      AUL_R_EINVAL    - invalid argument(mimetype)
1538  * @retval      AUL_R_ERROR     - general error (no mimetype or no extenstion)
1539  *
1540  * @see
1541  *      aul_get_mime_description
1542  * @code
1543  * #include <aul.h>
1544  *
1545  * void get_extension()
1546  * {
1547  *      char extlist[255];
1548  *      aul_get_mime_extension("text/html",extlist,sizeof(extlist));
1549  * }
1550  *
1551  * @endcode
1552  * @remark
1553  *      Some mimetype don't have extension.
1554  *      In that case, You can use aul_get_mime_description.
1555  *      This API is only available in User Session.
1556 */
1557 int aul_get_mime_extension(const char *mimetype, char *extlist, int len);
1558
1559 /**
1560  * @par Description:
1561  *      This API get the description associated with given mimetype
1562  * @par Purpose:
1563  *      This API use to get description associteted with given mimetype
1564  * @par Typical use case:
1565  *      In general, user is not familiar with mimetype(text/html),
1566  *      user is familiar with well-knowing information like extenstions(*.html, *.htm)
1567  *      But, some mimetype don't have extenstion.
1568  *      At that time,to show mimetype information to user, use this API
1569  *
1570  * @param[in]   mimetype        a mime type
1571  * @param[out]  desc            description (ex> Call client)
1572  * @param[in]   len             length of desc
1573  * @return      0 if success, negative value if fail
1574  * @retval      AUL_R_OK        - success
1575  * @retval      AUL_R_EINVAL    - invalid argument(mimetype)
1576  * @retval      AUL_R_ERROR     - general error (no mimetype or no descrition)
1577  *
1578  * @see
1579  *      aul_get_mime_extension
1580  * @code
1581  * #include <aul.h>
1582  *
1583  * void get_information_from_mime()
1584  * {
1585  *      char info[255];
1586  *      if(aul_get_mime_extension("text/html",info,sizeof(info))<0){
1587  *              aul_get_mime_description("text/html",info,sizeof(info));
1588  *      }
1589  * }
1590  *
1591  * @endcode
1592  * @remark
1593  *      This API is only available in User Session.
1594  */
1595 int aul_get_mime_description(const char *mimetype, char *desc, int len);
1596
1597 /**
1598  * @par Description:
1599  *      This API create service result bundle based on bundle received in reset event.
1600  * @par Purpose:
1601  *      This API use to create result bundle to send it to caller.
1602  * @par Typical use case:
1603  *      This API is for callee which provide application service.\n
1604  *      To send result to caller, You must create result bundle. \n
1605  *      Callee(application providing the service) can send result by using this API and aul_send_service_result.
1606  *
1607  * @param[in]   inb             bundle received in reset event
1608  * @param[out]  outb            bundle to use for returning result
1609  * @return      0 if success, negative value(<0) if fail
1610  * @retval      AUL_R_OK        - success
1611  * @retval      AUL_R_EINVAL    - inb is not bundle created by aul_open_service
1612  * @retval      AUL_R_ERROR     - general error
1613  *
1614  * @pre
1615  *      To create result bundle, You need received original bundle.
1616  *      The original bundle can get from app_reset handler.
1617  * @post
1618  *      None
1619  * @see
1620  *      aul_send_service_result
1621  * @code
1622  * #include <aul.h>
1623  * #include <bundle.h>
1624  *
1625  * int app_reset(bundle *b, void *data)
1626  * {
1627  *      ad->recved_bundle = bundle_dup(b);
1628  * }
1629  *
1630  * int click_ok()
1631  * {
1632  *      bundle* res_bundle;
1633  *      aul_create_result_bundle(ad->recved_bundle,&res_bundle);
1634  *      bundle_add(res_bundle, "result", "1");
1635  *      aul_send_service_result(res_bundle);
1636  * }
1637  * @endcode
1638  * @remark
1639  *      This API is only available in User Session.
1640  *
1641  */
1642 int aul_create_result_bundle(bundle *inb, bundle **outb);
1643
1644 /**
1645  * @par Description:
1646  *      This API send service result to caller with bundle
1647  * @par Purpose:
1648  *      This API is used to send result bundle to caller.
1649  * @par Typical use case:
1650  *      This API is for callee which provide application service.\n
1651  *      To send result to caller, You can use this API after creating result bundle. \n
1652  *      Callee(application to provide service) can send result by using this API and aul_create_result_bundle.
1653  *
1654  * @param[in]   b      Result data in bundle format
1655  * @return      0 if success, negative value(<0) if fail
1656  * @retval      AUL_R_OK        - success
1657  * @retval      AUL_R_EINVAL    - invalid result bundle
1658  * @retval      AUL_R_ECOMM     - internal AUL IPC error
1659  * @retval      AUL_R_ERROR     - general error
1660  *
1661  * @pre
1662  *      To send result bundle, You must create result bundle.
1663  *      see aul_create_result_bundle
1664  * @post
1665  *      None
1666  * @see
1667  *      aul_create_result_bundle
1668  * @code
1669  * #include <aul.h>
1670  * #include <bundle.h>
1671  *
1672  * int app_reset(bundle *b, void *data)
1673  * {
1674  *      ad->recved_bundle = bundle_dup(b);
1675  * }
1676  *
1677  * int click_ok()
1678  * {
1679  *      bundle* res_bundle;
1680  *      aul_create_result_bundle(ad->recved_bundle,&res_bundle);
1681  *      bundle_add(res_bundle, "result", "1");
1682  *      aul_send_service_result(res_bundle);
1683  * }
1684  * @endcode
1685  * @remark
1686  *      This API is only available in User Session.
1687  *
1688  */
1689 int aul_send_service_result(bundle *b);
1690
1691 /**
1692  * @par Description:
1693  *      This API sets callback fuction that will be called when applications die.
1694  * @par Purpose:
1695  *      This API's purpose is to listen the application dead event.
1696  *      In general, task manager Application need this API.
1697  *
1698  * @param[in]   func            callback function
1699  * @param[in]   data            user data
1700  * @return      0 if success, negative value if fail
1701  * @retval      AUL_R_OK        - success
1702  * @retval      AUL_R_ERROR     - general error
1703  *
1704  * @see
1705  *      aul_listen_app_launch_signal
1706  * @code
1707  * #include <aul.h>
1708  *
1709  * int app_dead_handler(int pid, void *data)
1710  * {
1711  *      printf("===> %s : %d\n", __FUNCTION__, pid);
1712  *      return 0;
1713  * }
1714  *
1715  * void dead_listen()
1716  * {
1717  *      aul_listen_app_dead_signal(app_dead_handler, NULL);
1718  * }
1719  *
1720  * @endcode
1721  * @remark
1722  *      This API is only available in User Session.
1723  *
1724  */
1725 int aul_listen_app_dead_signal(int (*func) (int, void *), void *data);
1726
1727 /**
1728  * @par Description:
1729  *      This API sets callback fuction that will be called when applications are launched.
1730  * @par Purpose:
1731  *      This API's purpose is to listen the application launching event.
1732  *      In general, task manager Application need this API.
1733  *
1734  * @param[in]   func            callback function
1735  * @param[in]   data            user data
1736  * @return      0 if success, negative value if fail
1737  * @retval      AUL_R_OK        - success
1738  * @retval      AUL_R_ERROR     - general error
1739  *
1740  * @see
1741  *      aul_listen_app_dead_signal
1742  * @code
1743  * #include <aul.h>
1744  *
1745  * int app_launch_handler(int pid, void *data)
1746  * {
1747  *      printf("===> %s : %d\n", __FUNCTION__, pid);
1748  *      return 0;
1749  * }
1750  *
1751  * void dead_listen()
1752  * {
1753  *      aul_listen_app_launch_signal(app_launch_handler, NULL);
1754  * }
1755  *
1756  * @endcode
1757  * @remark
1758  *      This API is only available in User Session.
1759  *
1760  */
1761 int aul_listen_app_launch_signal(int (*func) (int, void *), void *data);
1762
1763 /**
1764  * @par Description:
1765  *      This API sets callback fuction that will be called when applications are launched.
1766  * @par Purpose:
1767  *      This API's purpose is to listen the application launching event.
1768  *      In general, task manager Application need this API.
1769  *
1770  * @param[in]   func            callback function
1771  * @param[in]   data            user data
1772  * @return      0 if success, negative value if fail
1773  * @retval      AUL_R_OK        - success
1774  * @retval      AUL_R_ERROR     - general error
1775  *
1776  * @see
1777  *      aul_listen_app_dead_signal
1778  * @code
1779  * #include <aul.h>
1780  *
1781  * int app_launch_handler(int pid, const char *app_id, void *data)
1782  * {
1783  *      printf("===> %s : %d, %s\n", __FUNCTION__, pid, app_id);
1784  *      return 0;
1785  * }
1786  *
1787  * void dead_listen()
1788  * {
1789  *      aul_listen_app_launch_signal(app_launch_handler, NULL);
1790  * }
1791  *
1792  * @endcode
1793  * @remark
1794  *      This API is only available in User Session.
1795  *
1796  */
1797 int aul_listen_app_launch_signal_v2(int (*func) (int, const char *, void *), void *data);
1798
1799 /**
1800  * @par Description:
1801  *      This API gets status of specified application process id.
1802  * @par Purpose:
1803  *      This API's purpose is to get the application's status.
1804  *
1805  * @param[in]   pid     pid of application
1806  * @return      0 or greater if success, nagative value if fail
1807  * @retval      STATUS_LAUNCHING
1808  * @retval      STATUS_CREATED
1809  * @retval      STATUS_FOCUS
1810  * @retval      STATUS_VISIBLE
1811  * @retval      STATUS_BG
1812  * @retval      STATUS_DYING
1813  * @retval      STATUS_HOME
1814  * @retval      STATUS_NORESTART
1815  * @see
1816  *      aul_status_update
1817  * @code
1818  * #include <aul.h>
1819  *
1820  * int iterfunc(const aul_app_info *info, void *data)
1821  * {
1822  *      int status;
1823  *      status = aul_app_get_status_bypid(info->pid);
1824  *      if (status == STATUS_FOCUS) {
1825  *              printf("%s has focus", info->app_id);
1826  *              (int *)data = info->pid;
1827  *              return -1;
1828  *      }
1829  *      return 0;
1830  * }
1831  *
1832  * int find_focus_app_pid()
1833  * {
1834  *      int pid = 0;
1835  *      aul_app_get_running_app_info(iterfunc, &pid);
1836  *      return pid;
1837  * }
1838  * @endcode
1839  * @remark
1840  *      This API is only available in User Session.
1841  */
1842 int aul_app_get_status_bypid(int pid);
1843
1844 /**
1845  * @par Description:
1846  *      This API gets status of specified application process id.
1847  * @par Purpose:
1848  *      This API's purpose is to get the application's status.
1849  *
1850  * @param[in]   pid     pid of application
1851  * @param[in]   uid     User ID
1852  * @return      0 or greater if success, nagative value if fail
1853  * @retval      STATUS_LAUNCHING
1854  * @retval      STATUS_CREATED
1855  * @retval      STATUS_FOCUS
1856  * @retval      STATUS_VISIBLE
1857  * @retval      STATUS_BG
1858  * @retval      STATUS_DYING
1859  * @retval      STATUS_HOME
1860  * @retval      STATUS_NORESTART
1861  *
1862  * @remark
1863  *      This API is only available to System user.
1864  */
1865 int aul_app_get_status_bypid_for_uid(int pid, uid_t uid);
1866
1867 /**
1868  * @par Description:
1869  *      This API gets the status of specified application id.
1870  * @par Purpose:
1871  *      This API's purpose is to get the status of the application.
1872  *
1873  * @param[in]   appid   application ID
1874  * @return      0 or greater if success, nagative value if fail
1875  * @retval      STATUS_LAUNCHING
1876  * @retval      STATUS_FOCUS
1877  * @retval      STATUS_VISIBLE
1878  * @retval      STATUS_BG
1879  * @retval      STATUS_DYING
1880  * @retval      STATUS_NORESTART
1881  * @see
1882  *      aul_status_update
1883  * @code
1884  * #include <aul.h>
1885  *
1886  * int func(void)
1887  * {
1888  *      int status;
1889  *
1890  *      status = aul_app_get_status("org.tizen.helloworld");
1891  *      if (status == STATUS_FOCUS)
1892  *              printf("org.tizen.helloworld has focus");
1893  *
1894  *      return 0;
1895  * }
1896  *
1897  * @endcode
1898  * @remark
1899  *      This API is only available in User Session.
1900  */
1901 int aul_app_get_status(const char *appid);
1902
1903 /**
1904  * @par Description:
1905  *      This API gets the status of specified application id.
1906  * @par Purpose:
1907  *      This API's purpose is to get the status of the application
1908  *
1909  * @param[in]   appid   application ID
1910  * @param[in]   uid     User ID
1911  * @return      0 or greater if success, nagative value if fail
1912  * @retval      STATUS_LAUNCHING
1913  * @retval      STATUS_FOCUS
1914  * @retval      STATUS_VISIBLE
1915  * @retval      STATUS_BG
1916  * @retval      STATUS_DYING
1917  * @retval      STATUS_NORESTART
1918  *
1919  * @remark
1920  *      This API is only available to System user.
1921  */
1922 int aul_app_get_status_for_uid(const char *appid, uid_t uid);
1923
1924 /**
1925  * @par Description
1926  *      This API sets callback function that on application status changed.
1927  * @par Purpose:
1928  *      This API's purpose is to listen the application's status changed within
1929  *      the caller process. In general, a library that required to release resource on
1930  *      application's status may use this API.
1931  *
1932  * @param[in]   func    callback function
1933  * @param[in]   data    user data
1934  * @return      0 if success, negative value if fail
1935  * @retval      AUL_R_OK        - success
1936  * @retval      AUL_R_ERROR     - general error
1937  * @see
1938  *      aul_remove_status_local_cb
1939  * @code
1940  * #include <aul.h>
1941  *
1942  * int status_changed(int status, void *data)
1943  * {
1944  *      if (status == STATUS_FOCUS)
1945  *              printf("%d has focus\n", getpid());
1946  *
1947  *      if (status == STATUS_VISIBLE)
1948  *              printf("%d resume\n", getpid());
1949  *
1950  *      if (status == STATUS_BG0
1951  *              printf("%d pause\n", getpid());
1952  * }
1953  *
1954  * void listen_app_status()
1955  * {
1956  *      aul_add_status_local_cb(status_changed, NULL);
1957  * }
1958  * @endcode
1959  * @remark
1960  *      This API is only available in User Session.
1961  *
1962  */
1963 int aul_add_status_local_cb(int (*func) (int, void *), void *data);
1964
1965 /**
1966  * @par Description
1967  *      This API unsets callback function that on application status changed.
1968  * @par Purpose:
1969  *      This API's purpose is to remove callback that added by
1970  *      aul_add_status_local_cb.
1971  *
1972  * @param[in]   func    callback function
1973  * @param[in]   data    user data
1974  * @return      0 if success, negative value if fail
1975  * @retval      AUL_R_OK        - success
1976  * @retval      AUL_R_ERROR     - general error
1977  *
1978  * @see
1979  *      aul_add_status_local_cb
1980  * @code
1981  * #include <aul.h>
1982  *
1983  * int status_changed(int status, void *data)
1984  * {
1985  *      if (status == STATUS_FOCUS)
1986  *              printf("%d has focus\n", getpid());
1987  *
1988  *      if (status == STATUS_VISIBLE)
1989  *              printf("%d resume\n", getpid());
1990  *
1991  *      if (status == STATUS_BG0
1992  *              printf("%d pause\n", getpid());
1993  * }
1994  *
1995  * void listen_app_status()
1996  * {
1997  *      aul_add_status_local_cb(status_changed, NULL);
1998  * }
1999  *
2000  * void ignore_app_status()
2001  * {
2002  *      aul_remove_status_local_cb(status_changed, NULL);
2003  * }
2004  *
2005  * @endcode
2006  * @remark
2007  *      This API is only available in User Session.
2008  *
2009  */
2010 int aul_remove_status_local_cb(int (*func) (int, void *), void *data);
2011
2012 /*
2013  * This API is only for appfw internally.
2014  */
2015 int aul_set_process_group(int parent_pid, int child_pid);
2016
2017 /*
2018  * This API is only for Appfw internally.
2019  */
2020 int aul_terminate_bgapp_pid(int pid);
2021
2022 /*
2023  * This API is only for Appfw internally.
2024  */
2025 int aul_terminate_pid_without_restart(int pid);
2026
2027 /*
2028  * This API is only for Appfw internally.
2029  */
2030 int aul_terminate_pid_sync_without_restart(int pid);
2031
2032 /*
2033  * This API is only for Appfw internally.
2034  */
2035 int aul_terminate_pid_sync_without_restart_for_uid(int pid, uid_t uid);
2036
2037 /*
2038  * This API is only for Appfw internally.
2039  */
2040 const char *aul_get_app_external_root_path(void);
2041
2042 /*
2043  * This API is only for Appfw internally.
2044  */
2045 const char *aul_get_app_root_path(void);
2046
2047 /*
2048  * This API is only for Appfw internally.
2049  */
2050 const char *aul_get_app_data_path(void);
2051
2052 /*
2053  * This API is only for Appfw internally.
2054  */
2055 const char *aul_get_app_cache_path(void);
2056
2057 /*
2058  * This API is only for Appfw internally.
2059  */
2060 const char *aul_get_app_resource_path(void);
2061
2062 /*
2063  * This API is only for Appfw internally.
2064  */
2065 const char *aul_get_app_tep_resource_path(void);
2066
2067 /*
2068  * This API is only for Appfw internally.
2069  */
2070 int aul_get_app_shared_data_path(char **path);
2071
2072 /*
2073  * This API is only for Appfw internally.
2074  */
2075 const char *aul_get_app_shared_resource_path(void);
2076
2077 /*
2078  * This API is only for Appfw internally.
2079  */
2080 const char *aul_get_app_shared_trusted_path(void);
2081
2082 /*
2083  * This API is only for Appfw internally.
2084  */
2085 const char *aul_get_app_external_data_path(void);
2086
2087 /*
2088  * This API is only for Appfw internally.
2089  */
2090 const char *aul_get_app_external_cache_path(void);
2091
2092 /*
2093  * This API is only for Appfw internally.
2094  */
2095 const char *aul_get_app_external_shared_data_path(void);
2096
2097 /*
2098  * This API is only for Appfw internally.
2099  */
2100 const char *aul_get_app_specific_path(void);
2101
2102 /*
2103  * This API is only for Appfw internally.
2104  */
2105 const char *aul_get_app_external_specific_path(void);
2106
2107 /*
2108  * This API is only for Appfw internally.
2109  */
2110 int aul_get_app_shared_data_path_by_appid(const char *app_id, char **path);
2111
2112 /*
2113  * This API is only for Appfw internally.
2114  */
2115 int aul_get_app_shared_resource_path_by_appid(const char *app_id, char **path);
2116
2117 /*
2118  * This API is only for Appfw internally.
2119  */
2120 int aul_get_app_shared_trusted_path_by_appid(const char *app_id, char **path);
2121
2122 /*
2123  * This API is only for Appfw internally.
2124  */
2125 int aul_get_app_external_shared_data_path_by_appid(const char *app_id, char **path);
2126
2127 /*
2128  * This API is only for Appfw internally.
2129  */
2130 int aul_get_usr_app_shared_data_path_by_appid(const char *app_id, char **path, uid_t uid);
2131
2132 /*
2133  * This API is only for Appfw internally.
2134  */
2135 int aul_get_usr_app_shared_resource_path_by_appid(const char *app_id, char **path, uid_t uid);
2136
2137 /*
2138  * This API is only for Appfw internally.
2139  */
2140 int aul_get_usr_app_shared_trusted_path_by_appid(const char *app_id, char **path, uid_t uid);
2141
2142 /*
2143  * This API is only for Appfw internally.
2144  */
2145 int aul_get_usr_app_external_shared_data_path_by_appid(const char *app_id, char **path, uid_t uid);
2146
2147 /*
2148  * This type is only for Appfw internally.
2149  */
2150 typedef int (*subapp_fn)(void *data);
2151
2152 /*
2153  * This API is only for Appfw internally.
2154  */
2155 int aul_set_subapp(subapp_fn cb, void *data);
2156
2157 /*
2158  * This API is only for Appfw internally.
2159  */
2160 int aul_subapp_terminate_request_pid(int pid);
2161
2162 /*
2163  * This API is only for Appfw internally.
2164  */
2165 int aul_is_subapp(void);
2166
2167 /*
2168  * This API is only for Appfw internally.
2169  */
2170 int aul_kill_pid(int pid);
2171
2172 /*
2173  * This API is only for Appfw internally.
2174  */
2175 int aul_add_caller_cb(int pid,  void (*caller_cb) (int, void *), void *data);
2176
2177 /*
2178  * This API is only for Appfw internally.
2179  */
2180 int aul_remove_caller_cb(int pid, void *data);
2181
2182 /*
2183  * This API is only for Appfw internally.
2184  */
2185 int aul_invoke_caller_cb(void *data);
2186
2187 /*
2188  * This API is only for Appfw internally.
2189  */
2190 void aul_set_preinit_window(void *evas_object);
2191
2192 /*
2193  * This API is only for Appfw internally.
2194  */
2195 void* aul_get_preinit_window(const char *win_name);
2196
2197 /*
2198  * This API is only for Appfw internally.
2199  */
2200 void aul_set_preinit_background(void *evas_object);
2201
2202 /*
2203  * This API is only for Appfw internally.
2204  */
2205 void* aul_get_preinit_background(void);
2206
2207 /*
2208  * This API is only for Appfw internally.
2209  */
2210 void aul_set_preinit_conformant(void *evas_object);
2211
2212 /*
2213  * This API is only for Appfw internally.
2214  */
2215 void* aul_get_preinit_conformant(void);
2216
2217 /*
2218  * This API is only for Appfw internally.
2219  */
2220 void aul_set_preinit_appid(const char *appid);
2221
2222 /*
2223  * This API is only for Appfw internally.
2224  */
2225 void aul_set_preinit_pkgid(const char *pkgid);
2226
2227 /*
2228  * This API is only for Appfw internally.
2229  */
2230 void aul_set_preinit_root_path(const char *root_path);
2231
2232 /*
2233  * This API is only for Appfw internally.
2234  */
2235 const char *aul_get_preinit_root_path(void);
2236
2237 /*
2238  * This API is only for Appfw internally.
2239  */
2240 int aul_update_freezer_status(int pid, const char* type);
2241
2242 /*
2243  * This API is only for Appfw internally.
2244  */
2245 int aul_send_app_launch_request_signal(int pid, const char* appid, const char* pkgid, const char* type);
2246
2247 /*
2248  * This API is only for Appfw internally.
2249  */
2250 int aul_send_app_resume_request_signal(int pid, const char* appid, const char* pkgid, const char *type);
2251
2252 /*
2253  * This API is only for Appfw internally.
2254  */
2255 int aul_send_app_terminate_request_signal(int pid, const char* appid, const char* pkgid, const char *type);
2256
2257 /*
2258  * This API is only for Appfw internally.
2259  */
2260 int aul_send_app_status_change_signal(int pid, const char* appid, const char* pkgid, const char* status, const char *type);
2261
2262 /*
2263  * This API is only for Appfw internally.
2264  */
2265 int aul_send_app_terminated_signal(int pid);
2266
2267 /*
2268  * This API is only for Appfw internally.
2269  */
2270 int aul_send_app_group_signal(int owner_pid, int child_pid, const char *child_pkgid);
2271
2272 /*
2273  * This API is only for Appfw internally.
2274  */
2275 int aul_invoke_status_local_cb(int status);
2276
2277 /*
2278  * This type is only for Appfw internally.
2279  */
2280 typedef int (*data_control_provider_handler_fn) (bundle *b, int request_id, void *data);
2281
2282 /*
2283  * This API is only for Appfw internally.
2284  */
2285 int aul_set_data_control_provider_cb(data_control_provider_handler_fn handler);
2286
2287 /*
2288  * This API is only for Appfw internally.
2289  */
2290 int aul_unset_data_control_provider_cb(void);
2291
2292 /*
2293  * This API is only for Appfw internally.
2294  */
2295 int aul_pause_app(const char *appid);
2296
2297 /*
2298  * This API is only for Appfw internally.
2299  */
2300 int aul_pause_app_for_uid(const char *appid, uid_t uid);
2301
2302 /*
2303  * This API is only for Appfw internally.
2304  */
2305 int aul_pause_pid(int pid);
2306
2307 /*
2308  * This API is only for Appfw internally.
2309  */
2310 int aul_pause_pid_for_uid(int pid, uid_t uid);
2311
2312 /*
2313  * This API is only for Appfw internally.
2314  */
2315 int aul_reload_appinfo(void);
2316
2317 /*
2318  * This API is only for Appfw internally.
2319  */
2320 int aul_status_update(int status);
2321
2322 /*
2323  * This API is only for Appfw internally.
2324  */
2325 int aul_running_list_update(char *appid, char *app_path, char *pid);
2326
2327 /*
2328  * This API is only for Appfw internally.
2329  */
2330 int aul_app_group_get_window(int pid);
2331
2332 /*
2333  * This API is only for Appfw internally.
2334  */
2335 int aul_app_group_set_window(int wid);
2336
2337 /*
2338  * This API is only for Appfw internally.
2339  */
2340 void aul_app_group_get_leader_pids(int *cnt, int **pids);
2341
2342 /*
2343  * This API is only for Appfw internally.
2344  */
2345 void aul_app_group_get_group_pids(int leader_pid, int *cnt, int **pids);
2346
2347 /*
2348  * This API is only for Appfw internally.
2349  */
2350 int aul_app_group_get_leader_pid(int pid);
2351
2352 /*
2353  * This API is only for Appfw internally.
2354  */
2355 int aul_app_group_clear_top(void);
2356
2357 /*
2358  * This API is only for Appfw internally.
2359  */
2360 int aul_app_group_is_top(void);
2361
2362 /*
2363  * This API is only for Appfw internally.
2364  */
2365 int aul_app_group_get_fg_flag(int pid);
2366
2367 /*
2368  * This API is only for Appfw internally.
2369  */
2370 void aul_app_group_lower(int *exit);
2371
2372 /*
2373  * This API is only for Appfw internally.
2374  */
2375 void aul_app_group_get_idle_pids(int *cnt, int **pids);
2376
2377 /**
2378  * @par Description:
2379  *      This API puts some app below the caller app
2380  * @par Purpose:
2381  *      This API's purpose is to reorder window stack limitedly.
2382  *
2383  * @param[in]   below_appid     The appid to be reordered below the caller app
2384  * @return      Loader ID if success, negative value(<0) if fail
2385  *
2386  * @remark
2387  *      The caller app should be resumed before calling this API.
2388  *      below_appid should be main app which have been launched before.
2389  *      This API is only available in User Session.
2390 */
2391 int aul_app_group_activate_below(const char *below_appid);
2392
2393 /*
2394  * This API is only for Appfw internally.
2395  */
2396 int aul_request_data_control_socket_pair(bundle *b, int *fd);
2397 /*
2398  * This API is only for Appfw internally.
2399  */
2400 int aul_request_message_port_socket_pair(int *fd);
2401 /*
2402  * This API is only for Appfw internally.
2403  */
2404 int aul_listen_booting_done_signal(int (*func) (int, void *), void *data);
2405
2406 /*
2407  * This API is only for Appfw internally.
2408  */
2409 int aul_listen_cooldown_signal(int (*func) (const char *, void *), void *data);
2410
2411 /**
2412  * @par Description:
2413  *      This API registers a callback function that will be called when the
2414  *      status of the application is changed.
2415  * @par Purpose:
2416  *      This API is for monitoring the status of all applications.
2417  *
2418  * @param[in]   func            callback function
2419  * @param[in]   data            user data
2420  * @return      0 if success, negative value if fail
2421  * @retval      AUL_R_OK        - success
2422  * @retval      AUL_R_ERROR     - general error
2423  *
2424  * @code
2425  * #include <aul.h>
2426  *
2427  * int app_status_handler(int pid, int status, void *data)
2428  * {
2429  *      const char *app_status;
2430  *
2431  *      switch (status) {
2432  *      case 0:
2433  *              app_status = "STATUS_LAUNCHING";
2434  *              break;
2435  *      case 3:
2436  *              app_status = "STATUS_VISIBLE";
2437  *              break;
2438  *      case 4:
2439  *              app_status = "STATUS_BACKGROUND";
2440  *              break;
2441  *      case 5:
2442  *              app_status = "STATUS_FOCUS";
2443  *              break;
2444  *      default:
2445  *              app_status = "STATUS_UNKNOWN";
2446  *      }
2447  *
2448  *      printf("pid: %d, status: %s", pid, status);
2449  *      return 0;
2450  * }
2451  *
2452  * int main(int argc, char **argv)
2453  * {
2454  *      int ret;
2455  *
2456  *      ret = aul_listen_app_status_signal(app_status_handler, NULL);
2457  *      if (ret != AUL_R_OK) {
2458  *              printf("Failed to add status handler");
2459  *              return -1;
2460  *      }
2461  *
2462  *      ...
2463  *
2464  *      return 0;
2465  * }
2466  * @endcode
2467  */
2468 int aul_listen_app_status_signal(int (*func)(int, int, void *), void *data);
2469
2470 /*
2471  * This API is only for Appfw internally.
2472  */
2473 int aul_check_tep_mount(const char *tep_path);
2474
2475 /*
2476  * This API is only for Appfw internally.
2477  */
2478 int aul_is_tep_mount_dbus_done(const char *tep_string);
2479
2480 /*
2481  * This API is only for Appfw internally.
2482  */
2483 int aul_forward_app(const char *appid, bundle *kb);
2484
2485 /**
2486  * @par Description:
2487  *      This API create custom launchpad-loader
2488  * @par Purpose:
2489  *      This API's purpose is to make a slot for custom loader.
2490  *      Once it is made, added loader will make a candidate process to use.
2491  *
2492  * @param[in]   loader_path     The file name of the custom loader binary including full path
2493  * @param[in]   extra           A bundle to be passed to the custom loader
2494  * @return      Loader ID if success, negative value(<0) if fail
2495  *
2496  * @remark
2497  *      This API is only for Appfw internally.
2498  *      This API is only available in User Session.
2499 */
2500 int aul_add_loader(const char *loader_path, bundle *extra);
2501
2502 /**
2503  * @par Description:
2504  *      This API create custom launchpad-loader
2505  * @par Purpose:
2506  *      This API's purpose is to make a slot for custom loader.
2507  *      Once it is made, added loader will make a candidate process to use.
2508  *
2509  * @param[in]   loader_path     The file name of the custom loader binary including full path
2510  * @param[in]   extra           A bundle to be passed to the custom loader
2511  * @param[in]   uid             User ID
2512  * @return      Loader ID if success, negative value(<0) if fail
2513  *
2514  * @remark
2515  *      This API is only for Appfw internally.
2516  *      This API is only available to System user.
2517 */
2518 int aul_add_loader_for_uid(const char *loader_path, bundle *extra, uid_t uid);
2519
2520
2521 /**
2522  * @par Description:
2523  *      This API destroy custom launchpad-loader
2524  * @par Purpose:
2525  *      This API's purpose is to remove a slot for custom loader.
2526  *      Once it is removed, the prepared process will be removed as well.
2527  *
2528  * @param[in]   loader_id       Loader ID
2529  * @return      0 if success, negative value(<0) if fail
2530  *
2531  * @remark
2532  *      This API is only for Appfw internally.
2533  *      This API is only available in User Session.
2534 */
2535 int aul_remove_loader(int loader_id);
2536
2537 /**
2538  * @par Description:
2539  *      This API destroy custom launchpad-loader
2540  * @par Purpose:
2541  *      This API's purpose is to remove a slot for custom loader.
2542  *      Once it is removed, the prepared process will be removed as well.
2543  *
2544  * @param[in]   loader_id       Loader ID
2545  * @param[in]   uid             User ID
2546  * @return      0 if success, negative value(<0) if fail
2547  *
2548  * @remark
2549  *      This API is only for Appfw internally.
2550  *      This API is only available to System user.
2551 */
2552 int aul_remove_loader_for_uid(int loader_id, uid_t uid);
2553
2554 /**
2555  * @par Description
2556  *      This API gets specified application process id.
2557  * @par Purpose:
2558  *      The purpose of this API is to get the pid of specified application.
2559  *
2560  * @param[in]   appid   application name
2561  * @return      callee's pid if success, negative value(<0) if fail
2562  *
2563  * @remark
2564  *      This API is only available in User Session.
2565  */
2566 int aul_app_get_pid(const char *appid);
2567
2568 /**
2569  * @par Description
2570  *      This API gets specified application process id.
2571  * @par Purpose:
2572  *      The purpose of this API is to get the pid of specified application.
2573  *
2574  * @param[in]   appid   application name
2575  * @param[in]   uid     User ID
2576  * @return      callee's pid if success, negative value(<0) if fail
2577  *
2578  * @remark
2579  *      This API is only available to System user.
2580  */
2581 int aul_app_get_pid_for_uid(const char *appid, uid_t uid);
2582
2583 /**
2584  * @par Description:
2585  * This function update rua stat.
2586  *
2587  * @param[in] b Bundle object contains caller and tag information.
2588  * @param[in] uid Target uid
2589  *
2590  * @return 0 if success, negative value(<0) if fail
2591  * @see None
2592  * @remarks This API is only for Appfw internally.
2593  *
2594  * @par Sample code:
2595  * @code
2596 #include <aul.h>
2597
2598 ...
2599 {
2600     int r;
2601     bundle *b = bundle_create();
2602     bundle_add_str(b, AUL_SVC_K_RUA_STAT_CALLER, caller);
2603     bundle_add_str(b, AUL_SVC_K_RUA_STAT_TAG, tag);
2604
2605     r = aul_update_rua_stat_for_uid(b);
2606 }
2607
2608  * @endcode
2609  **/
2610 int aul_update_rua_stat_for_uid(bundle *b, uid_t uid);
2611
2612 /**
2613  * @par Description:
2614  * This function add rua history.
2615  *
2616  * @param[in] b Bundle object Target Package name or app path.
2617  * @param[in] uid Target uid
2618  *
2619  * @return 0 if success, negative value(<0) if fail
2620  * @see None
2621  * @remarks This API is only for Appfw internally.
2622  *
2623  * @par Sample code:
2624  * @code
2625 #include <aul.h>
2626
2627 ...
2628 {
2629     int r;
2630     bundle *b = bundle_create();
2631     if (pkg_name)
2632         bundle_add_str(b, AUL_K_RUA_PKGNAME, pkg_name);
2633     else if (app_path)
2634         bundle_add_str(b, AUL_K_RUA_APPPATH, app_path);
2635
2636     r = aul_add_rua_history_for_uid(b);
2637 }
2638
2639  * @endcode
2640  **/
2641 int aul_add_rua_history_for_uid(bundle *b, uid_t uid);
2642
2643 /**
2644  * @par Description:
2645  * This function delete rua history.
2646  *
2647  * @param[in] b Bundle object Target Package name. If NULL or has no value, delete all rua history.
2648  * @param[in] uid Target uid
2649  *
2650  * @return 0 if success, negative value(<0) if fail
2651  * @see None
2652  * @remarks This API is only for Appfw internally.
2653  *
2654  * @par Sample code:
2655  * @code
2656 #include <aul.h>
2657
2658 ...
2659 {
2660     int r;
2661     bundle *b = NULL;
2662     if (pkg_name) {
2663         b = bundle_create();
2664         bundle_add_str(b, AUL_K_RUA_PKGNAME, pkg_name);
2665     }
2666     r = aul_delete_rua_history_for_uid(b, getuid());
2667 }
2668
2669  * @endcode
2670  **/
2671 int aul_delete_rua_history_for_uid(bundle *b, uid_t uid);
2672
2673
2674 /**
2675  * @par Description:
2676  * This function sets the default application(application id) associated with operatioin, uri and mime-type.
2677  *
2678  * @param[in] b Bundle object Target application id and operation, uri and mime-type.
2679  *
2680  * @return 0 if success, negative value(<0) if fail
2681  * @see None
2682  * @remarks This API is only for Appfw internally.
2683  *
2684  * @par Sample code:
2685  * @code
2686 #include <aul.h>
2687 #include <aul_svc.h>
2688
2689 ...
2690 {
2691     int r;
2692     bundle *b = bundle_create();
2693
2694     const char *appid = "org.tizen.test";
2695     const char *operation = "test_operation";
2696     const char *mime_type = "test_mime";
2697     const char *uri = "test_uri";
2698
2699     aul_svc_set_operation(b, operation);
2700     aul_svc_set_mime(b, mime_type);
2701     aul_svc_set_uri(b, uri);
2702
2703     aul_svc_set_appid(b, appid)
2704
2705     r = aul_set_default_app_by_operation(b);
2706 }
2707
2708  * @endcode
2709  **/
2710 int aul_set_default_app_by_operation(bundle *b);
2711
2712 /**
2713  * @par Description:
2714  * This API unset the default application(application id) associated with operation, uri and mime-type.
2715  *
2716  * @param[in] app_id    The ID of the application
2717  *
2718  * @return 0 if success, negative value(<0) if fail
2719  *
2720  * @pre None.
2721  * @post None.
2722  * @see None.
2723  * @remarks None.
2724  *
2725  * @par Sample code:
2726  * @code
2727 #include <aul.h>
2728
2729 ...
2730 {
2731     aul_unset_default_app_by_operation("org.tizen.test");
2732 }
2733  * @endcode
2734  *
2735  */
2736 int aul_unset_default_app_by_operation(const char *app_id);
2737
2738 /**
2739  * @par Description:
2740  *      This API launches application with the given bundle asynchronously.
2741  *  If the application is not running or a multiple-instance one, this API launches with the given bundle.
2742  *      If the application is running, this API sends a RESET event to the App.
2743  *      While the application is running, if the application cannot receive the RESET event,
2744  *      this API returns a general error(AUL_R_ERROR).\n
2745  * @par Purpose:
2746  *      This API is for caller.
2747  *      This API's purpose is to launch/reset application with given bundle.
2748  * @par Typical use case:
2749  *      If you know the target application's pkgname and bundle types,
2750  *      you can use this API to launch/reset the application.
2751  *
2752  * @param[in]   pkgname         package name to be run as callee
2753  * @param[in]   kb              bundle to be passed to callee
2754  * @return      0 if success, negative value(<0) if fail
2755  * @retval      AUL_R_OK        - success
2756  * @retval      AUL_R_EINVAL    - invaild package name
2757  * @retval      AUL_R_ECOM      - internal AUL IPC error
2758  * @retval      AUL_R_ERROR     - general error
2759  *
2760  * @remark
2761  *      This API is only available in User Session.
2762  *      This API doesn't check whether the callee application is executed successfully.
2763  */
2764 int aul_launch_app_async(const char *appid, bundle *kb);
2765
2766 /**
2767  * @par Description:
2768  *      This API launches application with the given bundle asynchronously.
2769  *  If the application is not running or a multiple-instance one, this API launches with the given bundle.
2770  *      If the application is running, this API sends a RESET event to the App.
2771  *      While the application is running, if the application cannot receive the RESET event,
2772  *      this API returns a general error(AUL_R_ERROR).\n
2773  * @par Purpose:
2774  *      This API is for caller.
2775  *      This API's purpose is to launch/reset application with given bundle.
2776  * @par Typical use case:
2777  *      If you know the target application's pkgname and bundle types,
2778  *      you can use this API to launch/reset the application.
2779  *
2780  * @param[in]   pkgname         package name to be run as callee
2781  * @param[in]   kb              bundle to be passed to callee
2782  * @param[in]   uid             User ID
2783  * @return      0 if success, negative value(<0) if fail
2784  * @retval      AUL_R_OK        - success
2785  * @retval      AUL_R_EINVAL    - invaild package name
2786  * @retval      AUL_R_ECOM      - internal AUL IPC error
2787  * @retval      AUL_R_ERROR     - general error
2788  *
2789  * @remark
2790  *      This API is only available to System user.
2791  *      This API doesn't check whether the callee application is executed successfully.
2792  */
2793 int aul_launch_app_async_for_uid(const char *appid, bundle *kb, uid_t uid);
2794
2795 /**
2796  * @par Description:
2797  * This API request launchpad to make candidate processes.
2798  *
2799  * @return 0 if success, negative value(<0) if fail
2800  *
2801  * @remark
2802  *      This API is only available in User Session.
2803  */
2804 int aul_prepare_candidate_process(void);
2805
2806 /*
2807  * This API is only for Appfw internally.
2808  */
2809 int aul_widget_instance_add(const char *widget_id, const char *instance_id);
2810
2811 /*
2812  * This API is only for Appfw internally.
2813  */
2814 int aul_widget_instance_del(const char *widget_id, const char *instance_id);
2815
2816 /*
2817  * This API is only for Appfw internally.
2818  */
2819 typedef void (*aul_widget_instance_foreach_cb)(const char *instance_id, void *data);
2820
2821 /*
2822  * This API is only for Appfw internally.
2823  */
2824 int aul_widget_instance_foreach(const char *widget_id, aul_widget_instance_foreach_cb cb, void *data);
2825
2826 /*
2827  * This API is only for Appfw internally.
2828  */
2829 int aul_widget_instance_update(const char *widget_id, const char *instance_id, bundle *b);
2830
2831 /*
2832  * This API is only for Appfw internally.
2833  */
2834 int aul_widget_instance_count(const char *widget_id);
2835
2836 /**
2837  * @par Description:
2838  *      This API gets the last caller process id of specified application process id.
2839  * @par Purpose:
2840  *      This API's purpose is to get the application's last caller process id.
2841  *
2842  * @param[in]   pid     pid of application
2843  * @return      caller pid if success, nagative value if fail
2844  *
2845  * @remark
2846  *      This API is only available in User Session.
2847  */
2848 int aul_app_get_last_caller_pid(int pid);
2849
2850 /**
2851  * @par Description:
2852  *      This API gets the last caller process id of specified application process id.
2853  * @par Purpose:
2854  *      This API's purpose is to get the last caller process id of the application.
2855  *
2856  * @param[in]   pid     pid of application
2857  * @param[in]   uid     User ID
2858  * @return      caller pid if success, nagative value if fail
2859  *
2860  * @remark
2861  *      This API is only available in System users.
2862  */
2863 int aul_app_get_last_caller_pid_for_uid(int pid, uid_t uid);
2864
2865 /**
2866  * @par Description:
2867  *      This API trigger to resume application asynchronously.
2868  *      If the application is running, this API send a resume event to the App.
2869  *      If the application is not running, this API return AUL_R_ERROR.
2870  *      Although the application is running, if the application cannot receive resume event,
2871  *      AUL try to raise the application's default windows.
2872  * @par Purpose:
2873  *      This API is for caller.
2874  *      This API's purpose is to send resume event.
2875  * @par Typical use case:
2876  *      In multiple application model, If you want to only resume specific application, Use this API
2877  *
2878  * @param[in]   pid     application's pid to be resumed
2879  * @return      0 if success, negative value(<0) if fail
2880  * @retval      AUL_R_OK        - success
2881  * @retval      AUL_R_EINVAL    - invaild pid
2882  * @retval      AUL_R_ECOM      - internal AUL IPC error
2883  * @retval      AUL_R_ERROR     - general error (include application is not running)
2884  * @warning     This API need to require root or inhouse permisssion \n
2885  *              If you have not the permission, this API return AUL_R_ERROR. \n
2886  * @remark
2887  *      This API is only available to User Session.
2888  */
2889 int aul_resume_pid_async(int pid);
2890
2891 /**
2892  * @par Description:
2893  *      This API trigger to resume application asynchronously.
2894  *      If the application is running, this API send a resume event to the App.
2895  *      If the application is not running, this API return AUL_R_ERROR.
2896  *      Although the application is running, if the application cannot receive resume event,
2897  *      AUL try to raise the application's default windows.
2898  * @par Purpose:
2899  *      This API is for caller.
2900  *      This API's purpose is to send resume event.
2901  * @par Typical use case:
2902  *      In multiple application model, If you want to only resume specific application, Use this API
2903  *
2904  * @param[in]   pid     application's pid to be resumed
2905  * @param[in]   uid     User ID
2906  * @return      0 if success, negative value(<0) if fail
2907  * @retval      AUL_R_OK        - success
2908  * @retval      AUL_R_EINVAL    - invaild pid
2909  * @retval      AUL_R_ECOM      - internal AUL IPC error
2910  * @retval      AUL_R_ERROR     - general error (include application is not running)
2911  * @warning     This API need to require root or inhouse permisssion \n
2912  *              If you have not the permission, this API return AUL_R_ERROR. \n
2913  * @remark
2914  *      This API is only available to System user.
2915  */
2916 int aul_resume_pid_async_for_uid(int pid, uid_t uid);
2917
2918 /**
2919  * @par Description:
2920  *      This API set the alias appid.
2921  *      The alias appid is only available for the aul_svc_set_appid() API.
2922  *      If the appid is not available, this API returns an error.
2923  *
2924  * @privlevel platform
2925  * @privilege %http://tizen.org/privilege/systemsettings.admin
2926  * @param[in]   alias_appid     an alias application ID
2927  * @param[in]   appid           an application ID
2928  * @return      0 if success, negative value(<0) if fail
2929  *
2930  * @remark
2931  *      This API is only available to User Session.
2932  */
2933 int aul_set_alias_appid(const char *alias_appid, const char *appid);
2934
2935 /**
2936  * @par Description:
2937  *      This API unset the alias appid.
2938  *
2939  * @privlevel platform
2940  * @privilege %http://tizen.org/privilege/systemsettings.admin
2941  * @param[in]   alias_appid     an alias application ID
2942  * @return      0 if success, negative value(<0) if fail
2943  *
2944  * @remark
2945  *      This API is only available to User Session.
2946  */
2947 int aul_unset_alias_appid(const char *alias_appid);
2948
2949 /**
2950  * @par Description:
2951  *      This API activates the alias information based on the given appid.
2952  *
2953  * @privlevel platform
2954  * @privilege %http://tizen.org/privilege/systemsettings.admin
2955  * @param[in]   appid   an application ID
2956  * @return      0 if success, negative value(<0) if fail
2957  *
2958  * @remark
2959  *      This API is only available to User Session.
2960  */
2961 int aul_enable_alias_info(const char *appid);
2962
2963 /**
2964  * @par Description:
2965  *      This API deactivates the alias information based on the given appid.
2966  *
2967  * @privlebel platform
2968  * @privilege %http://tizen.org/privilege/systemsettings.admin
2969  * @param[in]   appid   an application ID
2970  * @return      0 if success, negative value(<0) if fail
2971  *
2972  * @remark
2973  *      This API is only available to User Session.
2974  */
2975 int aul_disable_alias_info(const char *appid);
2976
2977 /*
2978  * This API is only for Appfw internally.
2979  */
2980 API int aul_listen_app_status(const char *appid,
2981                 int (*aul_handler)(const char *appid, const char *pkgid,
2982                         int pid, int status, int is_subapp, void *data),
2983                 void *data);
2984
2985 /*
2986  * This API is only for Appfw internally.
2987  */
2988 int aul_widget_instance_get_content(const char *widget_id, const char *instance_id, char **content);
2989
2990 #ifdef __cplusplus
2991         }
2992 #endif
2993
2994