tizen 2.3 release
[framework/appfw/aul-1.git] / include / aul.h
index ef7353d..48bc10d 100755 (executable)
@@ -70,6 +70,11 @@ extern "C" {
  * @brief Return values in AUL.
  */
 typedef enum _aul_return_val {
+       AUL_R_EREJECTED = -14,  /**< App disable for mode*/
+       AUL_R_ENOAPP = -13,             /**< Failed to find app ID or pkg ID */
+#ifdef _APPFW_FEATURE_APP_CONTROL_LITE
+       AUL_R_UG_LOCAL = -12,
+#endif
        AUL_R_EHIDDENFORGUEST = -11,    /**< App hidden for guest mode */
        AUL_R_ENOLAUNCHPAD = -10,       /**< no launchpad */
        AUL_R_ETERMINATING = -9,        /**< application terminating */
@@ -123,7 +128,11 @@ enum app_status {
 typedef enum _aul_type{
        AUL_START,
        AUL_RESUME,
-       AUL_TERMINATE
+       AUL_TERMINATE,
+#ifdef _APPFW_FEATURE_VISIBILITY_CHECK_BY_LCD_STATUS
+       AUL_PAUSE_LCD_OFF,
+       AUL_RESUME_LCD_ON,
+#endif
 }aul_type;
 
 /** AUL internal private key */
@@ -180,9 +189,6 @@ typedef enum _aul_type{
 /** AUL public key - To support Media key */
 #define AUL_K_MULTI_KEY_EVENT  "__AUL_MULTI_KEY_EVENT__"
 
-/** AUL public bundle value */
-#define AUL_K_PRIVACY_APPID            "__AUL_PRIVACY_APPID__"
-
 /** AUL public bundle value - To support Media key*/
 #define AUL_V_KEY_PRESSED      "__AUL_KEY_PRESSED__"
 /** AUL public bundle value - To support Media key*/
@@ -204,9 +210,21 @@ typedef enum _aul_type{
 #define AUL_K_APPID            "__AUL_APPID__"
 /** AUL internal private key */
 #define AUL_K_PID              "__AUL_PID__"
+/** AUL internal private key */
+#define AUL_K_PRELAUCHING      "__AUL_PRELAUCHING__"
 
-#define PRIVACY_POPUP "tizenprv00.privacy-popup"
+#ifdef _APPFW_FEATURE_CONTACT_PHONE_AS_ONE_APP
+/** AUL internal private key - To distinguish between Contacts and Phone */
+#define AUL_K_INTERNAL_APPID   "__AUL_INTERNAL_APPID__"
+#endif
+
+#ifdef _APPFW_FEATURE_PROCESS_POOL
+#define AUL_K_LAUNCHPAD_TYPE   "__AUL_LAUNCHPAD_TYPE__"
+#endif
 
+#ifdef _APPFW_FEATURE_DATA_CONTROL
+#define AUL_K_DATA_CONTROL_TYPE   "__AUL_DATA_CONTROL_TYPE__"
+#endif
 
 /**
  * @brief      This is callback function for aul_launch_init
@@ -440,7 +458,7 @@ int aul_launch_local(bundle *b);
  * @return     callee's pid if success, negative value(<0) if fail
  * @retval     AUL_R_OK        - success
  * @retval     AUL_R_EINVAL    - invaild package name
- * @retval     AUL_R_ECOM      - internal AUL IPC error
+ * @retval     AUL_R_ECOMM     - internal AUL IPC error
  * @retval     AUL_R_ERROR     - general error
  *
  * @pre
@@ -459,6 +477,7 @@ int aul_launch_local(bundle *b);
  *     b = bundle_create();
  *     bundle_add(b,"type","SIM");
  *     aul_launch_app("org.tizen.contact",b);
+ *     iuu
  * }
  *
  * @endcode
@@ -485,7 +504,7 @@ int aul_launch_app(const char *appid, bundle *kb);
  * @return     callee's pid if success, negative value(<0) if fail
  * @retval     AUL_R_OK        - success
  * @retval     AUL_R_EINVAL    - invaild package name
- * @retval     AUL_R_ECOM      - internal AUL IPC error
+ * @retval     AUL_R_ECOMM     - internal AUL IPC error
  * @retval     AUL_R_ERROR     - general error
  *
  * @pre
@@ -529,7 +548,7 @@ int aul_open_app(const char *appid);
  * @return     callee's pid if success, negative value(<0) if fail
  * @retval     AUL_R_OK        - success
  * @retval     AUL_R_EINVAL    - invaild package name
- * @retval     AUL_R_ECOM      - internal AUL IPC error
+ * @retval     AUL_R_ECOMM     - internal AUL IPC error
  * @retval     AUL_R_ERROR     - general error
  *
  * @pre
@@ -577,7 +596,7 @@ int aul_resume_app(const char *appid);
  * @return     0 if success, negative value(<0) if fail
  * @retval     AUL_R_OK        - success
  * @retval     AUL_R_EINVAL    - invaild pid
- * @retval     AUL_R_ECOM      - internal AUL IPC error
+ * @retval     AUL_R_ECOMM     - internal AUL IPC error
  * @retval     AUL_R_ERROR     - general error (include application is not running)
  * @warning    This API need to require root or inhouse permisssion \n
  *             If you have not the permission, this API return AUL_R_ERROR. \n
@@ -625,7 +644,7 @@ int aul_resume_pid(int pid);
  * @return     0 if success, negative value(<0) if fail
  * @retval     AUL_R_OK        - success
  * @retval     AUL_R_EINVAL    - invaild pid
- * @retval     AUL_R_ECOM      - internal AUL IPC error
+ * @retval     AUL_R_ECOMM     - internal AUL IPC error
  * @retval     AUL_R_ERROR     - general error
  * @warning    This API need to require root or inhouse permisssion. \n
  *
@@ -655,6 +674,9 @@ int aul_resume_pid(int pid);
  *     If you have not the permission, this API return AUL_R_ERROR. \n
 */
 int aul_terminate_pid(int pid);
+int aul_terminate_pid_without_restart(int pid);
+int aul_terminate_pid_async(int pid);
+
 
 /** @} */
 
@@ -775,6 +797,22 @@ int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
 
 /**
  * @par Description:
+ *     This API use to get running application list from the proc file system.
+ *     This API call iter_fn with each aul_app_info of running apps when running application is found.
+ *
+ * @param[in]  iter_fn         iterator function
+ * @param[in]  data            user-supplied data for iter_fn
+ * @return     0 if success, negative value(<0) if fail
+ * @retval     AUL_R_OK        - success
+ * @retval     AUL_R_ERROR     - internal error
+ */
+int aul_get_running_app_info_from_proc(aul_app_info_iter_fn iter_fn, void *data);
+
+int aul_get_running_app_info_from_memory(aul_app_info_iter_fn iter_fn, void *data);
+
+
+/**
+ * @par Description:
  *     This API get application package name by pid
  * @par Purpose:
  *     If you want to get package name of running application, use this API
@@ -851,6 +889,8 @@ int aul_app_get_pkgname_bypid(int pid, char *pkgname, int len);
 */
 int aul_app_get_appid_bypid(int pid, char *appid, int len);
 
+int aul_app_get_pkgid_bypid(int pid, char *pkgid, int len);
+
 
 /** @} */
 
@@ -877,222 +917,6 @@ int aul_app_get_appid_bypid(int pid, char *appid, int len);
 
 /**
  * @par Description:
- *     This API launch application associated with given filename
- * @par Purpose:
- *      This API is for caller.
- *     This API launch application based on mime type.
- *     This API find mime_type associated with file name,
- *     and then find default app associated with found mime_type
- *     and then launch the app with filename argument.
- * @par Typical use case:
- *     You can launch application to process given filename.
- *     That is, Even if you don't know the specific application's pkgname,
- *     you can launch the applicaiton processing given filename .
- *     For example, If you want to process image file, you can simply launch image viewer.
- *     At that time, you can use this APIs like aul_open_file("myimage.jpg");
- *
- * @param[in]  filename        filename
- * @return     callee's pid or 0 if success, negative value if fail\n
- *              (when no found default app, return 0)
- * @retval     AUL_R_OK        - success
- * @retval     AUL_R_EINVAL    - invalid argument(filename)
- * @retval     AUL_R_ECOM      - internal AUL IPC error
- * @retval     AUL_R_ERROR     - general error
- *
- * @pre
- *     None
- * @post
- *     None
- * @see
- *     None
- * @code
- * #include <aul.h>
- *
- * int view_image_file(char *filename)
- * {
- *      aul_open_file(filename);
- * }
- *
- * @endcode
- * @remark
- *     None
- *
- */
-int aul_open_file(const char* filename);
-
-/**
- * @par Description:
- *     This API launch application associated with given specific mimetype
- * @par Purpose:
- *      This API is for caller.
- *     This API launch application based on mime type like aul_open_file API.
- *     But, This API don't find mime_type associated with file name.
- *     This API use mimetype given by user. By using given mimetype, find default application.
- *     and then launch the app with filename argument.
- * @par Typical use case:
- *     Some files cannot extract exact mimetype automatically.
- *     For example, To know mime type of files with DRM lock, first we should unlock DRM file.
- *     In this case, You can use this API.
- *     First, unlock DRM file, and extract mimetype from unlock file by using aul_get_mime_from_file,
- *     and then, use this API with DRM file and extracted mime type.
- *
- * @param[in]  filename        filename
- * @param[in]  mimetype        specific mimetype
- * @return     callee's pid or 0 if success, negative value if fail\n
- *              (when no found default app, return 0)
- * @retval     AUL_R_OK        - success
- * @retval     AUL_R_EINVAL    - invalid argument(filename,mimetype)
- * @retval     AUL_R_ECOM      - internal AUL IPC error
- * @retval     AUL_R_ERROR     - general error
- *
- * @pre
- *     None
- * @post
- *     None
- * @see
- *     aul_open_file, aul_get_mime_from_file
- * @code
- * #include <aul.h>
- *
- * int view_drm_image_file(char *drm_filename)
- * {
- *     char* mimetype;
- *     // you must implement this function
- *     mimetype = get_mimetype_from_drmfile(drm_filename);
- *
- *      aul_open_file_with_mimetype(drm_filename,mimetype);
- * }
- *
- * @endcode
- * @remark
- *     None
- */
-int aul_open_file_with_mimetype(const char *filename, const char *mimetype);
-
-/**
- * @par Description:
- *     This API launch application associated with content like "http://www.samsung.com"
- * @par Purpose:
- *      This API is for caller.
- *     This API launch application based on mime type.
- *     This API find mime_type associated with content,
- *     and then find default app associated with found mime_type,
- *     and then launch the app with content argument.
- * @par Typical use case:
- *     You can launch application to process given content.
- *     That is, Even if you don't know the specific application's pkgname,
- *     you can launch the applicaiton processing given content.
- *     For example, If you want to process URL "http://www.samsung.com",
- *     you can simply launch browser.
- *     At that time, you can use this APIs like aul_open_content("http://www.samsung.com");
- *
- * @param[in]   content                content
- * @return     callee's pid or 0 if success, negative value if fail\n
- *              (when no found default app, return 0)
- * @retval     AUL_R_OK        - success
- * @retval     AUL_R_EINVAL    - invalid argument(content)
- * @retval     AUL_R_ECOM      - internal AUL IPC error
- * @retval     AUL_R_ERROR     - general error or no found mimetype
- *
- * @pre
- *     None
- * @post
- *     None
- * @see
- *     None
- * @code
- * #include <aul.h>
- *
- * int view_url(char *url)
- * {
- *      aul_open_content(url);
- * }
- *
- * @endcode
- * @remark
- *     None
- *
- */
-int aul_open_content(const char* content);
-
-/**
- * @par Description:
- *      This API get the default application(appid) associated with MIME type
- * @par Purpose:
- *     This API use to get default application associteted with mimetype
- *     In general, Setting Application need this API.
- * @par Typical use case:
- *     Setting Application show mapping of default application / mimetype
- *
- * @param[in]  mimetype        a mime type
- * @param[out] defapp          a application appid of the app
- * @param[in]  len             length of defapp
- * @return     0 if success, negative value if fail
- * @retval     AUL_R_OK        - success
- * @retval     AUL_R_EINVAL    - invalid argument(mimetype)
- * @retval     AUL_R_ERROR     - general error or no found mimetype
- *
- * @pre
- *     None
- * @post
- *     None
- * @see
- *     aul_set_defapp_with_mime
- * @code
- * #include <aul.h>
- *
- * void get_text_html_defapp()
- * {
- *     char appname[255];
- *     aul_get_defapp_from_mime("text/html",appname,sizeof(appname));
- * }
- *
- * @endcode
- * @remark
- *     None
- *
- */
-int aul_get_defapp_from_mime(const char *mimetype, char *defapp, int len);
-
-/**
- * @par Description:
- *      This API set the default application(appid) associated with MIME type
- * @par Purpose:
- *     This API use to change default application associteted with mimetype
- *     In general, Setting Application or Installer need this API.
- * @par Typical use case:
- *     Default Application associated with mimetype can be changed by Setting Application or installer
- *     So, application to process specific mimetype can be substituted.
- *
- * @param[in]  mimetype        a mime type
- * @param[in]  defapp          a application appid of the app to be set
- * @return     0 if success, negative value if fail
- * @retval     AUL_R_OK        - success
- * @retval     AUL_R_EINVAL    - invalid argument(mimetype)
- * @retval     AUL_R_ERROR     - general error
- *
- * @pre
- *     None
- * @post
- *     None
- * @see
- *     aul_get_defapp_from_mime
- * @code
- * #include <aul.h>
- *
- * void set_text_html_defapp()
- * {
- *     aul_set_defapp_with_mime("text/html","org.tizen.browser");
- * }
- *
- * @endcode
- * @remark
- *     None
-*/
-int aul_set_defapp_with_mime(const char *mimetype, const char *defapp);
-
-/**
- * @par Description:
  *     This API get the mimetype associated with filename
  * @par Purpose:
  *     This API use to get mimetype associteted with given filename
@@ -1291,19 +1115,6 @@ int aul_get_mime_extension(const char *mimetype, char *extlist, int len);
  */
 int aul_get_mime_description(const char *mimetype, char *desc, int len);
 
-/************************************************************************************************/
-/* Example of aul_open_content or aul_open_file                                                        */
-/* voice call , browser , docview , image viewer , audio player, video player                   */
-/*                                                                                              */
-/* voice call - aul_open_content("callto://011-1111-1111");                                     */
-/* browser -    aul_open_content("http://www.naver.com");                                       */
-/*         -    aul_open_file("/opt/share/index.html");                                         */
-/* docview -    aul_open_file("/opt/share/word.pdf");                                           */
-/* image view - aul_open_file("/opt/share/image.jpg");                                          */
-/* audio play - aul_open_file("/opt/share/audio.mp3");                                          */
-/* video play - aul_open_file("/opt/share/video.mpg");                                          */
-/************************************************************************************************/
-
 /** @} */
 
 /**
@@ -1340,62 +1151,6 @@ typedef void (*aul_service_res_fn)(bundle *b, int reserved, void *user_data);
 
 /**
  * @par Description:
- *     This API launch application based on service.
- * @par Purpose:
- *      This API is for caller.
- *     This API launch application based on service name.
- *     This API find default application associated with service name.
- *     and then launch the application with given bundle.
- * @par Typical use case:
- *     You can launch application provided the service if you know service name.
- *     That is, even if you don't know the specific application's pkgname,
- *     you can launch the applicaiton by requesting the service.
- *     For example, If you want to take a picture in your app, you can simply launch camera application.
- *     At that time, you can use this API like aul_open_service(TAKE_PICTURE_SVC,..);
- *
- *
- * @param[in]   svcname         service name to launch as callee
- * @param[in]   b               bundle to be passed to callee
- * @param[in]   cbfunc          result callback function
- * @param[in]   data            user-supplied data passed to callback function
- * @return      callee's pid if success, negative value(<0) if fail
- * @retval      AUL_R_OK        - success
- * @retval      AUL_R_EINVAL    - invaild service name
- * @retval      AUL_R_ENOINIT   - you must initilize aul library with aul_launch_init
- * @retval      AUL_R_ECOM      - internal AUL IPC error
- * @retval      AUL_R_ERROR     - general error
- *
- * @pre
- *     None
- * @post
- *     None
- * @see
- *     None
- * @code
- * #include <aul.h>
- * #include <aul_service.h>
- * #include <bundle.h>
- *
- * void res_func(bundle *b, int reserved, void *user_data)
- * {
- *     // process result bundle
- * }
- *
- * int create_camera_view()
- * {
- *      aul_open_service(TAKE_PICTURE_SVC, NULL, res_func, NULL);
- * }
- *
- * @endcode
- * @remark
- *     This API can wait result (asynchronous).
- *     To see kinds of default service provided by platform, see "aul_service.h" header file
- *
- */
-int aul_open_service(const char *svcname, bundle *b, aul_service_res_fn cbfunc, void *data);
-
-/**
- * @par Description:
  *     This API create service result bundle based on bundle received in reset event.
  * @par Purpose:
  *     This API use to create result bundle to send it to caller.
@@ -1408,7 +1163,7 @@ int aul_open_service(const char *svcname, bundle *b, aul_service_res_fn cbfunc,
  * @param[out]  outb            bundle to use for returning result
  * @return      0 if success, negative value(<0) if fail
  * @retval      AUL_R_OK        - success
- * @retval      AUL_R_EINVAL    - inb is not bundle created by aul_open_service
+ * @retval      AUL_R_EINVAL    - inb is not bundle
  * @retval      AUL_R_ERROR     - general error
  *
  * @pre
@@ -1490,85 +1245,6 @@ int aul_send_service_result(bundle *b);
 
 /**
  * @par Description:
- *     This API set the default application(appid) associated with service name
- * @par Purpose:
- *     This API use to change default application associteted with service name
- *     In general, Setting Application needs this API.
- * @par Typical use case:
- *     Default Application associated with service name can be changed by Setting Application
- *     So, Inhouse service application can be substituted by 3rd party service application
- *
- * @param[in]  svcname         service string like "create_contact"
- * @param[in]  defapp          default application like "org.tizen.contact"
- * @return     0 if success, negative value if fail
- * @retval     AUL_R_OK        - success
- * @retval     AUL_R_EINVAL    - invalid argument(content)
- * @retval     AUL_R_ERROR     - general error
- *
- * @pre
- *     None
- * @post
- *     None
- * @see
- *     aul_get_defapp_for_service
- * @code
- * #include <aul.h>
- * #include <aul_service.h>
- *
- * void set_camera_service_defapp()
- * {
- *     aul_set_defapp_for_service(TAKE_PICTURE_SVC,"org.tizen.camera");
- * }
- *
- * @endcode
- * @remark
- *     None
- *
- */
-int aul_set_defapp_for_service(const char *svcname, const char *defapp);
-
-/**
- * @par Description:
- *     This API get the application appid associated with given service name
- * @par Purpose:
- *     This API use to get default application associteted with service name
- *     In general, Setting Application need this API.
- * @par Typical use case:
- *     Setting Application show mapping of default application/ service
- *
- * @param[in]  svcname         service string like "create_contact"
- * @param[out] defapp          default application
- * @param[in]  len             length of defapp
- * @return     0 if success, negative value if fail
- * @retval     AUL_R_OK        - success
- * @retval     AUL_R_EINVAL    - invalid argument(content)
- * @retval     AUL_R_ERROR     - general error
- *
- * @pre
- *     None
- * @post
- *     None
- * @see
- *     aul_set_defapp_for_service
- * @code
- * #include <aul.h>
- * #include <aul_service.h>
- *
- * void get_camera_service_defapp()
- * {
- *     char appname[255];
- *     aul_get_defapp_for_service(TAKE_PICTURE_SVC,appname,sizeof(appname));
- * }
- *
- * @endcode
- * @remark
- *     None
- *
- */
-int aul_get_defapp_for_service(const char *svcname, char *defapp, int len);
-
-/**
- * @par Description:
  *     This API sets callback fuction that will be called when applications die.
  * @par Purpose:
  *     This API's purpose is to listen the application dead event.
@@ -1647,6 +1323,27 @@ int aul_listen_app_dead_signal(int (*func) (int, void *), void *data);
  */
 int aul_listen_app_launch_signal(int (*func) (int, void *), void *data);
 
+int aul_listen_booting_done_signal(int (*func) (int, void *), void *data);
+
+int aul_listen_cooldown_signal(int (*func) (const char *, void *), void *data);
+
+const char *aul_get_app_external_root_path(void);
+const char *aul_get_app_root_path(void);
+const char *aul_get_app_data_path(void);
+const char *aul_get_app_cache_path(void);
+const char *aul_get_app_resource_path(void);
+const char *aul_get_app_shared_data_path(void);
+const char *aul_get_app_shared_resource_path(void);
+const char *aul_get_app_shared_trusted_path(void);
+const char *aul_get_app_external_data_path(void);
+const char *aul_get_app_external_cache_path(void);
+const char *aul_get_app_external_shared_data_path(void);
+const char *aul_get_app_specific_path(void);
+const char *aul_get_app_external_specific_path(void);
+int aul_get_app_shared_data_path_by_appid(const char *app_id, char **path);
+int aul_get_app_shared_resource_path_by_appid(const char *app_id, char **path);
+int aul_get_app_shared_trusted_path_by_appid(const char *app_id, char **path);
+int aul_get_app_external_shared_data_path_by_appid(const char *app_id, char **path);
 
 typedef int (*subapp_fn)(void *data);
 
@@ -1656,15 +1353,45 @@ int aul_is_subapp(void);
 int aul_add_caller_cb(int pid,  void (*caller_cb) (int, void *), void *data);
 int aul_remove_caller_cb(int pid);
 
+#ifdef _APPFW_FEATURE_PROCESS_POOL
 void aul_set_preinit_window(void *evas_object);
-void* aul_get_preinit_window(void);
+void* aul_get_preinit_window(const char *win_name);
+
+void aul_set_preinit_background(void *evas_object);
+void* aul_get_preinit_background(void);
+
+void aul_set_preinit_conformant(void *evas_object);
+void* aul_get_preinit_conformant(void);
+#endif
 
 void aul_set_preinit_appid(const char *appid);
 
 int aul_launch_app_async(const char *appid, bundle *kb);
 
+#ifdef _APPFW_FEATURE_MULTI_INSTANCE
+int aul_launch_app_for_multi_instance(const char *appid, bundle *kb);
+#endif
+
+int aul_update_freezer_status(int pid, const char* type);
+
 int aul_status_update(int status);
 
+int aul_get_app_allocated_memory(void);
+
+long long aul_get_app_running_time(void);
+
+int aul_listen_e17_status_signal(int (*func) (int, int, void *), void *data);
+
+#ifdef _APPFW_FEATURE_DATA_CONTROL
+typedef int (*data_control_provider_handler_fn) (bundle *b, int request_id, void *data);
+int aul_set_data_control_provider_cb(data_control_provider_handler_fn handler);
+int aul_unset_data_control_provider_cb(void);
+#endif
+#ifdef _APPFW_FEATURE_APP_CONTROL_LITE
+int aul_call_ug_result_callback(bundle *kb, int is_cancel, int id);
+#endif
+
+int aul_get_support_legacy_lifecycle(void);
 
 /** @} */