Tizen 2.4 SDK Rev6 Release
[framework/appfw/aul-1.git] / include / aul.h
1 /*
2  *  aul
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22
23 #ifndef __AUL_H__
24 #define __AUL_H__
25
26 #include <errno.h>
27 #include <bundle.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 /**
34  * @mainpage
35  *
36  * This is new version of Application Utility Library
37  *
38  * Almost function's input param is application package name(APN).\n
39  * APN is application package name which is set by developer.\n
40  * In case of in-house application, prefix is org.tizen.\n
41  * It is different from debian package name.\n
42  *
43  * - Debian Package Name : Name which is managed by package manager
44  * - Application Package Name : Name which is used by AUL
45  * - Execution Path : real program executable path
46  */
47
48 /**
49  * @open
50  * @ingroup APPLICATION_FRAMEWORK
51  * @defgroup aul  Application Utility Library
52  * @{
53  */
54
55
56 /**
57  * @file        aul.h
58  * @brief       Application Utility Library header
59  *
60  * Patched by    Knhoon Baik <knhoon.baik@samsung.com>
61  * Patched by    Youmin Ha   <youmin.ha@samsung.com>
62  */
63
64 /**
65  * @addtogroup aul
66  * @{
67  */
68
69 /**
70  * @brief Return values in AUL.
71  */
72 typedef enum _aul_return_val {
73         AUL_R_EREJECTED = -14,  /**< App disable for mode*/
74         AUL_R_ENOAPP = -13,             /**< Failed to find app ID or pkg ID */
75 #ifdef _APPFW_FEATURE_APP_CONTROL_LITE
76         AUL_R_UG_LOCAL = -12,
77 #endif
78         AUL_R_EHIDDENFORGUEST = -11,    /**< App hidden for guest mode */
79         AUL_R_ENOLAUNCHPAD = -10,       /**< no launchpad */
80         AUL_R_ETERMINATING = -9,        /**< application terminating */
81         AUL_R_EILLACC = -8,             /**< Illegal Access */
82         AUL_R_LOCAL = -7,               /**< Launch by himself */
83         AUL_R_ETIMEOUT = -6,            /**< Timeout */
84         AUL_R_ECANCELED = -5,           /**< Operation canceled */
85         AUL_R_EINVAL = -4,              /**< Invalid argument */
86         AUL_R_ECOMM = -3,               /**< Comunication Error */
87         AUL_R_ENOINIT = -2,             /**< AUL handler NOT initialized */
88         AUL_R_ERROR = -1,               /**< General error */
89         AUL_R_OK = 0                    /**< General success */
90 }aul_return_val;
91
92 enum app_status {
93         STATUS_LAUNCHING,
94         STATUS_CREATED,
95         STATUS_FOCUS,
96         STATUS_VISIBLE,
97         STATUS_BG,
98         STATUS_DYING,
99         STATUS_HOME,
100         STATUS_NORESTART,
101         STATUS_SERVICE
102 };
103
104 /** @} */
105
106 /**
107  * @defgroup aul_launch         Primitive APIs to launch/resume/terminate application
108  * @ingroup aul
109  * @brief
110  *      APIs to launch/resume/terminate application
111  *      - Launch application based on application package name
112  *      - Resume application based on application package name
113  *      - Resume application based on pid (required root or inhouse permisssion)
114  *      - Terminate application base on pid (required root or inhouse permission)
115  *
116  *      AUL internal information
117  *      - AUL grant pid, gid to launched application for security
118  *      - AUL send RESET/RESUME/TERM event for running application in case of single instance
119  *      - AUL set application enviroment based on desktop entry
120  *      - AUL support single instance / multi instance
121  *      - AUL support application data exchange format (bundle)
122  */
123
124 /**
125  * @addtogroup aul_launch
126  * @{
127  */
128
129 typedef enum _aul_type{
130         AUL_START,
131         AUL_RESUME,
132         AUL_TERMINATE,
133         AUL_TERMINATE_BGAPP,
134         AUL_PAUSE,
135         AUL_SUSPEND,
136         AUL_WAKE,
137 }aul_type;
138
139 /** AUL internal private key */
140 #define AUL_K_PKG_NAME          "__AUL_PKG_NAME__"
141 /** AUL internal private key */
142 #define AUL_K_WAIT_RESULT       "__AUL_WAIT_RESULT__"
143 /** AUL internal private key */
144 #define AUL_K_SEND_RESULT       "__AUL_SEND_RESULT__"
145 /** AUL internal private key */
146 #define AUL_K_TASK_MANAGE       "__AUL_TASK_MANAGE__"
147 /** AUL internal private key */
148 #define AUL_K_APP_TYPE          "__AUL_APP_TYPE__"
149 /** AUL internal private key - To check original caller's identity */
150 #define AUL_K_ORG_CALLER_PID    "__AUL_ORG_CALLER_PID__"
151 /** AUL internal private key - To check forwarded callee app's pid */
152 #define AUL_K_FWD_CALLEE_PID    "__AUL_FWD_CALLEE_PID__"
153
154 /** AUL internal private key */
155 #define AUL_K_NO_CANCEL        "__AUL_NO_CANCEL__"
156
157 /** AUL public key - To check caller's secuirty */
158 #define AUL_K_CALLER_PID        "__AUL_CALLER_PID__"
159 /** AUL public key - To check callee's secuirty */
160 #define AUL_K_CALLEE_PID        "__AUL_CALLEE_PID__"
161
162 /** AUL public key - To check caller's secuirty */
163 #define AUL_K_CALLER_APPID      "__AUL_CALLER_APPID__"
164 /** AUL public key - To check caller's secuirty */
165 #define AUL_K_CALLEE_APPID      "__AUL_CALLEE_APPID__"
166
167 /** AUL public key - To find argv0 */
168 #define AUL_K_ARGV0             "__AUL_ARGV0__"
169 /** AUL public key - To measure launching time */
170 #define AUL_K_STARTTIME         "__AUL_STARTTIME__"
171
172 /** AUL public key - To support launching based on mime type */
173 #define AUL_K_MIME_TYPE         "__AUL_MIME_TYPE__"
174 /** AUL public key - To support launching based on mime type */
175 #define AUL_K_UNALIASED_MIME_TYPE               "__AUL_UNALIASED_MIME_TYPE__"
176 /** AUL public key - To support launching based on mime type */
177 #define AUL_K_MIME_CONTENT      "__AUL_MIME_CONTENT__"
178
179 /** AUL public key - To support launching based on service */
180 #define AUL_K_SERVICE_NAME              "__AUL_SERVICE_NAME__"
181
182 /** AUL public key - To force launch app selector instead of lauchingn default app */
183 #define AUL_K_FORCE_LAUNCH_APP_SELECTOR "__AUL_FORCE_LAUNCH_APP_SELECTOR__"
184
185 /** AUL public key - To support SDK */
186 #define AUL_K_SDK       "__AUL_SDK__"
187
188 /** AUL public key - To support Media key */
189 #define AUL_K_MULTI_KEY "__AUL_MULTI_KEY__"
190 /** AUL public key - To support Media key */
191 #define AUL_K_MULTI_KEY_EVENT   "__AUL_MULTI_KEY_EVENT__"
192
193 /** AUL public bundle value - To support Media key*/
194 #define AUL_V_KEY_PRESSED       "__AUL_KEY_PRESSED__"
195 /** AUL public bundle value - To support Media key*/
196 #define AUL_V_KEY_RELEASED      "__AUL_KEY_RELEASED__"
197
198 /** AUL internal private key */
199 #define AUL_K_EXEC              "__AUL_EXEC__"
200 /** AUL internal private key */
201 #define AUL_K_MULTIPLE          "__AUL_MULTIPLE__"
202 /** AUL internal private key */
203 #define AUL_K_PACKAGETYPE       "__AUL_PACKAGETYPE__"
204 /** AUL internal private key */
205 #define AUL_K_HWACC             "__AUL_HWACC__"
206 /** AUL internal private key */
207 #define AUL_K_TASKMANAGE        "__AUL_TASKMANAGE__"
208
209
210 /** AUL internal private key */
211 #define AUL_K_APPID             "__AUL_APPID__"
212 /** AUL internal private key */
213 #define AUL_K_PID               "__AUL_PID__"
214 /** AUL internal private key */
215 #define AUL_K_WID               "__AUL_WID__"
216 /** AUL internal private key */
217 #define AUL_K_LEADER_PID        "__AUL_LEADER_PID__"
218
219 /** AUL internal private key */
220 #define AUL_K_PRELAUCHING       "__AUL_PRELAUCHING__"
221
222 /** AUL internal private key */
223 #define AUL_K_OWNER_PID         "__AUL_OWNER_PID__"
224 /** AUL internal private key */
225 #define AUL_K_CHILD_PID         "__AUL_CHILD_PID__"
226
227 #ifdef _APPFW_FEATURE_PROCESS_POOL
228 #define AUL_K_INTERNAL_POOL "__AUL_INTERNAL_POOL__"
229 #endif
230
231 #ifdef _APPFW_FEATURE_DATA_CONTROL
232 #define AUL_K_DATA_CONTROL_TYPE   "__AUL_DATA_CONTROL_TYPE__"
233 #endif
234
235 /** AUL internal private key */
236 #define AUL_K_HOST_PID  "__AUL_HOST_PID__"
237
238 /** Internal operation for launching application which is other zone */
239 #define AUL_SVC_OPERATION_JUMP  "http://tizen.org/appcontrol/operation/jump"
240 #define AUL_SVC_K_JUMP_ZONE_NAME        "__K_JUMP_DOMAIN_NAME__"
241 #define AUL_SVC_K_JUMP_ORIGIN_OPERATION "__K_JUMP_ORIGIN_OPERATION__"
242 #define AUL_SVC_K_FOCUS_ZONE "__K_FOCUS_ZONE__"
243 #define AUL_SVC_K_RUA_STAT_CALLER               "__K_RUA_STAT_CALLER__"
244 #define AUL_SVC_K_RUA_STAT_TAG          "__K_RUA_STAT_TAG__"
245
246
247 #define AUL_K_ALLOWED_BG        "__AUL_INTERNAL_ALLOWED_BG__"
248
249 #ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
250 #define AUL_TEP_PATH                    "_AUL_TEP_PATH_"
251 int aul_check_tep_mount(const char *tep_path);
252 int aul_is_tep_mount_dbus_done(const char *tep_string);
253 #endif
254
255
256 /** AUL internal private key */
257 #define AUL_K_PKGID             "__AUL_PKGID_"
258
259
260 /**
261  * @brief       This is callback function for aul_launch_init
262  * @param[in]   type    event's type received from system
263  * @param[in]   b       In case of RESET events, bundle which is received from peer
264  * @param[in]   data    user-supplied data
265  */
266 typedef int (*aul_handler_fn) (aul_type type, bundle * b, void *data);
267
268 /**
269  * @par Description:
270  *      This API install your AUL handler and setup AUL internal connection.
271  * @par Purpose:
272  *      AUL receive START(RESET), RESUME, TERMINATE events from system.\n
273  *      This API use to handle the events. \n
274  * @par Typical use case:
275  *      In general, you need not use this API.
276  *      If you use AppCore, you should NOT use this API.
277  *      AppCore will set default aul_handler.
278  *
279  * @param[in]   handler         aul main callback handler function
280  * @param[in]   data            user-supplied data for start_handler
281  * @return      0 if success, negative value(<0) if fail\n
282  * @retval      AUL_R_OK        - success
283  * @retval      AUL_R_ECANCELD  - aul handler was installed already by others
284  * @retval      AUL_R_ECOMM     - error to create internal ipc
285  * @retval      AUL_R_ERROR     - error to attach glib main loop or ecore main loop
286  *
287  * @warning     If you use AppCore, you should NOT use this API.\n
288  *              You need glib main loop or ecore main loop.\n
289  * @pre
290  *      you must have aul handler to use this API.
291  *      aul_luanch_init register aul handler.
292  * @post
293  *      None
294  * @see
295  *      None
296  * @code
297  * #include <aul.h>
298  * #include <bundle.h>
299  *
300  * static int aul_handler(aul_type type, bundle *kb,void *data)
301  * {
302  *      switch(type)
303  *      {
304  *              case AUL_START:
305  *                      // process RESET event
306  *                      break;
307  *              case AUL_RESUME:
308  *                      // process RESUME event
309  *                      break;
310  *              case AUL_TERMINATE:
311  *                      // preocess TERMINATE event
312  *                      break;
313  *      }
314  *      return 0;
315  * }
316  *
317  * int main(int argc, char **argv)
318  * {
319  *      ecore_init();
320  *      aul_launch_init(aul_handler,NULL);
321  *      aul_launch_argv_handler(argc, argv);
322  *      ecore_main_loop_begin();
323  * }
324  *
325  * @endcode
326  * @remark
327  *      None
328 */
329 int aul_launch_init(aul_handler_fn handler, void *data);
330
331 /**
332  * @par Description:
333  *      This API create internal RESET events with given argc, argv \n
334  * @par Purpose:
335  *      This API's purpose is to generate reset event.
336  *      If you want to generate local RESET events with argument vector format, use this API
337  * @par Typical use case:
338  *      In general, you need not use this API.
339  *      AppCore use this API to create internal reset event.
340  *
341  * @param[in]   argc    # of args
342  * @param[in]   argv    list of arg strings
343  * @return      0 if success, negative value(<0) if fail
344  * @retval      AUL_R_OK        - success
345  * @retval      AUL_R_ENOINIT   - aul handler was NOT yet installed
346  * @retval      AUL_R_ECANCLED  - error to create internal bundle with given argc,argv.
347  * @retval      AUL_R_ERROR     - general error
348  *
349  * @pre
350  *      you must have aul handler to use this API.
351  *      aul_luanch_init register aul handler.
352  * @post
353  *      None
354  * @see
355  *      aul_launch_init
356  * @code
357  * #include <aul.h>
358  * #include <bundle.h>
359  *
360  * int send_local_reset_event()
361  * {
362  *      int argc=3;
363  *      char* argv[4];
364  *      argv[0] = "local.app";
365  *      argv[1] = "event_type";
366  *      argv[2] = "my_reset";
367  *      argv[3] = NULL;
368  *      aul_launch_argv_handler(argc,argv);
369  * }
370  *
371  * @endcode
372  * @remark
373  *      If you use AppCore, you NEED NOT use this API.
374 */
375 int aul_launch_argv_handler(int argc, char **argv);
376
377 /**
378  * @par Description:
379  *      This API create internal RESET events with given argc, argv \n
380  * @par Purpose:
381  *      This API's purpose is to generate reset event.
382  *      If you want to generate local RESET events with argument vector format, use this API
383  * @par Typical use case:
384  *      In general, you need not use this API.
385  *      AppCore use this API to create internal reset event.
386  *
387  * @param[in]   argc    # of args
388  * @param[in]   argv    list of arg strings
389  * @return      0 if success, negative value(<0) if fail
390  * @retval      AUL_R_OK        - success
391  * @retval      AUL_R_ENOINIT   - aul handler was NOT yet installed
392  * @retval      AUL_R_ECANCLED  - error to create internal bundle with given argc,argv.
393  * @retval      AUL_R_ERROR     - general error
394  *
395  * @pre
396  *      you must have aul handler to use this API.
397  *      aul_luanch_init register aul handler.
398  * @post
399  *      None
400  * @see
401  *      aul_launch_init
402  * @code
403  * #include <aul.h>
404  * #include <bundle.h>
405  *
406  * int send_local_reset_event()
407  * {
408  *      int argc=3;
409  *      char* argv[4];
410  *      argv[0] = "local.app";
411  *      argv[1] = "event_type";
412  *      argv[2] = "my_reset";
413  *      argv[3] = NULL;
414  *      aul_launch_argv_handler_for_efl(argc,argv);
415  * }
416  *
417  * @endcode
418  * @remark
419  *      If you use AppCore, you NEED NOT use this API.
420 */
421 int aul_launch_argv_handler_for_efl(int argc, char **argv);
422
423
424 /**
425  * @par Description:
426  *      This API creates internal RESET events with given bundle \n
427  * @par Purpose:
428  *  This API's purpose is to generate reset event.
429  *  If you want to generate local RESET events with argument vector format, first use
430  *  bundle_import_from_argv to create a bundle from the argument vector and then use this API
431  *  Eventually, this API will replace aul_launch_argv_handler().
432  * @par Typical use case:
433  *      In general, you need not use this API.
434  *      AppCore use this API to create internal reset event.
435  *
436  * @param[in]   b       bundle
437  * @return      0 if success, negative value(<0) if fail
438  * @retval      AUL_R_OK        - success
439  * @retval      AUL_R_ENOINIT   - aul handler was NOT yet installed
440  * @retval      AUL_R_ERROR     - general error
441  *
442  * @pre
443  *      you must have aul handler to use this API.
444  *      aul_luanch_init register aul handler.
445  * @post
446  *      None
447  * @see
448  *      aul_launch_init, bundle_import_from_argv
449  * @code
450  * #include <aul.h>
451  * #include <bundle.h>
452  *
453  * int send_local_reset_event()
454  * {
455  *  bundle* b;
456  *      int argc=3;
457  *      char* argv[4];
458  *      argv[0] = "local.app";
459  *      argv[1] = "event_type";
460  *      argv[2] = "my_reset";
461  *      argv[3] = NULL;
462  *
463  *      b = bundle_import_from_argv(argc,argv);
464  *      aul_launch_local(b);
465  * }
466  *
467  * @endcode
468  * @remark
469  *      If you use AppCore, you NEED NOT to use this API.
470 */
471 int aul_launch_local(bundle *b);
472
473 /**
474  * @par Description:
475  *      This API launches application with the given bundle.
476  *  If the application is not running or a multiple-instance one, this API launches with the given bundle.
477  *      If the application is running, this API sends a RESET event to the App.
478  *      While the application is running, if the application cannot receive the RESET event,
479  *      this API returns a general error(AUL_R_ERROR).\n
480  * @par Purpose:
481  *      This API is for caller.
482  *      This API's purpose is to launch/reset application with given bundle.
483  * @par Typical use case:
484  *      If you know the target application's pkgname and bundle types,
485  *      you can use this API to launch/reset the application.
486  *
487  * @param[in]   pkgname         package name to be run as callee
488  * @param[in]   kb              bundle to be passed to callee
489  * @return      callee's pid if success, negative value(<0) if fail
490  * @retval      AUL_R_OK        - success
491  * @retval      AUL_R_EINVAL    - invaild package name
492  * @retval      AUL_R_ECOMM     - internal AUL IPC error
493  * @retval      AUL_R_ERROR     - general error
494  *
495  * @pre
496  *      None
497  * @post
498  *      None
499  * @see
500  *      aul_open_app
501  * @code
502  * #include <aul.h>
503  * #include <bundle.h>
504  *
505  * int launch_inhouse_contact_app()
506  * {
507  *      bundle *b;
508  *      b = bundle_create();
509  *      bundle_add(b,"type","SIM");
510  *      aul_launch_app("org.tizen.contact",b);
511  *      iuu
512  * }
513  *
514  * @endcode
515  * @remark
516  *      None
517  */
518 int aul_launch_app(const char *appid, bundle *kb);
519
520 /**
521  * @par Description:
522  *  This API launches application, as menu screen launches the app.
523  *  Thus, if the applocation is running, this API sends a RESUME event to the app.
524  *  If the application is not running, this API launches the app.
525  *  While the application is running, if the application cannot receive the RESUME event,
526  *  AUL tries to raise the application's default window.
527  *
528  * @par Purpose:
529  *      This API is for caller.
530  *      This API's purpose is to resume/launch application
531  * @par Typical use case:
532  *      If you only want to show application with previous state or default state, Use this API.
533  *
534  * @param[in]   pkgname         package name to be resume as callee
535  * @return      callee's pid if success, negative value(<0) if fail
536  * @retval      AUL_R_OK        - success
537  * @retval      AUL_R_EINVAL    - invaild package name
538  * @retval      AUL_R_ECOMM     - internal AUL IPC error
539  * @retval      AUL_R_ERROR     - general error
540  *
541  * @pre
542  *      None
543  * @post
544  *      None
545  * @see
546  *      aul_launch_app, aul_app_is_running, aul_resume_pid
547  * @code
548  * #include <aul.h>
549  * #include <bundle.h>
550  *
551  * int open_inhouse_contact_app()
552  * {
553  *      if(aul_app_is_running("org.tizen.contact"))
554  *              aul_open_app("org.tizen.contact");
555  * }
556  *
557  * @endcode
558  * @remark
559  *      If you don't want to launch the app,
560  *      you should check app's running state with aul_app_is_running.
561  *      This API will launch the application if the application is not running.
562 */
563 int aul_open_app(const char *appid);
564
565 /**
566  * @par Description:
567  *      This API trigger to resume application
568  *      If the application is running, this API send a resume event to the App.
569  *      If the application is not running, this API returns fail.
570  *      Although the application is running, if the application cannot receive resume event,
571  *      AUL try to raise the application's default windows.
572  * @par Purpose:
573  *      This API is for caller.
574  *      This API's purpose is to send resume event.
575  * @par Typical use case:
576  *      If you only want to show application with previous state or default state, Use this API.
577  *
578  * @param[in]   pkgname         package name to be resume as callee
579  * @return      callee's pid if success, negative value(<0) if fail
580  * @retval      AUL_R_OK        - success
581  * @retval      AUL_R_EINVAL    - invaild package name
582  * @retval      AUL_R_ECOMM     - internal AUL IPC error
583  * @retval      AUL_R_ERROR     - general error
584  *
585  * @pre
586  *      None
587  * @post
588  *      None
589  * @see
590  *      aul_launch_app, aul_app_is_running, aul_resume_pid
591  * @deprecated
592  *  This function will be deprecated. Use aul_open_add() instead.
593  * @code
594  * #include <aul.h>
595  * #include <bundle.h>
596  *
597  * int resume_inhouse_contact_app()
598  * {
599  *      if(aul_app_is_running("org.tizen.contact"))
600  *              aul_resume_app("org.tizen.contact");
601  * }
602  *
603  * @endcode
604  * @remark
605  *      If you don't want to launch the app,
606  *      you should check app's running state with aul_app_is_running.
607  *      This API will launch the application if the application is not running.
608  *      If you want to only resume without launching in multiple instance application model,
609  *      you should use aul_resume_pid.
610 */
611 int aul_resume_app(const char *appid);
612
613 /**
614  * @par Description:
615  *      This API trigger to resume application
616  *      If the application is running, this API send a resume event to the App.
617  *      If the application is not running, this API return AUL_R_ERROR.
618  *      Although the application is running, if the application cannot receive resume event,
619  *      AUL try to raise the application's default windows.
620  * @par Purpose:
621  *      This API is for caller.
622  *      This API's purpose is to send resume event.
623  * @par Typical use case:
624  *      In multiple application model, If you want to only resume specific application, Use this API
625  *
626  * @param[in]   pid     application's pid to be resumed
627  * @return      0 if success, negative value(<0) if fail
628  * @retval      AUL_R_OK        - success
629  * @retval      AUL_R_EINVAL    - invaild pid
630  * @retval      AUL_R_ECOMM     - internal AUL IPC error
631  * @retval      AUL_R_ERROR     - general error (include application is not running)
632  * @warning     This API need to require root or inhouse permisssion \n
633  *              If you have not the permission, this API return AUL_R_ERROR. \n
634  * @pre
635  *      None
636  * @post
637  *      None
638  * @see
639  *      aul_launch_app
640  * @code
641  * #include <aul.h>
642  * #include <bundle.h>
643  *
644  * int iterfunc(const aul_app_info *info, void *data)
645  * {
646  *      if(strcmp(info->pkg_name,"org.tizen.contact")==0)
647  *              aul_resume_pid(info->pid);
648  * }
649  *
650  * int iterate_running_apps()
651  * {
652  *      return aul_app_get_running_app_info(iterfunc,NULL);
653  * }
654  *
655  * @endcode
656  * @remark
657  *      None
658 */
659 int aul_resume_pid(int pid);
660
661 /**
662  * @par Description:
663  *      This API trigger to terminate application
664  *
665  *      If the application is running, this API send a terminate event to the App. \n
666  *      If the app cannot receive the event, AUL kill forcely the application.\n
667  * @par Purpose:
668  *      This API's purpose is to kill application
669  * @par Typical use case:
670  *      In general, Application like Task Manager use this API.
671  *
672  *              This API need to require root or inhouse permisssion. \n
673  *
674  * @param[in]   pid     application's pid to be terminated
675  * @return      0 if success, negative value(<0) if fail
676  * @retval      AUL_R_OK        - success
677  * @retval      AUL_R_EINVAL    - invaild pid
678  * @retval      AUL_R_ECOMM     - internal AUL IPC error
679  * @retval      AUL_R_ERROR     - general error
680  * @warning     This API need to require root or inhouse permisssion. \n
681  *
682  * @pre
683  *      None
684  * @post
685  *      None
686  * @see
687  *      None
688  * @code
689  * #include <aul.h>
690  * #include <bundle.h>
691  *
692  * int iterfunc(const aul_app_info *info, void *data)
693  * {
694  *      if(strcmp(info->pkg_name,"org.tizen.contact")==0)
695  *              aul_terminate_pid(info->pid);
696  * }
697  *
698  * int iterate_running_apps()
699  * {
700  *      return aul_app_get_running_app_info(iterfunc,NULL);
701  * }
702  *
703  * @endcode
704  * @remark
705  *      If you have not the permission, this API return AUL_R_ERROR. \n
706 */
707 int aul_terminate_pid(int pid);
708 int aul_terminate_bgapp_pid(int pid);
709 int aul_terminate_pid_without_restart(int pid);
710 int aul_terminate_pid_async(int pid);
711
712
713 /** @} */
714
715 /**
716  * @defgroup aul_info           Helper APIs to get running application information
717  * @ingroup aul
718  * @brief
719  *      API to get running application information (state, executable path, ..)
720  *      - get application package name from pid
721  *      - get application running state
722  *      - get application list of runnning applications
723  */
724
725 /**
726  * @addtogroup aul_info
727  * @{
728  */
729
730 /**
731  *@brief Running application's information structure retrieved by AUL
732  */
733 typedef struct _aul_app_info {
734         int pid;                /**< app's pid if running*/
735         char* pkg_name;         /**< application id */
736         char* app_path;         /**< application excutable path */
737         char* appid;
738 } aul_app_info;
739
740 /**
741  * @brief iterator function running with aul_app_get_running_app_info
742  * @param[out]  ainfo   aul_app_info retreived by aul_app_get_running_app_info
743  * @param[out]  data    user-supplied data
744 */
745 typedef int (*aul_app_info_iter_fn)(const aul_app_info *ainfo, void *data);
746
747 /**
748  * @par Description:
749  *      This API ask a application is running by application package name.
750  * @par Purpose:
751  *      To know whether some application is running or not, use this API
752  * @par Typical use case:
753  *      For example, If you want to know browser application running,
754  *      you can check it by using this API.
755  *
756  * @param[in]   pkgname application package name
757  * @return      true / false
758  * @retval      1       app_name is running now.
759  * @retval      0       app_name is NOT running now.
760  *
761  * @pre
762  *      None
763  * @post
764  *      None
765  * @see
766  *      None
767  * @code
768  * #include <aul.h>
769  *
770  * int is_running_browser_app()
771  * {
772  *      return aul_app_is_running("org.tizen.browser");
773  * }
774  *
775  * @endcode
776  * @remark
777  *      None
778 *
779 */
780 int aul_app_is_running(const char *appid);
781
782 /**
783  * @par Description:
784  *      This API use to get running application list.
785  *      This API call iter_fn with each aul_app_info of running apps when running application is found.
786  * @par Purpose:
787  *      If you want to get running application list, use this API
788  *      This API give you running applications which has SLP desktop file.
789  * @par Typical use case:
790  *      In general, this API is used by task manager appllication. (running application list viewer)
791  *
792  * @param[in]   iter_fn         iterator function
793  * @param[in]   data            user-supplied data for iter_fn
794  * @return      0 if success, negative value(<0) if fail
795  * @retval      AUL_R_OK        - success
796  * @retval      AUL_R_ERROR     - internal error
797  *
798  * @pre
799  *      None
800  * @post
801  *      None
802  * @see
803  *      None
804  * @code
805  * #include <aul.h>
806  *
807  * int iterfunc(const aul_app_info* info, void* data)
808  * {
809  *      printf("\t==========================\n");
810  *      printf("\t pkg_name: %s\n", info->appid);
811  *      printf("\t app_path: %s\n", info->app_path);
812  *      printf("\t running pid: %d\n", info->pid);
813  *      printf("\t==========================\n");
814  *      return 0;
815  * }
816  *
817  * int iterate_running_apps()
818  * {
819  *      return aul_app_get_running_app_info(iterfunc,NULL);
820  * }
821  *
822  * @endcode
823  * @remark
824  *      This API should use if you want to know running application which has desktop files.
825  *      If you want to get all process list, you must iterate process information by using proc filesystem
826  *      Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
827  */
828 int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
829
830 /**
831  * @par Description:
832  *      This API use to get running application list from the proc file system.
833  *      This API call iter_fn with each aul_app_info of running apps when running application is found.
834  *
835  * @param[in]   iter_fn         iterator function
836  * @param[in]   data            user-supplied data for iter_fn
837  * @return      0 if success, negative value(<0) if fail
838  * @retval      AUL_R_OK        - success
839  * @retval      AUL_R_ERROR     - internal error
840  */
841 int aul_get_running_app_info_from_proc(aul_app_info_iter_fn iter_fn, void *data);
842
843 int aul_get_running_app_info_from_memory(aul_app_info_iter_fn iter_fn, void *data);
844
845
846 /**
847  * @par Description:
848  *      This API get application package name by pid
849  * @par Purpose:
850  *      If you want to get package name of running application, use this API
851  * @par Typical use case:
852  *      In general, You can use this API when you want to know caller's information.
853  *
854  * @param[in]   pid             given pid
855  * @param[out]  pkgname         pkgname to be get
856  * @param[in]   len             length of pkgname
857  * @return      0 if success, negative value(<0) if fail
858  * @retval      AUL_R_OK        - success
859  * @retval      AUL_R_ERROR     - no such a package name
860  * @pre
861  *      None
862  * @post
863  *      None
864  * @see
865  *      None
866  * @code
867  * #include <aul.h>
868  * #include <bundle.h>
869  *
870  * static int app_reset(bundle *b, void *data)
871  * {
872  *      int pid;
873  *      char appname[255];
874  *
875  *      pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
876  *      aul_app_get_pkgname_bypid(pid, appname, sizeof(appname));
877  * }
878  *
879  * @endcode
880  * @remark
881  *      None
882 */
883 int aul_app_get_pkgname_bypid(int pid, char *pkgname, int len);
884
885 /**
886  * @par Description:
887  *      This API get application appid by pid
888  * @par Purpose:
889  *      If you want to get appid of running application, use this API
890  * @par Typical use case:
891  *      In general, You can use this API when you want to know caller's information.
892  *
893  * @param[in]   pid             given pid
894  * @param[out]  appid           application id
895  * @param[in]   len             length of pkgname
896  * @return      0 if success, negative value(<0) if fail
897  * @retval      AUL_R_OK        - success
898  * @retval      AUL_R_ERROR     - no such a appid
899  * @pre
900  *      None
901  * @post
902  *      None
903  * @see
904  *      None
905  * @code
906  * #include <aul.h>
907  * #include <bundle.h>
908  *
909  * static int app_reset(bundle *b, void *data)
910  * {
911  *      int pid;
912  *      char appid[255];
913  *
914  *      pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
915  *      aul_app_get_appid_bypid(pid, appid, sizeof(appid));
916  * }
917  *
918  * @endcode
919  * @remark
920  *      None
921 */
922 int aul_app_get_appid_bypid(int pid, char *appid, int len);
923
924 int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len);
925
926
927 /** @} */
928
929 /**
930  * @defgroup aul_mime High-level APIs to launch default application based on mime type
931  * @ingroup aul
932  * @brief
933  *   AUL High-level APIs based on mime type
934  *
935  *   These APIs provide two functionality\n
936  *
937  *   -# To launch default application to open a file based on its MIME type \n
938  *   For example, you can launch the default video player to open .mp4 files
939  *   or launch the default browser to open HTML files \n
940  *   -# To launch default application to process given content \n
941  *   For example, you can launch the default e-mail application to process
942  *   "nice@samsung.com" e-mail address.
943  */
944
945 /**
946  * @addtogroup aul_mime
947  * @{
948  */
949
950 /**
951  * @par Description:
952  *      This API get the mimetype associated with filename
953  * @par Purpose:
954  *      This API use to get mimetype associteted with given filename
955  *      In general, This API use when you want to know only mimetype given filename.
956  * @par Typical use case:
957  *      For example, In trasfering data through bluetooth,
958  *      additional information like mimetype should be added.
959  *      In such situation, You can get mimetype by using this API.
960  *
961  * @param[in]   filename        file name
962  * @param[out]  mimetype        a mime type
963  * @param[in]   len             length of mimetype
964  * @return      0 if success, negative value if fail
965  * @retval      AUL_R_OK        - success
966  * @retval      AUL_R_EINVAL    - invalid argument(filename)
967  * @retval      AUL_R_ERROR     - general error
968  *
969  * @pre
970  *      None
971  * @post
972  *      None
973  * @see
974  *      None
975  * @code
976  * #include <aul.h>
977  *
978  * void get_mimetype()
979  * {
980  *      char mimetype[255];
981  *      aul_get_mime_from_file("image.jpg",mimetype,sizeof(mimetype));
982  * }
983  *
984  * @endcode
985  * @remark
986  *      None
987  */
988 int aul_get_mime_from_file(const char *filename, char *mimetype, int len);
989
990 /**
991  * @par Description:
992  *      This API get the mimetype associated with given content
993  * @par Purpose:
994  *      This API use to get mimetype associteted with given content
995  *      In general, This API use when you want to know only mimetype given content
996  * @par Typical use case:
997  *      For example, In trasfering data through bluetooth,
998  *      additional information like mimetype should be added.
999  *      In such situation, You can get mimetype by using this API.
1000  *
1001  * @param[in]   content         content string like "011-0000-0000"
1002  * @param[out]  mimetype        a mime type
1003  * @param[in]   len             length of mimetype
1004  * @return      0 if success, negative value if fail
1005  * @retval      AUL_R_OK        - success
1006  * @retval      AUL_R_EINVAL    - invalid argument(content)
1007  * @retval      AUL_R_ERROR     - general error
1008  *
1009  * @pre
1010  *      None
1011  * @post
1012  *      None
1013  * @see
1014  *      None
1015  * @code
1016  * #include <aul.h>
1017  *
1018  * void get_mimetype()
1019  * {
1020  *      char mimetype[255];
1021  *      aul_get_mime_from_content("http://www.samsung.com",mimetype,sizeof(mimetype));
1022  * }
1023  *
1024  * @endcode
1025  * @remark
1026  *      None
1027 */
1028 int aul_get_mime_from_content(const char *content, char *mimetype, int len);
1029
1030 /**
1031  * @par Description:
1032  *      This API get the icon's name associated with given mimetype
1033  * @par Purpose:
1034  *      This API use to get icon's name associteted with given mimetype
1035  * @par Typical use case:
1036  *      If you want to show mimetype's icon, use this API.
1037  *
1038  * @param[in]   mimetype        a mime type
1039  * @param[out]  iconname        icon's name
1040  * @param[in]   len             length of iconname
1041  * @return      0 if success, negative value if fail
1042  * @retval      AUL_R_OK        - success
1043  * @retval      AUL_R_EINVAL    - invalid argument(content)
1044  * @retval      AUL_R_ERROR     - general error (no such mime type)
1045  *
1046  * @pre
1047  *      None
1048  * @post
1049  *      None
1050  * @see
1051  *      None
1052  * @code
1053  * #include <aul.h>
1054  *
1055  * void get_mime_icon()
1056  * {
1057  *      char icon[255];
1058  *      aul_get_mime_icon("text/html",icon,sizeof(icon));
1059  * }
1060  *
1061  * @endcode
1062  * @remark
1063  *      None
1064  */
1065 int aul_get_mime_icon(const char *mimetype, char *iconname, int len);
1066
1067 /**
1068  * @par Description:
1069  *      This API get the extensions associated with given mimetype
1070  * @par Purpose:
1071  *      This API use to get extensions associteted with given mimetype
1072  * @par Typical use case:
1073  *      In general, user is not familiar with mimetype(text/html),
1074  *      user is familiar with extenstions(*.html, *.htm)
1075  *      So, To show mimetype information to user, use this API
1076  *
1077  * @param[in]   mimetype        a mime type
1078  * @param[out]  extlist         extentions (ex> mpeg,mpg,mpe)
1079  * @param[in]   len             length of extlist
1080  * @return      0 if success, negative value if fail
1081  * @retval      AUL_R_OK        - success
1082  * @retval      AUL_R_EINVAL    - invalid argument(mimetype)
1083  * @retval      AUL_R_ERROR     - general error (no mimetype or no extenstion)
1084  *
1085  * @pre
1086  *      None
1087  * @post
1088  *      None
1089  * @see
1090  *      aul_get_mime_description
1091  * @code
1092  * #include <aul.h>
1093  *
1094  * void get_extension()
1095  * {
1096  *      char extlist[255];
1097  *      aul_get_mime_extension("text/html",extlist,sizeof(extlist));
1098  * }
1099  *
1100  * @endcode
1101  * @remark
1102  *      Some mimetype don't have extension.
1103  *      In that case, You can use aul_get_mime_description.
1104  *
1105 */
1106 int aul_get_mime_extension(const char *mimetype, char *extlist, int len);
1107
1108 /**
1109  * @par Description:
1110  *      This API get the description associated with given mimetype
1111  * @par Purpose:
1112  *      This API use to get description associteted with given mimetype
1113  * @par Typical use case:
1114  *      In general, user is not familiar with mimetype(text/html),
1115  *      user is familiar with well-knowing information like extenstions(*.html, *.htm)
1116  *      But, some mimetype don't have extenstion.
1117  *      At that time,to show mimetype information to user, use this API
1118  *
1119  * @param[in]   mimetype        a mime type
1120  * @param[out]  desc            description (ex> Call client)
1121  * @param[in]   len             length of desc
1122  * @return      0 if success, negative value if fail
1123  * @retval      AUL_R_OK        - success
1124  * @retval      AUL_R_EINVAL    - invalid argument(mimetype)
1125  * @retval      AUL_R_ERROR     - general error (no mimetype or no descrition)
1126  *
1127  * @pre
1128  *      None
1129  * @post
1130  *      None
1131  * @see
1132  *      aul_get_mime_extension
1133  * @code
1134  * #include <aul.h>
1135  *
1136  * void get_information_from_mime()
1137  * {
1138  *      char info[255];
1139  *      if(aul_get_mime_extension("text/html",info,sizeof(info))<0){
1140  *              aul_get_mime_description("text/html",info,sizeof(info));
1141  *      }
1142  * }
1143  *
1144  * @endcode
1145  * @remark
1146  *      None
1147  */
1148 int aul_get_mime_description(const char *mimetype, char *desc, int len);
1149
1150 /** @} */
1151
1152 /**
1153  * @defgroup aul_service High-level APIs to launch applications based on service.
1154  * @ingroup aul
1155  * @brief
1156  *      AUL High-level APIs based on service
1157  *
1158  *      This is Request/Response mechanism based on AUL like DBUS service call with auto-activation.\n
1159  *      We recommend this APIs for requesting application service like camera application service (take_picture)
1160  *      But, You can use other mechanism like DBUS service or your own internal IPC
1161  *
1162  *      - Caller\n
1163  *        Launch application based on service \n
1164  *        If application is not running, AUL requests to reset the event.\n
1165  *        Application can wait result with callback function.
1166  *
1167  *      - Callee\n
1168  *        After callee performs the requested operation, callee sends the result back, if necessary.\n
1169  *
1170  */
1171
1172 /**
1173  * @addtogroup aul_service
1174  * @{
1175  */
1176
1177 /**
1178  * @brief aul_service_res_fn is service result function
1179  * @param[out]  b       result bundle
1180  * @param[out]  data    user-supplied data
1181 */
1182 typedef void (*aul_service_res_fn)(bundle *b, int reserved, void *user_data);
1183
1184 /**
1185  * @par Description:
1186  *      This API create service result bundle based on bundle received in reset event.
1187  * @par Purpose:
1188  *      This API use to create result bundle to send it to caller.
1189  * @par Typical use case:
1190  *      This API is for callee which provide application service.\n
1191  *      To send result to caller, You must create result bundle. \n
1192  *      Callee(application providing the service) can send result by using this API and aul_send_service_result.
1193  *
1194  * @param[in]   inb             bundle received in reset event
1195  * @param[out]  outb            bundle to use for returning result
1196  * @return      0 if success, negative value(<0) if fail
1197  * @retval      AUL_R_OK        - success
1198  * @retval      AUL_R_EINVAL    - inb is not bundle
1199  * @retval      AUL_R_ERROR     - general error
1200  *
1201  * @pre
1202  *      To create result bundle, You need received original bundle.
1203  *      The original bundle can get from app_reset handler.
1204  * @post
1205  *      None
1206  * @see
1207  *      aul_send_service_result
1208  * @code
1209  * #include <aul.h>
1210  * #include <bundle.h>
1211  *
1212  * int app_reset(bundle *b, void *data)
1213  * {
1214  *      ad->recved_bundle = bundle_dup(b);
1215  * }
1216  *
1217  * int click_ok()
1218  * {
1219  *      bundle* res_bundle;
1220  *      aul_create_result_bundle(ad->recved_bundle,&res_bundle);
1221  *      bundle_add(res_bundle, "result", "1");
1222  *      aul_send_service_result(res_bundle);
1223  * }
1224  * @endcode
1225  * @remark
1226  *      None
1227  *
1228  */
1229 int aul_create_result_bundle(bundle *inb, bundle **outb);
1230
1231 /**
1232  * @par Description:
1233  *      This API send service result to caller with bundle
1234  * @par Purpose:
1235  *      This API is used to send result bundle to caller.
1236  * @par Typical use case:
1237  *      This API is for callee which provide application service.\n
1238  *      To send result to caller, You can use this API after creating result bundle. \n
1239  *      Callee(application to provide service) can send result by using this API and aul_create_result_bundle.
1240  *
1241  * @param[in]   b      Result data in bundle format
1242  * @return      0 if success, negative value(<0) if fail
1243  * @retval      AUL_R_OK        - success
1244  * @retval      AUL_R_EINVAL    - invalid result bundle
1245  * @retval      AUL_R_ECOMM     - internal AUL IPC error
1246  * @retval      AUL_R_ERROR     - general error
1247  *
1248  * @pre
1249  *      To send result bundle, You must create result bundle.
1250  *      see aul_create_result_bundle
1251  * @post
1252  *      None
1253  * @see
1254  *      aul_create_result_bundle
1255  * @code
1256  * #include <aul.h>
1257  * #include <bundle.h>
1258  *
1259  * int app_reset(bundle *b, void *data)
1260  * {
1261  *      ad->recved_bundle = bundle_dup(b);
1262  * }
1263  *
1264  * int click_ok()
1265  * {
1266  *      bundle* res_bundle;
1267  *      aul_create_result_bundle(ad->recved_bundle,&res_bundle);
1268  *      bundle_add(res_bundle, "result", "1");
1269  *      aul_send_service_result(res_bundle);
1270  * }
1271  * @endcode
1272  * @remark
1273  *      None
1274  *
1275  */
1276 int aul_send_service_result(bundle *b);
1277
1278 /**
1279  * @par Description:
1280  *      This API sets callback fuction that will be called when applications die.
1281  * @par Purpose:
1282  *      This API's purpose is to listen the application dead event.
1283  *      In general, task manager Application need this API.
1284  *
1285  * @param[in]   func            callback function
1286  * @param[in]   data            user data
1287  * @return      0 if success, negative value if fail
1288  * @retval      AUL_R_OK        - success
1289  * @retval      AUL_R_ERROR     - general error
1290  *
1291  * @pre
1292  *      None
1293  * @post
1294  *      None
1295  * @see
1296  *      aul_listen_app_launch_signal
1297  * @code
1298  * #include <aul.h>
1299  *
1300  * int app_dead_handler(int pid, void *data)
1301  * {
1302  *      printf("===> %s : %d\n", __FUNCTION__, pid);
1303  *      return 0;
1304  * }
1305  *
1306  * void dead_listen()
1307  * {
1308  *      aul_listen_app_dead_signal(app_dead_handler, NULL);
1309  * }
1310  *
1311  * @endcode
1312  * @remark
1313  *      None
1314  *
1315  */
1316 int aul_listen_app_dead_signal(int (*func) (int, void *), void *data);
1317
1318 /**
1319  * @par Description:
1320  *      This API sets callback fuction that will be called when applications are launched.
1321  * @par Purpose:
1322  *      This API's purpose is to listen the application launching event.
1323  *      In general, task manager Application need this API.
1324  *
1325  * @param[in]   func            callback function
1326  * @param[in]   data            user data
1327  * @return      0 if success, negative value if fail
1328  * @retval      AUL_R_OK        - success
1329  * @retval      AUL_R_ERROR     - general error
1330  *
1331  * @pre
1332  *      None
1333  * @post
1334  *      None
1335  * @see
1336  *      aul_listen_app_dead_signal
1337  * @code
1338  * #include <aul.h>
1339  *
1340  * int app_launch_handler(int pid, void *data)
1341  * {
1342  *      printf("===> %s : %d\n", __FUNCTION__, pid);
1343  *      return 0;
1344  * }
1345  *
1346  * void dead_listen()
1347  * {
1348  *      aul_listen_app_launch_signal(app_launch_handler, NULL);
1349  * }
1350  *
1351  * @endcode
1352  * @remark
1353  *      None
1354  *
1355  */
1356 int aul_listen_app_launch_signal(int (*func) (int, void *), void *data);
1357
1358 int aul_listen_app_launch_signal_v2(int (*func) (int, const char *, void *), void *data);
1359
1360 int aul_listen_booting_done_signal(int (*func) (int, void *), void *data);
1361
1362 int aul_listen_cooldown_signal(int (*func) (const char *, void *), void *data);
1363
1364 const char *aul_get_app_external_root_path(void);
1365 const char *aul_get_app_root_path(void);
1366 const char *aul_get_app_data_path(void);
1367 const char *aul_get_app_cache_path(void);
1368 const char *aul_get_app_resource_path(void);
1369 const char *aul_get_app_tep_resource_path(void);
1370 const char *aul_get_app_shared_data_path(void);
1371 const char *aul_get_app_shared_resource_path(void);
1372 const char *aul_get_app_shared_trusted_path(void);
1373 const char *aul_get_app_external_data_path(void);
1374 const char *aul_get_app_external_cache_path(void);
1375 const char *aul_get_app_external_shared_data_path(void);
1376 const char *aul_get_app_specific_path(void);
1377 const char *aul_get_app_external_specific_path(void);
1378 int aul_get_app_shared_data_path_by_appid(const char *app_id, char **path);
1379 int aul_get_app_shared_resource_path_by_appid(const char *app_id, char **path);
1380 int aul_get_app_shared_trusted_path_by_appid(const char *app_id, char **path);
1381 int aul_get_app_external_shared_data_path_by_appid(const char *app_id, char **path);
1382
1383 typedef int (*subapp_fn)(void *data);
1384
1385 int aul_set_subapp(subapp_fn cb, void *data);
1386 int aul_subapp_terminate_request_pid(int pid);
1387 int aul_is_subapp(void);
1388 int aul_add_caller_cb(int pid,  void (*caller_cb) (int, void *), void *data);
1389 int aul_remove_caller_cb(int pid);
1390 int aul_invoke_caller_cb(int pid);
1391
1392 #ifdef _APPFW_FEATURE_PROCESS_POOL
1393 void aul_set_preinit_window(void *evas_object);
1394 void* aul_get_preinit_window(const char *win_name);
1395
1396 void aul_set_preinit_background(void *evas_object);
1397 void* aul_get_preinit_background(void);
1398
1399 void aul_set_preinit_conformant(void *evas_object);
1400 void* aul_get_preinit_conformant(void);
1401 #endif
1402
1403 void aul_set_preinit_appid(const char *appid);
1404
1405 void aul_set_preinit_pkgid(const char *pkgid);
1406 const char* aul_get_preinit_pkgid(void);
1407
1408 int aul_launch_app_async(const char *appid, bundle *kb);
1409
1410 #ifdef _APPFW_FEATURE_MULTI_INSTANCE
1411 int aul_launch_app_for_multi_instance(const char *appid, bundle *kb);
1412 #endif
1413
1414 int aul_update_freezer_status(int pid, const char* type);
1415
1416 int aul_send_app_launch_request_signal(int pid, const char* appid, const char* pkgid, const char* type);
1417 int aul_send_app_resume_request_signal(int pid, const char* appid, const char* pkgid, const char *type);
1418 int aul_send_app_terminate_request_signal(int pid, const char* appid, const char* pkgid, const char *type);
1419 int aul_send_app_status_change_signal(int pid, const char* appid, const char* pkgid, const char* status, const char *type);
1420 int aul_send_app_terminated_signal(int pid);
1421 int aul_send_app_group_signal(int owner_pid, int child_pid, const char *child_pkgid);
1422
1423 int aul_status_update(int status);
1424
1425 /**
1426  * @par Description:
1427  *      This API gets status of specified application process id.
1428  * @par Purpose:
1429  *      This API's purpose is to get the application's status.
1430  *
1431  * @param[in]   pid     pid of application
1432  * @return      0 or greater if success, nagative value if fail
1433  * @retval      STATUS_LAUNCHING
1434  * @retval      STATUS_CREATED
1435  * @retval      STATUS_FOCUS
1436  * @retval      STATUS_VISIBLE
1437  * @retval      STATUS_BG
1438  * @retval      STATUS_DYING
1439  * @retval      STATUS_HOME
1440  * @retval      STATUS_NORESTART
1441  * @see
1442  *      aul_status_update
1443  * @pre
1444  *      None
1445  * @post
1446  *      None
1447  * @code
1448  * #include <aul.h>
1449  *
1450  * int iterfunc(const aul_app_info *info, void *data)
1451  * {
1452  *      int status;
1453  *      status = aul_app_get_status_bypid(info->pid);
1454  *      if (status == STATUS_FOCUS) {
1455  *              printf("%s has focus", info->app_id);
1456  *              (int *)data = info->pid;
1457  *              return -1;
1458  *      }
1459  *      return 0;
1460  * }
1461  *
1462  * int find_focus_app_pid()
1463  * {
1464  *      int pid = 0;
1465  *      aul_app_get_running_app_info(iterfunc, &pid);
1466  *      return pid;
1467  * }
1468  * @endcode
1469  * @remark
1470  *      None
1471  */
1472 int aul_app_get_status_bypid(int pid);
1473
1474 /**
1475  * @par Description
1476  *      This API sets callback function that on application status changed.
1477  * @par Purpose:
1478  *      This API's purpose is to listen the application's status changed within
1479  *      the caller process. In general, a library that required to release resource on
1480  *      application's status may use this API.
1481  *
1482  * @param[in]   func    callback function
1483  * @param[in]   data    user data
1484  * @return      0 if success, negative value if fail
1485  * @retval      AUL_R_OK        - success
1486  * @retval      AUL_R_ERROR     - general error
1487  * @see
1488  *      aul_remove_status_local_cb
1489  * @pre
1490  *      None
1491  * @post
1492  *      None
1493  * @code
1494  * #include <aul.h>
1495  *
1496  * int status_changed(int status, void *data)
1497  * {
1498  *      if (status == STATUS_FOCUS)
1499  *              printf("%d has focus\n", getpid());
1500  *
1501  *      if (status == STATUS_VISIBLE)
1502  *              printf("%d resume\n", getpid());
1503  *
1504  *      if (status == STATUS_BG0
1505  *              printf("%d pause\n", getpid());
1506  * }
1507  *
1508  * void listen_app_status()
1509  * {
1510  *      aul_add_status_local_cb(status_changed, NULL);
1511  * }
1512  * @endcode
1513  * @remark
1514  *      None
1515  *
1516  */
1517 int aul_add_status_local_cb(int (*func) (int, void *), void *data);
1518
1519 /**
1520  * @par Description
1521  *      This API unsets callback function that on application status changed.
1522  * @par Purpose:
1523  *      This API's purpose is to remove callback that added by
1524  *      aul_add_status_local_cb.
1525  *
1526  * @param[in]   func    callback function
1527  * @param[in]   data    user data
1528  * @return      0 if success, negative value if fail
1529  * @retval      AUL_R_OK        - success
1530  * @retval      AUL_R_ERROR     - general error
1531  *
1532  * @pre
1533  *      None
1534  * @post
1535  *      None
1536  * @see
1537  *      aul_add_status_local_cb
1538  * @code
1539  * #include <aul.h>
1540  *
1541  * int status_changed(int status, void *data)
1542  * {
1543  *      if (status == STATUS_FOCUS)
1544  *              printf("%d has focus\n", getpid());
1545  *
1546  *      if (status == STATUS_VISIBLE)
1547  *              printf("%d resume\n", getpid());
1548  *
1549  *      if (status == STATUS_BG0
1550  *              printf("%d pause\n", getpid());
1551  * }
1552  *
1553  * void listen_app_status()
1554  * {
1555  *      aul_add_status_local_cb(status_changed, NULL);
1556  * }
1557  *
1558  * void ignore_app_status()
1559  * {
1560  *      aul_remove_status_local_cb(status_changed, NULL);
1561  * }
1562  *
1563  * @endcode
1564  * @remark
1565  *      None
1566  *
1567  */
1568 int aul_remove_status_local_cb(int (*func) (int, void *), void *data);
1569
1570 int aul_invoke_status_local_cb(int status);
1571
1572 int aul_running_list_update(char *appid, char *app_path, char *pid);
1573
1574 int aul_get_app_allocated_memory(void);
1575
1576 long long aul_get_app_running_time(void);
1577
1578 int aul_app_get_cmdline_bypid(int pid, char *cmdline, int len);
1579
1580 int aul_listen_e17_status_signal(int (*func) (int, int, void *), void *data);
1581
1582 #ifdef _APPFW_FEATURE_DATA_CONTROL
1583 typedef int (*data_control_provider_handler_fn) (bundle *b, int request_id, void *data);
1584 int aul_set_data_control_provider_cb(data_control_provider_handler_fn handler);
1585 int aul_unset_data_control_provider_cb(void);
1586 #endif
1587 #ifdef _APPFW_FEATURE_APP_CONTROL_LITE
1588 int aul_call_ug_result_callback(bundle *kb, int is_cancel, int id);
1589 #endif
1590
1591 int aul_get_support_legacy_lifecycle(void);
1592
1593 char *aul_get_cmdline_bypid(int pid);
1594
1595 int aul_app_group_get_window(int pid);
1596 int aul_app_group_set_window(int wid);
1597 void aul_app_group_get_leader_pids(int *cnt, int **pids);
1598 void aul_app_group_get_group_pids(int leader_pid, int *cnt, int **pids);
1599 int aul_app_group_get_leader_pid(int pid);
1600 int aul_app_group_clear_top(void);
1601 int aul_app_group_is_top(void);
1602 int aul_app_group_get_fg_flag(int pid);
1603 void aul_app_group_lower(int *exit);
1604 void aul_app_group_get_idle_pids(int *cnt, int **pids);
1605
1606 char *aul_get_group_info(void);
1607
1608 int aul_pause_app(const char *appid);
1609 int aul_pause_pid(int pid);
1610 int aul_app_get_pid(const char *appid);
1611 int aul_app_get_pid_cache(const char *appid);
1612
1613 int aul_app_get_last_caller_pid(int pid);
1614
1615 int aul_set_process_group(int parent_pid, int child_pid);
1616 /** @} */
1617
1618
1619
1620 #ifdef __cplusplus
1621         }
1622 #endif
1623
1624
1625 #endif          /* __AUL_H__ */
1626
1627 /* vi: set ts=8 sts=8 sw=8: */