tizen 2.4 release accepted/tizen_2.4_mobile accepted/tizen/2.4/mobile/20151029.034954 submit/tizen_2.4/20151028.063505 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 07:21:34 +0000 (16:21 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Sat, 24 Oct 2015 07:21:34 +0000 (16:21 +0900)
32 files changed:
CMakeLists.txt
TC/testcase/utc_app.c
alarm/alarm.c [changed mode: 0644->0755]
app_common/CMakeLists.txt
app_common/app_event.c
app_common/app_package.c
app_common/app_path.c
app_control/CMakeLists.txt
app_control/app_control.c
doc/appfw_alarm_doc.h
doc/appfw_app_control_doc.h
doc/appfw_app_doc.h
doc/appfw_event_doc.h [new file with mode: 0755]
doc/appfw_resource_manager_doc.h [new file with mode: 0755]
doc/images/capi_appfw_application_resource.png [new file with mode: 0755]
event/CMakeLists.txt [new file with mode: 0644]
event/event.c [new file with mode: 0644]
include/app.h
include/app_alarm.h
include/app_common.h
include/app_control.h
include/app_control_internal.h
include/app_event.h [new file with mode: 0644]
include/app_extension.h [new file with mode: 0755]
include/app_internal.h
include/app_resource_manager.h [new file with mode: 0644]
packaging/capi-appfw-application.spec
preference/preference.c
preference/preference_inoti.c
src/app_main.c
src/app_resource.c
src/app_resource_manager.c [new file with mode: 0644]

index 9c346a9..bd3d9a9 100755 (executable)
@@ -9,8 +9,8 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(requires "dlog bundle appcore-common appcore-efl aul elementary capi-base-common vconf-internal-keys")
-SET(pc_requires "capi-base-common capi-appfw-app-control capi-appfw-app-common")
+SET(requires "dlog bundle appcore-common appcore-efl aul elementary capi-base-common vconf-internal-keys pkgmgr-info glib-2.0")
+SET(pc_requires "capi-base-common capi-appfw-app-control capi-appfw-app-common capi-appfw-event appcore-common")
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(${fw_name} REQUIRED ${requires})
@@ -41,8 +41,9 @@ ADD_SUBDIRECTORY(app_control)
 ADD_SUBDIRECTORY(app_common)
 ADD_SUBDIRECTORY(alarm)
 ADD_SUBDIRECTORY(preference)
+ADD_SUBDIRECTORY(event)
 
-TARGET_LINK_LIBRARIES(${fw_name} capi-appfw-app-control capi-appfw-app-common ${${fw_name}_LDFLAGS})
+TARGET_LINK_LIBRARIES(${fw_name} capi-appfw-app-control capi-appfw-app-common capi-appfw-event ${${fw_name}_LDFLAGS})
 
 SET_TARGET_PROPERTIES(${fw_name}
      PROPERTIES
index e012ed1..955acab 100755 (executable)
@@ -35,10 +35,6 @@ static void utc_app_get_id_negative1(void);
 static void utc_app_get_id_negative2(void);
 static void utc_app_get_version_negative1(void);
 static void utc_app_get_version_negative2(void);
-static void utc_app_get_resource_negative1(void);
-static void utc_app_get_resource_negative2(void);
-static void utc_app_get_data_directory_negative1(void);
-static void utc_app_get_data_directory_negative2(void);
 static void utc_app_get_device_orientation_positive(void);
 static void utc_app_set_reclaiming_system_cache_on_pause_positive1(void);
 static void utc_app_set_reclaiming_system_cache_on_pause_positive2(void);
@@ -55,10 +51,6 @@ struct tet_testlist tet_testlist[] = {
        { utc_app_get_id_negative2, 1 },
        { utc_app_get_version_negative1, 1 },
        { utc_app_get_version_negative2, 1 },
-       { utc_app_get_resource_negative1, 1 },
-       { utc_app_get_resource_negative2, 1 },
-       { utc_app_get_data_directory_negative1, 1 },
-       { utc_app_get_data_directory_negative2, 1 },
        { utc_app_get_device_orientation_positive, 1 },
        { utc_app_set_reclaiming_system_cache_on_pause_positive1, 1 },
        { utc_app_set_reclaiming_system_cache_on_pause_positive2, 1 },
@@ -200,92 +192,6 @@ static void utc_app_get_version_negative2(void)
        }
 }
 
-
-static void utc_app_get_resource_negative1(void)
-{
-       const char *API_NAME = __FUNCTION__;
-       char *ret = NULL;
-       char *path = NULL;
-       int size = 0;
-
-       ret = app_get_resource("res/image.jpg", path, size);
-
-       dts_message(API_NAME, "ret(%s), path(%s)", ret, path);
-
-       if(path != NULL)
-       {
-               dts_fail(API_NAME, "failed");
-       }
-       else
-       {
-               dts_pass(API_NAME, "passed");
-       }
-}
-
-
-static void utc_app_get_resource_negative2(void)
-{
-       const char *API_NAME = __FUNCTION__;
-       char *ret = NULL;
-       int size = 0;
-
-       ret = app_get_resource("res/image.jpg", NULL, size);
-
-       dts_message(API_NAME, "ret(%s)", ret);
-
-       if(ret != NULL)
-       {
-               dts_fail(API_NAME, "failed");
-       }
-       else
-       {
-               dts_pass(API_NAME, "passed");
-       }
-}
-
-
-static void utc_app_get_data_directory_negative1(void)
-{
-       const char *API_NAME = __FUNCTION__;
-       char *ret = NULL;
-       char *path = NULL;
-       int size =0;
-
-       ret = app_get_data_directory(path, size);
-
-       dts_message(API_NAME, "ret(%s), path(%s)", ret, path);
-
-       if(ret != NULL)
-       {
-               dts_fail(API_NAME, "failed");
-       }
-       else
-       {
-               dts_pass(API_NAME, "passed");
-       }
-}
-
-
-static void utc_app_get_data_directory_negative2(void)
-{
-       const char *API_NAME = __FUNCTION__;
-       char *ret = NULL;
-       int size = 0;
-
-       ret = app_get_data_directory(NULL, size);
-
-       dts_message(API_NAME, "ret(%s)", ret);
-
-       if(ret != NULL)
-       {
-               dts_fail(API_NAME, "failed");
-       }
-       else
-       {
-               dts_pass(API_NAME, "passed");
-       }
-}
-
 static void utc_app_get_device_orientation_positive(void)
 {
        const char *API_NAME = __FUNCTION__;
old mode 100644 (file)
new mode 100755 (executable)
index 5b670f2..3b7df66
@@ -23,6 +23,8 @@
 #include <app_alarm.h>
 #include <app_control_internal.h>
 
+#include <bundle.h>
+
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif
@@ -40,18 +42,13 @@ static int alarm_registered_alarm_cb_broker(int alarm_id, void *user_data)
        alarm_foreach_item_cb_context* foreach_cb_context = NULL;
 
        if (user_data == NULL)
-       {
                return 0;
-       }
 
        foreach_cb_context = (alarm_foreach_item_cb_context*)user_data;
 
-       if (foreach_cb_context != NULL && *(foreach_cb_context->foreach_break) == false)
-       {
+       if (foreach_cb_context != NULL && *(foreach_cb_context->foreach_break) == false) {
                if (foreach_cb_context->cb(alarm_id, foreach_cb_context->user_data) == false)
-               {
                        *(foreach_cb_context->foreach_break) = true;
-               }
        }
 
        return 0;
@@ -59,8 +56,7 @@ static int alarm_registered_alarm_cb_broker(int alarm_id, void *user_data)
 
 static int convert_error_code_to_alarm(const char* function, alarm_error_t alarm_error)
 {
-       switch(alarm_error)
-       {
+       switch(alarm_error) {
        case ERR_ALARM_INVALID_PARAM:
        case ERR_ALARM_INVALID_REPEAT:
                LOGE("[%s] INVALID_PARAMETER(0x%08x)", function, ALARM_ERROR_INVALID_PARAMETER);
@@ -97,6 +93,11 @@ static int convert_error_code_to_alarm(const char* function, alarm_error_t alarm
                return ALARM_ERROR_PERMISSION_DENIED;
                break;
 
+       case ERR_ALARM_NOT_PERMITTED_APP:
+               LOGE("[%s] NOT_PERMITTED_APP(0x%08x)", function, ALARM_ERROR_NOT_PERMITTED_APP);
+               return ALARM_ERROR_NOT_PERMITTED_APP;
+               break;
+
        case ALARMMGR_RESULT_SUCCESS:
                return ALARM_ERROR_NONE;
                break;
@@ -111,17 +112,14 @@ int alarm_get_scheduled_date(int alarm_id, struct tm* date)
        alarm_error_t result;
        time_t due_time = 0;
 
-       if (date == NULL)
-       {
+       if (date == NULL) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
 
        result = alarmmgr_get_next_duetime(alarm_id, &due_time);
        if (result != ALARMMGR_RESULT_SUCCESS)
-       {
                return convert_error_code_to_alarm(__FUNCTION__, result);
-       }
 
        localtime_r(&due_time, date);
 
@@ -135,8 +133,7 @@ int alarm_get_scheduled_period(int alarm_id, int* period)
        alarm_repeat_mode_t mode;
        int value;
 
-       if (period == NULL)
-       {
+       if (period == NULL) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
@@ -144,32 +141,23 @@ int alarm_get_scheduled_period(int alarm_id, int* period)
        entry = alarmmgr_create_alarm();
 
        result = alarmmgr_get_info(alarm_id, entry);
-       if (result != ALARMMGR_RESULT_SUCCESS)
-       {
+       if (result != ALARMMGR_RESULT_SUCCESS) {
                if (entry != NULL)
-               {
                        alarmmgr_free_alarm(entry);
-               }
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
        result = alarmmgr_get_repeat_mode(entry, &mode, &value);
-       if (result != ALARMMGR_RESULT_SUCCESS)
-       {
+       if (result != ALARMMGR_RESULT_SUCCESS) {
                if (entry != NULL)
-               {
                        alarmmgr_free_alarm(entry);
-               }
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
        result = alarmmgr_free_alarm(entry);
-       if(result != ALARMMGR_RESULT_SUCCESS)
-       {
+       if(result != ALARMMGR_RESULT_SUCCESS) {
                if (entry != NULL)
-               {
                        alarmmgr_free_alarm(entry);
-               }
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
@@ -183,19 +171,17 @@ int alarm_schedule_after_delay(app_control_h app_control, int delay, int period,
        bundle *bundle_data;
        int result = 0;
 
-       if (app_control == NULL)
-       {
+       if (app_control == NULL) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
 
-       if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE)
-       {
+       if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
 
-       result = alarmmgr_add_alarm_appsvc(ALARM_TYPE_DEFAULT, delay, period, bundle_data, alarm_id);
+       result = alarmmgr_add_alarm_appsvc(ALARM_TYPE_DEFAULT | ALARM_TYPE_INEXACT, delay, period, bundle_data, alarm_id);
 
        return  convert_error_code_to_alarm(__FUNCTION__, result);
 }
@@ -207,14 +193,12 @@ int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int perio
        bundle *bundle_data;
        int result;
 
-       if (app_control == NULL || date == NULL)
-       {
+       if (app_control == NULL || date == NULL) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
 
-       if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE)
-       {
+       if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
@@ -231,39 +215,110 @@ int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int perio
 
        result = alarmmgr_set_time(alarm_info,internal_time);
 
-       if (result < 0)
-       {
+       if (result < 0) {
                alarmmgr_free_alarm(alarm_info);
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
        if (period_in_second > 0)
-       {
                result = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_REPEAT, period_in_second);
-       }
        else
-       {
                result = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_ONCE, period_in_second);
+
+       if (result < 0) {
+               alarmmgr_free_alarm(alarm_info);
+               return convert_error_code_to_alarm(__FUNCTION__, result);
+       }
+
+       result = alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT);
+
+       if (result < 0) {
+               alarmmgr_free_alarm(alarm_info);
+               return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
-       if (result < 0)
-       {
+       result = alarmmgr_add_alarm_appsvc_with_localtime(alarm_info, bundle_data, alarm_id);
+
+       if (result < 0) {
+               alarmmgr_free_alarm(alarm_info);
+               return convert_error_code_to_alarm(__FUNCTION__, result);
+       }
+
+       alarmmgr_free_alarm(alarm_info);
+       return ALARM_ERROR_NONE;
+}
+
+int alarm_schedule_once_after_delay(app_control_h app_control, int delay, int *alarm_id)
+{
+       bundle *bundle_data;
+       int result = 0;
+
+       if (app_control == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
+               return ALARM_ERROR_INVALID_PARAMETER;
+       }
+
+       if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE) {
+               LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
+               return ALARM_ERROR_INVALID_PARAMETER;
+       }
+
+       result = alarmmgr_add_alarm_appsvc(ALARM_TYPE_DEFAULT, delay, 0, bundle_data, alarm_id);
+
+       return  convert_error_code_to_alarm(__FUNCTION__, result);
+}
+
+int alarm_schedule_once_at_date(app_control_h app_control, struct tm *date, int *alarm_id)
+{
+       alarm_date_t internal_time;
+       alarm_entry_t* alarm_info;
+       bundle *bundle_data;
+       int result;
+
+       if (app_control == NULL || date == NULL) {
+               LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
+               return ALARM_ERROR_INVALID_PARAMETER;
+       }
+
+       if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE) {
+               LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
+               return ALARM_ERROR_INVALID_PARAMETER;
+       }
+
+       alarm_info = alarmmgr_create_alarm();
+
+       internal_time.year = date->tm_year + 1900;
+       internal_time.month = date->tm_mon + 1;
+       internal_time.day = date->tm_mday;
+
+       internal_time.hour = date->tm_hour;
+       internal_time.min = date->tm_min;
+       internal_time.sec = date->tm_sec;
+
+       result = alarmmgr_set_time(alarm_info, internal_time);
+
+       if (result < 0) {
+               alarmmgr_free_alarm(alarm_info);
+               return convert_error_code_to_alarm(__FUNCTION__, result);
+       }
+
+       result = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_ONCE, 0);
+
+       if (result < 0) {
                alarmmgr_free_alarm(alarm_info);
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
        result = alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT);
 
-       if (result < 0)
-       {
+       if (result < 0) {
                alarmmgr_free_alarm(alarm_info);
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
        result = alarmmgr_add_alarm_appsvc_with_localtime(alarm_info, bundle_data, alarm_id);
 
-       if (result < 0)
-       {
+       if (result < 0) {
                alarmmgr_free_alarm(alarm_info);
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
@@ -293,8 +348,7 @@ int alarm_foreach_registered_alarm(alarm_registered_alarm_cb callback, void* use
        int result;
        bool foreach_break = false;
 
-       if (callback == NULL)
-       {
+       if (callback == NULL) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
@@ -315,8 +369,7 @@ int alarm_get_current_time(struct tm* date)
 {
        time_t now;
 
-       if (date == NULL)
-       {
+       if (date == NULL) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
@@ -326,7 +379,6 @@ int alarm_get_current_time(struct tm* date)
        return ALARM_ERROR_NONE;
 }
 
-
 int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct tm *date, int week_flag,int *alarm_id)
 {
        alarm_date_t internal_time;
@@ -334,14 +386,12 @@ int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct t
        bundle *bundle_data;
        int result;
 
-       if (app_control == NULL || date == NULL)
-       {
+       if (app_control == NULL || date == NULL) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
 
-       if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE)
-       {
+       if (app_control_to_bundle(app_control, &bundle_data) != APP_CONTROL_ERROR_NONE) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
@@ -358,27 +408,22 @@ int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct t
 
        result = alarmmgr_set_time(alarm_info,internal_time);
 
-       if (result < 0)
-       {
+       if (result < 0) {
                alarmmgr_free_alarm(alarm_info);
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
        if (week_flag > 0)
-       {
                result = alarmmgr_set_repeat_mode(alarm_info, ALARM_REPEAT_MODE_WEEKLY, week_flag);
-       }
 
-       if (result < 0)
-       {
+       if (result < 0) {
                alarmmgr_free_alarm(alarm_info);
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
        result = alarmmgr_set_type(alarm_info, ALARM_TYPE_DEFAULT);
 
-       if (result < 0)
-       {
+       if (result < 0) {
                alarmmgr_free_alarm(alarm_info);
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
@@ -396,8 +441,7 @@ int alarm_get_scheduled_recurrence_week_flag(int alarm_id, int *week_flag)
        alarm_repeat_mode_t mode;
        int value;
 
-       if(week_flag == NULL)
-       {
+       if(week_flag == NULL) {
                LOGE("INVALID_PARAMETER(0x%08x)", ALARM_ERROR_INVALID_PARAMETER);
                return ALARM_ERROR_INVALID_PARAMETER;
        }
@@ -405,42 +449,30 @@ int alarm_get_scheduled_recurrence_week_flag(int alarm_id, int *week_flag)
        entry = alarmmgr_create_alarm();
 
        result = alarmmgr_get_info(alarm_id, entry);
-       if(result != ALARMMGR_RESULT_SUCCESS)
-       {
+       if(result != ALARMMGR_RESULT_SUCCESS) {
                if (entry != NULL)
-               {
                        alarmmgr_free_alarm(entry);
-               }
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
        result = alarmmgr_get_repeat_mode(entry, &mode, &value);
 
-       if(mode != ALARM_REPEAT_MODE_WEEKLY)
-       {
+       if(mode != ALARM_REPEAT_MODE_WEEKLY) {
                if (entry != NULL)
-               {
                        alarmmgr_free_alarm(entry);
-               }
                return ALARM_ERROR_INVALID_PARAMETER;
        }
 
-       if(result != ALARMMGR_RESULT_SUCCESS)
-       {
+       if(result != ALARMMGR_RESULT_SUCCESS) {
                if (entry != NULL)
-               {
                        alarmmgr_free_alarm(entry);
-               }
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
        result = alarmmgr_free_alarm(entry);
-       if(result != ALARMMGR_RESULT_SUCCESS)
-       {
+       if(result != ALARMMGR_RESULT_SUCCESS) {
                if (entry != NULL)
-               {
                        alarmmgr_free_alarm(entry);
-               }
                return convert_error_code_to_alarm(__FUNCTION__, result);
        }
 
@@ -451,31 +483,29 @@ int alarm_get_scheduled_recurrence_week_flag(int alarm_id, int *week_flag)
 
 int alarm_get_app_control(int alarm_id, app_control_h *app_control)
 {
-    bundle *b = NULL;
-    int error_code = 0;
+       bundle *b = NULL;
+       int error_code = 0;
+
+       if (app_control == NULL)
+               return ALARM_ERROR_INVALID_PARAMETER;
 
-    b = alarmmgr_get_alarm_appsvc_info(alarm_id, &error_code);
+       b = alarmmgr_get_alarm_appsvc_info(alarm_id, &error_code);
 
-    if(error_code != ALARMMGR_RESULT_SUCCESS)
-    {
-        return convert_error_code_to_alarm(__FUNCTION__, error_code);
-    }
+       if(error_code != ALARMMGR_RESULT_SUCCESS)
+               return convert_error_code_to_alarm(__FUNCTION__, error_code);
 
-    if(b == NULL)
-    {
-        return ALARM_ERROR_INVALID_PARAMETER;
-    }
+       if(b == NULL)
+               return ALARM_ERROR_INVALID_PARAMETER;
 
-    error_code = app_control_create_request(b, app_control);
+       error_code = app_control_create_request(b, app_control);
 
-    if(error_code != APP_CONTROL_ERROR_NONE)
-    {
-       bundle_free(b);
-        return ALARM_ERROR_OUT_OF_MEMORY;
-    }
+       if(error_code != APP_CONTROL_ERROR_NONE) {
+               bundle_free(b);
+               return ALARM_ERROR_OUT_OF_MEMORY;
+       }
 
-    bundle_free(b);
+       bundle_free(b);
 
-    return ALARM_ERROR_NONE;
+       return ALARM_ERROR_NONE;
 }
 
index 25cc14d..b68010c 100644 (file)
@@ -9,7 +9,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(requires "dlog aul ail capi-base-common")
+SET(requires "dlog aul capi-base-common")
 SET(pc_requires "capi-base-common")
 
 INCLUDE(FindPkgConfig)
index 0cf5de0..fc9a96a 100644 (file)
@@ -153,3 +153,18 @@ int app_event_get_device_orientation(app_event_info_h event_info, app_device_ori
        return APP_ERROR_NONE;
 }
 
+int app_event_get_suspended_state(app_event_info_h event_info, app_suspended_state_e *state)
+{
+       if (event_info == NULL || state == NULL)
+               return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
+
+       if (event_info->type != APP_EVENT_SUSPENDED_STATE_CHANGED)
+               return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "event type mismatching");
+
+       if (*(enum appcore_suspended_state *)(event_info->value) == APPCORE_SUSPENDED_STATE_WILL_ENTER_SUSPEND)
+               *state = APP_SUSPENDED_STATE_WILL_ENTER;
+       else if (*(enum appcore_suspended_state *)(event_info->value) == APPCORE_SUSPENDED_STATE_DID_EXIT_FROM_SUSPEND)
+               *state = APP_SUSPENDED_STATE_DID_EXIT;
+
+       return APP_ERROR_NONE;
+}
index e4e7b32..fdfbc77 100755 (executable)
@@ -20,7 +20,8 @@
 #include <string.h>
 
 #include <aul.h>
-#include <ail.h>
+#include <pkgmgr-info.h>
+#include <dlog.h>
 
 #include <app_internal.h>
 
@@ -35,26 +36,20 @@ int app_get_package_app_name(const char *appid, char **name)
        char *name_token = NULL;
 
        if (appid == NULL)
-       {
                return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
        // com.vendor.name -> name
        name_token = strrchr(appid, '.');
 
        if (name_token == NULL)
-       {
                return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-       }
 
        name_token++;
 
        *name = strdup(name_token);
 
        if (*name == NULL)
-       {
                return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-       }
 
        return APP_ERROR_NONE;
 }
@@ -70,111 +65,112 @@ int app_get_id(char **id)
        int ret = -1;
 
        if (id == NULL)
-       {
                return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
-       if (id_buf[0] == '\0')
-       {
+       if (id_buf[0] == '\0') {
                ret = aul_app_get_appid_bypid(getpid(), id_buf, sizeof(id_buf));
-               if (ret < 0) {
+               if (ret < 0)
                        return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the application ID");
-               }
        }
 
        if (id_buf[0] == '\0')
-       {
                return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the application ID");
-       }
 
        *id = strdup(id_buf);
 
        if (*id == NULL)
-       {
                return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-       }
 
        return APP_ERROR_NONE;
 }
 
-static int app_get_appinfo(const char *package, const char *property, char **value)
+int app_get_name(char **name)
 {
-       ail_appinfo_h appinfo;
-       char *appinfo_value;
-       char *appinfo_value_dup;
+       int retval = 0;
+       char *appid = NULL;
+       char *label = NULL;
+       pkgmgrinfo_appinfo_h appinfo = NULL;
 
-       if (ail_get_appinfo(package, &appinfo) != 0)
-       {
-               return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get app-info");
-       }
+       if(name == NULL)
+               return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+       if (app_get_id(&appid) != 0)
+               return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
 
-       if (ail_appinfo_get_str(appinfo, property, &appinfo_value) != 0)
-       {
-               ail_destroy_appinfo(appinfo);
-               return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get app-property");
+       retval = pkgmgrinfo_appinfo_get_appinfo(appid, &appinfo);
+       if (retval != 0) {
+               free(appid);
+               return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
        }
 
-       appinfo_value_dup = strdup(appinfo_value);
+       retval = pkgmgrinfo_appinfo_get_label(appinfo, &label);
+       if (retval != 0) {
+               free(appid);
+               pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
+               return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+       }
 
-       ail_destroy_appinfo(appinfo);
+       *name = strdup(label);
+       pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
+       free(appid);
 
-       if (appinfo_value_dup == NULL)
-       {
+       if (*name == NULL)
                return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
-       }
-
-       *value = appinfo_value_dup;
 
        return APP_ERROR_NONE;
 }
 
-int app_get_name(char **name)
+int app_get_version(char **version)
 {
-       char *package = NULL;
-       int retval;
+       int retval = 0;
+       char *appid = NULL;
+       char *pkgid = NULL;
+       char *pkg_version = NULL;
+       pkgmgrinfo_pkginfo_h pkginfo = NULL;
+       pkgmgrinfo_appinfo_h appinfo = NULL;
 
-       if(name == NULL)
-       {
+       if(version == NULL)
                return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-       }
 
-       if (app_get_id(&package) != 0)
-       {
+       if (app_get_id(&appid) != 0)
                return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
-       }
 
-       retval = app_get_appinfo(package, AIL_PROP_NAME_STR, name);
-
-       if (package != NULL)
-       {
-               free(package);
+       retval = pkgmgrinfo_appinfo_get_appinfo(appid, &appinfo);
+       if (retval != 0) {
+               free(appid);
+               return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
        }
 
-       return retval;
-}
-
-int app_get_version(char **version)
-{
-       char *package;
-       int retval;
+       retval = pkgmgrinfo_appinfo_get_pkgid(appinfo, &pkgid);
+       if (retval != 0) {
+               free(appid);
+               pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
+               return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+       }
 
-       if(version == NULL)
-       {
+       retval = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &pkginfo);
+       if (retval != 0) {
+               free(appid);
+               pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
                return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
        }
 
-       if (app_get_id(&package) != 0)
-       {
-               return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
+       retval = pkgmgrinfo_pkginfo_get_version(pkginfo, &pkg_version);
+       if (retval != 0) {
+               free(appid);
+               pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
+               pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
+               return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
        }
 
-       retval = app_get_appinfo(package, AIL_PROP_VERSION_STR, version);
+       *version = strdup(pkg_version);
+       pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
+       pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
+       free(appid);
 
-       if (package != NULL)
-       {
-               free(package);
-       }
+       if (*version == NULL)
+               return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
 
-       return retval;
+       return APP_ERROR_NONE;
 }
 
index e534130..f24a598 100755 (executable)
@@ -70,3 +70,10 @@ char *app_get_external_shared_data_path(void)
        const char *buf = aul_get_app_external_shared_data_path();
        return buf != NULL ? strdup(buf) : NULL;
 }
+
+char *app_get_tep_resource_path(void)
+{
+       const char *buf = aul_get_app_tep_resource_path();
+       return buf != NULL ? strdup(buf) : NULL;
+}
+
index 6350997..f8f75cd 100644 (file)
@@ -9,7 +9,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(requires "dlog bundle aul appsvc capi-base-common capi-security-privilege-manager pkgmgr-info")
+SET(requires "dlog bundle aul appsvc capi-base-common security-privilege-checker pkgmgr-info eventsystem")
 SET(pc_requires "capi-base-common")
 
 INCLUDE(FindPkgConfig)
index 0ac2825..ea3371f 100755 (executable)
  */
 
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-#include <errno.h>
 
 #include <bundle.h>
+#include <bundle_internal.h>
 #include <aul.h>
+#include <aul_svc.h>
 #include <appsvc.h>
 #include <dlog.h>
 
@@ -29,6 +31,7 @@
 #include <pkgmgr-info.h>
 
 #include <privilege_checker.h>
+#include <eventsystem.h>
 
 #ifdef LOG_TAG
 #undef LOG_TAG
 #define BUNDLE_KEY_PACKAGE     "__APP_SVC_PKG_NAME__"
 #define BUNDLE_KEY_WINDOW      "__APP_SVC_K_WIN_ID__"
 #define BUNDLE_KEY_CATEGORY    "__APP_SVC_CATEGORY__"
+#define BUNDLE_KEY_EVENTNAME   "__APP_SVC_EVENTNAME_TYPE__"
+#define BUNDLE_KEY_EVENTDATA   "__APP_SVC_EVENTDATA_TYPE__"
+
+#define LAUNCH_MODE_SIZE 8
+#define LAUNCH_MODE_SINGLE "single"
+#define LAUNCH_MODE_GROUP "group"
 
 typedef enum {
        APP_CONTROL_TYPE_REQUEST,
@@ -72,7 +81,7 @@ typedef struct app_control_request_context_s {
 
 extern int appsvc_allow_transient_app(bundle *b, unsigned int id);
 extern int appsvc_request_transient_app(bundle *b, unsigned int callee_id, appsvc_host_res_fn cbfunc, void *data);
-
+extern int aul_invoke_caller_cb(int launch_pid);
 static int app_control_create_reply(bundle *data, struct app_control_s **app_control);
 
 static const char* app_control_error_to_string(app_control_error_e error)
@@ -112,6 +121,9 @@ static const char* app_control_error_to_string(app_control_error_e error)
        case APP_CONTROL_ERROR_TIMED_OUT:
                return "TIMED_OUT";
 
+       case APP_CONTROL_ERROR_IO_ERROR:
+               return "IO ERROR";
+
        default :
                return "UNKNOWN";
        }
@@ -352,7 +364,8 @@ int app_control_destroy(app_control_h app_control)
                return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
        }
 
-       if(app_control->type == APP_CONTROL_TYPE_REQUEST && app_control->launch_pid > 0)
+       if(app_control->type == APP_CONTROL_TYPE_REQUEST && app_control->launch_pid > 0 &&
+               bundle_get_val(app_control->data, AUL_SVC_K_LAUNCH_RESULT_APP_STARTED) == NULL)
        {
                aul_remove_caller_cb(app_control->launch_pid);
        }
@@ -692,7 +705,62 @@ int app_control_clone(app_control_h *clone, app_control_h app_control)
        return APP_CONTROL_ERROR_NONE;
 }
 
-static void update_launch_pid(int launched_pid, void *data)
+int app_control_set_launch_mode(app_control_h app_control,
+               app_control_launch_mode_e mode)
+{
+       char launch_mode[LAUNCH_MODE_SIZE] = { 0, };
+
+       if (app_control_validate(app_control)) {
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
+                               __FUNCTION__, NULL);
+       }
+
+       switch (mode) {
+       case APP_CONTROL_LAUNCH_MODE_SINGLE:
+               strncpy(launch_mode, LAUNCH_MODE_SINGLE, strlen(LAUNCH_MODE_SINGLE));
+               break;
+       case APP_CONTROL_LAUNCH_MODE_GROUP:
+               strncpy(launch_mode, LAUNCH_MODE_GROUP, strlen(LAUNCH_MODE_GROUP));
+               break;
+       default:
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
+                               __FUNCTION__, "invalid mode");
+       }
+
+       return appsvc_set_launch_mode(app_control->data, launch_mode);
+}
+
+int app_control_get_launch_mode(app_control_h app_control,
+               app_control_launch_mode_e *mode)
+{
+       const char *launch_mode;
+
+       if (app_control_validate(app_control)) {
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
+                               __FUNCTION__, NULL);
+       }
+
+       launch_mode = appsvc_get_launch_mode(app_control->data);
+       if (launch_mode == NULL) {
+               *mode = APP_CONTROL_LAUNCH_MODE_SINGLE;
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
+                               __FUNCTION__, "fail to get launch_mode");
+       } else {
+               if (!strcmp(launch_mode, LAUNCH_MODE_SINGLE)) {
+                       *mode = APP_CONTROL_LAUNCH_MODE_SINGLE;
+               } else if (!strcmp(launch_mode, LAUNCH_MODE_GROUP)) {
+                       *mode = APP_CONTROL_LAUNCH_MODE_GROUP;
+               } else {
+                       *mode = APP_CONTROL_LAUNCH_MODE_SINGLE;
+                       return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER,
+                                       __FUNCTION__, "launch_mode is not matched");
+               }
+       }
+
+       return APP_CONTROL_ERROR_NONE;
+}
+
+static void __update_launch_pid(int launched_pid, void *data)
 {
        app_control_h app_control;
 
@@ -704,6 +772,53 @@ static void update_launch_pid(int launched_pid, void *data)
        app_control->launch_pid = launched_pid;
 }
 
+static void __handle_launch_result(int launched_pid, void *data)
+{
+       app_control_request_context_h request_context;
+       app_control_h reply = NULL;
+       app_control_h request;
+       app_control_result_e result;
+       app_control_reply_cb reply_cb;
+       void *user_data;
+       char callee[255] = {0, };
+       int ret = 0;
+
+       if (data == NULL)
+               return;
+
+       request_context = (app_control_request_context_h)data;
+
+       if (app_control_create_event(request_context->app_control->data, &reply) != 0)
+       {
+               app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create app_control event");
+               return;
+       }
+
+       ret = aul_app_get_appid_bypid(launched_pid, callee, sizeof(callee));
+       if (ret < 0) {
+               LOGE("aul_app_get_appid_bypid failed: %d", launched_pid);
+       }
+
+       app_control_set_app_id(reply, callee);
+       LOGI("app control async result callback callee pid:%d", launched_pid);
+
+       result = APP_CONTROL_RESULT_APP_STARTED;
+       request = request_context->app_control;
+       user_data = request_context->user_data;
+       reply_cb = request_context->reply_cb;
+
+       if (reply_cb != NULL)
+       {
+               reply_cb(request, reply, result, user_data);
+       }
+       else
+       {
+               app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid callback ");
+       }
+
+       app_control_destroy(reply);
+}
+
 int app_control_send_launch_request(app_control_h app_control, app_control_reply_cb callback, void *user_data)
 {
        const char *operation;
@@ -725,38 +840,21 @@ int app_control_send_launch_request(app_control_h app_control, app_control_reply
                operation = APP_CONTROL_OPERATION_DEFAULT;
        }
 
+       if (!strcmp(operation, APP_CONTROL_OPERATION_LAUNCH_ON_EVENT))
+       {
+               return app_control_error(APP_CONTROL_ERROR_LAUNCH_REJECTED, __FUNCTION__,
+                       "Not supported operation value");
+       }
+
        // Check the privilege for call operation
        if (!strcmp(operation, APP_CONTROL_OPERATION_CALL))
        {
                int ret;
-               char app_id[256];
-               char *pkg_id;
-               pkgmgrinfo_appinfo_h app_info;
 
-               ret = aul_app_get_appid_bypid(getpid(), app_id, sizeof(app_id));
-               if (ret != AUL_R_OK)
+               ret = privilege_checker_check_privilege("http://tizen.org/privilege/call");
+               if (ret != PRIVILEGE_CHECKER_ERR_NONE)
                {
-                       return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to get the app_id of the current application");
-               }
-
-               ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &app_info);
-               if (ret != PMINFO_R_OK)
-               {
-                       return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to get app_info of the current application");
-               }
-
-               ret = pkgmgrinfo_appinfo_get_pkgname(app_info, &pkg_id);
-               if (ret != PMINFO_R_OK)
-               {
-                       pkgmgrinfo_appinfo_destroy_appinfo(app_info);
-                       return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to get pkg_id of the current application");
-               }
-
-               ret = privilege_checker_check_package_privilege(pkg_id, "http://tizen.org/privilege/call");
-               pkgmgrinfo_appinfo_destroy_appinfo(app_info);
-               if (ret != PRIV_CHECKER_ERR_NONE)
-               {
-                       if (ret == PRIV_CHECKER_ERR_INVALID_PRIVILEGE)
+                       if (ret == PRIVILEGE_CHECKER_ERR_UNDECLARED_PRIVILEGE)
                        {
                                return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, "no privilege for Call operation");
                        }
@@ -833,8 +931,24 @@ int app_control_send_launch_request(app_control_h app_control, app_control_reply
        }
 
        app_control->launch_pid = launch_pid;
+       // app_control_enable_app_started_result_event called
+       if (bundle_get_val(app_control->data, AUL_SVC_K_LAUNCH_RESULT_APP_STARTED)) {
+               char callee[255] = {0,};
+               if (aul_app_get_appid_bypid(launch_pid, callee, sizeof(callee)) != AUL_R_OK)
+                       LOGE("aul_app_get_appid_bypid failed: %d", launch_pid);
+
+               if (request_context && request_context->app_control)
+                       request_context->app_control->launch_pid = launch_pid;
+
+               aul_add_caller_cb(launch_pid, __handle_launch_result, request_context);
 
-       aul_add_caller_cb(launch_pid,  update_launch_pid, app_control);
+               // launched without app selector
+               if (strncmp(callee, APP_SELECTOR, strlen(APP_SELECTOR)) != 0)
+                       aul_invoke_caller_cb(launch_pid);
+
+       } else { // default case
+               aul_add_caller_cb(launch_pid, __update_launch_pid, app_control);
+       }
 
        return APP_CONTROL_ERROR_NONE;
 }
@@ -904,6 +1018,11 @@ int app_control_reply_to_launch_request(app_control_h reply, app_control_h reque
                return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
        }
 
+       if (result == APP_CONTROL_RESULT_APP_STARTED)
+       {
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "APP_CONTROL_RESULT_APP_STARTED is not allowed to use");
+       }
+
        if (appsvc_create_result_bundle(request->data, &reply_data) != 0)
        {
                return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a result bundle");
@@ -931,6 +1050,8 @@ int app_control_reply_to_launch_request(app_control_h reply, app_control_h reque
        }
 
        ret = appsvc_send_result(reply_data, appsvc_result);
+       bundle_free(reply_data);
+
        if (ret < 0)
        {
                if (ret == APPSVC_RET_EINVAL)
@@ -1046,7 +1167,7 @@ int app_control_get_extra_data(app_control_h app_control, const char *key, char
 
        if (data_value == NULL)
        {
-               if (errno == ENOTSUP)
+               if (get_last_result() == BUNDLE_ERROR_INVALID_PARAMETER)
                {
                        return app_control_error(APP_CONTROL_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
                }
@@ -1088,7 +1209,7 @@ int app_control_get_extra_data_array(app_control_h app_control, const char *key,
 
        if (array_data == NULL)
        {
-               if (errno == ENOTSUP)
+               if (get_last_result() == BUNDLE_ERROR_INVALID_PARAMETER)
                {
                        return app_control_error(APP_CONTROL_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
                }
@@ -1375,7 +1496,6 @@ int app_control_export_as_bundle(app_control_h app_control, bundle **data)
        return APP_CONTROL_ERROR_NONE;
 }
 
-
 int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data)
 {
        int ret;
@@ -1395,3 +1515,21 @@ int app_control_request_transient_app(app_control_h app_control, unsigned int ca
        return APP_CONTROL_ERROR_NONE;
 }
 
+int app_control_enable_app_started_result_event(app_control_h app_control)
+{
+       int ret;
+
+       if (app_control_validate(app_control))
+       {
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+       }
+
+       ret = aul_svc_subscribe_launch_result(app_control->data, AUL_SVC_K_LAUNCH_RESULT_APP_STARTED);
+
+       if (ret < 0)
+       {
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+       }
+
+       return APP_CONTROL_ERROR_NONE;
+}
index 8ef2681..3504336 100755 (executable)
@@ -33,7 +33,7 @@
  * block your main UI thread.  Use of alarms helps build smooth user experiences and implements unattended data synchronization tasks.
  * If an application is installed after setting the alarm, your alarm is cancelled automatically.\n
  * When the alarm is expired, Alarm Manager will turn on LCD to prohibit background jobs.
- * Please make sure background jobs using alarm APIs are not allowed.
+ * If you want to use alarm API without turning on LCD, you can use alarm_schedule_after_delay().
  *
  * There are 3 ways to set an alarm.
  * <table>
  *     <td>alarm_schedule_once_at_date()</td>
  *     <td>Sets an alarm to be triggered after specific delay once</td>
  * </tr>
 * <tr>
+ * <tr>
  *     <td>alarm_schedule_with_recurrence_week_flag()</td>
  *     <td>Sets an alarm to be triggered at specific time with recurrent days of the week(can repeat on days of the week)</td>
  * </tr>
+ * <tr>
+ *     <td>alarm_schedule_after_delay()</td>
+ *     <td>Sets an alarm to be triggered after specific time(Since 2.4, this api does not support exact period and delay for minimizing the wakeups of the device. The system can adjust when the alarm expires.)</td>
+ * </tr>
  * </table>
  * \n
  *
index 1187ac8..150dda0 100755 (executable)
@@ -27,7 +27,8 @@
  *   \#include <app_control.h>
  *
  * @section CAPI_APP_CONTROLMODULE_OVERVIEW Overview
- * <a href="../org.tizen.mobile.native.appprogramming/html/guide/app/platform_appcontrol.htm">Platform Application Controls</a>
+ * <a href="https://developer.tizen.org/development/guides/native-application/application-framework/application#platform_appcontrol">Platform Application Controls</a>
+ *
  */
 
 #endif /* __TIZEN_APPFW_APP_CONTROL_DOC_H__ */
index c65eadb..6da6fac 100755 (executable)
 *  Region change means a different time zone; the application UI may need to update the time to reflect the time zone change.
 * </td>
 * </tr>
+* <tr>
+*  <td> APP_EVENT_SUSPENDED_STATE_CHANGED </td>
+*  <td> The suspended state is changed.
+*   The application will enter to the suspended state, or exited from the state. Do the necessary action before or after the suspended; the application shall not respond to requests of the other modules.
+*  </td>
+* </tr>
 * </table>
 *
 * @subsection CAPI_APPLICATION_MODULE_STATES_TRANSITIONS The Application States and Transitions
 *   your application temporarily
 * - An alarm went off for another application so it now becomes the top-most window and hides your application
 *
+* Since Tizen 2.4, the application on the background goes in to a suspended state. In the suspended state, the application process is executed with limited CPU resources. In other words, the platform does
+* not allow the running of the background applications.
+*
 *  When your application becomes visible again, the app_resume_cb() callback is invoked. Some possible scenarios for your application to become visible are:
 * - Another application requests your application to run (perhaps the Task Navigator which shows all running applications and lets
 *   the user select any app to run)
diff --git a/doc/appfw_event_doc.h b/doc/appfw_event_doc.h
new file mode 100755 (executable)
index 0000000..54bf3ba
--- /dev/null
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __TIZEN_APPFW_EVENT_DOC_H__
+#define __TIZEN_APPFW_EVENT_DOC_H__
+
+ /**
+ * @ingroup CAPI_APPLICATION_MODULE
+ * @defgroup CAPI_EVENT_MODULE Event
+ * @brief The @ref CAPI_EVENT_MODULE API provides functions to serve publication and subscription of event.
+ *
+ * @section CAPI_EVENT_MODULE_HEADER Required Header
+ *   \#include <app_event.h>
+ *
+ * @section CAPI_EVENT_MODULE_OVERVIEW Overview
+ *
+ * The @ref CAPI_EVENT_MODULE API provides functions to broadcast user-defined event.
+ *     - event_publish_app_event()
+ *     - event_publish_trusted_app_event()
+ * If you want to send an event to trusted application, you can use event_publish_trusted_app_event() API. Only applications which have same signature with sender application can receive the event.
+ *
+ * The @ref CAPI_EVENT_MODULE API provides functions to add and remove the event handler for event subscription.
+ * The event handler's function will be called when the interested event occurs.
+ * Adding multiple event handlers to one event is possible.
+ *
+ * There are two types event.
+ *     - User-Event is user-defined event.
+ *     - System-Event is pre-defined platform event. See definitions for system event. NOTE: You can't receive the system-event which is not supported on the target device, even if you register event handler for that event. Some system-events require the privilege. (Refer to @ref CAPI_EVENT_MODULE_PRIVILEGED_SYSTEM_EVENT)
+ *
+ * The type of event data is bundle type.
+ *     - For System-Event, see definitions for key and value of system event.
+ *
+ * @subsection CAPI_EVENT_MODULE_EVENT_FORMAT The name-format of User-Event.
+ * The format of User-Event's name MUST be "event.{sender's appid}.{user-defined name}", unless the API calls using event_name will be failed.
+ * The {user-defined name} have some restrictions.
+ *     - Must have length of Min 1 byte and Max 127 bytes.
+ *     - Must only contain the characters("[A~Z][a~z][0~9]_") and not begin with a digit.
+ * For example,
+ *     "event.org.tizen.testapp.user_event_1".
+ *
+ * @subsection CAPI_EVENT_MODULE_LAUNCH_ON_EVENT Launch-On-Event (Service Application only)
+ * Service application can be launched by event triggering.
+ * For Launch-On-Event,
+ *     - The APP_CONTROL_OPERATION_LAUNCH_ON_EVENT must be defined in the manifest file.
+ *     - The uri name represents event name and the format is "event://{event name"}".
+ *         For uri example,
+ *             "event://tizen.system.event.battery_charger_status". (System-Event)
+ *     - The APP_CONTROL_OPERATION_LAUNCH_ON_EVENT can not be requested via app_control_send_launch_request().
+ *
+ * How to know the triggered event after launch by event triggering.
+ *     - You can get the event name and data in the first called app_control_cb which is called after 'Created' of application states.
+ * @code
+ * static void
+ * app_control(app_control_h app_control, void *data)
+ * {
+ *     //check "launch on event"
+ *     int ret = 0;
+ *     const char *event_uri = "event://tizen.system.event.battery_charger_status";
+ *     char *operation = NULL;
+ *     char *uri = NULL;
+ *     char *event_value = NULL;
+ *
+ *     ret = app_control_get_operation(app_control, &operation);
+ *     if (ret == APP_CONTROL_ERROR_NONE && operation &&
+ *             strcmp(operation, APP_CONTROL_OPERATION_LAUNCH_ON_EVENT) == 0) {
+ *         ret = app_control_get_uri(app_control, &uri);
+ *         if (ret == APP_CONTROL_ERROR_NONE && uri) {
+ *             if (strncmp(uri, event_uri, strlen(event_uri) + 1) == 0) {
+ *                 ret = app_control_get_extra_data(app_control, "battery_charger_status", &event_value);
+ *                 if (ret == APP_CONTROL_ERROR_NONE && event_value) {
+ *                     free(event_value);
+ *                 }
+ *             }
+ *             free(uri);
+ *         }
+ *         free(operation);
+ *     }
+ * }
+ * @endcode
+ *     - Use event_add_event_handler() API in the first called app_control_cb for further subscription of that event.
+ *
+ * NOTE : Only several of System-Events support Launch-On-Event.
+ * The System-Events and their Conditions which support Launch-On-Event are listed in the table below.
+ * <table>
+ * <tr>
+ * <th>Name</th>
+ * <th>Condition</th>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_BATTERY_CHARGER_STATUS</td>
+ * <td>When Charger CONNECTED</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_USB_STATUS</td>
+ * <td>When Usb CONNECTED</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_EARJACK_STATUS</td>
+ * <td>When Earjack CONNECTED</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_INCOMMING_MSG</td>
+ * <td>When MSG_TYPE & MSG_ID exist</td>
+ * </tr>
+ * </table>
+ *
+ * @subsection CAPI_EVENT_MODULE_PRIVILEGED_SYSTEM_EVENT Privileged System-Events.
+ * There are some system-events which need the privilege for normal operation.
+ * You can know these privileged system-events from the 'privilege' comment of the definition of each system-event.
+ * If you try to add event handler for these events without privilege, you will get EVENT_ERROR_PERMISSION_DENIED return when you use the API for adding event handler.
+ * Also, If you declare app_control operation and uri in the manifest file for these events to enable 'Launch On Event' without privilege, there will be no real launch.
+ *
+ * @subsection CAPI_EVENT_MODULE_SYSTEM_EVENT Supported System-Events.
+ * The supported system-event's name, keys and values of each event are listed in the table below.
+ * <table>
+ * <tr>
+ * <th>Name</th>
+ * <th>Key</th>
+ * <th>Value</th>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_BATTERY_CHARGER_STATUS</td>
+ * <td>EVENT_KEY_BATTERY_CHARGER_STATUS</td>
+ * <td>EVENT_VAL_BATTERY_CHARGER_DISCONNECTED<br/>EVENT_VAL_BATTERY_CHARGER_CONNECTED<br/>EVENT_VAL_BATTERY_CHARGER_CHARGING<br/>EVENT_VAL_BATTERY_CHARGER_DISCHARGING</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_BATTERY_LEVEL_STATUS</td>
+ * <td>EVENT_KEY_BATTERY_LEVEL_STATUS</td>
+ * <td>EVENT_VAL_BATTERY_LEVEL_EMPTY<br/>EVENT_VAL_BATTERY_LEVEL_CRITICAL<br/>EVENT_VAL_BATTERY_LEVEL_LOW<br/>EVENT_VAL_BATTERY_LEVEL_HIGH<br/>EVENT_VAL_BATTERY_LEVEL_FULL</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_USB_STATUS</td>
+ * <td>EVENT_KEY_USB_STATUS</td>
+ * <td>EVENT_VAL_USB_DISCONNECTED<br/>EVENT_VAL_USB_CONNECTED<br/>EVENT_VAL_USB_AVAILABLE</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_EARJACK_STATUS</td>
+ * <td>EVENT_KEY_EARJACK_STATUS</td>
+ * <td>EVENT_VAL_EARJACK_DISCONNECTED<br/>EVENT_VAL_EARJACK_CONNECTED</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_DISPLAY_STATE</td>
+ * <td>EVENT_KEY_DISPLAY_STATE</td>
+ * <td>EVENT_VAL_DISPLAY_NORMAL<br/>EVENT_VAL_DISPLAY_DIM<br/>EVENT_VAL_DISPLAY_OFF</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_BOOT_COMPLETED</td>
+ * <td>N/A</td>
+ * <td>N/A</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_SYSTEM_SHUTDOWN</td>
+ * <td>N/A</td>
+ * <td>N/A</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_LOW_MEMORY</td>
+ * <td>EVENT_KEY_LOW_MEMORY</td>
+ * <td>EVENT_VAL_MEMORY_NORMAL<br/>EVENT_VAL_MEMORY_SOFT_WARNING<br/>EVENT_VAL_MEMORY_HARD_WARNING</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_WIFI_STATE</td>
+ * <td>EVENT_KEY_WIFI_STATE</td>
+ * <td>EVENT_VAL_WIFI_OFF<br/>EVENT_VAL_WIFI_ON<br/>EVENT_VAL_WIFI_CONNECTED</td>
+ * </tr>
+ * <tr>
+ * <td rowspan="3">SYSTEM_EVENT_BT_STATE</td>
+ * <td>EVENT_KEY_BT_STATE</td>
+ * <td>EVENT_VAL_BT_OFF<br/>EVENT_VAL_BT_ON</td>
+ * </tr>
+ * <tr>
+ * <td>EVENT_KEY_BT_LE_STATE</td>
+ * <td>EVENT_VAL_BT_LE_OFF<br/>EVENT_VAL_BT_LE_ON</td>
+ * </tr>
+ * <tr>
+ * <td>EVENT_KEY_BT_TRANSFERING_STATE</td>
+ * <td>EVENT_VAL_BT_NON_TRANSFERING<br/>EVENT_VAL_BT_TRANSFERING</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_LOCATION_ENABLE_STATE</td>
+ * <td>EVENT_KEY_LOCATION_ENABLE_STATE</td>
+ * <td>EVENT_VAL_LOCATION_DISABLED<br/>EVENT_VAL_LOCATION_ENABLED</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_GPS_ENABLE_STATE</td>
+ * <td>EVENT_KEY_GPS_ENABLE_STATE</td>
+ * <td>EVENT_VAL_GPS_DISABLED<br/>EVENT_VAL_GPS_ENABLED</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_NPS_ENABLE_STATE</td>
+ * <td>EVENT_KEY_NPS_ENABLE_STATE</td>
+ * <td>EVENT_VAL_NPS_DISABLED<br/>EVENT_VAL_NPS_ENABLED</td>
+ * </tr>
+ * <tr>
+ * <td rowspan="2">SYSTEM_EVENT_INCOMMING_MSG</td>
+ * <td>EVENT_KEY_MSG_TYPE</td>
+ * <td>EVENT_VAL_SMS<br/>EVENT_VAL_PUSH<br/>EVENT_VAL_CB</td>
+ * </tr>
+ * <tr>
+ * <td>EVENT_KEY_MSG_ID</td>
+ * <td>string of unsigned int type value.</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_TIME_CHANGED</td>
+ * <td>N/A</td>
+ * <td>N/A</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_TIME_ZONE</td>
+ * <td>EVENT_KEY_TIME_ZONE</td>
+ * <td>The value of this key is timezone value of tz database, for example,<br/> "Asia/Seoul", "America/New_York",<br/>refer to the Time Zone Database of IANA.</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_HOUR_FORMAT</td>
+ * <td>EVENT_KEY_HOUR_FORMAT</td>
+ * <td>EVENT_VAL_HOURFORMAT_12<br/>EVENT_VAL_HOURFORMAT_24</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_LANGUAGE_SET</td>
+ * <td>EVENT_KEY_LANGUAGE_SET</td>
+ * <td>The value of this key is full name of locale, for example,<br/> "ko_KR.UTF8" : in case of Korean language<br/> "en_US.UTF8" : in case of USA language,<br/>refer to linux locale info.</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_REGION_FORMAT</td>
+ * <td>EVENT_KEY_REGION_FORMAT</td>
+ * <td>The value of this key is full name of locale, for example,<br/> "ko_KR.UTF8" : in case of Korean region format<br/> "en_US.UTF8" : in case of USA region format,<br/>refer to linux locale info.</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_SILENT_MODE</td>
+ * <td>EVENT_KEY_SILENT_MODE</td>
+ * <td>EVENT_VAL_SILENTMODE_ON<br/>EVENT_VAL_SILENTMODE_OFF</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_VIBRATION_STATE</td>
+ * <td>EVENT_KEY_VIBRATION_STATE</td>
+ * <td>EVENT_VAL_VIBRATION_ON<br/>EVENT_VAL_VIBRATION_OFF</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_SCREEN_AUTOROTATE_STATE</td>
+ * <td>EVENT_KEY_SCREEN_AUTOROTATE_STATE</td>
+ * <td>EVENT_VAL_SCREEN_AUTOROTATE_ON<br/>EVENT_VAL_SCREEN_AUTOROTATE_OFF</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_MOBILE_DATA_STATE</td>
+ * <td>EVENT_KEY_MOBILE_DATA_STATE</td>
+ * <td>EVENT_VAL_MOBILE_DATA_OFF<br/>EVENT_VAL_MOBILE_DATA_ON</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_DATA_ROAMING_STATE</td>
+ * <td>EVENT_KEY_DATA_ROAMING_STATE</td>
+ * <td>EVENT_VAL_DATA_ROAMING_OFF<br/>EVENT_VAL_DATA_ROAMING_ON</td>
+ * </tr>
+ * <tr>
+ * <td>SYSTEM_EVENT_FONT_SET</td>
+ * <td>EVENT_KEY_FONT_SET</td>
+ * <td>The value of this key is font name of string type by font-config.</td>
+ * </tr>
+ * </table>
+ *
+ */
+
+#endif /* __TIZEN_APPFW_EVENT_DOC_H__ */
diff --git a/doc/appfw_resource_manager_doc.h b/doc/appfw_resource_manager_doc.h
new file mode 100755 (executable)
index 0000000..8f45226
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_APPFW_APP_RESOURCE_MANAGER_DOC_H__
+#define __TIZEN_APPFW_APP_RESOURCE_MANAGER_DOC_H__
+
+/**
+ * @ingroup CAPI_APPLICATION_MODULE
+ * @defgroup CAPI_RESOURCE_MANAGER_MODULE Resource Manager
+ * @brief The @ref CAPI_RESOURCE_MANAGER_MODULE API provides functions to get/set the common resource for multiple devices.
+ *
+ * @section CAPI_RESOURCE_MANAGER_MODULE_HEADER Required Header
+ * \#include <app_resource_manager.h>
+ *
+ * @section CAPI_RESOURCE_MANAGER_MODULE_OVERVIEW Overview
+ *
+ * The @ref CAPI_RESOURCE_MANAGER_MODULE API provides functions to use different resources(images, layout, sounds) between each devices have different device specification.
+ * For example, if you want to change button image of application depends on device's current language setting, put resource files into different folders which are managed by SDK as the same filename.
+ * Then call app_resource_manager_get() with resource ID described below to get appropriate resource filepath then OS will choose resources for specific device.
+ * You should get the path of the resource file that is managed by the resource manager with app_resource_manager_get() API. Tizen may remove unnecessary resource files for a certain device, so you may fail to access if you access the resource file with the path that is not gotten with app_resource_manager_get() API.
+ * Make sure app_resource_manager_init() should be called first and app_resource_manager_release should be called after using resource manager.
+ *
+ * @section CAPI_RESOURCE_MANAGER_MODULE_RESOURCE_ID Resource ID
+ *
+ * Resource ID is an identifier for specific resource. It consists of sub directories and filename including its extension.
+ * Same resources are located at different location with same filename for supporting multi devices.
+ * If you want to get actual filename with given resourceID, refer app_resource_manager_get().
+ *
+ * @section CAPI_RESOURCE_MANAGER_MODULE_RESOURCE_TYPE Resource Type
+ *
+ * For now, 4 resource types are supported.
+ *
+ * Resource which has same resource type are grouped as folder.
+ * Folder name is irrelevant with its actual resource type.
+ * The managed folders for each type will be generated by SDK tools.
+ * In source codes, you can use resource types listed below.
+ * (Types will be added for further needs)
+ *
+ * <table>
+ * <tr>
+ * <th>TYPE</th>
+ * <th>Description</th>
+ * </tr>
+ * <tr>
+ * <td>RSC_TYPE_IMAGE</td>
+ * <td>Image resources.</td>
+ * </tr>
+ * <tr>
+ * <td>RSC_TYPE_LAYOUT</td>
+ * <td>Application's layout to be displayed.</td>
+ * </tr>
+ * <tr>
+ * <td>RSC_TYPE_SOUND</td>
+ * <td>Sound, audio resources.</td>
+ * </tr>
+ * <tr>
+ * <td>RSC_TYPE_BIN</td>
+ * <td>All other resources to be needed but not specified above.</td>
+ * </tr>
+ * </table>
+ *
+ * @subsection CAPI_RESOURCE_MANAGER_MODULE_MATCHING_ALGORITHM Matching Algorithm
+ *
+ * @image html capi_appfw_application_resource.png "Matching Algorithm"
+ *
+ */
+
+#endif /* __TIZEN_APPFW_APP_RESOURCE_MANAGER_DOC_H__ */
diff --git a/doc/images/capi_appfw_application_resource.png b/doc/images/capi_appfw_application_resource.png
new file mode 100755 (executable)
index 0000000..db6129b
Binary files /dev/null and b/doc/images/capi_appfw_application_resource.png differ
diff --git a/event/CMakeLists.txt b/event/CMakeLists.txt
new file mode 100644 (file)
index 0000000..28991da
--- /dev/null
@@ -0,0 +1,65 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-appfw-event")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+SET(requires "glib-2.0 dlog bundle eventsystem capi-base-common")
+SET(pc_requires "capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${requires})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+    ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+add_library(${fw_name} SHARED
+               event.c
+               )
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+     PROPERTIES
+     VERSION ${FULLVER}
+     SOVERSION ${MAJORVER}
+     CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(
+        DIRECTORY ${INC_DIR}/ DESTINATION include/appfw
+        FILES_MATCHING
+        PATTERN "*_private.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
+        )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_requires})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+    ${CMAKE_SOURCE_DIR}/capi-appfw-module.pc.in
+    ${CMAKE_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+
diff --git a/event/event.c b/event/event.c
new file mode 100644 (file)
index 0000000..8ce5fe4
--- /dev/null
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+#include <glib.h>
+#include <tizen.h>
+#include <dlog.h>
+#include <app_event.h>
+#include <eventsystem.h>
+#include <app_internal.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_APPFW_EVENT"
+
+typedef struct event_handler {
+       char *event_name;
+       int event_type;
+       unsigned int reg_id;
+       event_cb cb;
+       void *user_data;
+} event_handler_s;
+
+typedef struct event_cb_data {
+       bundle *event_data;
+       void *user_data;
+} event_cb_data_s;
+
+static GHashTable *interested_event_table;
+static int _initialized;
+static event_cb earlier_callback;
+static pthread_mutex_t register_sync_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static const char *event_error_to_string(event_error_e error)
+{
+       switch (error) {
+       case EVENT_ERROR_NONE:
+               return "NONE";
+
+       case EVENT_ERROR_INVALID_PARAMETER:
+               return "INVALID_PARAMETER";
+
+       case EVENT_ERROR_OUT_OF_MEMORY:
+               return "OUT_OF_MEMORY";
+
+       case EVENT_ERROR_TIMED_OUT:
+               return "TIMED_OUT";
+
+       case EVENT_ERROR_IO_ERROR:
+               return "IO ERROR";
+
+       case EVENT_ERROR_PERMISSION_DENIED:
+               return "PERMISSION DENIED";
+
+       default:
+               return "UNKNOWN";
+       }
+}
+
+int event_error(event_error_e error, const char *function, const char *description)
+{
+       if (description) {
+               LOGE("[%s] %s(0x%08x) : %s", function, event_error_to_string(error),
+                       error, description);
+       } else {
+               LOGE("[%s] %s(0x%08x)", function, event_error_to_string(error), error);
+       }
+
+       return error;
+}
+
+static void event_do_cb(gpointer data, gpointer user_data)
+{
+       event_handler_h handler = (event_handler_h)data;
+       event_cb_data_s *cb_data = (event_cb_data_s *)user_data;
+
+       if (handler->cb) {
+               handler->cb(handler->event_name,
+                       cb_data->event_data, cb_data->user_data);
+       }
+}
+
+static void event_eventsystem_callback(const char *event_name,
+       bundle_raw *event_data, int len, void *user_data)
+{
+       bundle *b_to = NULL;
+       bundle *b = NULL;
+
+       LOGD("event_name(%s)", event_name);
+
+       if (earlier_callback != NULL) {
+               b_to = bundle_decode(event_data, len);
+               if (b_to == NULL) {
+                       LOGE("bundle_decode failed");
+                       return;
+               }
+               earlier_callback(event_name, b_to, user_data);
+               bundle_free(b_to);
+               return;
+       }
+
+       GList *handler_list = (GList *)g_hash_table_lookup(interested_event_table,
+               event_name);
+       if (handler_list) {
+               event_cb_data_s *cb_data = NULL;
+               cb_data = calloc(1, sizeof(event_cb_data_s));
+               if (cb_data == NULL) {
+                       LOGE("memory alloc failed");
+                       return;
+               }
+               b_to = bundle_decode(event_data, len);
+               if (b_to == NULL) {
+                       LOGE("bundle_decode failed");
+                       free(cb_data);
+                       return;
+               }
+               b = bundle_dup(b_to);
+               bundle_free(b_to);
+
+               cb_data->event_data = b;
+               cb_data->user_data = user_data;
+
+               g_list_foreach(handler_list, event_do_cb, cb_data);
+
+               bundle_free(b);
+       }
+}
+
+int event_add_event_handler(const char *event_name, event_cb callback, void *user_data,
+       event_handler_h *event_handler)
+{
+       int ret = 0;
+       int event_type = 0;
+       unsigned int reg_id = 0;
+       event_handler_h handler = NULL;
+
+       if (!_initialized) {
+               if (interested_event_table == NULL) {
+                       interested_event_table = g_hash_table_new(g_str_hash, g_str_equal);
+                       if (interested_event_table == NULL) {
+                               return event_error(EVENT_ERROR_OUT_OF_MEMORY,
+                                       __FUNCTION__, NULL);
+                       }
+               }
+               _initialized = 1;
+       }
+
+       if (event_handler == NULL || event_name == NULL || callback == NULL) {
+               return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+       }
+
+       handler = calloc(1, sizeof(event_handler_s));
+       if (handler == NULL) {
+               return event_error(EVENT_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+       }
+
+       pthread_mutex_lock(&register_sync_lock);
+       earlier_callback = callback;
+       ret = eventsystem_register_application_event(event_name, &reg_id, &event_type,
+               (eventsystem_cb)event_eventsystem_callback, user_data);
+       earlier_callback = NULL;
+       pthread_mutex_unlock(&register_sync_lock);
+       if (ret < 0) {
+               free(handler);
+               if (ret == ES_R_ENOTPERMITTED) {
+                       return event_error(EVENT_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
+               } else {
+                       return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
+               }
+       }
+
+       handler->event_name = strdup(event_name);
+       if (handler->event_name == NULL) {
+               free(handler);
+               return event_error(EVENT_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+       }
+
+       handler->reg_id = reg_id;
+       handler->event_type = event_type;
+       handler->cb = callback;
+       handler->user_data = user_data;
+
+       *event_handler = handler;
+
+       GList *handler_list = (GList *)g_hash_table_lookup(interested_event_table,
+               handler->event_name);
+       if (handler_list) {
+               LOGD("add new handler");
+               handler_list = g_list_append(handler_list, handler);
+       } else {
+               LOGD("add new table item");
+               GList *ehl = NULL;
+               ehl = g_list_append(ehl, handler);
+               g_hash_table_insert(interested_event_table, handler->event_name, ehl);
+       }
+
+       return EVENT_ERROR_NONE;
+}
+
+int event_remove_event_handler(event_handler_h event_handler)
+{
+       int ret = 0;
+
+       if (!_initialized) {
+               LOGI("handler list is not initialized");
+               return EVENT_ERROR_NONE;
+       }
+
+       if (event_handler == NULL) {
+               return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+       }
+
+       ret = eventsystem_unregister_application_event(event_handler->reg_id);
+       if (ret < 0) {
+               return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
+       }
+
+       GList *handler_list = (GList *)g_hash_table_lookup(interested_event_table,
+               event_handler->event_name);
+       if (handler_list) {
+               GList *list = NULL;
+               list = g_list_find(handler_list, event_handler);
+               if (list) {
+                       LOGD("remove match handler");
+                       handler_list = g_list_remove_all(handler_list, event_handler);
+                       GList *first_list = NULL;
+                       first_list = g_list_first(handler_list);
+                       if (first_list == NULL) {
+                               LOGD("remove table item");
+                               g_hash_table_remove(interested_event_table,
+                                       event_handler->event_name);
+                       }
+               }
+       }
+
+       free(event_handler->event_name);
+       free(event_handler);
+
+       return EVENT_ERROR_NONE;
+}
+
+int event_publish_app_event(const char *event_name, bundle *event_data)
+{
+       if (event_data == NULL || event_name == NULL) {
+               return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+       }
+
+       if (eventsystem_send_user_event(event_name, event_data, false) < 0) {
+               return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
+       }
+
+       return EVENT_ERROR_NONE;
+}
+
+int event_publish_trusted_app_event(const char *event_name, bundle *event_data)
+{
+       if (event_data == NULL || event_name == NULL) {
+               return event_error(EVENT_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+       }
+
+       if (eventsystem_send_user_event(event_name, event_data, true) < 0) {
+               return event_error(EVENT_ERROR_IO_ERROR, __FUNCTION__, NULL);
+       }
+
+       return EVENT_ERROR_NONE;
+}
index f1bb296..03ecc9f 100755 (executable)
@@ -117,105 +117,6 @@ typedef void (*app_terminate_cb) (void *user_data);
  */
 typedef void (*app_control_cb) (app_control_h app_control, void *user_data);
 
-
-/**
- * @internal
- * @brief Called when the system memory is running low.
- *
- * @details When a low memory event is dispatched, the application should immediately save state and release resources to save as much memory as possible. \n
- *          If enough memory is not reclaimed during low memory conditions, the system will terminate some of the applications to reclaim the memory.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] user_data        The user data passed from the callback registration function
- * @see        app_main()
- * @see #app_event_callback_s
- */
-typedef void (*app_low_memory_cb) (void *user_data);
-
-
-/**
- * @internal
- * @brief Called when the battery power is running low.
- * @details When the battery level falls below 5%, it is called.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] user_data        The user data passed from the callback registration function
- * @see        app_main()
- * @see #app_event_callback_s
- */
-typedef void (*app_low_battery_cb) (void *user_data);
-
-
-/**
- * @internal
- * @brief Called when the orientation of the device changes.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] orientation The orientation of the device
- * @param[in] user_data        The user data passed from the callback registration function
- * @see        app_main()
- * @see #app_event_callback_s
- */
-typedef void (*app_device_orientation_cb) (app_device_orientation_e orientation, void *user_data);
-
-
-/**
- * @internal
- * @brief Called when language setting changes.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] user_data The user data passed from the callback registration function
- * @see        app_main()
- * @see #app_event_callback_s
- */
-typedef void (*app_language_changed_cb) (void *user_data);
-
-
-/**
- * @internal
- * @brief Called when region format setting changes.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] user_data The user data passed from the callback registration function
- * @see        app_main()
- * @see #app_event_callback_s
- */
-typedef void (*app_region_format_changed_cb) (void *user_data);
-
-
-/**
- * @internal
- * @brief The structure type containing the set of callback functions for handling application events.
- * @details It is one of the input parameters of the app_main() function.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @see app_main()
- * @see app_create_cb()
- * @see app_pause_cb()
- * @see app_resume_cb()
- * @see app_terminate_cb()
- * @see app_control_cb()
- * @see app_low_memory_cb()
- * @see app_low_battery_cb()
- * @see app_device_orientation_cb()
- * @see app_language_changed_cb()
- * @see app_region_format_changed_cb()
- */
-typedef struct
-{
-       app_create_cb create; /**< This callback function is called at the start of the application. */
-       app_terminate_cb terminate; /**< This callback function is called once after the main loop of the application exits. */
-       app_pause_cb pause; /**< This callback function is called each time the application is completely obscured by another application and becomes invisible to the user. */
-       app_resume_cb resume; /**< This callback function is called each time the application becomes visible to the user. */
-       app_control_cb app_control; /**< This callback function is called when another application sends the launch request to the application. */
-       app_low_memory_cb low_memory; /**< The registered callback function is called when the system runs low on memory. */
-       app_low_battery_cb low_battery; /**< The registered callback function is called when the battery is low. */
-       app_device_orientation_cb device_orientation; /**< The registered callback function is called when the orientation of the device changes */
-       app_language_changed_cb language_changed; /**< The registered callback function is called when language setting changes. */
-       app_region_format_changed_cb region_format_changed; /**< The registered callback function is called when region format setting changes. */
-} app_event_callback_s;
-
-
 /**
  * @brief The structure type containing the set of callback functions for handling application lifecycle events.
  * @details It is one of the input parameters of the ui_app_main() function.
@@ -237,106 +138,6 @@ typedef struct
        app_control_cb app_control; /**< This callback function is called when another application sends the launch request to the application. */
 } ui_app_lifecycle_callback_s;
 
-
-/**
- * @internal
- * @brief Runs the application's main loop until app_exit() is called.
- *
- * @details This function is the main entry point of the Tizen application.
- *          The app_create_cb() callback function is called to initialize the application before the main loop of application starts up.
- *          After the app_create_cb() callback function returns true, the main loop starts up and the app_control_cb() callback function is subsequently called.
- *          If the app_create_cb() callback function returns false, the main loop doesn't start up and app_terminate_cb() callback function is called.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] argc The argument count
- * @param[in] argv The argument vector
- * @param[in] callback The set of callback functions to handle application events
- * @param[in] user_data The user data to be passed to the callback functions
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
- * @retval #APP_ERROR_ALREADY_RUNNING The main loop already starts
- *
- * @see app_create_cb()
- * @see app_terminate_cb()
- * @see app_pause_cb()
- * @see app_resume_cb()
- * @see app_control_cb()
- * @see app_low_memory_cb()
- * @see app_low_battery_cb()
- * @see app_device_orientation_cb()
- * @see app_language_changed_cb()
- * @see app_region_format_changed_cb()
- * @see app_exit()
- * @see #app_event_callback_s
- */
-int app_main(int argc, char **argv, app_event_callback_s *callback, void *user_data);
-
-
-/**
- * @internal
- * @brief Runs the application's main loop until app_efl_exit() is called.
- *
- * @details This function is the main entry point of the Tizen application.
- *          The app_create_cb() callback function is called to initialize the application before the main loop of the application starts up.
- *          After the app_create_cb() callback function returns @c true, the main loop starts up and the app_control_cb() callback function is subsequently called.
- *          If the app_create_cb() callback function returns @c false, the main loop doesn't start up and the app_terminate_cb() callback function is called.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] argc The argument count
- * @param[in] argv The argument vector
- * @param[in] callback The set of callback functions to handle application events
- * @param[in] user_data The user data to be passed to the callback functions
- *
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_ERROR_NONE Successful
- * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
- * @retval #APP_ERROR_ALREADY_RUNNING The main loop has already started
- *
- * @see app_create_cb()
- * @see app_terminate_cb()
- * @see app_pause_cb()
- * @see app_resume_cb()
- * @see app_control_cb()
- * @see app_low_memory_cb()
- * @see app_low_battery_cb()
- * @see app_device_orientation_cb()
- * @see app_language_changed_cb()
- * @see app_region_format_changed_cb()
- * @see app_efl_exit()
- * @see #app_event_callback_s
- */
-int app_efl_main(int *argc, char ***argv, app_event_callback_s *callback, void *user_data);
-
-
-/**
- * @internal
- * @brief Exits the main loop of application.
- *
- * @details The main loop of application stops and app_terminate_cb() is invoked.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @see app_main()
- * @see app_terminate_cb()
- */
-void app_exit(void);
-
-
-/**
- * @internal
- * @brief Exits the main loop of the application.
- *
- * @details The main loop of the application stops and app_terminate_cb() is invoked.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @see app_efl_main()
- * @see app_terminate_cb()
- */
-void app_efl_exit(void);
-
-
 /**
  * @brief Gets the current device orientation.
  *
@@ -347,59 +148,6 @@ app_device_orientation_e app_get_device_orientation(void);
 
 
 /**
- * @internal
- * @brief Sets whether reclaiming system cache is enabled in the pause state.
- *
- * @details If reclaiming system cache is enabled, the system caches are released as possible when the application's state changes to the pause state.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks Reclaiming system cache is enabled by default.
- *
- * @param[in] enable If @c true reclaiming system cache is enabled,
- *                   otherwise @c false
- */
-void app_set_reclaiming_system_cache_on_pause(bool enable);
-
-/**
- * @internal
- * @brief      Gets the preinitialized window object.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks    This API only supports BASIC type window.
- *
- * @param[in] win_name The name to be set for the preinitialized window
- *
- * @return     A @a window object on success,
- *          otherwise @c NULL
- */
-void* app_get_preinitialized_window(const char* win_name);
-
-/**
- * @internal
- * @brief      Gets the preinitialized background object added to the preinitialized window.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks    This API should be called after calling app_get_preinitizlized_window().
- *
- * @return     A @a background object on success,
- *          otherwise @c NULL
- */
-void* app_get_preinitialized_background(void);
-
-/**
- * @internal
- * @brief      Gets the preinitialized conformant widget added to the preinitialized window.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks    This API should be called after calling app_get_preinitizlized_window().
- *
- * @return     A conformant object on success,
- *          otherwise @c NULL
- */
-void* app_get_preinitialized_conformant(void);
-
-
-/**
  * @brief Runs the application's main loop until ui_app_exit() is called.
  *
  * @details This function is the main entry point of the Tizen application.
index ba2b4fb..2df8d46 100755 (executable)
@@ -52,6 +52,7 @@ typedef enum
        ALARM_ERROR_INVALID_TIME = TIZEN_ERROR_APPLICATION | 0x05,      /**< Invalid time */
        ALARM_ERROR_INVALID_DATE = TIZEN_ERROR_APPLICATION | 0x06,      /**< Invalid date */
        ALARM_ERROR_CONNECTION_FAIL = TIZEN_ERROR_APPLICATION | 0x07,   /**< The alarm service connection failed */
+       ALARM_ERROR_NOT_PERMITTED_APP = TIZEN_ERROR_APPLICATION | 0x08, /**< Application is not permitted. (Since 2.4) */
        ALARM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,  /**< Out of memory */
        ALARM_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED   /**< Permission denied */
 } alarm_error_e;
@@ -88,17 +89,21 @@ typedef bool (*alarm_registered_alarm_cb)(int alarm_id, void *user_data);
 /**
  * @brief Sets an alarm to be triggered after a specific time.
  * @details The alarm will first go off @a delay seconds later and then will go off every certain amount of time defined using @a period seconds.
- *          If @a period is bigger than @c 0, the alarm will be scheduled after the @a period time.
- *          If @a period is set to @c 0, the alarm will go off just once without repetition.
  *          To cancel the alarm, call alarm_cancel() with @a alarm_id.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @privlevel  public
  * @privilege  %http://tizen.org/privilege/alarm.set
  * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
+ *          If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
+ *          If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
+ *          Since 2.4, this api does not support exact period and delay for minimizing the wakeups of the device. The system can adjust when the alarm expires.
+ *          If you want to trigger an alarm exactly, see @see alarm_schedule_once_after_delay()
+ *          Since 2.4 If @a app_control is specified with service-application, the application is only allowed to run on which has Background Category.
+ *          Since 2.4 If the appid of @a app_control is not specified, this api is not allowed. In other words, the explicit @a app_control is only allowed.
  *
  * @param[in] app_control The destination app_control to perform a specific task when the alarm is triggered
- * @param[in] delay    The amount of time before the first execution (in seconds)
- * @param[in] period The amount of time between subsequent alarms (in seconds)
+ * @param[in] delay    The amount of time before the first execution (in seconds). Since 2.4, Although this is inexact, the alarm will not fire before this time
+ * @param[in] period The amount of time between subsequent alarms (in seconds). Since 2.4, This value does not guarantee the accuracy. The actual interval is calculated by the OS. The minimum value is 600sec
  * @param[out] alarm_id        The alarm ID that uniquely identifies an alarm
  * @return     @c 0 on success,
  *          otherwise a negative error value
@@ -107,15 +112,18 @@ typedef bool (*alarm_registered_alarm_cb)(int alarm_id, void *user_data);
  * @retval  #ALARM_ERROR_INVALID_TIME Triggered time is invalid
  * @retval  #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
  * @retval  #ALARM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval  #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted
  * @see alarm_cancel()
  * @see alarm_cancel_all()
  * @see alarm_get_scheduled_date()
  * @see alarm_get_scheduled_period()
+ * @see alarm_schedule_once_after_delay()
  */
 int alarm_schedule_after_delay(app_control_h app_control, int delay, int period, int *alarm_id);
 
 
 /**
+ * @deprecated Deprecated since 2.4. [Use alarm_schedule_once_at_date() instead]
  * @brief Sets an alarm to be triggered at a specific time.
  * @details The @a date describes the time of the first occurrence.
  *          If @a period is bigger than @c 0, the alarm will be scheduled after the @a period time.
@@ -147,6 +155,70 @@ int alarm_schedule_after_delay(app_control_h app_control, int delay, int period,
 int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int period, int *alarm_id);
 
 /**
+ * @brief Sets an alarm to be triggered after a specific time.
+ * @details The alarm will go off @a delay seconds later.
+ *          To cancel the alarm, call alarm_cancel() with @a alarm_id.
+ * @since_tizen 2.4
+ * @privlevel  public
+ * @privilege  %http://tizen.org/privilege/alarm.set
+ * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
+ *          If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
+ *          If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
+ *          If the appid of @a app_control is not specified, this api is not allowed. In other words, the explicit @a app_control is only allowed.
+ *          The @a app_control only supports UI application with this api. If @a app_control is not UI application, #ALARM_ERROR_NOT_PERMITTED_APP returned.
+ *          When the alarm is expired, Alarm Manager will turn on LCD to prohibit background jobs.
+ *
+ * @param[in] app_control The destination app_control to perform a specific task when the alarm is triggered
+ * @param[in] delay    The amount of time before the execution (in seconds)
+ * @param[out] alarm_id        The alarm ID that uniquely identifies an alarm
+ * @return     @c 0 on success,
+ *          otherwise a negative error value
+ * @retval  #ALARM_ERROR_NONE Successful
+ * @retval  #ALARM_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #ALARM_ERROR_INVALID_TIME Triggered time is invalid
+ * @retval  #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval  #ALARM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval  #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted. @a app_control for UI application is only permitted.
+ * @see alarm_cancel()
+ * @see alarm_cancel_all()
+ * @see alarm_get_scheduled_date()
+ */
+int alarm_schedule_once_after_delay(app_control_h app_control, int delay, int *alarm_id);
+
+
+/**
+ * @brief Sets an alarm to be triggered at a specific time.
+ * @details The @a date describes the time of the first occurrence.
+ *          To cancel the alarm, call alarm_cancel() with @a alarm_id.
+ * @since_tizen 2.4
+ * @privlevel  public
+ * @privilege  %http://tizen.org/privilege/alarm.set
+ * @remarks If application is uninstalled after setting an alarm, the alarm is cancelled automatically.
+ *          If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
+ *          If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
+ *          If the appid of @a app_control is not specified, this api is not allowed. In other words, the explicit @a app_control is only allowed.
+ *          The @a app_control only supports UI application with this api. If @a app_control is not UI application, #ALARM_ERROR_NOT_PERMITTED_APP returned.
+ *          When the alarm is expired, Alarm Manager will turn on LCD to prohibit background jobs.
+ *
+ * @param[in]  app_control The destination app_control to perform specific work when the alarm is triggered
+ * @param[in]  date    The first active alarm time
+ * @param[out] alarm_id        The alarm ID that uniquely identifies an alarm
+ * @return     @c 0 on success,
+ *          otherwise a negative error value
+ * @retval  #ALARM_ERROR_NONE   Successful
+ * @retval  #ALARM_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #ALARM_ERROR_INVALID_DATE Triggered date is invalid
+ * @retval  #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
+ * @retval  #ALARM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval  #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted. @a app_control for UI application is only permitted.
+ * @see alarm_cancel()
+ * @see alarm_cancel_all()
+ * @see alarm_get_scheduled_date()
+ */
+int alarm_schedule_once_at_date(app_control_h app_control, struct tm *date, int *alarm_id);
+
+
+/**
  * @brief Sets an alarm to be triggered periodically, starting at a specific time.
  * @details The @a date describes the time of the first occurrence.
  *              @a week_flag is the repeat value of the days of the week.
@@ -158,6 +230,9 @@ int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int perio
  * @remarks If the application is uninstalled after setting an alarm, the alarm is cancelled automatically.
  *          If the operation of @a app_control is not specified, #APP_CONTROL_OPERATION_DEFAULT is used for the launch request.
  *          If the operation of @a app_control is #APP_CONTROL_OPERATION_DEFAULT, the package information is mandatory to explicitly launch the application.
+ *          Since 2.4, The @a app_control only supports UI application with this api. If @a app_control is not UI application, #ALARM_ERROR_NOT_PERMITTED_APP returned.
+ *          When the alarm is expired, Alarm Manager will turn on LCD to prohibit background jobs.
+ *          Since 2.4, If the appid of @a app_control is not specified, this api is not allowed. In other words, the explicit @a app_control is only allowed.
  *
  * @param[in] app_control The destination app_control to perform specific work when the alarm is triggered
  * @param[in] date     The first active alarm time
@@ -169,7 +244,8 @@ int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int perio
  * @retval #ALARM_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #ALARM_ERROR_INVALID_DATE Triggered date is invalid
  * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
- * @retval  #ALARM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #ALARM_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #ALARM_ERROR_NOT_PERMITTED_APP @a app_control is not permitted. @a app_control for UI application is only permitted.
  * @see alarm_cancel()
  * @see alarm_cancel_all()
  * @see alarm_get_scheduled_recurrence_week_flag()
@@ -210,6 +286,7 @@ int alarm_get_scheduled_recurrence_week_flag(int alarm_id, int *week_flag);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #ALARM_ERROR_NONE Successful
+ * @retval #ALARM_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval #ALARM_ERROR_CONNECTION_FAIL Failed to connect to an alarm server
  * @retval  #ALARM_ERROR_PERMISSION_DENIED Permission denied
  * @see alarm_schedule_at_date()
@@ -282,7 +359,7 @@ int alarm_get_scheduled_date(int alarm_id, struct tm *date);
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @privlevel  public
  * @privilege  %http://tizen.org/privilege/alarm.get
- * @remarks If the given @a alarm_id is not obtained by using the alarm_get_scheduled_date() or alarm_schedule_after_delay() function,
+ * @remarks If the given @a alarm_id is not obtained by using the alarm_schedule_at_date() or alarm_schedule_after_delay() function,
  *          an error (error code #ALARM_ERROR_INVALID_PARAMETER) will occur.
  * @param[in] alarm_id The alarm ID returned when the alarm is scheduled
  * @param[out] period The period of time between recurrent alarms in seconds
index f025299..badc43f 100644 (file)
@@ -45,6 +45,8 @@ typedef enum
        APP_EVENT_LANGUAGE_CHANGED, /**< The system language changed event */
        APP_EVENT_DEVICE_ORIENTATION_CHANGED, /**< The device orientation changed event */
        APP_EVENT_REGION_FORMAT_CHANGED, /**< The region format changed event */
+       APP_EVENT_SUSPENDED_STATE_CHANGED, /**< The suspended state changed event of the application (since 2.4)
+                                               @see app_event_get_suspended_state */
 } app_event_type_e;
 
 
@@ -85,6 +87,16 @@ typedef enum
 
 
 /**
+ * @brief Enumeration for suspended state
+ * @since_tizen 2.4
+ */
+typedef enum
+{
+       APP_SUSPENDED_STATE_WILL_ENTER = 0, /**< Application will enter the suspended state */
+       APP_SUSPENDED_STATE_DID_EXIT, /**< Application did exit from the suspended state */
+} app_suspended_state_e;
+
+/**
  * @brief The event handler that returned from add event handler function
  *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
@@ -105,6 +117,7 @@ typedef struct app_event_handler* app_event_handler_h;
  * @see app_event_get_language
  * @see app_event_get_region_format
  * @see app_event_get_device_orientation
+ * @see app_event_get_suspended_state
  */
 typedef struct app_event_info* app_event_info_h;
 
@@ -118,6 +131,12 @@ typedef struct app_event_info* app_event_info_h;
  *
  * @see app_add_event_handler
  * @see app_event_info_h
+ *
+ * @remarks If the given @a event_info has #APP_SUSPENDED_STATE_WILL_ENTER value,
+ *     the application should not call any asynchronous operations in this callback.
+ *     After the callback returns, process of the application will be changed to suspended
+ *     state immediately. Thus, asynchronous operations may work incorrectly. (since 2.4)
+ *
  */
 typedef void (*app_event_cb)(app_event_info_h event_info, void *user_data);
 
@@ -213,6 +232,25 @@ int app_event_get_device_orientation(app_event_info_h event_info, app_device_ori
 
 
 /**
+ * @brief Gets the suspended state of the application from given event info.
+ *
+ * @since_tizen 2.4
+ * @param[in] event_info The handle for getting the suspended state
+ * @param[out] state The suspended state of the application
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT Invalid event context
+ *
+ * @remarks The application should not use any asynchronous operations in #APP_SUSPENDED_STATE_WILL_ENTER event.
+ *     Because applications will be changed to suspended state just after #APP_SUSPENDED_STATE_WILL_ENTER,
+ *     asynchronous calls are not guaranteed to work properly.
+ */
+int app_event_get_suspended_state(app_event_info_h event_info, app_suspended_state_e *state);
+
+
+/**
  * @brief Gets the ID of the application.
  *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
@@ -362,6 +400,8 @@ char *app_get_shared_trusted_path(void);
  * @remarks    The returned path should be released. @n
  *          The important files stored in the application's external data directory should be
  *          encrypted because they can be exported via the external sdcard.
+ * @remarks    To access the path returned by this function requires the privilege
+ *              that is "http://tizen.org/privilege/externalstorage.appdata".
  *
  * @return     The absolute path to the application's external data directory, @n
  *                     otherwise a null pointer if the memory is insufficient
@@ -375,11 +415,13 @@ char *app_get_external_data_path(void);
  * @details    An application can read and write its own files in the application's external cache
  *          directory.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The returned path should be released. @n
+ * @remarks    The returned path should be released. @n
  *          The files stored in the application's external cache directory can be removed by
  *          Setting application while the application is running. @n
  *          The important files stored in the application's external cache directory should be
  *          encrypted because they can be exported via the external sdcard.
+ * @remarks    To access the path returned by this function requires the privilege
+ *              that is "http://tizen.org/privilege/externalstorage.appdata".
  *
  * @return     The absolute path to the application's external cache directory, @n
  *          otherwise a null pointer if the memory is insufficient
@@ -388,12 +430,16 @@ char *app_get_external_cache_path(void);
 
 
 /**
+ * @deprecated Deprecated since 2.4.
  * @brief      Gets the absolute path to the application's external shared data directory which is
  *          used to share data with other applications.
  * @details    An application can read and write its own files in the application's external shared
  *          data directory and others can only read the files.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @remarks    The specified @a path should be released.
+ * @remarks    To access the path returned by this function requires the privilege
+ *              that is "http://tizen.org/privilege/externalstorage.appdata".
+ * @remarks    The function may not work as intended in certain devices due to some implementation issues.
  *
  * @return     The absolute path to the application's external shared data directory, @n
  *          otherwise a null pointer if the memory is insufficient
@@ -401,6 +447,18 @@ char *app_get_external_cache_path(void);
 char *app_get_external_shared_data_path(void);
 
 /**
+ * @brief       Gets the absolute path to the application's TEP(Tizen Expansion Package) directory.
+ *              The resource files are delivered with the expansion package.
+ * @details     An application can only read its own files in the application's TEP(Tizen Expansion Package) directory.
+ * @since_tizen 2.4
+ * @remarks     The returned path should be released.
+ *
+ * @return      The absolute path to the application's TEP(Tizen Expansion Package) directory, @n
+ *              otherwise a null pointer if the memory is insufficient
+ **/
+char *app_get_tep_resource_path(void);
+
+/**
  * @}
  */
 
index 83eddb7..fa14219 100755 (executable)
@@ -35,7 +35,7 @@ extern "C" {
 
 
 typedef struct _bundle_t bundle;
-
+typedef unsigned char bundle_raw;
 
 /**
  * @brief App Control handle.
@@ -60,66 +60,91 @@ typedef enum
        APP_CONTROL_ERROR_LAUNCH_REJECTED = TIZEN_ERROR_APPLICATION | 0x23, /**< The application cannot be launched now*/
        APP_CONTROL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,    /**< Permission denied */
        APP_CONTROL_ERROR_LAUNCH_FAILED = TIZEN_ERROR_APPLICATION | 0x24, /**< Internal launch error */
-       APP_CONTROL_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT /**< Time out */
+       APP_CONTROL_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
+       APP_CONTROL_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR       /**< IO error */
 } app_control_error_e;
 
 
 /**
  * @brief Enumeration for App Control Result.
+ * @see app_control_enable_app_started_result_event()
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 typedef enum
 {
+       APP_CONTROL_RESULT_APP_STARTED = 1, /**< Callee application launched actually (Since 2.4) */
        APP_CONTROL_RESULT_SUCCEEDED = 0, /**< Operation succeeded */
        APP_CONTROL_RESULT_FAILED = -1, /**< Operation failed by the callee */
-       APP_CONTROL_RESULT_CANCELED = -2, /**< Operation canceled by the framework */
+       APP_CONTROL_RESULT_CANCELED = -2, /**< Operation canceled by the platform */
 } app_control_result_e;
 
+/**
+ * @brief Enumeration for App Control Launch Mode.
+ * @since_tizen 2.4
+ */
+typedef enum {
+       APP_CONTROL_LAUNCH_MODE_SINGLE = 0, /**< Prefer to launch an application as single mode */
+       APP_CONTROL_LAUNCH_MODE_GROUP, /**< Prefer to launch an application as group mode */
+} app_control_launch_mode_e;
 
 /**
- * @brief Definition for the app_control operation: main operation for an explicit launch.
+ * @brief Definition for the app_control operation: An explicit launch for a homescreen application.
+ * @details Input: Nothing\n
+ *          Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_MAIN "http://tizen.org/appcontrol/operation/main"
 
 
 /**
- * @brief Definition for the app_control operation: default operation for an explicit launch.
+ * @brief Definition for the app_control operation: An explicit launch for an application that excludes a homescreen application.
+ * @details Input: Nothing\n
+ *          Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_DEFAULT "http://tizen.org/appcontrol/operation/default"
 
 
 /**
- * @brief Definition for the app_control operation: provides an explicit editable access to the given data.
+ * @brief Definition for the app_control operation: Provides an editable access to the given data.
+ * @details Input: It depends on application scenario/configuration.\n
+ *         Output: It depends on application scenario/configuration.\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_EDIT "http://tizen.org/appcontrol/operation/edit"
 
 
 /**
- * @brief Definition for the app_control operation: displays the data.
+ * @brief Definition for the app_control operation: Displays the data.
+ * @details Input: URI is usually used to inform the path to show. In some cases, some other data in Extra can be used (e.g., VIEW operation for viewing Contact, Calendar data).\n
+ *         Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_VIEW "http://tizen.org/appcontrol/operation/view"
 
 
 /**
- * @brief Definition for the app_control operation: picks an item from the data, returning what is selected.
+ * @brief Definition for the app_control operation: Picks items.
+ * @details Input: It depends on application scenario/configuration.\n
+ *         Output: APP_CONTROL_DATA_SELECTED in Extra\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_PICK "http://tizen.org/appcontrol/operation/pick"
 
 
 /**
- * @brief Definition for the app_control operation: creates content, returning what is created.
+ * @brief Definition for the app_control operation: Creates contents.
+ * @details Input: It depends on application scenario/configuration.\n
+ *         Output: APP_CONTROL_DATA_SELECTED in Extra\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_CREATE_CONTENT "http://tizen.org/appcontrol/operation/create_content"
 
 
 /**
- * @brief Definition for the app_control operation: performs a call to someone specified by the data.
+ * @brief Definition for the app_control operation: Performs a call to someone.
+ * @details Input: URI is the number to be dialed. This is mandatory field.\n
+ *          Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @privlevel public
  * @privilege %http://tizen.org/privilege/call
@@ -129,137 +154,316 @@ typedef enum
 
 
 /**
- * @brief Definition for the app_control operation: delivers some data to someone else.
+ * @brief Definition for the app_control operation: Delivers some data to someone else.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @deprecated Deprecated since 2.4. Use #APP_CONTROL_OPERATION_SHARE instead.
  */
 #define APP_CONTROL_OPERATION_SEND "http://tizen.org/appcontrol/operation/send"
 
 
 /**
- * @brief Definition for the app_control operation: delivers text data to someone else.
+ * @brief Definition for the app_control operation: Delivers text data to someone else.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @deprecated Deprecated since 2.4. Use #APP_CONTROL_OPERATION_SHARE_TEXT instead.
  */
 #define APP_CONTROL_OPERATION_SEND_TEXT "http://tizen.org/appcontrol/operation/send_text"
 
 
 /**
- * @brief Definition for the app_control operation: shares an item with someone else.
+ * @brief Definition for the app_control operation: Shares an item with someone else.
+ * @details Input: URI is usually used to inform the path to share. In some cases, some other data in Extra can be used (e.g., SHARE operation for sharing Contact data, SHARE operation for sharing an item through Message, Email applications).\n
+ *         Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_SHARE "http://tizen.org/appcontrol/operation/share"
 
 
 /**
- * @brief Definition for the app_control operation: shares multiple items with someone else.
+ * @brief Definition for the app_control operation: Shares multiple items with someone else.
+ * @details Input: APP_CONTROL_DATA_PATH in Extra is usually used to inform the data to share. In some cases, some other data in Extra can be used (e.g., MULTI_SHARE opeation for sharing Contact data).\n
+ *          Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_MULTI_SHARE "http://tizen.org/appcontrol/operation/multi_share"
 
 
 /**
- * @brief Definition for the app_control operation: shares text data with someone else.
+ * @brief Definition for the app_control operation: Shares text data with someone else.
+ * @details Input: APP_CONTROL_DATA_TEXT in Extra is the text to share\n
+ *          Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_SHARE_TEXT "http://tizen.org/appcontrol/operation/share_text"
 
 
 /**
- * @brief Definition for the app_control operation: dials a number as specified by the data.
+ * @brief Definition for the app_control operation: Dials a number. This shows a UI with the number to be dialed, allowing the user to explicitly initiate the call.
+ * @details Input: URI is the number to be dialed. If empty, show a UI without number.\n
+ *          Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_DIAL "http://tizen.org/appcontrol/operation/dial"
 
 
 /**
- * @brief Definition for the app_control operation: performs a search.
+ * @brief Definition for the app_control operation: Performs a search.
+ * @details Input: APP_CONTROL_DATA_TEXT in Extra is the text to search for. If empty, show a search UI.\n
+ *          Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_SEARCH "http://tizen.org/appcontrol/operation/search"
 
 
 /**
- * @brief Definition for the app_control operation: downloads an item.
+ * @brief Definition for the app_control operation: Downloads items.
+ * @details Input: It depends on application scenario/configuration.\n
+ *         Output: It depends on application scenario/configuration.\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/download (Since 2.4)
+ * @remarks When you request this operation, you must declare this privilege. (Since 2.4)
  */
 #define APP_CONTROL_OPERATION_DOWNLOAD "http://tizen.org/appcontrol/operation/download"
 
 
 /**
- * @brief Definition for the app_control operation: prints content.
+ * @brief Definition for the app_control operation: Prints contents.
+ * @details Input: It depends on application scenario/configuration.\n
+ *         Output: It depends on application scenario/configuration.\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_PRINT "http://tizen.org/appcontrol/operation/print"
 
 /**
- * @brief Definition for the app_control operation: composes.
+ * @brief Definition for the app_control operation: Composes a message.
+ * @details Input: It depends on application scenario/configuration.\n
+ *          Output: Nothing\n
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_OPERATION_COMPOSE "http://tizen.org/appcontrol/operation/compose"
 
 /**
- * @brief Definition for app_control optional data: the subject of a message.
+ * @brief Definition for the app_control operation: Can be launched by interested System-Event.
+ * @details Input : URI and extras data defined in Event module.\n
+ *          Output: Nothing\n
+ * @since_tizen 2.4
+ * @remarks This operation is for handling event from the platform. This operation can not be requested via app_control_send_launch_request().
+ * @remarks Refer to Launch-On-Event section of Event module.
+ */
+#define APP_CONTROL_OPERATION_LAUNCH_ON_EVENT "http://tizen.org/appcontrol/operation/launch_on_event"
+
+/**
+ * @brief Definition for the app_control operation: Adds an item.
+ * @details Input: It depends on application scenario/configuration.\n
+ *          Output: It depends on application scenario/configuration.\n
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_OPERATION_ADD "http://tizen.org/appcontrol/operation/add"
+
+/**
+ * @brief Definition for the app_control operation: Captures images by camera applications.
+ * @details Input: Nothing\n
+ *         Output: APP_CONTROL_DATA_SELECTED in Extra\n
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_OPERATION_IMAGE_CAPTURE "http://tizen.org/appcontrol/operation/image_capture"
+
+/**
+ * @brief Definition for the app_control operation: Captures videos by camera applications.
+ * @details Input: Nothing\n
+ *         Output: APP_CONTROL_DATA_SELECTED in Extra\n
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_OPERATION_VIDEO_CAPTURE "http://tizen.org/appcontrol/operation/video_capture"
+
+/**
+ * @brief Definition for the app_control operation: Shows settings to enable Bluetooth.
+ * @details Input: Nothing\n
+ *          Output: Nothing\n
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_OPERATION_SETTING_BT_ENABLE "http://tizen.org/appcontrol/operation/setting/bt_enable"
+
+/**
+ * @brief Definition for the app_control operation: Shows settings to configure Bluetooth visibility.
+ * @details Input: Nothing\n
+ *          Output: Nothing\n
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_OPERATION_SETTING_BT_VISIBILITY "http://tizen.org/appcontrol/operation/setting/bt_visibility"
+
+/**
+ * @brief Definition for the app_control operation: Shows settings to allow configuration of current location sources.
+ * @details Input: Nothing\n
+ *          Output: Nothing\n
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_OPERATION_SETTING_LOCATION "http://tizen.org/appcontrol/operation/setting/location"
+
+/**
+ * @brief Definition for the app_control operation: Shows NFC settings.
+ * @details Input: Nothing\n
+ *          Output: Nothing\n
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_OPERATION_SETTING_NFC "http://tizen.org/appcontrol/operation/setting/nfc"
+
+/**
+ * @brief Definition for the app_control operation: Shows system settings.
+ * @details Input: Nothing\n
+ *          Output: Nothing\n
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_OPERATION_SETTING "http://tizen.org/appcontrol/operation/setting"
+
+/**
+ * @brief Definition for the app_control operation: Shows settings to allow configuration of Wi-Fi.
+ * @details Input: Nothing\n
+ *          Output: Nothing\n
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_OPERATION_SETTING_WIFI "http://tizen.org/appcontrol/operation/setting/wifi"
+
+/**
+ * @brief Definition for app_control data: Subject
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_DATA_SUBJECT "http://tizen.org/appcontrol/data/subject"
 
 
 /**
- * @brief Definition for app_control optional data: e-mail addresses.
+ * @brief Definition for app_control data: Recipients
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_DATA_TO "http://tizen.org/appcontrol/data/to"
 
 
 /**
- * @brief Definition for app_control optional data: e-mail addresses that should be carbon copied.
+ * @brief Definition for app_control data: E-mail addresses that should be carbon copied
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_DATA_CC "http://tizen.org/appcontrol/data/cc"
 
 
 /**
- * @brief Definition for app_control optional data: e-mail addresses that should be blind carbon copied.
+ * @brief Definition for app_control data: E-mail addresses that should be blind carbon copied
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_DATA_BCC "http://tizen.org/appcontrol/data/bcc"
 
 
 /**
- * @brief Definition for app_control optional data: the content of the data is associated with #APP_CONTROL_OPERATION_SEND.
+ * @brief Definition for app_control data: Text
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_DATA_TEXT "http://tizen.org/appcontrol/data/text"
 
 
 /**
- * @brief Definition for app_control optional data: the title of the data.
+ * @brief Definition for app_control data: Title
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_DATA_TITLE "http://tizen.org/appcontrol/data/title"
 
 
 /**
- * @brief Definition for app_control optional data: the path of a selected item.
+ * @brief Definition for app_control data: Selected items
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_DATA_SELECTED "http://tizen.org/appcontrol/data/selected"
 
 
 /**
- * @brief Definition for app_control optional data: multiple item path to deliver.
+ * @brief Definition for app_control data: Paths of items
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks Since Tizen 2.4, if all added paths with this key are under the caller application's data path which can be obtained by calling app_get_data_path() function, those will be shared to the callee application. Framework will grant a temporary permission to the callee application for those files and revoke it when the callee application is terminated. Paths should be regular files. The callee application can just read them.
  */
 #define APP_CONTROL_DATA_PATH "http://tizen.org/appcontrol/data/path"
 
 
 /**
- * @brief Definition for app_control optional data: the selection type.
+ * @brief Definition for app_control data: Selection mode. ("single" or "multiple")
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 #define APP_CONTROL_DATA_SELECTION_MODE "http://tizen.org/appcontrol/data/selection_mode"
 
 
 /**
+ * @brief Definition for app_control data: All-day mode of event ("true" or "false")
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_CALENDAR_ALL_DAY "http://tizen.org/appcontrol/data/calendar/all_day"
+
+
+/**
+ * @brief Definition for app_control data: Start time of event (format: YYYY-MM-DD HH:MM:SS)
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_CALENDAR_START_TIME "http://tizen.org/appcontrol/data/calendar/start_time"
+
+
+/**
+ * @brief Definition for app_control data: End time of event (format: YYYY-MM-DD HH:MM:SS)
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_CALENDAR_END_TIME "http://tizen.org/appcontrol/data/calendar/end_time"
+
+
+/**
+ * @brief Definition for app_control data: E-mail addresses
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_EMAIL "http://tizen.org/appcontrol/data/email"
+
+
+/**
+ * @brief Definition for app_control data: Phone numbers
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_PHONE "http://tizen.org/appcontrol/data/phone"
+
+
+/**
+ * @brief Definition for app_control data: URLs
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_URL "http://tizen.org/appcontrol/data/url"
+
+
+/**
+ * @brief Definition for app_control data: IDs
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_ID "http://tizen.org/appcontrol/data/id"
+
+
+/**
+ * @brief Definition for app_control data: Type
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_TYPE "http://tizen.org/appcontrol/data/type"
+
+
+/**
+ * @brief Definition for app_control data: Total count
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_TOTAL_COUNT "http://tizen.org/appcontrol/data/total_count"
+
+
+/**
+ * @brief Definition for app_control data: Total size (unit : bytes)
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_TOTAL_SIZE "http://tizen.org/appcontrol/data/total_size"
+
+/**
+ * @brief Definition for app_control data: Name
+ * @since_tizen 2.4
+ */
+#define APP_CONTROL_DATA_NAME "http://tizen.org/appcontrol/data/name"
+
+/**
  * @brief Called when the reply of the launch request is delivered.
  *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
@@ -271,8 +475,12 @@ typedef enum
  * @param[in] result The result code of the launch request
  * @param[in] user_data        The user data passed from the callback registration function
  * @pre When the callee replies to the launch request, this callback will be invoked.
+ * @pre Since 2.4, if #APP_CONTROL_RESULT_APP_STARTED event is enabled,
+ *      this callback also will be invoked when the callee app actually launched.
  * @see app_control_send_launch_request()
  * @see app_control_reply_to_launch_request()
+ * @see app_control_enable_app_started_result_event()
+ * @see #APP_CONTROL_RESULT_APP_STARTED
  */
 typedef void (*app_control_reply_cb) (app_control_h request, app_control_h reply, app_control_result_e result, void *user_data);
 
@@ -344,20 +552,6 @@ int app_control_destroy(app_control_h app_control);
 
 
 /**
- * @internal
- * @brief Converts the app_control handle to bundle data.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[out] data The bundle data on success
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- */
-int app_control_to_bundle(app_control_h app_control, bundle **data);
-
-/**
  * @brief Sets the operation to be performed.
  *
  * @details The @a operation is the mandatory information for the launch request.
@@ -406,6 +600,7 @@ int app_control_get_operation(app_control_h app_control, char **operation);
  * @brief Sets the URI of the data.
  *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks Since Tizen 2.4, if the parameter 'uri' is started with 'file://' and it is a regular file in this application's data path which can be obtained by calling app_get_data_path() function, it will be shared to the callee application. Framework will grant a temporary permission to the callee application for this file and revoke it when the callee application is terminated. The callee application can just read it.
  * @param[in] app_control The app_control handle
  * @param[in] uri The URI of the data this app_control is operating on (if the @a uri is @c NULL, it clears the previous value)
  * @return @c 0 on success,
@@ -531,40 +726,6 @@ int app_control_set_app_id(app_control_h app_control, const char *app_id);
 int app_control_get_app_id(app_control_h app_control, char **app_id);
 
 /**
- * @internal
- * @brief Sets the window ID of the application.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_get_window()
- */
-int app_control_set_window(app_control_h app_control, unsigned int id);
-
-
-/**
- * @internal
- * @brief Gets the window ID of the application.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] app_control The app_control handle
- * @param[out] id The window ID of the caller application
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #APP_CONTROL_ERROR_NONE Successful
- * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- * @see app_control_set_app_id()
-*/
-int app_control_get_window(app_control_h app_control, unsigned int *id);
-
-
-/**
  * @brief Adds extra data to the app_control.
  *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
@@ -620,6 +781,7 @@ int app_control_add_extra_data_array(app_control_h app_control, const char *key,
  * @retval #APP_CONTROL_ERROR_NONE Successful
  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
+ * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
  * @see app_control_add_extra_data()
  * @see app_control_add_extra_data_array()
  * @see app_control_get_extra_data()
@@ -643,6 +805,7 @@ int app_control_remove_extra_data(app_control_h app_control, const char *key);
  * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
  * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
+ * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
  * @see app_control_add_extra_data()
  * @see app_control_add_extra_data_array()
  * @see app_control_get_extra_data()
@@ -669,6 +832,7 @@ int app_control_get_extra_data(app_control_h app_control, const char *key, char
  * @retval #APP_CONTROL_ERROR_KEY_NOT_FOUND Specified key not found
  * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #APP_CONTROL_ERROR_INVALID_DATA_TYPE Invalid data type
+ * @retval #APP_CONTROL_ERROR_KEY_REJECTED Key not available
  * @see app_control_add_extra_data()
  * @see app_control_add_extra_data_array()
  * @see app_control_remove_extra_data()
@@ -739,10 +903,11 @@ int app_control_foreach_app_matched(app_control_h app_control, app_control_app_m
  * @details The operation is mandatory information for the launch request. \n
  *          If the operation is not specified, #APP_CONTROL_OPERATION_DEFAULT is used by default.
  *          If the operation is #APP_CONTROL_OPERATION_DEFAULT, the application ID is mandatory to explicitly launch the application.
- * @remarks In some implementations of the Tizen platform, service applications are only allowed to be launched explicitly by the application in the same package; hence you should not use this function to launch the service application that is not in the your application package.
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @privlevel  public
  * @privilege  %http://tizen.org/privilege/appmanager.launch
+ * @remarks The function returns #APP_CONTROL_ERROR_LAUNCH_REJECTED if the operation value is #APP_CONTROL_OPERATION_LAUNCH_ON_EVENT which is only for handling the event from the platform or other application, refer to @a Event module.
+ * @remarks Since Tizen 2.4, the launch request of the service application over out of packages is restricted by the platform. Also, implicit launch requests are NOT delivered to service applications since 2.4. To launch a service application, an explicit launch request with application ID given by app_control_set_app_id() MUST be sent.
  * @param[in] app_control The app_control handle
  * @param[in] callback The callback function to be called when the reply is delivered
  * @param[in] user_data The user data to be passed to the callback function
@@ -756,9 +921,10 @@ int app_control_foreach_app_matched(app_control_h app_control, app_control_app_m
  * @retval #APP_CONTROL_ERROR_LAUNCH_FAILED Failed to launch the application
  * @retval #APP_CONTROL_ERROR_TIMED_OUT Failed due to timeout. The application that handles @a app_control may be busy
  * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
- * @post If the launch request is sent for the result, the result will come back through app_control_reply_cb() from the callee application.
+ * @post If the launch request is sent for the result, the result will come back through app_control_reply_cb() from the callee application. Additional replies may be delivered on app_control_enable_app_started_result_event() called.
  * @see app_control_reply_to_launch_request()
  * @see app_control_reply_cb()
+ * @see app_control_enable_app_started_result_event()
  */
 int app_control_send_launch_request(app_control_h app_control, app_control_reply_cb callback, void *user_data);
 
@@ -766,6 +932,9 @@ int app_control_send_launch_request(app_control_h app_control, app_control_reply
 /**
  * @brief Sends the terminate request to the application that is launched by app_control. This API is only effective for some applications that are provided by default for handling platform default app_controls. You are not allowed to terminate other general applications using this API.
  *
+ * @remarks Since Tizen 2.4, this API can be used to terminate sub-applications which were launched as group mode by caller application.
+ *          Once callee application is being terminated by this API, other applications which were launched by callee application as group mode will be terminated as well.
+ *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @param[in] app_control The app_control handle
  * @return @c 0 on success,
@@ -774,6 +943,7 @@ int app_control_send_launch_request(app_control_h app_control, app_control_reply
  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #APP_CONTROL_ERROR_PERMISSION_DENIED Permission denied
  * @see app_control_send_launch_request()
+ * @see app_control_set_launch_mode()
  */
 int app_control_send_terminate_request(app_control_h app_control);
 
@@ -783,6 +953,7 @@ int app_control_send_terminate_request(app_control_h app_control);
  * @details If the caller application sent the launch request to receive the result, the callee application can return the result back to the caller.
  *
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks The function is not allowed to send reply #APP_CONTROL_RESULT_APP_STARTED as @a result which is reserved for platform developers.
  * @param[in] reply The app_control handle in which the results of the callee are contained
  * @param[in] request The app_control handle sent by the caller
  * @param[in] result  The result code of the launch request
@@ -832,6 +1003,8 @@ int app_control_clone(app_control_h *clone, app_control_h app_control);
 int app_control_get_caller(app_control_h app_control, char **id);
 
 
+
+
 /**
  * @brief Checks whether the caller is requesting a reply from the launch request.
  *
@@ -850,23 +1023,58 @@ int app_control_get_caller(app_control_h app_control, char **id);
 int app_control_is_reply_requested(app_control_h app_control, bool *requested);
 
 /**
- * @internal
- * @brief Requests the specified callee window to be transient for the caller window.
+ * @brief Sets the launch mode of the application.
  *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
+ * @details This function allows callee application to be launched as group or single mode.
+ * @remarks Although launch_mode were set as #APP_CONTROL_LAUNCH_MODE_GROUP, callee application would be launched as single mode if the manifest file of callee application defined the launch mode as "single".
+ *          This function can just set the preference of caller application to launch an application.
+ * @remarks Sub-applications which were launched as group mode always have own process.
+ *
+ * @since_tizen 2.4
  * @param[in] app_control The app_control handle
- * @param[in] callee_id The callee window ID
- * @param[in] cbfunc The callback function to be called when the transient is requested
- * @param[in] data A data pointer to pass to the callback function
- * @return @c 0 on success,
- *         otherwise a negative error value.
+ * @param[in] launch_mode The launch mode of app
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_control_set_launch_mode()
+ * @see app_control_launch_mode_e
+ */
+int app_control_set_launch_mode(app_control_h app_control,
+               app_control_launch_mode_e mode);
+
+/**
+ * @brief Gets the launch mode of the application.
+ *
+ * @since_tizen 2.4
+ * @param[in] app_control The app_control handle
+ * @param[out] launch_mode The launch mode of app
+ *
+ * @return 0 on success, otherwise a negative error value
  * @retval #APP_CONTROL_ERROR_NONE Successful
  * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see        app_control_get_launch_mode()
+ * @see app_control_launch_mode_e
  */
-int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);
+int app_control_get_launch_mode(app_control_h app_control,
+               app_control_launch_mode_e *mode);
 
 /**
+ * @brief Enables additional launch result event on launch request.
+ *
+ * @details The function allows to receive #APP_CONTROL_RESULT_APP_STARTED event on\n
+ *         application get launched by app_control.
+ * @remarks app_control_reply_cb() will be called on APP_CONTROL_RESULT_APP_STARTED event received.
+ * @since_tizen 2.4
+ * @param[in] app_control The app_control handle
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_control_send_launch_request()
+ * @see #APP_CONTROL_RESULT_APP_STARTED
+ */
+int app_control_enable_app_started_result_event(app_control_h app_control);
+/**
  * @}
  */
 
index 3daa86b..89be11d 100644 (file)
 #ifndef __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
 #define __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__
 
-#include <bundle.h>
-
 #include <app_control.h>
 
+/**
+ * @brief Definition for app_control data: Connect the previous app with the next app when the sub-app is terminated.
+ * @details If a sub-app is terminated, framework will connect the previous app with the next app.
+ *          By default, this flag is 'false'
+ */
+#define APP_CONTROL_DATA_REROUTE "__K_REROUTE__"
+
+/**
+ * @brief Definition for app_control data: The flag for attaching app.
+ * @details If this flag is set, callee app will be attached to caller app for a while and it will be detached when callee app is lowered.
+ *          By default, this flag is 'false'
+ */
+#define APP_CONTROL_DATA_SHIFT_WINDOW "__K_SHIFT_WINDOW"
+
+/**
+ * @brief Definition for app_control data : The flag for supporting recycling processes.
+ * @details By default, this flag is 'false'. Once it is set to 'true', launched sub-app process will be reused even if it was lowered later.
+ *
+ */
+#define APP_CONTROL_DATA_RECYCLE "__K_RECYCLE"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -84,6 +103,54 @@ int app_control_create_request(bundle *data, app_control_h *app_control);
 
 int app_control_create_event(bundle *data, app_control_h *app_control);
 
+int app_control_to_bundle(app_control_h app_control, bundle **data);
+
+/**
+ * @brief Sets the window ID of the application.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] app_control The app_control handle
+ * @param[in] id The window ID of the caller application (if the @a id is not positive, it clears the previous value)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_get_window()
+ */
+int app_control_set_window(app_control_h app_control, unsigned int id);
+
+/**
+ * @brief Gets the window ID of the application.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] app_control The app_control handle
+ * @param[out] id The window ID of the caller application
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
+ * @see app_control_set_app_id()
+ */
+int app_control_get_window(app_control_h app_control, unsigned int *id);
+
+/**
+ * @brief Requests the specified callee window to be transient for the caller window.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks The @a callee_id window is transient for the top-level caller window and should be handled accordingly.
+ * @param[in] app_control The app_control handle
+ * @param[in] callee_id The callee window ID
+ * @param[in] cbfunc The callback function to be called when the transient is requested
+ * @param[in] data A data pointer to pass to the callback function
+ * @return @c 0 on success,
+ *         otherwise a negative error value.
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int app_control_request_transient_app(app_control_h app_control, unsigned int callee_id, app_control_host_res_fn cbfunc, void *data);
+
 /**
  * @}
  */
diff --git a/include/app_event.h b/include/app_event.h
new file mode 100644 (file)
index 0000000..706b506
--- /dev/null
@@ -0,0 +1,845 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __TIZEN_APPFW_EVENT_H__
+#define __TIZEN_APPFW_EVENT_H__
+
+#include <bundle.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file event.h
+ */
+
+/**
+ * @addtogroup CAPI_EVENT_MODULE
+ * @{
+ */
+
+
+/**
+ * @brief Event handle.
+ * @since_tizen 2.4
+ */
+typedef struct event_handler* event_handler_h;
+
+/**
+ * @brief Event callback.
+ *
+ * @since_tizen 2.4
+ * @param[in] event_name The interested event name
+ * @param[in] event_data The data of interested event
+ * @param[in] user_data The user data set by event_add_event_handler()
+ * @see event_add_event_handler
+ */
+typedef void (*event_cb)(const char *event_name, bundle *event_data, void *user_data);
+
+/**
+ * @brief Enumeration for Event Error.
+ * @since_tizen 2.4
+ */
+typedef enum
+{
+       EVENT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+       EVENT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+       EVENT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+       EVENT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Time out */
+       EVENT_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< IO error */
+       EVENT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED /**< Permisiion denied */
+} event_error_e;
+
+/**
+ * @brief Definition for system-event of battery : charger status.
+ * @since_tizen 2.4
+ * @remarks If there is earlier occurrence regarding this event, you will receive the event as soon as you register event handler for this event. You can use this earlier event-data as initial value.
+ * @see EVENT_KEY_BATTERY_CHARGER_STATUS
+ */
+#define SYSTEM_EVENT_BATTERY_CHARGER_STATUS "tizen.system.event.battery_charger_status"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_BATTERY_CHARGER_STATUS.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_BATTERY_CHARGER_DISCONNECTED
+ * @see EVENT_VAL_BATTERY_CHARGER_CONNECTED
+ * @see EVENT_VAL_BATTERY_CHARGER_CHARGING
+ * @see EVENT_VAL_BATTERY_CHARGER_DISCHARGING
+ */
+#define EVENT_KEY_BATTERY_CHARGER_STATUS "battery_charger_status"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
+ * @since_tizen 2.4
+ * @remarks charger disconnected
+ */
+#define EVENT_VAL_BATTERY_CHARGER_DISCONNECTED "disconnected"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
+ * @since_tizen 2.4
+ * @remarks charger connected
+ */
+#define EVENT_VAL_BATTERY_CHARGER_CONNECTED "connected"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
+ * @since_tizen 2.4
+ * @remarks charging is enabled
+ */
+#define EVENT_VAL_BATTERY_CHARGER_CHARGING "charging"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BATTERY_CHARGER_STATUS.
+ * @since_tizen 2.4
+ * @remarks charging is disabled
+ */
+#define EVENT_VAL_BATTERY_CHARGER_DISCHARGING "discharging"
+
+/**
+ * @brief Definition for system-event of battery : level status.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_BATTERY_LEVEL_STATUS
+ */
+#define SYSTEM_EVENT_BATTERY_LEVEL_STATUS "tizen.system.event.battery_level_status"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_BATTERY_LEVEL_STATUS.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_BATTERY_LEVEL_EMPTY
+ * @see EVENT_VAL_BATTERY_LEVEL_CRITICAL
+ * @see EVENT_VAL_BATTERY_LEVEL_LOW
+ * @see EVENT_VAL_BATTERY_LEVEL_HIGH
+ * @see EVENT_VAL_BATTERY_LEVEL_FULL
+ */
+#define EVENT_KEY_BATTERY_LEVEL_STATUS "battery_level_status"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BATTERY_LEVEL_EMPTY "empty"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BATTERY_LEVEL_CRITICAL "critical"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BATTERY_LEVEL_LOW "low"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BATTERY_LEVEL_HIGH "high"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BATTERY_LEVEL_STATUS.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BATTERY_LEVEL_FULL "full"
+
+/**
+ * @brief Definition for system-event of usb : status of usb connection.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_USB_STATUS
+ */
+#define SYSTEM_EVENT_USB_STATUS "tizen.system.event.usb_status"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_USB_STATUS.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_USB_DISCONNECTED
+ * @see EVENT_VAL_USB_CONNECTED
+ * @see EVENT_VAL_USB_AVAILABLE
+ */
+#define EVENT_KEY_USB_STATUS "usb_status"
+
+/**
+ * @brief Definition for value of EVENT_KEY_USB_STATUS.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_USB_DISCONNECTED "disconnected"
+
+/**
+ * @brief Definition for value of EVENT_KEY_USB_STATUS.
+ * @since_tizen 2.4
+ * @remarks Connected but not-available.
+ */
+#define EVENT_VAL_USB_CONNECTED "connected"
+
+/**
+ * @brief Definition for value of EVENT_KEY_USB_STATUS.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_USB_AVAILABLE "available"
+
+/**
+ * @brief Definition for system-event of ear-jack : status of ear-jack connection.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_EARJACK_STATUS
+ */
+#define SYSTEM_EVENT_EARJACK_STATUS "tizen.system.event.earjack_status"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_EARJACK_STATUS.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_EARJACK_DISCONNECTED
+ * @see EVENT_VAL_EARJACK_CONNECTED
+ */
+#define EVENT_KEY_EARJACK_STATUS "earjack_status"
+
+/**
+ * @brief Definition for value of EVENT_KEY_EARJACK_STATUS.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_EARJACK_DISCONNECTED "disconnected"
+
+/**
+ * @brief Definition for value of EVENT_KEY_EARJACK_STATUS.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_EARJACK_CONNECTED "connected"
+
+/**
+ * @brief Definition for system-event of display : state of display.
+ * @since_tizen 2.4
+ * @privilege %http://tizen.org/privilege/display
+ * @remarks If you want to receive this event, you must declare this privilege.
+ * @see EVENT_KEY_DISPLAY_STATE
+ */
+#define SYSTEM_EVENT_DISPLAY_STATE "tizen.system.event.display_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_DISPLAY_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_DISPLAY_NORMAL
+ * @see EVENT_VAL_DISPLAY_DIM
+ * @see EVENT_VAL_DISPLAY_OFF
+ */
+#define EVENT_KEY_DISPLAY_STATE "display_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_DISPLAY_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_DISPLAY_NORMAL "normal"
+
+/**
+ * @brief Definition for value of EVENT_KEY_DISPLAY_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_DISPLAY_DIM "dim"
+
+/**
+ * @brief Definition for value of EVENT_KEY_DISPLAY_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_DISPLAY_OFF "off"
+
+/**
+ * @brief Definition for system-event of system : boot completion.
+ * @since_tizen 2.4
+ * @remarks There is no corresponding key/value.
+ * @remarks You can treat the initial value as "false" before you receive this event.
+ * @remarks If it's already boot-completed state before you regiser event handler, you can receive the event as soon as you register the event handler.
+ */
+#define SYSTEM_EVENT_BOOT_COMPLETED "tizen.system.event.boot_completed"
+
+/**
+ * @brief Definition for system-event of system : shutdown.
+ * @since_tizen 2.4
+ * @remarks There is no corresponding key/value.
+ * @remarks You can treat the inital value as "false" before you receive this event.
+ * @remarks If it's already shutting-down state before you regiser event handler, you can receive the event as soon as you register the event handler.
+*/
+#define SYSTEM_EVENT_SYSTEM_SHUTDOWN "tizen.system.event.system_shutdown"
+
+/**
+ * @brief Definition for system-event of system : low memory.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_LOW_MEMORY
+ */
+#define SYSTEM_EVENT_LOW_MEMORY "tizen.system.event.low_memory"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_LOW_MEMORY.
+ * @since_tizen 2.4
+ * @remarks If there is earlier occurrence regarding this event, you will receive the event as soon as you register event handler for this event. You can use this earlier event-data as initial value.
+ * @see EVENT_VAL_MEMORY_NORMAL
+ * @see EVENT_VAL_MEMORY_SOFT_WARNING
+ * @see EVENT_VAL_MEMORY_HARD_WARNING
+ */
+#define EVENT_KEY_LOW_MEMORY "low_memory"
+
+/**
+ * @brief Definition for value of EVENT_KEY_LOW_MEMORY.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_MEMORY_NORMAL "normal"
+
+/**
+ * @brief Definition for value of EVENT_KEY_LOW_MEMORY.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_MEMORY_SOFT_WARNING "soft_warning"
+
+/**
+ * @brief Definition for value of EVENT_KEY_LOW_MEMORY.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_MEMORY_HARD_WARNING "hard_warning"
+
+/**
+ * @brief Definition for system-event of wifi : state of wifi.
+ * @since_tizen 2.4
+ * @privilege %http://tizen.org/privilege/network.get
+ * @remarks If you want to receive this event, you must declare this privilege.
+ * @see EVENT_KEY_WIFI_STATE
+ */
+#define SYSTEM_EVENT_WIFI_STATE "tizen.system.event.wifi_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_WIFI_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_WIFI_OFF
+ * @see EVENT_VAL_WIFI_ON
+ * @see EVENT_VAL_WIFI_CONNECTED
+ */
+#define EVENT_KEY_WIFI_STATE "wifi_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_WIFI_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_WIFI_OFF "off"
+
+/**
+ * @brief Definition for value of EVENT_KEY_WIFI_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_WIFI_ON "on"
+
+/**
+ * @brief Definition for value of EVENT_KEY_WIFI_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_WIFI_CONNECTED "connected"
+
+/**
+ * @brief Definition for system-event of bluetooth : status of bluetooth.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_BT_STATE
+ * @see EVENT_KEY_BT_LE_STATE
+ * @see EVENT_KEY_BT_TRANSFERING_STATE
+ */
+#define SYSTEM_EVENT_BT_STATE "tizen.system.event.bt_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_BT_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_BT_STATE_OFF
+ * @see EVENT_VAL_BT_STATE_ON
+ */
+#define EVENT_KEY_BT_STATE "bt_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BT_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BT_OFF "off"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BT_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BT_ON "on"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_BT_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_BT_LE_STATE_OFF
+ * @see EVENT_VAL_BT_LE_STATE_ON
+ */
+#define EVENT_KEY_BT_LE_STATE "bt_le_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BT_LE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BT_LE_OFF "off"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BT_LE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BT_LE_ON "on"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_BT_STATE.
+ * @since_tizen 2.4
+ * @remarks If it's already transfering state before you register this event, you can't receive the event regarding current transfer but you can receive the following transfers.
+ * @see EVENT_VAL_BT_NON_TRANSFERING
+ * @see EVENT_VAL_BT_TRANSFERING
+ */
+#define EVENT_KEY_BT_TRANSFERING_STATE "bt_transfering_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BT_TRANSFERING_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BT_NON_TRANSFERING "non_transfering"
+
+/**
+ * @brief Definition for value of EVENT_KEY_BT_TRANSFERING_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_BT_TRANSFERING "transfering"
+
+/**
+ * @brief Definition for system-event of location : enable state of location.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_LOCATION_ENABLE_STATE
+ */
+#define SYSTEM_EVENT_LOCATION_ENABLE_STATE "tizen.system.event.location_enable_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_LOCATION_ENABLE_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_LOCATION_DISABLED
+ * @see EVENT_VAL_LOCATION_ENABLED
+ */
+#define EVENT_KEY_LOCATION_ENABLE_STATE "location_enable_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_LOCATION_ENABLE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_LOCATION_DISABLED "disabled"
+
+/**
+ * @brief Definition for value of EVENT_KEY_LOCATION_ENABLE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_LOCATION_ENABLED "enabled"
+
+/**
+ * @brief Definition for system-event of location : enable state of gps.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_GPS_ENABLE_STATE
+ */
+#define SYSTEM_EVENT_GPS_ENABLE_STATE "tizen.system.event.gps_enable_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_GPS_ENABLE_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_GPS_DISABLED
+ * @see EVENT_VAL_GPS_ENABLED
+ */
+#define EVENT_KEY_GPS_ENABLE_STATE "gps_enable_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_GPS_ENABLE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_GPS_DISABLED "disabled"
+
+/**
+ * @brief Definition for value of EVENT_KEY_GPS_ENABLE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_GPS_ENABLED "enabled"
+
+/**
+ * @brief Definition for system-event of location : enable state of nps.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_NPS_ENABLE_STATE
+ */
+#define SYSTEM_EVENT_NPS_ENABLE_STATE "tizen.system.event.nps_enable_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_NPS_ENABLE_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_NPS_DISABLED
+ * @see EVENT_VAL_NPS_ENABLED
+ */
+#define EVENT_KEY_NPS_ENABLE_STATE "nps_enable_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_NPS_ENABLE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_NPS_DISABLED "disabled"
+
+/**
+ * @brief Definition for value of EVENT_KEY_NPS_ENABLE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_NPS_ENABLED "enabled"
+
+/**
+ * @brief Definition for system-event of message : incoming msg.
+ * @since_tizen 2.4
+ * @privilege %http://tizen.org/privilege/message.read
+ * @remarks If you want to receive this event, you must declare this privilege.
+ * @see EVENT_KEY_MSG_TYPE
+ * @see EVENT_KEY_MSG_ID
+ */
+#define SYSTEM_EVENT_INCOMMING_MSG "tizen.system.event.incoming_msg"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_INCOMMING_MSG.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_SMS
+ * @see EVENT_VAL_PUSH
+ * @see EVENT_VAL_CB
+ */
+#define EVENT_KEY_MSG_TYPE "msg_type"
+
+/**
+ * @brief Definition for value of EVENT_KEY_MSG_TYPE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_SMS "sms"
+
+/**
+ * @brief Definition for value of EVENT_KEY_MSG_TYPE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_PUSH "push"
+
+/**
+ * @brief Definition for value of EVENT_KEY_MSG_TYPE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_CB "cb"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_INCOMMING_MSG.
+ * @since_tizen 2.4
+ * @remarks The value of this key is a string of unsigned int value : new message id.
+ */
+#define EVENT_KEY_MSG_ID "msg_id"
+
+/**
+ * @brief Definition for system-event of setting : time changed.
+ * @since_tizen 2.4
+ * @remarks There is no corresponding key/value.
+ * @remarks You can use a @a alarm_get_current_time() API for checking new time after receiving this event.
+ */
+#define SYSTEM_EVENT_TIME_CHANGED "tizen.system.event.time_changed"
+
+/**
+ * @brief Definition for system-event of setting : timezone setting.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_TIME_ZONE
+ */
+#define SYSTEM_EVENT_TIME_ZONE "tizen.system.event.time_zone"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_TIME_ZONE.
+ * @since_tizen 2.4
+ * @remarks The value of this key is timezone value of tz database,
+ *     for example, "Asia/Seoul", "America/New_York",
+ *     refer to the Time Zone Database of IANA.
+ */
+#define EVENT_KEY_TIME_ZONE "time_zone"
+
+/**
+ * @brief Definition for system-event of setting : hour format.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_HOUR_FORMAT
+ */
+#define SYSTEM_EVENT_HOUR_FORMAT "tizen.system.event.hour_format"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_HOUR_FORMAT.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_HOURFORMAT_12
+ * @see EVENT_VAL_HOURFORMAT_24
+ */
+#define EVENT_KEY_HOUR_FORMAT "hour_format"
+
+/**
+ * @brief Definition for value of EVENT_KEY_HOUR_FORMAT.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_HOURFORMAT_12 "12"
+
+/**
+ * @brief Definition for value of EVENT_KEY_HOUR_FORMAT.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_HOURFORMAT_24 "24"
+
+/**
+ * @brief Definition for system-event of setting : language setting.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_LANGUAGE_SET
+ */
+#define SYSTEM_EVENT_LANGUAGE_SET "tizen.system.event.language_set"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_LANGUAGE_SET.
+ * @since_tizen 2.4
+ * @remarks The value of this key is full name of locale, for example,
+ *     "ko_KR.UTF8" : in case of Korean language
+ *     "en_US.UTF8" : in case of USA language,
+ *     refer to linux locale info.
+ */
+#define EVENT_KEY_LANGUAGE_SET "language_set"
+
+/**
+ * @brief Definition for system-event of setting : region format.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_REGION_FORMAT
+ */
+#define SYSTEM_EVENT_REGION_FORMAT "tizen.system.event.region_format"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_REGION_FORMAT.
+ * @since_tizen 2.4
+ * @remarks The value of this key is full name of locale, for example,
+ *     "ko_KR.UTF8" : in case of Korean region format
+ *     "en_US.UTF8" : in case of USA region format,
+ *     refer to linux locale info.
+ */
+#define EVENT_KEY_REGION_FORMAT "region_format"
+
+/**
+ * @brief Definition for system-event of setting : silent_mode.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_SILENT_MODE
+ */
+#define SYSTEM_EVENT_SILENT_MODE "tizen.system.event.silent_mode"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_SILENT_MODE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_SILENTMODE_ON
+ * @see EVENT_VAL_SILENTMODE_OFF
+ */
+#define EVENT_KEY_SILENT_MODE "silent_mode"
+
+/**
+ * @brief Definition for value of EVENT_KEY_SILENT_MODE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_SILENTMODE_ON "on"
+
+/**
+ * @brief Definition for value of EVENT_KEY_SILENT_MODE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_SILENTMODE_OFF "off"
+
+/**
+ * @brief Definition for system-event of setting : state of vibration.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_VIBRATION_STATE
+ */
+#define SYSTEM_EVENT_VIBRATION_STATE "tizen.system.event.vibration_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_VIBRATION_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_VIBRATION_ON
+ * @see EVENT_VAL_VIBRATION_OFF
+ */
+#define EVENT_KEY_VIBRATION_STATE "vibration_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_VIBRATION_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_VIBRATION_ON "on"
+
+/**
+ * @brief Definition for value of EVENT_KEY_VIBRATION_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_VIBRATION_OFF "off"
+
+/**
+ * @brief Definition for system-event of setting : state of screen's auto-rotation.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_SCREEN_AUTOROTATE_STATE
+ */
+#define SYSTEM_EVENT_SCREEN_AUTOROTATE_STATE "tizen.system.event.screen_autorotate_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_SCREEN_AUTOROTATE_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_SCREEN_AUTOROTATE_ON
+ * @see EVENT_VAL_SCREEN_AUTOROTATE_OFF
+ */
+#define EVENT_KEY_SCREEN_AUTOROTATE_STATE "screen_autorotate_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_SCREEN_AUTOROTATE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_SCREEN_AUTOROTATE_ON "on"
+
+/**
+ * @brief Definition for value of EVENT_KEY_SCREEN_AUTOROTATE_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_SCREEN_AUTOROTATE_OFF "off"
+
+/**
+ * @brief Definition for system-event of setting : state of mobile data.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_MOBILE_DATA_STATE
+ */
+#define SYSTEM_EVENT_MOBILE_DATA_STATE "tizen.system.event.mobile_data_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_MOBILE_DATA_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_MOBILE_DATA_OFF
+ * @see EVENT_VAL_MOBILE_DATA_ON
+ */
+#define EVENT_KEY_MOBILE_DATA_STATE "mobile_data_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_MOBILE_DATA_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_MOBILE_DATA_OFF "off"
+
+/**
+ * @brief Definition for value of EVENT_KEY_MOBILE_DATA_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_MOBILE_DATA_ON "on"
+
+/**
+ * @brief Definition for system-event of setting : state of data roaming.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_DATA_ROAMING_STATE
+ */
+#define SYSTEM_EVENT_DATA_ROAMING_STATE "tizen.system.event.data_roaming_state"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_DATA_ROAMING_STATE.
+ * @since_tizen 2.4
+ * @see EVENT_VAL_DATA_ROAMING_OFF
+ * @see EVENT_VAL_DATA_ROAMING_ON
+ */
+#define EVENT_KEY_DATA_ROAMING_STATE "data_roaming_state"
+
+/**
+ * @brief Definition for value of EVENT_KEY_DATA_ROAMING_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_DATA_ROAMING_OFF "off"
+
+/**
+ * @brief Definition for value of EVENT_KEY_DATA_ROAMING_STATE.
+ * @since_tizen 2.4
+ */
+#define EVENT_VAL_DATA_ROAMING_ON "on"
+
+/**
+ * @brief Definition for system-event of setting : font setting.
+ * @since_tizen 2.4
+ * @see EVENT_KEY_FONT_SET
+ */
+#define SYSTEM_EVENT_FONT_SET "tizen.system.event.font_set"
+
+/**
+ * @brief Definition for key of SYSTEM_EVENT_FONT_SET.
+ * @since_tizen 2.4
+ * @remarks The value of this key is font name of string type by font-config.
+ */
+#define EVENT_KEY_FONT_SET "font_set"
+
+/**
+ * @brief Adds the event handler for receiving event-data of interested events.
+ *
+ * @since_tizen 2.4
+ * @remarks If you want to add the privileged event, you MUST declare right privilge first. Unless that, this function returns #EVENT_ERROR_PERMISSION_DENIED. The privileged events are commented on remarks of it's definitions.
+ * @param[in] event_name The interested event name
+ * @param[in] callback The event callback called when the event occurs
+ * @param[in] user_data The user data for passing to callback
+ * @param[out] event_handler The event handler
+ * @return 0 on success, otherwise a negative error value
+ * @retval #EVENT_ERROR_NONE Successful
+ * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EVENT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #EVENT_ERROR_IO_ERROR Adding handler failed
+ * @retval #EVENT_ERROR_OUT_OF_MEMORY Out of memory
+ */
+int event_add_event_handler(const char *event_name, event_cb callback, void *user_data,
+       event_handler_h *event_handler);
+
+/**
+ * @brief Removes the registered event handler.
+ *
+ * @since_tizen 2.4
+ * @param[in] event_handler The event handler
+ * @return 0 on success, otherwise a negative error value
+ * @retval #EVENT_ERROR_NONE Successful
+ * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int event_remove_event_handler(event_handler_h event_handler);
+
+/**
+ * @brief Sends the User-Event to receiver applications.
+ *
+ * @since_tizen 2.4
+ * @remarks The format of User-Event's name MUST be "event.{sender's appid}.{user-defined name}", refer to 'The name-format of User-Event' section, If the event_name is invalid, the function returns #EVENT_ERROR_IO_ERROR.
+ * @param[in] event_name The event's name to send
+ * @param[in] event_data The event's data to send
+ * @return 0 on success, otherwise a negative error value
+ * @retval #EVENT_ERROR_NONE Successful
+ * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EVENT_ERROR_IO_ERROR Sending operation failed
+ */
+int event_publish_app_event(const char *event_name, bundle *event_data);
+
+/**
+ * @brief Sends the User-Event to trusted receiver-applications.
+ *
+ * @since_tizen 2.4
+ * @remarks The application which has same certification with sender can receive the event.
+ * @remarks The format of User-Event's name MUST be "event.{sender's appid}.{user-defined name}", refer to 'The name-format of User-Event' section,  If the event_name is invalid, the function returns #EVENT_ERROR_IO_ERROR.
+ * @param[in] event_name The event's name to send
+ * @param[in] event_data The event's data to send
+ * @return 0 on success, otherwise a negative error value
+ * @retval #EVENT_ERROR_NONE Successful
+ * @retval #EVENT_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EVENT_ERROR_IO_ERROR Sending operation failed
+ */
+int event_publish_trusted_app_event(const char *event_name, bundle *event_data);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_APPFW_EVENT_H__ */
diff --git a/include/app_extension.h b/include/app_extension.h
new file mode 100755 (executable)
index 0000000..9e5970f
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __TIZEN_APPFW_APP_EXTENSION_H__
+#define __TIZEN_APPFW_APP_EXTENSION_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief      Gets the preinitialized window object.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks    This API only supports BASIC type window.
+ *
+ * @param[in] win_name The name to be set for the preinitialized window
+ *
+ * @return     A @a window object on success,
+ *          otherwise @c NULL
+ */
+void* app_get_preinitialized_window(const char* win_name);
+
+/**
+ * @brief      Gets the preinitialized background object added to the preinitialized window.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks    This API should be called after calling app_get_preinitizlized_window().
+ *
+ * @return     A @a background object on success,
+ *          otherwise @c NULL
+ */
+void* app_get_preinitialized_background(void);
+
+/**
+ * @brief      Gets the preinitialized conformant widget added to the preinitialized window.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks    This API should be called after calling app_get_preinitizlized_window().
+ *
+ * @return     A conformant object on success,
+ *          otherwise @c NULL
+ */
+void* app_get_preinitialized_conformant(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_APPFW_APP_EXTENSION_H__ */
index c42458e..5eeeef9 100755 (executable)
@@ -65,6 +65,205 @@ void app_finalizer_execute(void);
 
 int app_get_package(char **package);
 
+
+/**
+ * @internal
+ * @brief Called when the system memory is running low.
+ *
+ * @details When a low memory event is dispatched, the application should immediately save state and release resources to save as much memory as possible. \n
+ *          If enough memory is not reclaimed during low memory conditions, the system will terminate some of the applications to reclaim the memory.
+ *
+ * @since_tizen 2.3
+ * @param[in] user_data        The user data passed from the callback registration function
+ * @see        app_main()
+ * @see #app_event_callback_s
+ */
+typedef void (*app_low_memory_cb) (void *user_data);
+
+
+/**
+ * @internal
+ * @brief Called when the battery power is running low.
+ * @details When the battery level falls below 5%, it is called.
+ *
+ * @since_tizen 2.3
+ * @param[in] user_data        The user data passed from the callback registration function
+ * @see        app_main()
+ * @see #app_event_callback_s
+ */
+typedef void (*app_low_battery_cb) (void *user_data);
+
+
+/**
+ * @internal
+ * @brief Called when the orientation of the device changes.
+ *
+ * @since_tizen 2.3
+ * @param[in] orientation The orientation of the device
+ * @param[in] user_data        The user data passed from the callback registration function
+ * @see        app_main()
+ * @see #app_event_callback_s
+ */
+typedef void (*app_device_orientation_cb) (app_device_orientation_e orientation, void *user_data);
+
+
+/**
+ * @internal
+ * @brief Called when language setting changes.
+ *
+ * @since_tizen 2.3
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see        app_main()
+ * @see #app_event_callback_s
+ */
+typedef void (*app_language_changed_cb) (void *user_data);
+
+
+/**
+ * @internal
+ * @brief Called when region format setting changes.
+ *
+ * @since_tizen 2.3
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see        app_main()
+ * @see #app_event_callback_s
+ */
+typedef void (*app_region_format_changed_cb) (void *user_data);
+
+
+/**
+ * @internal
+ * @brief The structure type containing the set of callback functions for handling application events.
+ * @details It is one of the input parameters of the app_main() function.
+ *
+ * @since_tizen 2.3
+ * @see app_main()
+ * @see app_create_cb()
+ * @see app_pause_cb()
+ * @see app_resume_cb()
+ * @see app_terminate_cb()
+ * @see app_control_cb()
+ * @see app_low_memory_cb()
+ * @see app_low_battery_cb()
+ * @see app_device_orientation_cb()
+ * @see app_language_changed_cb()
+ * @see app_region_format_changed_cb()
+ */
+typedef struct
+{
+       app_create_cb create; /**< This callback function is called at the start of the application. */
+       app_terminate_cb terminate; /**< This callback function is called once after the main loop of the application exits. */
+       app_pause_cb pause; /**< This callback function is called each time the application is completely obscured by another application and becomes invisible to the user. */
+       app_resume_cb resume; /**< This callback function is called each time the application becomes visible to the user. */
+       app_control_cb app_control; /**< This callback function is called when another application sends the launch request to the application. */
+       app_low_memory_cb low_memory; /**< The registered callback function is called when the system runs low on memory. */
+       app_low_battery_cb low_battery; /**< The registered callback function is called when the battery is low. */
+       app_device_orientation_cb device_orientation; /**< The registered callback function is called when the orientation of the device changes */
+       app_language_changed_cb language_changed; /**< The registered callback function is called when language setting changes. */
+       app_region_format_changed_cb region_format_changed; /**< The registered callback function is called when region format setting changes. */
+} app_event_callback_s;
+
+
+/**
+ * @internal
+ * @brief Runs the application's main loop until app_exit() is called.
+ *
+ * @details This function is the main entry point of the Tizen application.
+ *          The app_create_cb() callback function is called to initialize the application before the main loop of application starts up.
+ *          After the app_create_cb() callback function returns true, the main loop starts up and the app_control_cb() callback function is subsequently called.
+ *          If the app_create_cb() callback function returns false, the main loop doesn't start up and app_terminate_cb() callback function is called.
+ *
+ * @since_tizen 2.3
+ * @param[in] argc The argument count
+ * @param[in] argv The argument vector
+ * @param[in] callback The set of callback functions to handle application events
+ * @param[in] user_data The user data to be passed to the callback functions
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
+ * @retval #APP_ERROR_ALREADY_RUNNING The main loop already starts
+ *
+ * @see app_create_cb()
+ * @see app_terminate_cb()
+ * @see app_pause_cb()
+ * @see app_resume_cb()
+ * @see app_control_cb()
+ * @see app_low_memory_cb()
+ * @see app_low_battery_cb()
+ * @see app_device_orientation_cb()
+ * @see app_language_changed_cb()
+ * @see app_region_format_changed_cb()
+ * @see app_exit()
+ * @see #app_event_callback_s
+ */
+int app_main(int argc, char **argv, app_event_callback_s *callback, void *user_data);
+
+
+/**
+ * @internal
+ * @brief Runs the application's main loop until app_efl_exit() is called.
+ *
+ * @details This function is the main entry point of the Tizen application.
+ *          The app_create_cb() callback function is called to initialize the application before the main loop of the application starts up.
+ *          After the app_create_cb() callback function returns @c true, the main loop starts up and the app_control_cb() callback function is subsequently called.
+ *          If the app_create_cb() callback function returns @c false, the main loop doesn't start up and the app_terminate_cb() callback function is called.
+ *
+ * @since_tizen 2.3
+ * @param[in] argc The argument count
+ * @param[in] argv The argument vector
+ * @param[in] callback The set of callback functions to handle application events
+ * @param[in] user_data The user data to be passed to the callback functions
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #APP_ERROR_NONE Successful
+ * @retval #APP_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #APP_ERROR_INVALID_CONTEXT The application is illegally launched, not launched by the launch system
+ * @retval #APP_ERROR_ALREADY_RUNNING The main loop has already started
+ *
+ * @see app_create_cb()
+ * @see app_terminate_cb()
+ * @see app_pause_cb()
+ * @see app_resume_cb()
+ * @see app_control_cb()
+ * @see app_low_memory_cb()
+ * @see app_low_battery_cb()
+ * @see app_device_orientation_cb()
+ * @see app_language_changed_cb()
+ * @see app_region_format_changed_cb()
+ * @see app_efl_exit()
+ * @see #app_event_callback_s
+ */
+int app_efl_main(int *argc, char ***argv, app_event_callback_s *callback, void *user_data);
+
+
+/**
+ * @internal
+ * @brief Exits the main loop of application.
+ *
+ * @details The main loop of application stops and app_terminate_cb() is invoked.
+ * @since_tizen 2.3
+ * @see app_main()
+ * @see app_terminate_cb()
+ */
+void app_exit(void);
+
+
+/**
+ * @internal
+ * @brief Exits the main loop of the application.
+ *
+ * @details The main loop of the application stops and app_terminate_cb() is invoked.
+ * @since_tizen 2.3
+ * @see app_efl_main()
+ * @see app_terminate_cb()
+ */
+void app_efl_exit(void);
+
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/app_resource_manager.h b/include/app_resource_manager.h
new file mode 100644 (file)
index 0000000..d0c8080
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_APPFW_RESOURCE_MANAGER_H__
+#define __TIZEN_APPFW_RESOURCE_MANAGER_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file app_resource_manager.h
+ */
+
+/**
+ * @addtogroup CAPI_RESOURCE_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for Resource Types
+ * @since_tizen 2.4
+ */
+typedef enum {
+       APP_RESOURCE_TYPE_IMAGE = 0, /**<Image*/
+       APP_RESOURCE_TYPE_LAYOUT, /**<Edje*/
+       APP_RESOURCE_TYPE_SOUND, /**<Sound*/
+       APP_RESOURCE_TYPE_BIN, /**<Bin*/
+       APP_RESOURCE_TYPE_MIN = APP_RESOURCE_TYPE_IMAGE,
+       APP_RESOURCE_TYPE_MAX = APP_RESOURCE_TYPE_BIN,
+/*add values between APP_RESOURCE_TYPE_MIN and APP_RESOURCE_TYPE_MAX*/
+} app_resource_e;
+
+/**
+ * @brief Enumeration for App Resource Manager Error.
+ * @since_tizen 2.4
+ */
+typedef enum {
+       APP_RESOURCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+       APP_RESOURCE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+       APP_RESOURCE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+       APP_RESOURCE_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
+} app_resource_error_e;
+
+/**
+ * @brief Creates resource manager and get from db.
+ *
+ * @since_tizen 2.4
+ * @remarks If resource manager is already exist,
+ *                     It will just return APP_RESOURCE_ERROR_NONE
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #APP_RESOURCE_ERROR_NONE Successful
+ * @retval #APP_RESOURCE_ERROR_IO_ERROR IO Internal I/O Error
+ * @retval #APP_RESOURCE_ERROR_OUT_OF_MEMORY Out of memeory
+ * @see        app_resource_manager_release()
+ */
+int app_resource_manager_init(void);
+
+/**
+ * @brief Convert resource ID to path name
+ *
+ * @since_tizen 2.4
+ * @remarks If resource manager is not created yet,
+ *                     app_resource_manager_init() will be invoked automatically.
+ *                     Caller should free the returned pointer.
+ * @param[in] type Resource type @see app_resource_e
+ * @param[in] id Resource ID
+ * @param[out] path The name of requested resource on success, otherwise NULL
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #APP_RESOURCE_ERROR_NONE Successful
+ * @retval #APP_RESOURCE_ERROR_INVALID_PARAMETER Invalid Parameter
+ * @retval #APP_RESOURCE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #APP_RESOURCE_ERROR_IO_ERROR Internal I/O Error or failed to find valid resource
+ * @see        app_resource_manager_init()
+ */
+int app_resource_manager_get(app_resource_e type, const char *id, char **path);
+
+/**
+ * @brief Destroys resource manager.
+ *
+ * @since_tizen 2.4
+ * @remarks Please make sure that the instance of resource manager should be released when the application is closing only.
+ *                     It is highly recommended way to improve run-time performance.
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #APP_RESOURCE_ERROR_NONE Successful
+ * @see        app_resource_manager_init()
+ */
+int app_resource_manager_release(void);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_APPFW_RESOURCE_MANAGER_H__ */
+
index 743588e..e3f4e22 100755 (executable)
@@ -11,20 +11,21 @@ BuildRequires:  pkgconfig(bundle)
 BuildRequires:  pkgconfig(appcore-common)
 BuildRequires:  pkgconfig(appcore-efl)
 BuildRequires:  pkgconfig(aul)
-BuildRequires:  pkgconfig(ail)
 BuildRequires:  pkgconfig(appsvc)
 BuildRequires:  pkgconfig(elementary)
 BuildRequires:  pkgconfig(alarm-service)
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(sqlite3)
-BuildRequires:  pkgconfig(capi-security-privilege-manager)
+BuildRequires:  pkgconfig(security-privilege-checker)
 BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(vconf-internal-keys)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(eventsystem)
 
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
-%define feature_appfw_process_pool 1
+%define appfw_feature_process_pool 1
 
 %description
 An Application library in SLP C API
@@ -41,7 +42,7 @@ An Application library in SLP C API (DEV)
 %setup -q
 
 %build
-%if 0%{?feature_appfw_process_pool}
+%if 0%{?appfw_feature_process_pool}
  _APPFW_FEATURE_PROCESS_POOL=ON
 %endif
 
@@ -68,6 +69,7 @@ cp LICENSE %{buildroot}/usr/share/license/%{name}
 %{_libdir}/libcapi-appfw-app-common.so.*
 %{_libdir}/libcapi-appfw-alarm.so.*
 %{_libdir}/libcapi-appfw-preference.so.*
+%{_libdir}/libcapi-appfw-event.so.*
 %manifest capi-appfw-application.manifest
 /usr/share/license/%{name}
 
@@ -79,4 +81,5 @@ cp LICENSE %{buildroot}/usr/share/license/%{name}
 %{_libdir}/libcapi-appfw-app-common.so
 %{_libdir}/libcapi-appfw-alarm.so
 %{_libdir}/libcapi-appfw-preference.so
+%{_libdir}/libcapi-appfw-event.so
 
index f11b451..cab3d4f 100755 (executable)
@@ -168,7 +168,7 @@ int _preference_get_key_name(const char *path, char **keyname)
        }
 
        read_size = fread((void *)&keyname_len, sizeof(int), 1, fp);
-       if (read_size <= 0) {
+       if (read_size <= 0 || keyname_len > PREFERENCE_KEY_PATH_LEN) {
                fclose(fp);
                return PREFERENCE_ERROR_FILE_FREAD;
        }
@@ -242,7 +242,9 @@ static int _preference_set_key_check_pref_dir()
 
        if (access(pref_dir_path, F_OK) < 0) {
                if (mkdir(pref_dir_path, dir_mode) < 0) {
-                       ERR("mkdir() failed(%d/%s)", errno, strerror(errno));
+                       char err_buf[ERR_LEN] = {0,};
+                       strerror_r(errno, err_buf, sizeof(err_buf));
+                       ERR("mkdir() failed(%d/%s)", errno, err_buf);
                        return PREFERENCE_ERROR_IO_ERROR;
                }
        }
@@ -259,7 +261,9 @@ static int _preference_set_key_creation(const char* path)
        umask(temp);
 
        if(fd == -1) {
-               ERR("open(rdwr,create) error: %d(%s)", errno, strerror(errno));
+               char err_buf[ERR_LEN] = {0,};
+               strerror_r(errno, err_buf, sizeof(err_buf));
+               ERR("open(rdwr,create) error: %d(%s)", errno, err_buf);
                return PREFERENCE_ERROR_IO_ERROR;
        }
        close(fd);
@@ -322,19 +326,22 @@ static void _preference_log_subject_label(void)
        char smack_label[256] = {0,};
        char curren_path[256] = {0,};
        int tid;
+       char err_buf[ERR_LEN] = {0,};
 
        tid = (int)syscall(SYS_gettid);
        snprintf(curren_path, sizeof(curren_path)-1, "/proc/%d/attr/current", tid);
        fd = open(curren_path, O_RDONLY);
        if (fd < 0) {
-               LOGE("fail to open self current attr (err: %s)", strerror(errno));
+               strerror_r(errno, err_buf, sizeof(err_buf));
+               LOGE("fail to open self current attr (err: %s)", err_buf);
                return;
        }
 
        ret = read(fd, smack_label, sizeof(smack_label)-1);
        if (ret < 0) {
                close(fd);
-               LOGE("fail to open self current attr (err: %s)", strerror(errno));
+               strerror_r(errno, err_buf, sizeof(err_buf));
+               LOGE("fail to open self current attr (err: %s)", err_buf);
                return;
        }
 
@@ -456,7 +463,9 @@ static int _preference_check_retry_err(keynode_t *keynode, int preference_errno,
        }
        else
        {
-               ERR("key(%s), check retry err: %d/(%d/%s).",keynode->keyname, preference_errno, io_errno, strerror(io_errno));
+               char err_buf[ERR_LEN] = {0,};
+               strerror_r(errno, err_buf, sizeof(err_buf));
+               ERR("key(%s), check retry err: %d/(%d/%s).",keynode->keyname, preference_errno, io_errno, err_buf);
                return 0;
        }
 }
@@ -1263,7 +1272,9 @@ API int preference_remove(const char *key)
        do {
                ret = remove(path);
                if(ret == -1) {
-                       ERR("preference_remove() failed. ret=%d(%s), key(%s)", errno, strerror(errno), key);
+                       char err_buf[ERR_LEN] = {0,};
+                       strerror_r(errno, err_buf, sizeof(err_buf));
+                       ERR("preference_remove() failed. ret=%d(%s), key(%s)", errno, err_buf, key);
                        func_ret = PREFERENCE_ERROR_IO_ERROR;
                } else {
                        func_ret = PREFERENCE_ERROR_NONE;
@@ -1286,8 +1297,10 @@ API int preference_remove_all(void)
        int err_retry = PREFERENCE_ERROR_RETRY_CNT;
        int func_ret = PREFERENCE_ERROR_NONE;
        DIR *dir;
-       struct dirent *dent = NULL;
+       struct dirent dent;
+       struct dirent *result = NULL;
        char *pref_dir_path = NULL;
+       char err_buf[ERR_LEN] = {0,};
 
        pref_dir_path = _preference_get_pref_dir_path();
        if (!pref_dir_path)
@@ -1299,7 +1312,8 @@ API int preference_remove_all(void)
        dir = opendir(pref_dir_path);
        if (dir == NULL)
        {
-               LOGE("opendir() failed. pref_path: %s, error: %d(%s)", pref_dir_path, errno, strerror(errno));
+               strerror_r(errno, err_buf, sizeof(err_buf));
+               LOGE("opendir() failed. pref_path: %s, error: %d(%s)", pref_dir_path, errno, err_buf);
                return PREFERENCE_ERROR_IO_ERROR;
        }
 
@@ -1311,9 +1325,9 @@ API int preference_remove_all(void)
                return PREFERENCE_ERROR_OUT_OF_MEMORY;
        }
 
-       while ((dent = readdir(dir)))
+       while (readdir_r(dir, &dent, &result) == 0 && result != NULL)
        {
-               const char *entry = dent->d_name;
+               const char *entry = dent.d_name;
                char *keyname = NULL;
                char path[PATH_MAX] = {0,};
 
@@ -1343,7 +1357,8 @@ API int preference_remove_all(void)
                do {
                        ret = remove(path);
                        if (ret == -1) {
-                               ERR("preference_remove_all error: %d(%s)", errno, strerror(errno));
+                               strerror_r(errno, err_buf, sizeof(err_buf));
+                               ERR("preference_remove_all error: %d(%s)", errno, err_buf);
                                func_ret = PREFERENCE_ERROR_IO_ERROR;
                        } else {
                                func_ret = PREFERENCE_ERROR_NONE;
@@ -1467,7 +1482,9 @@ API int preference_unset_changed_cb(const char *key)
                        _preference_keynode_free(pKeyNode);
                        return PREFERENCE_ERROR_NO_KEY;
                } else if (errno != 0) {
-                       ERR("preference_unset_changed_cb() failed: key(%s) error(%d/%s)", key, errno, strerror(errno));
+                       char err_buf[ERR_LEN] = {0,};
+                       strerror_r(errno, err_buf, sizeof(err_buf));
+                       ERR("preference_unset_changed_cb() failed: key(%s) error(%d/%s)", key, errno, err_buf);
                        _preference_keynode_free(pKeyNode);
                        return PREFERENCE_ERROR_IO_ERROR;
                }
@@ -1489,8 +1506,10 @@ API int preference_foreach_item(preference_item_cb callback, void *user_data)
 
        int ret = 0;
        DIR *dir;
-       struct dirent *dent = NULL;
+       struct dirent dent;
+       struct dirent *result = NULL;
        char *pref_dir_path = NULL;
+       char err_buf[ERR_LEN] = {0,};
 
        pref_dir_path = _preference_get_pref_dir_path();
        if (!pref_dir_path) {
@@ -1500,12 +1519,13 @@ API int preference_foreach_item(preference_item_cb callback, void *user_data)
 
        dir = opendir(pref_dir_path);
        if (dir == NULL) {
-               LOGE("opendir() failed. path: %s, error: %d(%s)", pref_dir_path, errno, strerror(errno));
+               strerror_r(errno, err_buf, sizeof(err_buf));
+               LOGE("opendir() failed. path: %s, error: %d(%s)", pref_dir_path, errno, err_buf);
                return PREFERENCE_ERROR_IO_ERROR;
        }
 
-       while((dent = readdir(dir))) {
-               const char *entry = dent->d_name;
+       while(readdir_r(dir, &dent, &result) == 0 && result != NULL) {
+               const char *entry = dent.d_name;
                char *keyname = NULL;
                char path[PATH_MAX] = {0,};
 
index 7cbffbd..5447394 100755 (executable)
@@ -94,9 +94,10 @@ static GList* _preference_copy_noti_list(GList *orig_notilist)
                        }
 
                        n->keyname = strndup(t->keyname, PREFERENCE_KEY_PATH_LEN);
-                       if (n->keyname == NULL)
-                       {
-                               ERR("The memory is insufficient, errno: %d (%s)", errno, strerror(errno));
+                       if (n->keyname == NULL) {
+                               char err_buf[ERR_LEN] = {0,};
+                               strerror_r(errno, err_buf, sizeof(err_buf));
+                               ERR("The memory is insufficient, errno: %d (%s)", errno, err_buf);
                                free(n);
                                break;
                        }
@@ -324,7 +325,8 @@ int _preference_kdb_add_notify(keynode_t *keynode, preference_changed_cb cb, voi
 
        n->keyname = strndup(keyname, PREFERENCE_KEY_PATH_LEN);
        if (n->keyname == NULL) {
-               ERR("The memory is insufficient, errno: %d (%s)", errno, strerror(errno));
+               strerror_r(errno, err_buf, sizeof(err_buf));
+               ERR("The memory is insufficient, errno: %d (%s)", errno, err_buf);
                free(n);
                goto out_func;
        }
index 78e4f2b..4a7efa2 100755 (executable)
@@ -42,6 +42,7 @@ typedef enum {
        APP_STATE_RUNNING, // The application is running in the foreground and background
 } app_state_e;
 
+
 typedef struct {
        char *package;
        char *app_name;
@@ -67,6 +68,7 @@ static int app_appcore_region_changed(void *event, void *data);
 static void app_set_appcore_event_cb(app_context_h app_context);
 static void app_unset_appcore_event_cb(void);
 
+
 int app_main(int argc, char **argv, app_event_callback_s *callback, void *user_data)
 {
        return app_efl_main(&argc, &argv, callback, user_data);
@@ -139,7 +141,6 @@ void app_efl_exit(void)
        elm_exit();
 }
 
-
 int app_appcore_create(void *data)
 {
        LOGI("app_appcore_create");
@@ -232,7 +233,6 @@ int app_appcore_resume(void *data)
        return APP_ERROR_NONE;
 }
 
-
 int app_appcore_reset(bundle *appcore_bundle, void *data)
 {
        LOGI("app_appcore_reset");
@@ -412,7 +412,7 @@ void app_unset_appcore_event_cb(void)
        appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, NULL, NULL);
 }
 
-#define UI_APP_EVENT_MAX 5
+#define UI_APP_EVENT_MAX 6
 static Eina_List *handler_list[UI_APP_EVENT_MAX] = {NULL, };
 static int handler_initialized = 0;
 static int appcore_initialized = 0;
@@ -432,7 +432,8 @@ static void _free_handler_list(void)
 
        for (i = 0; i < UI_APP_EVENT_MAX; i++) {
                EINA_LIST_FREE(handler_list[i], handler)
-                       free(handler);
+                       if (handler)
+                               free(handler);
        }
 
        eina_shutdown();
@@ -533,25 +534,105 @@ static int _ui_app_appcore_region_changed(void *event_info, void *data)
        return APP_ERROR_NONE;
 }
 
+static int _ui_app_appcore_suspended_state_changed(void *event_info, void *data)
+{
+       Eina_List *l;
+       app_event_handler_h handler;
+       struct app_event_info event;
+
+       LOGI("_ui_app_appcore_suspended_state_changed");
+       LOGI("[__SUSPEND__] suspended state: %d (0: suspend, 1: wake)", *(int*)event_info);
+
+       event.type = APP_EVENT_SUSPENDED_STATE_CHANGED;
+       event.value = event_info;
+
+       EINA_LIST_FOREACH(handler_list[APP_EVENT_SUSPENDED_STATE_CHANGED], l, handler) {
+               handler->cb(&event, handler->data);
+       }
+
+       return APP_ERROR_NONE;
+}
+
+static void _ui_app_appcore_set_event_cb(app_event_type_e event_type)
+{
+       switch (event_type) {
+       case APP_EVENT_LOW_MEMORY:
+               appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, _ui_app_appcore_low_memory, NULL);
+               break;
+       case APP_EVENT_LOW_BATTERY:
+               appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, _ui_app_appcore_low_battery, NULL);
+               break;
+       case APP_EVENT_LANGUAGE_CHANGED:
+               appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, _ui_app_appcore_lang_changed, NULL);
+               break;
+       case APP_EVENT_DEVICE_ORIENTATION_CHANGED:
+               appcore_set_rotation_cb(_ui_app_appcore_rotation_event, NULL);
+               break;
+       case APP_EVENT_REGION_FORMAT_CHANGED:
+               appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, _ui_app_appcore_region_changed, NULL);
+               break;
+       case APP_EVENT_SUSPENDED_STATE_CHANGED:
+               LOGI("[__SUSPEND__]");
+               appcore_set_event_callback(APPCORE_EVENT_SUSPENDED_STATE_CHANGE, _ui_app_appcore_suspended_state_changed, NULL);
+               break;
+       default:
+               break;
+       }
+}
+
+static void _ui_app_appcore_unset_event_cb(app_event_type_e event_type)
+{
+       switch (event_type) {
+       case APP_EVENT_LOW_MEMORY:
+               appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, NULL, NULL);
+               break;
+       case APP_EVENT_LOW_BATTERY:
+               appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, NULL, NULL);
+               break;
+       case APP_EVENT_LANGUAGE_CHANGED:
+               appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, NULL, NULL);
+               break;
+       case APP_EVENT_DEVICE_ORIENTATION_CHANGED:
+               appcore_unset_rotation_cb();
+               break;
+       case APP_EVENT_REGION_FORMAT_CHANGED:
+               appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, NULL, NULL);
+               break;
+       case APP_EVENT_SUSPENDED_STATE_CHANGED:
+               LOGI("[__SUSPEND__]");
+               appcore_set_event_callback(APPCORE_EVENT_SUSPENDED_STATE_CHANGE, NULL, NULL);
+               break;
+       default:
+               break;
+       }
+}
 
 static void _ui_app_set_appcore_event_cb(void)
 {
-       appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, _ui_app_appcore_low_memory, NULL);
-       appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, _ui_app_appcore_low_battery, NULL);
+       _ui_app_appcore_set_event_cb(APP_EVENT_LOW_MEMORY);
+       _ui_app_appcore_set_event_cb(APP_EVENT_LANGUAGE_CHANGED);
+       _ui_app_appcore_set_event_cb(APP_EVENT_REGION_FORMAT_CHANGED);
+
+       if (eina_list_count(handler_list[APP_EVENT_LOW_BATTERY]) > 0)
+               _ui_app_appcore_set_event_cb(APP_EVENT_LOW_BATTERY);
        if (eina_list_count(handler_list[APP_EVENT_DEVICE_ORIENTATION_CHANGED]) > 0)
-               appcore_set_rotation_cb(_ui_app_appcore_rotation_event, NULL);
-       appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, _ui_app_appcore_lang_changed, NULL);
-       appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, _ui_app_appcore_region_changed, NULL);
+               _ui_app_appcore_set_event_cb(APP_EVENT_DEVICE_ORIENTATION_CHANGED);
+       if (eina_list_count(handler_list[APP_EVENT_SUSPENDED_STATE_CHANGED]) > 0)
+               _ui_app_appcore_set_event_cb(APP_EVENT_SUSPENDED_STATE_CHANGED);
 }
 
 static void _ui_app_unset_appcore_event_cb(void)
 {
-       appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, NULL, NULL);
-       appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, NULL, NULL);
+       _ui_app_appcore_unset_event_cb(APP_EVENT_LOW_MEMORY);
+       _ui_app_appcore_unset_event_cb(APP_EVENT_LANGUAGE_CHANGED);
+       _ui_app_appcore_unset_event_cb(APP_EVENT_REGION_FORMAT_CHANGED);
+
+       if (eina_list_count(handler_list[APP_EVENT_LOW_BATTERY]) > 0)
+               _ui_app_appcore_unset_event_cb(APP_EVENT_LOW_BATTERY);
        if (eina_list_count(handler_list[APP_EVENT_DEVICE_ORIENTATION_CHANGED]) > 0)
-               appcore_unset_rotation_cb();
-       appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, NULL, NULL);
-       appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, NULL, NULL);
+               _ui_app_appcore_unset_event_cb(APP_EVENT_DEVICE_ORIENTATION_CHANGED);
+       if (eina_list_count(handler_list[APP_EVENT_SUSPENDED_STATE_CHANGED]) > 0)
+               _ui_app_appcore_unset_event_cb(APP_EVENT_SUSPENDED_STATE_CHANGED);
 }
 
 static int _ui_app_appcore_create(void *data)
@@ -636,7 +717,6 @@ static int _ui_app_appcore_resume(void *data)
        return APP_ERROR_NONE;
 }
 
-
 static int _ui_app_appcore_reset(bundle *appcore_bundle, void *data)
 {
        LOGI("app_appcore_reset");
@@ -647,8 +727,15 @@ static int _ui_app_appcore_reset(bundle *appcore_bundle, void *data)
        if (app_context == NULL)
                return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
 
-       if (app_control_create_event(appcore_bundle, &app_control) != APP_ERROR_NONE)
-               return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a app_control handle from the bundle");
+       if (appcore_bundle) {
+               if (app_control_create_event(appcore_bundle, &app_control) != APP_ERROR_NONE)
+                       return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a app_control handle from the bundle");
+       } else {
+               int ret;
+               ret = app_control_create(&app_control);
+               if (ret != APP_ERROR_NONE)
+                       return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create a app_control");
+       }
 
        callback = app_context->callback->app_control;
 
@@ -709,7 +796,8 @@ int ui_app_main(int argc, char **argv, ui_app_lifecycle_callback_s *callback, vo
 
 void ui_app_exit(void)
 {
-       app_efl_exit();
+       LOGI("ui_app_exit");
+       elm_exit();
 }
 
 int ui_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_e event_type, app_event_cb callback, void *user_data)
@@ -725,7 +813,7 @@ int ui_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_
        if (event_handler == NULL || callback == NULL)
                return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
 
-       if (event_type < APP_EVENT_LOW_MEMORY || event_type > APP_EVENT_REGION_FORMAT_CHANGED)
+       if (event_type < APP_EVENT_LOW_MEMORY || event_type > APP_EVENT_SUSPENDED_STATE_CHANGED)
                return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid event type");
 
        EINA_LIST_FOREACH(handler_list[event_type], l_itr, handler) {
@@ -735,15 +823,14 @@ int ui_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_
 
        handler = calloc(1, sizeof(struct app_event_handler));
        if (!handler)
-               return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create handler");
+               return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "insufficient memory");
 
        handler->type = event_type;
        handler->cb = callback;
        handler->data = user_data;
 
-       if (appcore_initialized && event_type == APP_EVENT_DEVICE_ORIENTATION_CHANGED
-               && eina_list_count(handler_list[event_type]) == 0)
-               appcore_set_rotation_cb(_ui_app_appcore_rotation_event, NULL);
+       if (appcore_initialized && eina_list_count(handler_list[event_type]) == 0)
+               _ui_app_appcore_set_event_cb(event_type);
 
        handler_list[event_type] = eina_list_append(handler_list[event_type], handler);
 
@@ -768,7 +855,7 @@ int ui_app_remove_event_handler(app_event_handler_h event_handler)
        }
 
        type = event_handler->type;
-       if (type < APP_EVENT_LOW_MEMORY || type > APP_EVENT_REGION_FORMAT_CHANGED)
+       if (type < APP_EVENT_LOW_MEMORY || type > APP_EVENT_SUSPENDED_STATE_CHANGED)
                return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid handler");
 
        EINA_LIST_FOREACH_SAFE(handler_list[type], l_itr, l_next, handler) {
@@ -776,9 +863,8 @@ int ui_app_remove_event_handler(app_event_handler_h event_handler)
                        free(handler);
                        handler_list[type] = eina_list_remove_list(handler_list[type], l_itr);
 
-                       if (appcore_initialized && type == APP_EVENT_DEVICE_ORIENTATION_CHANGED
-                               && eina_list_count(handler_list[type]) == 0)
-                               appcore_unset_rotation_cb();
+                       if (appcore_initialized && eina_list_count(handler_list[type]) == 0)
+                               _ui_app_appcore_unset_event_cb(type);
 
                        return APP_ERROR_NONE;
                }
index 5c8dc29..939d3d9 100755 (executable)
 #include <appcore-efl.h>
 #include <aul.h>
 
-void app_set_reclaiming_system_cache_on_pause(bool enable)
-{
-       appcore_set_system_resource_reclaiming(enable);
-}
+#include "app_extension.h"
 
 //#ifdef _APPFW_FEATURE_PROCESS_POOL
 void* app_get_preinitialized_window(const char *win_name)
diff --git a/src/app_resource_manager.c b/src/app_resource_manager.c
new file mode 100644 (file)
index 0000000..fecec4b
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <aul_rsc_mgr.h>
+#include "app_resource_manager.h"
+
+int app_resource_manager_init()
+{
+       return aul_resource_manager_init();
+}
+
+int app_resource_manager_get(app_resource_e type, const char *id, char **path)
+{
+       return aul_resource_manager_get((aul_resource_e)type, id, path);
+}
+
+int app_resource_manager_release()
+{
+       return aul_resource_manager_release();
+}
+