4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
36 * This is new version of Application Utility Library
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
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
50 * @ingroup APPLICATION_FRAMEWORK
51 * @defgroup aul Application Utility Library
58 * @brief Application Utility Library header
60 * Patched by Knhoon Baik <knhoon.baik@samsung.com>
61 * Patched by Youmin Ha <youmin.ha@samsung.com>
70 * @brief Return values in AUL.
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
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 */
107 * @defgroup aul_launch Primitive APIs to launch/resume/terminate application
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)
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)
125 * @addtogroup aul_launch
129 typedef enum _aul_type{
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__"
154 /** AUL internal private key */
155 #define AUL_K_NO_CANCEL "__AUL_NO_CANCEL__"
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__"
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__"
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__"
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__"
179 /** AUL public key - To support launching based on service */
180 #define AUL_K_SERVICE_NAME "__AUL_SERVICE_NAME__"
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__"
185 /** AUL public key - To support SDK */
186 #define AUL_K_SDK "__AUL_SDK__"
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__"
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__"
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__"
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__"
219 /** AUL internal private key */
220 #define AUL_K_PRELAUCHING "__AUL_PRELAUCHING__"
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__"
227 #ifdef _APPFW_FEATURE_PROCESS_POOL
228 #define AUL_K_INTERNAL_POOL "__AUL_INTERNAL_POOL__"
231 #ifdef _APPFW_FEATURE_DATA_CONTROL
232 #define AUL_K_DATA_CONTROL_TYPE "__AUL_DATA_CONTROL_TYPE__"
235 /** AUL internal private key */
236 #define AUL_K_HOST_PID "__AUL_HOST_PID__"
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__"
247 #define AUL_K_ALLOWED_BG "__AUL_INTERNAL_ALLOWED_BG__"
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);
256 /** AUL internal private key */
257 #define AUL_K_PKGID "__AUL_PKGID_"
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
266 typedef int (*aul_handler_fn) (aul_type type, bundle * b, void *data);
270 * This API install your AUL handler and setup AUL internal connection.
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.
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
287 * @warning If you use AppCore, you should NOT use this API.\n
288 * You need glib main loop or ecore main loop.\n
290 * you must have aul handler to use this API.
291 * aul_luanch_init register aul handler.
298 * #include <bundle.h>
300 * static int aul_handler(aul_type type, bundle *kb,void *data)
305 * // process RESET event
308 * // process RESUME event
310 * case AUL_TERMINATE:
311 * // preocess TERMINATE event
317 * int main(int argc, char **argv)
320 * aul_launch_init(aul_handler,NULL);
321 * aul_launch_argv_handler(argc, argv);
322 * ecore_main_loop_begin();
329 int aul_launch_init(aul_handler_fn handler, void *data);
333 * This API create internal RESET events with given argc, argv \n
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.
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
350 * you must have aul handler to use this API.
351 * aul_luanch_init register aul handler.
358 * #include <bundle.h>
360 * int send_local_reset_event()
364 * argv[0] = "local.app";
365 * argv[1] = "event_type";
366 * argv[2] = "my_reset";
368 * aul_launch_argv_handler(argc,argv);
373 * If you use AppCore, you NEED NOT use this API.
375 int aul_launch_argv_handler(int argc, char **argv);
379 * This API create internal RESET events with given argc, argv \n
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.
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
396 * you must have aul handler to use this API.
397 * aul_luanch_init register aul handler.
404 * #include <bundle.h>
406 * int send_local_reset_event()
410 * argv[0] = "local.app";
411 * argv[1] = "event_type";
412 * argv[2] = "my_reset";
414 * aul_launch_argv_handler_for_efl(argc,argv);
419 * If you use AppCore, you NEED NOT use this API.
421 int aul_launch_argv_handler_for_efl(int argc, char **argv);
426 * This API creates internal RESET events with given bundle \n
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.
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
443 * you must have aul handler to use this API.
444 * aul_luanch_init register aul handler.
448 * aul_launch_init, bundle_import_from_argv
451 * #include <bundle.h>
453 * int send_local_reset_event()
458 * argv[0] = "local.app";
459 * argv[1] = "event_type";
460 * argv[2] = "my_reset";
463 * b = bundle_import_from_argv(argc,argv);
464 * aul_launch_local(b);
469 * If you use AppCore, you NEED NOT to use this API.
471 int aul_launch_local(bundle *b);
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
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.
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
503 * #include <bundle.h>
505 * int launch_inhouse_contact_app()
508 * b = bundle_create();
509 * bundle_add(b,"type","SIM");
510 * aul_launch_app("org.tizen.contact",b);
518 int aul_launch_app(const char *appid, bundle *kb);
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.
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.
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
546 * aul_launch_app, aul_app_is_running, aul_resume_pid
549 * #include <bundle.h>
551 * int open_inhouse_contact_app()
553 * if(aul_app_is_running("org.tizen.contact"))
554 * aul_open_app("org.tizen.contact");
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.
563 int aul_open_app(const char *appid);
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.
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.
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
590 * aul_launch_app, aul_app_is_running, aul_resume_pid
592 * This function will be deprecated. Use aul_open_add() instead.
595 * #include <bundle.h>
597 * int resume_inhouse_contact_app()
599 * if(aul_app_is_running("org.tizen.contact"))
600 * aul_resume_app("org.tizen.contact");
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.
611 int aul_resume_app(const char *appid);
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.
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
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
642 * #include <bundle.h>
644 * int iterfunc(const aul_app_info *info, void *data)
646 * if(strcmp(info->pkg_name,"org.tizen.contact")==0)
647 * aul_resume_pid(info->pid);
650 * int iterate_running_apps()
652 * return aul_app_get_running_app_info(iterfunc,NULL);
659 int aul_resume_pid(int pid);
663 * This API trigger to terminate application
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
668 * This API's purpose is to kill application
669 * @par Typical use case:
670 * In general, Application like Task Manager use this API.
672 * This API need to require root or inhouse permisssion. \n
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
690 * #include <bundle.h>
692 * int iterfunc(const aul_app_info *info, void *data)
694 * if(strcmp(info->pkg_name,"org.tizen.contact")==0)
695 * aul_terminate_pid(info->pid);
698 * int iterate_running_apps()
700 * return aul_app_get_running_app_info(iterfunc,NULL);
705 * If you have not the permission, this API return AUL_R_ERROR. \n
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);
716 * @defgroup aul_info Helper APIs to get running application information
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
726 * @addtogroup aul_info
731 *@brief Running application's information structure retrieved by AUL
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 */
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
745 typedef int (*aul_app_info_iter_fn)(const aul_app_info *ainfo, void *data);
749 * This API ask a application is running by application package name.
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.
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.
770 * int is_running_browser_app()
772 * return aul_app_is_running("org.tizen.browser");
780 int aul_app_is_running(const char *appid);
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.
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)
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
807 * int iterfunc(const aul_app_info* info, void* data)
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");
817 * int iterate_running_apps()
819 * return aul_app_get_running_app_info(iterfunc,NULL);
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
828 int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
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.
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
841 int aul_get_running_app_info_from_proc(aul_app_info_iter_fn iter_fn, void *data);
843 int aul_get_running_app_info_from_memory(aul_app_info_iter_fn iter_fn, void *data);
848 * This API get application package name by pid
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.
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
868 * #include <bundle.h>
870 * static int app_reset(bundle *b, void *data)
875 * pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
876 * aul_app_get_pkgname_bypid(pid, appname, sizeof(appname));
883 int aul_app_get_pkgname_bypid(int pid, char *pkgname, int len);
887 * This API get application appid by pid
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.
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
907 * #include <bundle.h>
909 * static int app_reset(bundle *b, void *data)
914 * pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
915 * aul_app_get_appid_bypid(pid, appid, sizeof(appid));
922 int aul_app_get_appid_bypid(int pid, char *appid, int len);
924 int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len);
930 * @defgroup aul_mime High-level APIs to launch default application based on mime type
933 * AUL High-level APIs based on mime type
935 * These APIs provide two functionality\n
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.
946 * @addtogroup aul_mime
952 * This API get the mimetype associated with filename
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.
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
978 * void get_mimetype()
980 * char mimetype[255];
981 * aul_get_mime_from_file("image.jpg",mimetype,sizeof(mimetype));
988 int aul_get_mime_from_file(const char *filename, char *mimetype, int len);
992 * This API get the mimetype associated with given content
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.
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
1018 * void get_mimetype()
1020 * char mimetype[255];
1021 * aul_get_mime_from_content("http://www.samsung.com",mimetype,sizeof(mimetype));
1028 int aul_get_mime_from_content(const char *content, char *mimetype, int len);
1032 * This API get the icon's name associated with given mimetype
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.
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)
1055 * void get_mime_icon()
1058 * aul_get_mime_icon("text/html",icon,sizeof(icon));
1065 int aul_get_mime_icon(const char *mimetype, char *iconname, int len);
1069 * This API get the extensions associated with given mimetype
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
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)
1090 * aul_get_mime_description
1094 * void get_extension()
1096 * char extlist[255];
1097 * aul_get_mime_extension("text/html",extlist,sizeof(extlist));
1102 * Some mimetype don't have extension.
1103 * In that case, You can use aul_get_mime_description.
1106 int aul_get_mime_extension(const char *mimetype, char *extlist, int len);
1110 * This API get the description associated with given mimetype
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
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)
1132 * aul_get_mime_extension
1136 * void get_information_from_mime()
1139 * if(aul_get_mime_extension("text/html",info,sizeof(info))<0){
1140 * aul_get_mime_description("text/html",info,sizeof(info));
1148 int aul_get_mime_description(const char *mimetype, char *desc, int len);
1153 * @defgroup aul_service High-level APIs to launch applications based on service.
1156 * AUL High-level APIs based on service
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
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.
1168 * After callee performs the requested operation, callee sends the result back, if necessary.\n
1173 * @addtogroup aul_service
1178 * @brief aul_service_res_fn is service result function
1179 * @param[out] b result bundle
1180 * @param[out] data user-supplied data
1182 typedef void (*aul_service_res_fn)(bundle *b, int reserved, void *user_data);
1186 * This API create service result bundle based on bundle received in reset event.
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.
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
1202 * To create result bundle, You need received original bundle.
1203 * The original bundle can get from app_reset handler.
1207 * aul_send_service_result
1210 * #include <bundle.h>
1212 * int app_reset(bundle *b, void *data)
1214 * ad->recved_bundle = bundle_dup(b);
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);
1229 int aul_create_result_bundle(bundle *inb, bundle **outb);
1233 * This API send service result to caller with bundle
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.
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
1249 * To send result bundle, You must create result bundle.
1250 * see aul_create_result_bundle
1254 * aul_create_result_bundle
1257 * #include <bundle.h>
1259 * int app_reset(bundle *b, void *data)
1261 * ad->recved_bundle = bundle_dup(b);
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);
1276 int aul_send_service_result(bundle *b);
1280 * This API sets callback fuction that will be called when applications die.
1282 * This API's purpose is to listen the application dead event.
1283 * In general, task manager Application need this API.
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
1296 * aul_listen_app_launch_signal
1300 * int app_dead_handler(int pid, void *data)
1302 * printf("===> %s : %d\n", __FUNCTION__, pid);
1306 * void dead_listen()
1308 * aul_listen_app_dead_signal(app_dead_handler, NULL);
1316 int aul_listen_app_dead_signal(int (*func) (int, void *), void *data);
1320 * This API sets callback fuction that will be called when applications are launched.
1322 * This API's purpose is to listen the application launching event.
1323 * In general, task manager Application need this API.
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
1336 * aul_listen_app_dead_signal
1340 * int app_launch_handler(int pid, void *data)
1342 * printf("===> %s : %d\n", __FUNCTION__, pid);
1346 * void dead_listen()
1348 * aul_listen_app_launch_signal(app_launch_handler, NULL);
1356 int aul_listen_app_launch_signal(int (*func) (int, void *), void *data);
1358 int aul_listen_booting_done_signal(int (*func) (int, void *), void *data);
1360 int aul_listen_cooldown_signal(int (*func) (const char *, void *), void *data);
1362 const char *aul_get_app_external_root_path(void);
1363 const char *aul_get_app_root_path(void);
1364 const char *aul_get_app_data_path(void);
1365 const char *aul_get_app_cache_path(void);
1366 const char *aul_get_app_resource_path(void);
1367 const char *aul_get_app_tep_resource_path(void);
1368 const char *aul_get_app_shared_data_path(void);
1369 const char *aul_get_app_shared_resource_path(void);
1370 const char *aul_get_app_shared_trusted_path(void);
1371 const char *aul_get_app_external_data_path(void);
1372 const char *aul_get_app_external_cache_path(void);
1373 const char *aul_get_app_external_shared_data_path(void);
1374 const char *aul_get_app_specific_path(void);
1375 const char *aul_get_app_external_specific_path(void);
1376 int aul_get_app_shared_data_path_by_appid(const char *app_id, char **path);
1377 int aul_get_app_shared_resource_path_by_appid(const char *app_id, char **path);
1378 int aul_get_app_shared_trusted_path_by_appid(const char *app_id, char **path);
1379 int aul_get_app_external_shared_data_path_by_appid(const char *app_id, char **path);
1381 typedef int (*subapp_fn)(void *data);
1383 int aul_set_subapp(subapp_fn cb, void *data);
1384 int aul_subapp_terminate_request_pid(int pid);
1385 int aul_is_subapp(void);
1386 int aul_add_caller_cb(int pid, void (*caller_cb) (int, void *), void *data);
1387 int aul_remove_caller_cb(int pid);
1388 int aul_invoke_caller_cb(int pid);
1390 #ifdef _APPFW_FEATURE_PROCESS_POOL
1391 void aul_set_preinit_window(void *evas_object);
1392 void* aul_get_preinit_window(const char *win_name);
1394 void aul_set_preinit_background(void *evas_object);
1395 void* aul_get_preinit_background(void);
1397 void aul_set_preinit_conformant(void *evas_object);
1398 void* aul_get_preinit_conformant(void);
1401 void aul_set_preinit_appid(const char *appid);
1403 void aul_set_preinit_pkgid(const char *pkgid);
1404 const char* aul_get_preinit_pkgid(void);
1406 int aul_launch_app_async(const char *appid, bundle *kb);
1408 #ifdef _APPFW_FEATURE_MULTI_INSTANCE
1409 int aul_launch_app_for_multi_instance(const char *appid, bundle *kb);
1412 int aul_update_freezer_status(int pid, const char* type);
1414 int aul_send_app_launch_request_signal(int pid, const char* appid, const char* pkgid, const char* type);
1415 int aul_send_app_resume_request_signal(int pid, const char* appid, const char* pkgid, const char *type);
1416 int aul_send_app_terminate_request_signal(int pid, const char* appid, const char* pkgid, const char *type);
1417 int aul_send_app_status_change_signal(int pid, const char* appid, const char* pkgid, const char* status, const char *type);
1418 int aul_send_app_terminated_signal(int pid);
1419 int aul_send_app_group_signal(int owner_pid, int child_pid, const char *child_pkgid);
1421 int aul_status_update(int status);
1425 * This API gets status of specified application process id.
1427 * This API's purpose is to get the application's status.
1429 * @param[in] pid pid of application
1430 * @return 0 or greater if success, nagative value if fail
1431 * @retval STATUS_LAUNCHING
1432 * @retval STATUS_CREATED
1433 * @retval STATUS_FOCUS
1434 * @retval STATUS_VISIBLE
1436 * @retval STATUS_DYING
1437 * @retval STATUS_HOME
1438 * @retval STATUS_NORESTART
1448 * int iterfunc(const aul_app_info *info, void *data)
1451 * status = aul_app_get_status_bypid(info->pid);
1452 * if (status == STATUS_FOCUS) {
1453 * printf("%s has focus", info->app_id);
1454 * (int *)data = info->pid;
1460 * int find_focus_app_pid()
1463 * aul_app_get_running_app_info(iterfunc, &pid);
1470 int aul_app_get_status_bypid(int pid);
1474 * This API sets callback function that on application status changed.
1476 * This API's purpose is to listen the application's status changed within
1477 * the caller process. In general, a library that required to release resource on
1478 * application's status may use this API.
1480 * @param[in] func callback function
1481 * @param[in] data user data
1482 * @return 0 if success, negative value if fail
1483 * @retval AUL_R_OK - success
1484 * @retval AUL_R_ERROR - general error
1486 * aul_remove_status_local_cb
1494 * int status_changed(int status, void *data)
1496 * if (status == STATUS_FOCUS)
1497 * printf("%d has focus\n", getpid());
1499 * if (status == STATUS_VISIBLE)
1500 * printf("%d resume\n", getpid());
1502 * if (status == STATUS_BG0
1503 * printf("%d pause\n", getpid());
1506 * void listen_app_status()
1508 * aul_add_status_local_cb(status_changed, NULL);
1515 int aul_add_status_local_cb(int (*func) (int, void *), void *data);
1519 * This API unsets callback function that on application status changed.
1521 * This API's purpose is to remove callback that added by
1522 * aul_add_status_local_cb.
1524 * @param[in] func callback function
1525 * @param[in] data user data
1526 * @return 0 if success, negative value if fail
1527 * @retval AUL_R_OK - success
1528 * @retval AUL_R_ERROR - general error
1535 * aul_add_status_local_cb
1539 * int status_changed(int status, void *data)
1541 * if (status == STATUS_FOCUS)
1542 * printf("%d has focus\n", getpid());
1544 * if (status == STATUS_VISIBLE)
1545 * printf("%d resume\n", getpid());
1547 * if (status == STATUS_BG0
1548 * printf("%d pause\n", getpid());
1551 * void listen_app_status()
1553 * aul_add_status_local_cb(status_changed, NULL);
1556 * void ignore_app_status()
1558 * aul_remove_status_local_cb(status_changed, NULL);
1566 int aul_remove_status_local_cb(int (*func) (int, void *), void *data);
1568 int aul_invoke_status_local_cb(int status);
1570 int aul_running_list_update(char *appid, char *app_path, char *pid);
1572 int aul_get_app_allocated_memory(void);
1574 long long aul_get_app_running_time(void);
1576 int aul_app_get_cmdline_bypid(int pid, char *cmdline, int len);
1578 int aul_listen_e17_status_signal(int (*func) (int, int, void *), void *data);
1580 #ifdef _APPFW_FEATURE_DATA_CONTROL
1581 typedef int (*data_control_provider_handler_fn) (bundle *b, int request_id, void *data);
1582 int aul_set_data_control_provider_cb(data_control_provider_handler_fn handler);
1583 int aul_unset_data_control_provider_cb(void);
1585 #ifdef _APPFW_FEATURE_APP_CONTROL_LITE
1586 int aul_call_ug_result_callback(bundle *kb, int is_cancel, int id);
1589 int aul_get_support_legacy_lifecycle(void);
1591 char *aul_get_cmdline_bypid(int pid);
1593 int aul_app_group_get_window(int pid);
1594 int aul_app_group_set_window(int wid);
1595 void aul_app_group_get_leader_pids(int *cnt, int **pids);
1596 void aul_app_group_get_group_pids(int leader_pid, int *cnt, int **pids);
1597 int aul_app_group_get_leader_pid(int pid);
1598 int aul_app_group_clear_top(void);
1599 int aul_app_group_is_top(void);
1600 int aul_app_group_get_fg_flag(int pid);
1601 void aul_app_group_lower(int *exit);
1602 void aul_app_group_get_idle_pids(int *cnt, int **pids);
1604 char *aul_get_group_info(void);
1606 int aul_pause_app(const char *appid);
1607 int aul_pause_pid(int pid);
1608 int aul_app_get_pid(const char *appid);
1609 int aul_app_get_pid_cache(const char *appid);
1611 int aul_app_get_last_caller_pid(int pid);
1613 int aul_set_process_group(int parent_pid, int child_pid);
1623 #endif /* __AUL_H__ */
1625 /* vi: set ts=8 sts=8 sw=8: */