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_EHIDDENFORGUEST = -11, /**< App hidden for guest mode */
74 AUL_R_ENOLAUNCHPAD = -10, /**< no launchpad */
75 AUL_R_ETERMINATING = -9, /**< application terminating */
76 AUL_R_EILLACC = -8, /**< Illegal Access */
77 AUL_R_LOCAL = -7, /**< Launch by himself */
78 AUL_R_ETIMEOUT = -6, /**< Timeout */
79 AUL_R_ECANCELED = -5, /**< Operation canceled */
80 AUL_R_EINVAL = -4, /**< Invalid argument */
81 AUL_R_ECOMM = -3, /**< Comunication Error */
82 AUL_R_ENOINIT = -2, /**< AUL handler NOT initialized */
83 AUL_R_ERROR = -1, /**< General error */
84 AUL_R_OK = 0 /**< General success */
101 * @defgroup aul_launch Primitive APIs to launch/resume/terminate application
104 * APIs to launch/resume/terminate application
105 * - Launch application based on application package name
106 * - Resume application based on application package name
107 * - Resume application based on pid (required root or inhouse permisssion)
108 * - Terminate application base on pid (required root or inhouse permission)
110 * AUL internal information
111 * - AUL grant pid, gid to launched application for security
112 * - AUL send RESET/RESUME/TERM event for running application in case of single instance
113 * - AUL set application enviroment based on desktop entry
114 * - AUL support single instance / multi instance
115 * - AUL support application data exchange format (bundle)
119 * @addtogroup aul_launch
123 typedef enum _aul_type{
129 /** AUL internal private key */
130 #define AUL_K_PKG_NAME "__AUL_PKG_NAME__"
131 /** AUL internal private key */
132 #define AUL_K_WAIT_RESULT "__AUL_WAIT_RESULT__"
133 /** AUL internal private key */
134 #define AUL_K_SEND_RESULT "__AUL_SEND_RESULT__"
135 /** AUL internal private key */
136 #define AUL_K_TASK_MANAGE "__AUL_TASK_MANAGE__"
137 /** AUL internal private key */
138 #define AUL_K_APP_TYPE "__AUL_APP_TYPE__"
139 /** AUL internal private key - To check original caller's identity */
140 #define AUL_K_ORG_CALLER_PID "__AUL_ORG_CALLER_PID__"
141 /** AUL internal private key - To check forwarded callee app's pid */
142 #define AUL_K_FWD_CALLEE_PID "__AUL_FWD_CALLEE_PID__"
144 /** AUL internal private key */
145 #define AUL_K_NO_CANCEL "__AUL_NO_CANCEL__"
147 /** AUL public key - To check caller's secuirty */
148 #define AUL_K_CALLER_PID "__AUL_CALLER_PID__"
149 /** AUL public key - To check callee's secuirty */
150 #define AUL_K_CALLEE_PID "__AUL_CALLEE_PID__"
152 /** AUL public key - To check caller's secuirty */
153 #define AUL_K_CALLER_APPID "__AUL_CALLER_APPID__"
154 /** AUL public key - To check caller's secuirty */
155 #define AUL_K_CALLEE_APPID "__AUL_CALLEE_APPID__"
157 /** AUL public key - To find argv0 */
158 #define AUL_K_ARGV0 "__AUL_ARGV0__"
159 /** AUL public key - To measure launching time */
160 #define AUL_K_STARTTIME "__AUL_STARTTIME__"
162 /** AUL public key - To support launching based on mime type */
163 #define AUL_K_MIME_TYPE "__AUL_MIME_TYPE__"
164 /** AUL public key - To support launching based on mime type */
165 #define AUL_K_UNALIASED_MIME_TYPE "__AUL_UNALIASED_MIME_TYPE__"
166 /** AUL public key - To support launching based on mime type */
167 #define AUL_K_MIME_CONTENT "__AUL_MIME_CONTENT__"
169 /** AUL public key - To support launching based on service */
170 #define AUL_K_SERVICE_NAME "__AUL_SERVICE_NAME__"
172 /** AUL public key - To force launch app selector instead of lauchingn default app */
173 #define AUL_K_FORCE_LAUNCH_APP_SELECTOR "__AUL_FORCE_LAUNCH_APP_SELECTOR__"
175 /** AUL public key - To support SDK */
176 #define AUL_K_SDK "__AUL_SDK__"
178 /** AUL public key - To support Media key */
179 #define AUL_K_MULTI_KEY "__AUL_MULTI_KEY__"
180 /** AUL public key - To support Media key */
181 #define AUL_K_MULTI_KEY_EVENT "__AUL_MULTI_KEY_EVENT__"
183 /** AUL public bundle value */
184 #define AUL_K_PRIVACY_APPID "__AUL_PRIVACY_APPID__"
186 /** AUL public bundle value - To support Media key*/
187 #define AUL_V_KEY_PRESSED "__AUL_KEY_PRESSED__"
188 /** AUL public bundle value - To support Media key*/
189 #define AUL_V_KEY_RELEASED "__AUL_KEY_RELEASED__"
191 /** AUL internal private key */
192 #define AUL_K_EXEC "__AUL_EXEC__"
193 /** AUL internal private key */
194 #define AUL_K_MULTIPLE "__AUL_MULTIPLE__"
195 /** AUL internal private key */
196 #define AUL_K_PACKAGETYPE "__AUL_PACKAGETYPE__"
197 /** AUL internal private key */
198 #define AUL_K_HWACC "__AUL_HWACC__"
199 /** AUL internal private key */
200 #define AUL_K_TASKMANAGE "__AUL_TASKMANAGE__"
203 /** AUL internal private key */
204 #define AUL_K_APPID "__AUL_APPID__"
205 /** AUL internal private key */
206 #define AUL_K_PID "__AUL_PID__"
208 #define PRIVACY_POPUP "tizenprv00.privacy-popup"
212 * @brief This is callback function for aul_launch_init
213 * @param[in] type event's type received from system
214 * @param[in] b In case of RESET events, bundle which is received from peer
215 * @param[in] data user-supplied data
217 typedef int (*aul_handler_fn) (aul_type type, bundle * b, void *data);
221 * This API install your AUL handler and setup AUL internal connection.
223 * AUL receive START(RESET), RESUME, TERMINATE events from system.\n
224 * This API use to handle the events. \n
225 * @par Typical use case:
226 * In general, you need not use this API.
227 * If you use AppCore, you should NOT use this API.
228 * AppCore will set default aul_handler.
230 * @param[in] handler aul main callback handler function
231 * @param[in] data user-supplied data for start_handler
232 * @return 0 if success, negative value(<0) if fail\n
233 * @retval AUL_R_OK - success
234 * @retval AUL_R_ECANCELD - aul handler was installed already by others
235 * @retval AUL_R_ECOMM - error to create internal ipc
236 * @retval AUL_R_ERROR - error to attach glib main loop or ecore main loop
238 * @warning If you use AppCore, you should NOT use this API.\n
239 * You need glib main loop or ecore main loop.\n
241 * you must have aul handler to use this API.
242 * aul_luanch_init register aul handler.
249 * #include <bundle.h>
251 * static int aul_handler(aul_type type, bundle *kb,void *data)
256 * // process RESET event
259 * // process RESUME event
261 * case AUL_TERMINATE:
262 * // preocess TERMINATE event
268 * int main(int argc, char **argv)
271 * aul_launch_init(aul_handler,NULL);
272 * aul_launch_argv_handler(argc, argv);
273 * ecore_main_loop_begin();
280 int aul_launch_init(aul_handler_fn handler, void *data);
284 * This API create internal RESET events with given argc, argv \n
286 * This API's purpose is to generate reset event.
287 * If you want to generate local RESET events with argument vector format, use this API
288 * @par Typical use case:
289 * In general, you need not use this API.
290 * AppCore use this API to create internal reset event.
292 * @param[in] argc # of args
293 * @param[in] argv list of arg strings
294 * @return 0 if success, negative value(<0) if fail
295 * @retval AUL_R_OK - success
296 * @retval AUL_R_ENOINIT - aul handler was NOT yet installed
297 * @retval AUL_R_ECANCLED - error to create internal bundle with given argc,argv.
298 * @retval AUL_R_ERROR - general error
301 * you must have aul handler to use this API.
302 * aul_luanch_init register aul handler.
309 * #include <bundle.h>
311 * int send_local_reset_event()
315 * argv[0] = "local.app";
316 * argv[1] = "event_type";
317 * argv[2] = "my_reset";
319 * aul_launch_argv_handler(argc,argv);
324 * If you use AppCore, you NEED NOT use this API.
326 int aul_launch_argv_handler(int argc, char **argv);
330 * This API create internal RESET events with given argc, argv \n
332 * This API's purpose is to generate reset event.
333 * If you want to generate local RESET events with argument vector format, use this API
334 * @par Typical use case:
335 * In general, you need not use this API.
336 * AppCore use this API to create internal reset event.
338 * @param[in] argc # of args
339 * @param[in] argv list of arg strings
340 * @return 0 if success, negative value(<0) if fail
341 * @retval AUL_R_OK - success
342 * @retval AUL_R_ENOINIT - aul handler was NOT yet installed
343 * @retval AUL_R_ECANCLED - error to create internal bundle with given argc,argv.
344 * @retval AUL_R_ERROR - general error
347 * you must have aul handler to use this API.
348 * aul_luanch_init register aul handler.
355 * #include <bundle.h>
357 * int send_local_reset_event()
361 * argv[0] = "local.app";
362 * argv[1] = "event_type";
363 * argv[2] = "my_reset";
365 * aul_launch_argv_handler_for_efl(argc,argv);
370 * If you use AppCore, you NEED NOT use this API.
372 int aul_launch_argv_handler_for_efl(int argc, char **argv);
377 * This API creates internal RESET events with given bundle \n
379 * This API's purpose is to generate reset event.
380 * If you want to generate local RESET events with argument vector format, first use
381 * bundle_import_from_argv to create a bundle from the argument vector and then use this API
382 * Eventually, this API will replace aul_launch_argv_handler().
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] b bundle
388 * @return 0 if success, negative value(<0) if fail
389 * @retval AUL_R_OK - success
390 * @retval AUL_R_ENOINIT - aul handler was NOT yet installed
391 * @retval AUL_R_ERROR - general error
394 * you must have aul handler to use this API.
395 * aul_luanch_init register aul handler.
399 * aul_launch_init, bundle_import_from_argv
402 * #include <bundle.h>
404 * int send_local_reset_event()
409 * argv[0] = "local.app";
410 * argv[1] = "event_type";
411 * argv[2] = "my_reset";
414 * b = bundle_import_from_argv(argc,argv);
415 * aul_launch_local(b);
420 * If you use AppCore, you NEED NOT to use this API.
422 int aul_launch_local(bundle *b);
426 * This API launches application with the given bundle.
427 * If the application is not running or a multiple-instance one, this API launches with the given bundle.
428 * If the application is running, this API sends a RESET event to the App.
429 * While the application is running, if the application cannot receive the RESET event,
430 * this API returns a general error(AUL_R_ERROR).\n
432 * This API is for caller.
433 * This API's purpose is to launch/reset application with given bundle.
434 * @par Typical use case:
435 * If you know the target application's pkgname and bundle types,
436 * you can use this API to launch/reset the application.
438 * @param[in] pkgname package name to be run as callee
439 * @param[in] kb bundle to be passed to callee
440 * @return callee's pid if success, negative value(<0) if fail
441 * @retval AUL_R_OK - success
442 * @retval AUL_R_EINVAL - invaild package name
443 * @retval AUL_R_ECOM - internal AUL IPC error
444 * @retval AUL_R_ERROR - general error
454 * #include <bundle.h>
456 * int launch_inhouse_contact_app()
459 * b = bundle_create();
460 * bundle_add(b,"type","SIM");
461 * aul_launch_app("org.tizen.contact",b);
468 int aul_launch_app(const char *appid, bundle *kb);
472 * This API launches application, as menu screen launches the app.
473 * Thus, if the applocation is running, this API sends a RESUME event to the app.
474 * If the application is not running, this API launches the app.
475 * While the application is running, if the application cannot receive the RESUME event,
476 * AUL tries to raise the application's default window.
479 * This API is for caller.
480 * This API's purpose is to resume/launch application
481 * @par Typical use case:
482 * If you only want to show application with previous state or default state, Use this API.
484 * @param[in] pkgname package name to be resume as callee
485 * @return callee's pid if success, negative value(<0) if fail
486 * @retval AUL_R_OK - success
487 * @retval AUL_R_EINVAL - invaild package name
488 * @retval AUL_R_ECOM - internal AUL IPC error
489 * @retval AUL_R_ERROR - general error
496 * aul_launch_app, aul_app_is_running, aul_resume_pid
499 * #include <bundle.h>
501 * int open_inhouse_contact_app()
503 * if(aul_app_is_running("org.tizen.contact"))
504 * aul_open_app("org.tizen.contact");
509 * If you don't want to launch the app,
510 * you should check app's running state with aul_app_is_running.
511 * This API will launch the application if the application is not running.
513 int aul_open_app(const char *appid);
517 * This API trigger to resume application
518 * If the application is running, this API send a resume event to the App.
519 * If the application is not running, this API returns fail.
520 * Although the application is running, if the application cannot receive resume event,
521 * AUL try to raise the application's default windows.
523 * This API is for caller.
524 * This API's purpose is to send resume event.
525 * @par Typical use case:
526 * If you only want to show application with previous state or default state, Use this API.
528 * @param[in] pkgname package name to be resume as callee
529 * @return callee's pid if success, negative value(<0) if fail
530 * @retval AUL_R_OK - success
531 * @retval AUL_R_EINVAL - invaild package name
532 * @retval AUL_R_ECOM - internal AUL IPC error
533 * @retval AUL_R_ERROR - general error
540 * aul_launch_app, aul_app_is_running, aul_resume_pid
542 * This function will be deprecated. Use aul_open_add() instead.
545 * #include <bundle.h>
547 * int resume_inhouse_contact_app()
549 * if(aul_app_is_running("org.tizen.contact"))
550 * aul_resume_app("org.tizen.contact");
555 * If you don't want to launch the app,
556 * you should check app's running state with aul_app_is_running.
557 * This API will launch the application if the application is not running.
558 * If you want to only resume without launching in multiple instance application model,
559 * you should use aul_resume_pid.
561 int aul_resume_app(const char *appid);
565 * This API trigger to resume application
566 * If the application is running, this API send a resume event to the App.
567 * If the application is not running, this API return AUL_R_ERROR.
568 * Although the application is running, if the application cannot receive resume event,
569 * AUL try to raise the application's default windows.
571 * This API is for caller.
572 * This API's purpose is to send resume event.
573 * @par Typical use case:
574 * In multiple application model, If you want to only resume specific application, Use this API
576 * @param[in] pid application's pid to be resumed
577 * @return 0 if success, negative value(<0) if fail
578 * @retval AUL_R_OK - success
579 * @retval AUL_R_EINVAL - invaild pid
580 * @retval AUL_R_ECOM - internal AUL IPC error
581 * @retval AUL_R_ERROR - general error (include application is not running)
582 * @warning This API need to require root or inhouse permisssion \n
583 * If you have not the permission, this API return AUL_R_ERROR. \n
592 * #include <bundle.h>
594 * int iterfunc(const aul_app_info *info, void *data)
596 * if(strcmp(info->pkg_name,"org.tizen.contact")==0)
597 * aul_resume_pid(info->pid);
600 * int iterate_running_apps()
602 * return aul_app_get_running_app_info(iterfunc,NULL);
609 int aul_resume_pid(int pid);
613 * This API trigger to terminate application
615 * If the application is running, this API send a terminate event to the App. \n
616 * If the app cannot receive the event, AUL kill forcely the application.\n
618 * This API's purpose is to kill application
619 * @par Typical use case:
620 * In general, Application like Task Manager use this API.
622 * This API need to require root or inhouse permisssion. \n
624 * @param[in] pid application's pid to be terminated
625 * @return 0 if success, negative value(<0) if fail
626 * @retval AUL_R_OK - success
627 * @retval AUL_R_EINVAL - invaild pid
628 * @retval AUL_R_ECOM - internal AUL IPC error
629 * @retval AUL_R_ERROR - general error
630 * @warning This API need to require root or inhouse permisssion. \n
640 * #include <bundle.h>
642 * int iterfunc(const aul_app_info *info, void *data)
644 * if(strcmp(info->pkg_name,"org.tizen.contact")==0)
645 * aul_terminate_pid(info->pid);
648 * int iterate_running_apps()
650 * return aul_app_get_running_app_info(iterfunc,NULL);
655 * If you have not the permission, this API return AUL_R_ERROR. \n
657 int aul_terminate_pid(int pid);
662 * @defgroup aul_info Helper APIs to get running application information
665 * API to get running application information (state, executable path, ..)
666 * - get application package name from pid
667 * - get application running state
668 * - get application list of runnning applications
672 * @addtogroup aul_info
677 *@brief Running application's information structure retrieved by AUL
679 typedef struct _aul_app_info {
680 int pid; /**< app's pid if running*/
681 char* pkg_name; /**< application id */
682 char* app_path; /**< application excutable path */
687 * @brief iterator function running with aul_app_get_running_app_info
688 * @param[out] ainfo aul_app_info retreived by aul_app_get_running_app_info
689 * @param[out] data user-supplied data
691 typedef int (*aul_app_info_iter_fn)(const aul_app_info *ainfo, void *data);
695 * This API ask a application is running by application package name.
697 * To know whether some application is running or not, use this API
698 * @par Typical use case:
699 * For example, If you want to know browser application running,
700 * you can check it by using this API.
702 * @param[in] pkgname application package name
703 * @return true / false
704 * @retval 1 app_name is running now.
705 * @retval 0 app_name is NOT running now.
716 * int is_running_browser_app()
718 * return aul_app_is_running("org.tizen.browser");
726 int aul_app_is_running(const char *appid);
730 * This API use to get running application list.
731 * This API call iter_fn with each aul_app_info of running apps when running application is found.
733 * If you want to get running application list, use this API
734 * This API give you running applications which has SLP desktop file.
735 * @par Typical use case:
736 * In general, this API is used by task manager appllication. (running application list viewer)
738 * @param[in] iter_fn iterator function
739 * @param[in] data user-supplied data for iter_fn
740 * @return 0 if success, negative value(<0) if fail
741 * @retval AUL_R_OK - success
742 * @retval AUL_R_ERROR - internal error
753 * int iterfunc(const aul_app_info* info, void* data)
755 * printf("\t==========================\n");
756 * printf("\t pkg_name: %s\n", info->appid);
757 * printf("\t app_path: %s\n", info->app_path);
758 * printf("\t running pid: %d\n", info->pid);
759 * printf("\t==========================\n");
763 * int iterate_running_apps()
765 * return aul_app_get_running_app_info(iterfunc,NULL);
770 * This API should use if you want to know running application which has desktop files.
771 * If you want to get all process list, you must iterate process information by using proc filesystem
772 * Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
774 int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
778 * This API get application package name by pid
780 * If you want to get package name of running application, use this API
781 * @par Typical use case:
782 * In general, You can use this API when you want to know caller's information.
784 * @param[in] pid given pid
785 * @param[out] pkgname pkgname to be get
786 * @param[in] len length of pkgname
787 * @return 0 if success, negative value(<0) if fail
788 * @retval AUL_R_OK - success
789 * @retval AUL_R_ERROR - no such a package name
798 * #include <bundle.h>
800 * static int app_reset(bundle *b, void *data)
805 * pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
806 * aul_app_get_pkgname_bypid(pid, appname, sizeof(appname));
813 int aul_app_get_pkgname_bypid(int pid, char *pkgname, int len);
817 * This API get application appid by pid
819 * If you want to get appid of running application, use this API
820 * @par Typical use case:
821 * In general, You can use this API when you want to know caller's information.
823 * @param[in] pid given pid
824 * @param[out] appid application id
825 * @param[in] len length of pkgname
826 * @return 0 if success, negative value(<0) if fail
827 * @retval AUL_R_OK - success
828 * @retval AUL_R_ERROR - no such a appid
837 * #include <bundle.h>
839 * static int app_reset(bundle *b, void *data)
844 * pid = atoi(bundle_get_val(b,AUL_K_CALLER_PID));
845 * aul_app_get_appid_bypid(pid, appid, sizeof(appid));
852 int aul_app_get_appid_bypid(int pid, char *appid, int len);
858 * @defgroup aul_mime High-level APIs to launch default application based on mime type
861 * AUL High-level APIs based on mime type
863 * These APIs provide two functionality\n
865 * -# To launch default application to open a file based on its MIME type \n
866 * For example, you can launch the default video player to open .mp4 files
867 * or launch the default browser to open HTML files \n
868 * -# To launch default application to process given content \n
869 * For example, you can launch the default e-mail application to process
870 * "nice@samsung.com" e-mail address.
874 * @addtogroup aul_mime
880 * This API launch application associated with given filename
882 * This API is for caller.
883 * This API launch application based on mime type.
884 * This API find mime_type associated with file name,
885 * and then find default app associated with found mime_type
886 * and then launch the app with filename argument.
887 * @par Typical use case:
888 * You can launch application to process given filename.
889 * That is, Even if you don't know the specific application's pkgname,
890 * you can launch the applicaiton processing given filename .
891 * For example, If you want to process image file, you can simply launch image viewer.
892 * At that time, you can use this APIs like aul_open_file("myimage.jpg");
894 * @param[in] filename filename
895 * @return callee's pid or 0 if success, negative value if fail\n
896 * (when no found default app, return 0)
897 * @retval AUL_R_OK - success
898 * @retval AUL_R_EINVAL - invalid argument(filename)
899 * @retval AUL_R_ECOM - internal AUL IPC error
900 * @retval AUL_R_ERROR - general error
911 * int view_image_file(char *filename)
913 * aul_open_file(filename);
921 int aul_open_file(const char* filename);
925 * This API launch application associated with given specific mimetype
927 * This API is for caller.
928 * This API launch application based on mime type like aul_open_file API.
929 * But, This API don't find mime_type associated with file name.
930 * This API use mimetype given by user. By using given mimetype, find default application.
931 * and then launch the app with filename argument.
932 * @par Typical use case:
933 * Some files cannot extract exact mimetype automatically.
934 * For example, To know mime type of files with DRM lock, first we should unlock DRM file.
935 * In this case, You can use this API.
936 * First, unlock DRM file, and extract mimetype from unlock file by using aul_get_mime_from_file,
937 * and then, use this API with DRM file and extracted mime type.
939 * @param[in] filename filename
940 * @param[in] mimetype specific mimetype
941 * @return callee's pid or 0 if success, negative value if fail\n
942 * (when no found default app, return 0)
943 * @retval AUL_R_OK - success
944 * @retval AUL_R_EINVAL - invalid argument(filename,mimetype)
945 * @retval AUL_R_ECOM - internal AUL IPC error
946 * @retval AUL_R_ERROR - general error
953 * aul_open_file, aul_get_mime_from_file
957 * int view_drm_image_file(char *drm_filename)
960 * // you must implement this function
961 * mimetype = get_mimetype_from_drmfile(drm_filename);
963 * aul_open_file_with_mimetype(drm_filename,mimetype);
970 int aul_open_file_with_mimetype(const char *filename, const char *mimetype);
974 * This API launch application associated with content like "http://www.samsung.com"
976 * This API is for caller.
977 * This API launch application based on mime type.
978 * This API find mime_type associated with content,
979 * and then find default app associated with found mime_type,
980 * and then launch the app with content argument.
981 * @par Typical use case:
982 * You can launch application to process given content.
983 * That is, Even if you don't know the specific application's pkgname,
984 * you can launch the applicaiton processing given content.
985 * For example, If you want to process URL "http://www.samsung.com",
986 * you can simply launch browser.
987 * At that time, you can use this APIs like aul_open_content("http://www.samsung.com");
989 * @param[in] content content
990 * @return callee's pid or 0 if success, negative value if fail\n
991 * (when no found default app, return 0)
992 * @retval AUL_R_OK - success
993 * @retval AUL_R_EINVAL - invalid argument(content)
994 * @retval AUL_R_ECOM - internal AUL IPC error
995 * @retval AUL_R_ERROR - general error or no found mimetype
1006 * int view_url(char *url)
1008 * aul_open_content(url);
1016 int aul_open_content(const char* content);
1020 * This API get the default application(appid) associated with MIME type
1022 * This API use to get default application associteted with mimetype
1023 * In general, Setting Application need this API.
1024 * @par Typical use case:
1025 * Setting Application show mapping of default application / mimetype
1027 * @param[in] mimetype a mime type
1028 * @param[out] defapp a application appid of the app
1029 * @param[in] len length of defapp
1030 * @return 0 if success, negative value if fail
1031 * @retval AUL_R_OK - success
1032 * @retval AUL_R_EINVAL - invalid argument(mimetype)
1033 * @retval AUL_R_ERROR - general error or no found mimetype
1040 * aul_set_defapp_with_mime
1044 * void get_text_html_defapp()
1046 * char appname[255];
1047 * aul_get_defapp_from_mime("text/html",appname,sizeof(appname));
1055 int aul_get_defapp_from_mime(const char *mimetype, char *defapp, int len);
1059 * This API set the default application(appid) associated with MIME type
1061 * This API use to change default application associteted with mimetype
1062 * In general, Setting Application or Installer need this API.
1063 * @par Typical use case:
1064 * Default Application associated with mimetype can be changed by Setting Application or installer
1065 * So, application to process specific mimetype can be substituted.
1067 * @param[in] mimetype a mime type
1068 * @param[in] defapp a application appid of the app to be set
1069 * @return 0 if success, negative value if fail
1070 * @retval AUL_R_OK - success
1071 * @retval AUL_R_EINVAL - invalid argument(mimetype)
1072 * @retval AUL_R_ERROR - general error
1079 * aul_get_defapp_from_mime
1083 * void set_text_html_defapp()
1085 * aul_set_defapp_with_mime("text/html","org.tizen.browser");
1092 int aul_set_defapp_with_mime(const char *mimetype, const char *defapp);
1096 * This API get the mimetype associated with filename
1098 * This API use to get mimetype associteted with given filename
1099 * In general, This API use when you want to know only mimetype given filename.
1100 * @par Typical use case:
1101 * For example, In trasfering data through bluetooth,
1102 * additional information like mimetype should be added.
1103 * In such situation, You can get mimetype by using this API.
1105 * @param[in] filename file name
1106 * @param[out] mimetype a mime type
1107 * @param[in] len length of mimetype
1108 * @return 0 if success, negative value if fail
1109 * @retval AUL_R_OK - success
1110 * @retval AUL_R_EINVAL - invalid argument(filename)
1111 * @retval AUL_R_ERROR - general error
1122 * void get_mimetype()
1124 * char mimetype[255];
1125 * aul_get_mime_from_file("image.jpg",mimetype,sizeof(mimetype));
1132 int aul_get_mime_from_file(const char *filename, char *mimetype, int len);
1136 * This API get the mimetype associated with given content
1138 * This API use to get mimetype associteted with given content
1139 * In general, This API use when you want to know only mimetype given content
1140 * @par Typical use case:
1141 * For example, In trasfering data through bluetooth,
1142 * additional information like mimetype should be added.
1143 * In such situation, You can get mimetype by using this API.
1145 * @param[in] content content string like "011-0000-0000"
1146 * @param[out] mimetype a mime type
1147 * @param[in] len length of mimetype
1148 * @return 0 if success, negative value if fail
1149 * @retval AUL_R_OK - success
1150 * @retval AUL_R_EINVAL - invalid argument(content)
1151 * @retval AUL_R_ERROR - general error
1162 * void get_mimetype()
1164 * char mimetype[255];
1165 * aul_get_mime_from_content("http://www.samsung.com",mimetype,sizeof(mimetype));
1172 int aul_get_mime_from_content(const char *content, char *mimetype, int len);
1176 * This API get the icon's name associated with given mimetype
1178 * This API use to get icon's name associteted with given mimetype
1179 * @par Typical use case:
1180 * If you want to show mimetype's icon, use this API.
1182 * @param[in] mimetype a mime type
1183 * @param[out] iconname icon's name
1184 * @param[in] len length of iconname
1185 * @return 0 if success, negative value if fail
1186 * @retval AUL_R_OK - success
1187 * @retval AUL_R_EINVAL - invalid argument(content)
1188 * @retval AUL_R_ERROR - general error (no such mime type)
1199 * void get_mime_icon()
1202 * aul_get_mime_icon("text/html",icon,sizeof(icon));
1209 int aul_get_mime_icon(const char *mimetype, char *iconname, int len);
1213 * This API get the extensions associated with given mimetype
1215 * This API use to get extensions associteted with given mimetype
1216 * @par Typical use case:
1217 * In general, user is not familiar with mimetype(text/html),
1218 * user is familiar with extenstions(*.html, *.htm)
1219 * So, To show mimetype information to user, use this API
1221 * @param[in] mimetype a mime type
1222 * @param[out] extlist extentions (ex> mpeg,mpg,mpe)
1223 * @param[in] len length of extlist
1224 * @return 0 if success, negative value if fail
1225 * @retval AUL_R_OK - success
1226 * @retval AUL_R_EINVAL - invalid argument(mimetype)
1227 * @retval AUL_R_ERROR - general error (no mimetype or no extenstion)
1234 * aul_get_mime_description
1238 * void get_extension()
1240 * char extlist[255];
1241 * aul_get_mime_extension("text/html",extlist,sizeof(extlist));
1246 * Some mimetype don't have extension.
1247 * In that case, You can use aul_get_mime_description.
1250 int aul_get_mime_extension(const char *mimetype, char *extlist, int len);
1254 * This API get the description associated with given mimetype
1256 * This API use to get description associteted with given mimetype
1257 * @par Typical use case:
1258 * In general, user is not familiar with mimetype(text/html),
1259 * user is familiar with well-knowing information like extenstions(*.html, *.htm)
1260 * But, some mimetype don't have extenstion.
1261 * At that time,to show mimetype information to user, use this API
1263 * @param[in] mimetype a mime type
1264 * @param[out] desc description (ex> Call client)
1265 * @param[in] len length of desc
1266 * @return 0 if success, negative value if fail
1267 * @retval AUL_R_OK - success
1268 * @retval AUL_R_EINVAL - invalid argument(mimetype)
1269 * @retval AUL_R_ERROR - general error (no mimetype or no descrition)
1276 * aul_get_mime_extension
1280 * void get_information_from_mime()
1283 * if(aul_get_mime_extension("text/html",info,sizeof(info))<0){
1284 * aul_get_mime_description("text/html",info,sizeof(info));
1292 int aul_get_mime_description(const char *mimetype, char *desc, int len);
1294 /************************************************************************************************/
1295 /* Example of aul_open_content or aul_open_file */
1296 /* voice call , browser , docview , image viewer , audio player, video player */
1298 /* voice call - aul_open_content("callto://011-1111-1111"); */
1299 /* browser - aul_open_content("http://www.naver.com"); */
1300 /* - aul_open_file("/opt/share/index.html"); */
1301 /* docview - aul_open_file("/opt/share/word.pdf"); */
1302 /* image view - aul_open_file("/opt/share/image.jpg"); */
1303 /* audio play - aul_open_file("/opt/share/audio.mp3"); */
1304 /* video play - aul_open_file("/opt/share/video.mpg"); */
1305 /************************************************************************************************/
1310 * @defgroup aul_service High-level APIs to launch applications based on service.
1313 * AUL High-level APIs based on service
1315 * This is Request/Response mechanism based on AUL like DBUS service call with auto-activation.\n
1316 * We recommend this APIs for requesting application service like camera application service (take_picture)
1317 * But, You can use other mechanism like DBUS service or your own internal IPC
1320 * Launch application based on service \n
1321 * If application is not running, AUL requests to reset the event.\n
1322 * Application can wait result with callback function.
1325 * After callee performs the requested operation, callee sends the result back, if necessary.\n
1330 * @addtogroup aul_service
1335 * @brief aul_service_res_fn is service result function
1336 * @param[out] b result bundle
1337 * @param[out] data user-supplied data
1339 typedef void (*aul_service_res_fn)(bundle *b, int reserved, void *user_data);
1343 * This API launch application based on service.
1345 * This API is for caller.
1346 * This API launch application based on service name.
1347 * This API find default application associated with service name.
1348 * and then launch the application with given bundle.
1349 * @par Typical use case:
1350 * You can launch application provided the service if you know service name.
1351 * That is, even if you don't know the specific application's pkgname,
1352 * you can launch the applicaiton by requesting the service.
1353 * For example, If you want to take a picture in your app, you can simply launch camera application.
1354 * At that time, you can use this API like aul_open_service(TAKE_PICTURE_SVC,..);
1357 * @param[in] svcname service name to launch as callee
1358 * @param[in] b bundle to be passed to callee
1359 * @param[in] cbfunc result callback function
1360 * @param[in] data user-supplied data passed to callback function
1361 * @return callee's pid if success, negative value(<0) if fail
1362 * @retval AUL_R_OK - success
1363 * @retval AUL_R_EINVAL - invaild service name
1364 * @retval AUL_R_ENOINIT - you must initilize aul library with aul_launch_init
1365 * @retval AUL_R_ECOM - internal AUL IPC error
1366 * @retval AUL_R_ERROR - general error
1376 * #include <aul_service.h>
1377 * #include <bundle.h>
1379 * void res_func(bundle *b, int reserved, void *user_data)
1381 * // process result bundle
1384 * int create_camera_view()
1386 * aul_open_service(TAKE_PICTURE_SVC, NULL, res_func, NULL);
1391 * This API can wait result (asynchronous).
1392 * To see kinds of default service provided by platform, see "aul_service.h" header file
1395 int aul_open_service(const char *svcname, bundle *b, aul_service_res_fn cbfunc, void *data);
1399 * This API create service result bundle based on bundle received in reset event.
1401 * This API use to create result bundle to send it to caller.
1402 * @par Typical use case:
1403 * This API is for callee which provide application service.\n
1404 * To send result to caller, You must create result bundle. \n
1405 * Callee(application providing the service) can send result by using this API and aul_send_service_result.
1407 * @param[in] inb bundle received in reset event
1408 * @param[out] outb bundle to use for returning result
1409 * @return 0 if success, negative value(<0) if fail
1410 * @retval AUL_R_OK - success
1411 * @retval AUL_R_EINVAL - inb is not bundle created by aul_open_service
1412 * @retval AUL_R_ERROR - general error
1415 * To create result bundle, You need received original bundle.
1416 * The original bundle can get from app_reset handler.
1420 * aul_send_service_result
1423 * #include <bundle.h>
1425 * int app_reset(bundle *b, void *data)
1427 * ad->recved_bundle = bundle_dup(b);
1432 * bundle* res_bundle;
1433 * aul_create_result_bundle(ad->recved_bundle,&res_bundle);
1434 * bundle_add(res_bundle, "result", "1");
1435 * aul_send_service_result(res_bundle);
1442 int aul_create_result_bundle(bundle *inb, bundle **outb);
1446 * This API send service result to caller with bundle
1448 * This API is used to send result bundle to caller.
1449 * @par Typical use case:
1450 * This API is for callee which provide application service.\n
1451 * To send result to caller, You can use this API after creating result bundle. \n
1452 * Callee(application to provide service) can send result by using this API and aul_create_result_bundle.
1454 * @param[in] b Result data in bundle format
1455 * @return 0 if success, negative value(<0) if fail
1456 * @retval AUL_R_OK - success
1457 * @retval AUL_R_EINVAL - invalid result bundle
1458 * @retval AUL_R_ECOMM - internal AUL IPC error
1459 * @retval AUL_R_ERROR - general error
1462 * To send result bundle, You must create result bundle.
1463 * see aul_create_result_bundle
1467 * aul_create_result_bundle
1470 * #include <bundle.h>
1472 * int app_reset(bundle *b, void *data)
1474 * ad->recved_bundle = bundle_dup(b);
1479 * bundle* res_bundle;
1480 * aul_create_result_bundle(ad->recved_bundle,&res_bundle);
1481 * bundle_add(res_bundle, "result", "1");
1482 * aul_send_service_result(res_bundle);
1489 int aul_send_service_result(bundle *b);
1493 * This API set the default application(appid) associated with service name
1495 * This API use to change default application associteted with service name
1496 * In general, Setting Application needs this API.
1497 * @par Typical use case:
1498 * Default Application associated with service name can be changed by Setting Application
1499 * So, Inhouse service application can be substituted by 3rd party service application
1501 * @param[in] svcname service string like "create_contact"
1502 * @param[in] defapp default application like "org.tizen.contact"
1503 * @return 0 if success, negative value if fail
1504 * @retval AUL_R_OK - success
1505 * @retval AUL_R_EINVAL - invalid argument(content)
1506 * @retval AUL_R_ERROR - general error
1513 * aul_get_defapp_for_service
1516 * #include <aul_service.h>
1518 * void set_camera_service_defapp()
1520 * aul_set_defapp_for_service(TAKE_PICTURE_SVC,"org.tizen.camera");
1528 int aul_set_defapp_for_service(const char *svcname, const char *defapp);
1532 * This API get the application appid associated with given service name
1534 * This API use to get default application associteted with service name
1535 * In general, Setting Application need this API.
1536 * @par Typical use case:
1537 * Setting Application show mapping of default application/ service
1539 * @param[in] svcname service string like "create_contact"
1540 * @param[out] defapp default application
1541 * @param[in] len length of defapp
1542 * @return 0 if success, negative value if fail
1543 * @retval AUL_R_OK - success
1544 * @retval AUL_R_EINVAL - invalid argument(content)
1545 * @retval AUL_R_ERROR - general error
1552 * aul_set_defapp_for_service
1555 * #include <aul_service.h>
1557 * void get_camera_service_defapp()
1559 * char appname[255];
1560 * aul_get_defapp_for_service(TAKE_PICTURE_SVC,appname,sizeof(appname));
1568 int aul_get_defapp_for_service(const char *svcname, char *defapp, int len);
1572 * This API sets callback fuction that will be called when applications die.
1574 * This API's purpose is to listen the application dead event.
1575 * In general, task manager Application need this API.
1577 * @param[in] func callback function
1578 * @param[in] data user data
1579 * @return 0 if success, negative value if fail
1580 * @retval AUL_R_OK - success
1581 * @retval AUL_R_ERROR - general error
1588 * aul_listen_app_launch_signal
1592 * int app_dead_handler(int pid, void *data)
1594 * printf("===> %s : %d\n", __FUNCTION__, pid);
1598 * void dead_listen()
1600 * aul_listen_app_dead_signal(app_dead_handler, NULL);
1608 int aul_listen_app_dead_signal(int (*func) (int, void *), void *data);
1612 * This API sets callback fuction that will be called when applications are launched.
1614 * This API's purpose is to listen the application launching event.
1615 * In general, task manager Application need this API.
1617 * @param[in] func callback function
1618 * @param[in] data user data
1619 * @return 0 if success, negative value if fail
1620 * @retval AUL_R_OK - success
1621 * @retval AUL_R_ERROR - general error
1628 * aul_listen_app_dead_signal
1632 * int app_launch_handler(int pid, void *data)
1634 * printf("===> %s : %d\n", __FUNCTION__, pid);
1638 * void dead_listen()
1640 * aul_listen_app_launch_signal(app_launch_handler, NULL);
1648 int aul_listen_app_launch_signal(int (*func) (int, void *), void *data);
1651 typedef int (*subapp_fn)(void *data);
1653 int aul_set_subapp(subapp_fn cb, void *data);
1654 int aul_subapp_terminate_request_pid(int pid);
1655 int aul_is_subapp(void);
1656 int aul_add_caller_cb(int pid, void (*caller_cb) (int, void *), void *data);
1657 int aul_remove_caller_cb(int pid);
1659 void aul_set_preinit_window(void *evas_object);
1660 void* aul_get_preinit_window(void);
1662 void aul_set_preinit_appid(const char *appid);
1664 int aul_launch_app_async(const char *appid, bundle *kb);
1666 int aul_status_update(int status);
1678 #endif /* __AUL_H__ */
1680 /* vi: set ts=8 sts=8 sw=8: */