summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunghoon Park <jh9216.park@samsung.com>2017-02-01 22:24:44 +0900
committerJunghoon Park <jh9216.park@samsung.com>2017-02-20 11:11:14 +0900
commit76c66f570105debbdbd689fc051e86cc932f3baa (patch)
tree220a64ce0a10460b44cf3ef2f91ec1a0a7f2fa23
parent0ce488ce95b9727691e9fb31c0cdc0f454f5b680 (diff)
downloadapplication-76c66f570105debbdbd689fc051e86cc932f3baa.tar.gz
application-76c66f570105debbdbd689fc051e86cc932f3baa.tar.bz2
application-76c66f570105debbdbd689fc051e86cc932f3baa.zip
Refactor APIs using appcore_ui_base
- require : https://review.tizen.org/gerrit/#/c/82655/ Change-Id: Iedc7603d7e0e3514856797d42751901886f1ff07 Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
-rwxr-xr-xapp_common/app_event.c30
-rw-r--r--app_control/CMakeLists.txt2
-rwxr-xr-xapp_control/app_control.c95
-rw-r--r--include/app_internal.h19
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/app_device.c33
-rwxr-xr-xsrc/app_main.c896
-rwxr-xr-xsrc/app_main_legacy.c181
-rw-r--r--src/app_resource.c43
9 files changed, 396 insertions, 906 deletions
diff --git a/app_common/app_event.c b/app_common/app_event.c
index 12f0387..fe32e89 100755
--- a/app_common/app_event.c
+++ b/app_common/app_event.c
@@ -18,9 +18,22 @@
#include <vconf-internal-keys.h>
#include <app_common.h>
+#include <appcore_base.h>
#include <app_internal.h>
-/* LCOV_EXCL_START */
+struct app_event_info {
+ app_event_type_e type;
+ void *value;
+};
+
+enum appcore_rm {
+ APPCORE_RM_UNKNOWN,
+ APPCORE_RM_PORTRAIT_NORMAL,
+ APPCORE_RM_PORTRAIT_REVERSE,
+ APPCORE_RM_LANDSCAPE_NORMAL,
+ APPCORE_RM_LANDSCAPE_REVERSE,
+};
+
app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm)
{
app_device_orientation_e dev_orientation;
@@ -45,9 +58,8 @@ app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm)
return dev_orientation;
}
-/* LCOV_EXCL_STOP */
-static int _app_convert_low_memory(void *val)
+static int __app_convert_low_memory(void *val)
{
switch (*(int *)val) {
case VCONFKEY_SYSMAN_LOW_MEMORY_NORMAL:
@@ -61,7 +73,7 @@ static int _app_convert_low_memory(void *val)
}
}
-static int _app_convert_low_battery(void *val)
+static int __app_convert_low_battery(void *val)
{
switch (*(int *)val) {
case VCONFKEY_SYSMAN_BAT_POWER_OFF:
@@ -83,7 +95,7 @@ int app_event_get_low_memory_status(app_event_info_h event_info, app_event_low_m
if (event_info->type != APP_EVENT_LOW_MEMORY)
return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "event type mismatching");
- ret = _app_convert_low_memory(event_info->value);
+ ret = __app_convert_low_memory(event_info->value);
if (ret < 0)
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "invalid event info");
@@ -102,7 +114,7 @@ int app_event_get_low_battery_status(app_event_info_h event_info, app_event_low_
if (event_info->type != APP_EVENT_LOW_BATTERY)
return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "event type mismatching");
- ret = _app_convert_low_battery(event_info->value);
+ ret = __app_convert_low_battery(event_info->value);
if (ret < 0)
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "invalid event info");
@@ -145,7 +157,7 @@ int app_event_get_device_orientation(app_event_info_h event_info, app_device_ori
if (event_info->type != APP_EVENT_DEVICE_ORIENTATION_CHANGED)
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "event type mismatching");
- *orientation = app_convert_appcore_rm(*(enum appcore_rm *)(event_info->value));
+ *orientation = app_convert_appcore_rm(*(enum appcore_base_rm *)(event_info->value));
return APP_ERROR_NONE;
}
@@ -158,9 +170,9 @@ int app_event_get_suspended_state(app_event_info_h event_info, app_suspended_sta
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)
+ if (*(enum appcore_base_suspended_state *)(event_info->value) == APPCORE_BASE_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)
+ else if (*(enum appcore_base_suspended_state *)(event_info->value) == APPCORE_BASE_SUSPENDED_STATE_DID_EXIT_FROM_SUSPEND)
*state = APP_SUSPENDED_STATE_DID_EXIT;
return APP_ERROR_NONE;
diff --git a/app_control/CMakeLists.txt b/app_control/CMakeLists.txt
index b0f2f1e..4df198f 100644
--- a/app_control/CMakeLists.txt
+++ b/app_control/CMakeLists.txt
@@ -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")
+SET(requires "dlog bundle aul capi-base-common")
SET(pc_requires "capi-base-common")
INCLUDE(FindPkgConfig)
diff --git a/app_control/app_control.c b/app_control/app_control.c
index b63d7fc..095c80d 100755
--- a/app_control/app_control.c
+++ b/app_control/app_control.c
@@ -23,7 +23,6 @@
#include <bundle.h>
#include <bundle_internal.h>
#include <aul.h>
-#include <appsvc.h>
#include <aul_svc.h>
#include <dlog.h>
@@ -74,8 +73,6 @@ typedef struct app_control_request_context_s {
void *user_data;
} *app_control_request_context_h;
-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);
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)
@@ -158,7 +155,7 @@ int app_control_validate_internal_key(const char *key)
}
/* LCOV_EXCL_START */
-static void app_control_request_result_broker(bundle *appsvc_bundle, int appsvc_request_code, appsvc_result_val appsvc_result, void *appsvc_data)
+static void app_control_request_result_broker(bundle *appsvc_bundle, int appsvc_request_code, aul_svc_result_val appsvc_result, void *appsvc_data)
{
app_control_request_context_h request_context;
app_control_h request;
@@ -181,13 +178,13 @@ static void app_control_request_result_broker(bundle *appsvc_bundle, int appsvc_
request = request_context->app_control;
switch (appsvc_result) {
- case APPSVC_RES_OK:
+ case AUL_SVC_RES_OK:
result = APP_CONTROL_RESULT_SUCCEEDED;
break;
- case APPSVC_RES_NOT_OK:
+ case AUL_SVC_RES_NOT_OK:
result = APP_CONTROL_RESULT_FAILED;
break;
- case APPSVC_RES_CANCEL:
+ case AUL_SVC_RES_CANCEL:
result = APP_CONTROL_RESULT_CANCELED;
break;
default:
@@ -265,9 +262,9 @@ int app_control_create_event(bundle *data, struct app_control_s **app_control)
app_control_event->data = bundle_dup(data);
app_control_event->id = app_control_new_id();
- operation = appsvc_get_operation(app_control_event->data);
+ operation = aul_svc_get_operation(app_control_event->data);
if (operation == NULL)
- appsvc_set_operation(app_control_event->data, APP_CONTROL_OPERATION_DEFAULT);
+ aul_svc_set_operation(app_control_event->data, APP_CONTROL_OPERATION_DEFAULT);
*app_control = app_control_event;
@@ -328,7 +325,7 @@ int app_control_set_operation(app_control_h app_control, const char *operation)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
if (operation != NULL) {
- if (appsvc_set_operation(app_control->data, operation) != 0)
+ if (aul_svc_set_operation(app_control->data, operation) != 0)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid operation");
} else {
bundle_del(app_control->data, BUNDLE_KEY_OPERATION);
@@ -344,7 +341,7 @@ int app_control_get_operation(app_control_h app_control, char **operation)
if (app_control_validate(app_control) || operation == NULL)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- operation_value = appsvc_get_operation(app_control->data);
+ operation_value = aul_svc_get_operation(app_control->data);
if (operation_value != NULL)
*operation = strdup(operation_value);
else
@@ -359,7 +356,7 @@ int app_control_set_uri(app_control_h app_control, const char *uri)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
if (uri != NULL) {
- if (appsvc_set_uri(app_control->data, uri) != 0)
+ if (aul_svc_set_uri(app_control->data, uri) != 0)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid URI");
} else {
bundle_del(app_control->data, BUNDLE_KEY_URI);
@@ -375,7 +372,7 @@ int app_control_get_uri(app_control_h app_control, char **uri)
if (app_control_validate(app_control) || uri == NULL)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- uri_value = appsvc_get_uri(app_control->data);
+ uri_value = aul_svc_get_uri(app_control->data);
if (uri_value != NULL)
*uri = strdup(uri_value);
else
@@ -390,7 +387,7 @@ int app_control_set_mime(app_control_h app_control, const char *mime)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
if (mime != NULL) {
- if (appsvc_set_mime(app_control->data, mime) != 0)
+ if (aul_svc_set_mime(app_control->data, mime) != 0)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid MIME type");
} else {
bundle_del(app_control->data, BUNDLE_KEY_MIME);
@@ -406,7 +403,7 @@ int app_control_get_mime(app_control_h app_control, char **mime)
if (app_control_validate(app_control) || mime == NULL)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- mime_value = appsvc_get_mime(app_control->data);
+ mime_value = aul_svc_get_mime(app_control->data);
if (mime_value != NULL)
*mime = strdup(mime_value);
else
@@ -421,7 +418,7 @@ int app_control_set_category(app_control_h app_control, const char *category)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
if (category != NULL) {
- if (appsvc_set_category(app_control->data, category) != 0)
+ if (aul_svc_set_category(app_control->data, category) != 0)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid Category");
} else {
bundle_del(app_control->data, BUNDLE_KEY_CATEGORY);
@@ -437,7 +434,7 @@ int app_control_get_category(app_control_h app_control, char **category)
if (app_control_validate(app_control) || category == NULL)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- category_value = appsvc_get_category(app_control->data);
+ category_value = aul_svc_get_category(app_control->data);
if (category_value != NULL)
*category = strdup(category_value);
else
@@ -464,7 +461,7 @@ int app_control_set_app_id(app_control_h app_control, const char *app_id)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
if (app_id != NULL) {
- if (appsvc_set_appid(app_control->data, app_id) != 0)
+ if (aul_svc_set_appid(app_control->data, app_id) != 0)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid application ID");
} else {
bundle_del(app_control->data, BUNDLE_KEY_PACKAGE);
@@ -480,7 +477,7 @@ int app_control_get_app_id(app_control_h app_control, char **app_id)
if (app_control_validate(app_control) || app_id == NULL)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- app_id_value = appsvc_get_appid(app_control->data);
+ app_id_value = aul_svc_get_appid(app_control->data);
if (app_id_value != NULL)
*app_id = strdup(app_id_value);
else
@@ -495,7 +492,7 @@ int app_control_set_window(app_control_h app_control, unsigned int id)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
if (id > 0) {
- if (appsvc_allow_transient_app(app_control->data, id) != 0)
+ if (aul_svc_allow_transient_app(app_control->data, id) != 0)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid id");
} else {
bundle_del(app_control->data, BUNDLE_KEY_WINDOW);
@@ -562,7 +559,7 @@ int app_control_set_launch_mode(app_control_h app_control,
__FUNCTION__, "invalid mode");
}
- return appsvc_set_launch_mode(app_control->data, launch_mode);
+ return aul_svc_set_launch_mode(app_control->data, launch_mode);
}
int app_control_get_launch_mode(app_control_h app_control,
@@ -575,7 +572,7 @@ int app_control_get_launch_mode(app_control_h app_control,
__FUNCTION__, NULL);
}
- launch_mode = appsvc_get_launch_mode(app_control->data);
+ launch_mode = aul_svc_get_launch_mode(app_control->data);
if (launch_mode == NULL) {
*mode = APP_CONTROL_LAUNCH_MODE_SINGLE;
} else {
@@ -707,7 +704,7 @@ int app_control_send_launch_request(app_control_h app_control, app_control_reply
if (app_control_validate(app_control))
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- operation = appsvc_get_operation(app_control->data);
+ operation = aul_svc_get_operation(app_control->data);
if (operation == NULL) {
implicit_default_operation = true;
operation = APP_CONTROL_OPERATION_DEFAULT;
@@ -721,7 +718,7 @@ int app_control_send_launch_request(app_control_h app_control, app_control_reply
/* operation : default */
if (!strcmp(operation, APP_CONTROL_OPERATION_DEFAULT)) {
- const char *appid = appsvc_get_appid(app_control->data);
+ const char *appid = aul_svc_get_appid(app_control->data);
if (appid == NULL)
return app_control_error(APP_CONTROL_ERROR_APP_NOT_FOUND, __FUNCTION__, "package must be specified if the operation is default value");
}
@@ -746,9 +743,9 @@ int app_control_send_launch_request(app_control_h app_control, app_control_reply
}
if (implicit_default_operation == true)
- appsvc_set_operation(app_control->data, APP_CONTROL_OPERATION_DEFAULT);
+ aul_svc_set_operation(app_control->data, APP_CONTROL_OPERATION_DEFAULT);
- launch_pid = appsvc_usr_run_service(app_control->data, app_control->id, callback ? app_control_request_result_broker : NULL, request_context, getuid());
+ launch_pid = aul_svc_run_service_for_uid(app_control->data, app_control->id, callback ? app_control_request_result_broker : NULL, request_context, getuid());
if (implicit_default_operation == true)
bundle_del(app_control->data, BUNDLE_KEY_OPERATION);
@@ -760,11 +757,11 @@ int app_control_send_launch_request(app_control_h app_control, app_control_reply
free(request_context);
}
- if (launch_pid == APPSVC_RET_ENOMATCH)
+ if (launch_pid == AUL_SVC_RET_ENOMATCH)
return app_control_error(APP_CONTROL_ERROR_APP_NOT_FOUND, __FUNCTION__, NULL);
- else if (launch_pid == APPSVC_RET_EILLACC)
+ else if (launch_pid == AUL_SVC_RET_EILLACC)
return app_control_error(APP_CONTROL_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
- else if (launch_pid == APPSVC_RET_EINVAL)
+ else if (launch_pid == AUL_SVC_RET_EINVAL)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
else
return app_control_error(APP_CONTROL_ERROR_LAUNCH_REJECTED, __FUNCTION__, NULL);
@@ -803,7 +800,7 @@ int app_control_send_terminate_request(app_control_h app_control)
if (app_control->type != APP_CONTROL_TYPE_REQUEST || app_control->launch_pid < 0)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- appsvc_subapp_terminate_request_pid(app_control->launch_pid);
+ aul_svc_subapp_terminate_request_pid(app_control->launch_pid);
return APP_CONTROL_ERROR_NONE;
}
@@ -822,9 +819,9 @@ static bool app_control_copy_reply_data_cb(app_control_h app_control, const char
return false;
}
- if (appsvc_data_is_array(app_control->data, key)) {
+ if (aul_svc_data_is_array(app_control->data, key)) {
app_control_get_extra_data_array(app_control, key, &value_array, &value_array_length);
- appsvc_add_data_array(reply_data, key, (const char **)value_array, value_array_length);
+ aul_svc_add_data_array(reply_data, key, (const char **)value_array, value_array_length);
for (value_array_index = 0; value_array_index < value_array_length; value_array_index++)
free(value_array[value_array_index]);
@@ -832,7 +829,7 @@ static bool app_control_copy_reply_data_cb(app_control_h app_control, const char
free(value_array);
} else {
app_control_get_extra_data(app_control, key, &value);
- appsvc_add_data(reply_data, key, value);
+ aul_svc_add_data(reply_data, key, value);
free(value);
}
@@ -852,30 +849,30 @@ int app_control_reply_to_launch_request(app_control_h reply, app_control_h reque
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)
+ if (aul_svc_create_result_bundle(request->data, &reply_data) != 0)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to create a result bundle");
app_control_foreach_extra_data(reply, app_control_copy_reply_data_cb, reply_data);
switch (result) {
case APP_CONTROL_RESULT_SUCCEEDED:
- appsvc_result = APPSVC_RES_OK;
+ appsvc_result = AUL_SVC_RES_OK;
break;
case APP_CONTROL_RESULT_FAILED:
- appsvc_result = APPSVC_RES_NOT_OK;
+ appsvc_result = AUL_SVC_RES_NOT_OK;
break;
case APP_CONTROL_RESULT_CANCELED:
- appsvc_result = APPSVC_RES_CANCEL;
+ appsvc_result = AUL_SVC_RES_CANCEL;
break;
default:
- appsvc_result = APPSVC_RES_CANCEL;
+ appsvc_result = AUL_SVC_RES_CANCEL;
break;
}
- ret = appsvc_send_result(reply_data, appsvc_result);
+ ret = aul_svc_send_result(reply_data, appsvc_result);
bundle_free(reply_data);
if (ret < 0) {
- if (ret == APPSVC_RET_EINVAL)
+ if (ret == AUL_SVC_RET_EINVAL)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
else
return app_control_error(APP_CONTROL_ERROR_LAUNCH_REJECTED, __FUNCTION__, NULL);
@@ -893,12 +890,12 @@ int app_control_add_extra_data(app_control_h app_control, const char *key, const
if (app_control_validate_internal_key(key))
return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- if (appsvc_get_data(app_control->data, key) != NULL) {
+ if (aul_svc_get_data(app_control->data, key) != NULL) {
/* overwrite any existing value */
bundle_del(app_control->data, key);
}
- if (appsvc_add_data(app_control->data, key, value) != 0)
+ if (aul_svc_add_data(app_control->data, key, value) != 0)
return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add data to the appsvc handle");
return APP_CONTROL_ERROR_NONE;
@@ -916,12 +913,12 @@ int app_control_add_extra_data_array(app_control_h app_control, const char *key,
if (app_control_validate_internal_key(key))
return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- if (appsvc_get_data_array(app_control->data, key, NULL) != NULL) {
+ if (aul_svc_get_data_array(app_control->data, key, NULL) != NULL) {
/* overwrite any existing value */
bundle_del(app_control->data, key);
}
- if (appsvc_add_data_array(app_control->data, key, value, length) != 0)
+ if (aul_svc_add_data_array(app_control->data, key, value, length) != 0)
return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "failed to add array data to the appsvc handle");
return APP_CONTROL_ERROR_NONE;
@@ -951,7 +948,7 @@ int app_control_get_extra_data(app_control_h app_control, const char *key, char
if (app_control_validate_internal_key(key))
return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- data_value = appsvc_get_data(app_control->data, key);
+ data_value = aul_svc_get_data(app_control->data, key);
if (data_value == NULL) {
if (errno == ENOTSUP)
return app_control_error(APP_CONTROL_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
@@ -980,7 +977,7 @@ int app_control_get_extra_data_array(app_control_h app_control, const char *key,
if (app_control_validate_internal_key(key))
return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- array_data = appsvc_get_data_array(app_control->data, key, &array_data_length);
+ array_data = aul_svc_get_data_array(app_control->data, key, &array_data_length);
if (array_data == NULL) {
if (errno == ENOTSUP)
return app_control_error(APP_CONTROL_ERROR_INVALID_DATA_TYPE, __FUNCTION__, NULL);
@@ -1011,7 +1008,7 @@ int app_control_is_extra_data_array(app_control_h app_control, const char *key,
if (app_control_validate_internal_key(key))
return app_control_error(APP_CONTROL_ERROR_KEY_REJECTED, __FUNCTION__, "the given key is reserved as internal use");
- if (!appsvc_data_is_array(app_control->data, key))
+ if (!aul_svc_data_is_array(app_control->data, key))
*array = false;
else
*array = true;
@@ -1116,7 +1113,7 @@ int app_control_foreach_app_matched(app_control_h app_control, app_control_app_m
if (app_control_validate(app_control) || callback == NULL)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- appsvc_usr_get_list(app_control->data, app_control_cb_broker_foreach_app_matched, &foreach_context, getuid());
+ aul_svc_get_list_for_uid(app_control->data, app_control_cb_broker_foreach_app_matched, &foreach_context, getuid());
return APP_CONTROL_ERROR_NONE;
}
@@ -1206,7 +1203,7 @@ int app_control_request_transient_app(app_control_h app_control, unsigned int ca
if (app_control_validate(app_control))
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- ret = appsvc_request_transient_app(app_control->data, callee_id, (appsvc_host_res_fn)cbfunc, data);
+ ret = aul_svc_request_transient_app(app_control->data, callee_id, (aul_svc_host_res_fn)cbfunc, data);
if (ret < 0)
return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
diff --git a/include/app_internal.h b/include/app_internal.h
index bdd09fe..f0624d8 100644
--- a/include/app_internal.h
+++ b/include/app_internal.h
@@ -19,7 +19,6 @@
#define __TIZEN_APPFW_APP_INTERNAL_H__
#include <app.h>
-#include <appcore-common.h>
#include <tzplatform_config.h>
/* GNU gettext macro is already defined at appcore-common.h */
@@ -42,27 +41,11 @@ extern "C" {
#define PATH_FMT_RO_RES_DIR "/res"
#define PATH_FMT_RO_LOCALE_DIR "/local"
-struct app_event_handler {
- app_event_type_e type;
- app_event_cb cb;
- void *data;
-};
-
-struct app_event_info {
- app_event_type_e type;
- void *value;
-};
-
-typedef struct appcore_ops *appcore_context_h;
-
-app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm);
-
typedef void (*app_finalizer_cb) (void *data);
+typedef void *appcore_context_h;
int app_error(app_error_e error, const char *function, const char *description);
-app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm);
-
int app_get_package_app_name(const char *package, char **name);
int app_finalizer_add(app_finalizer_cb callback, void *data);
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8701f93..5589fd5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,7 +9,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(INC_DIR ${CMAKE_SOURCE_DIR}/include)
INCLUDE_DIRECTORIES(${INC_DIR})
-SET(requires "dlog bundle appcore-common appcore-efl aul appsvc elementary capi-base-common sqlite3 libtzplatform-config pkgmgr-info glib-2.0")
+SET(requires "dlog bundle appcore-common appcore-efl aul capi-base-common libtzplatform-config pkgmgr-info glib-2.0")
SET(pc_requires "capi-base-common vconf-internal-keys capi-appfw-app-control capi-appfw-app-common appcore-common libtzplatform-config")
INCLUDE(FindPkgConfig)
@@ -33,6 +33,7 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
ADD_LIBRARY(${fw_name} SHARED
app_device.c
app_main.c
+ app_main_legacy.c
app_resource.c
app_resource_manager.c
i18n.c
diff --git a/src/app_device.c b/src/app_device.c
index 47f9e1a..4c9db0f 100644
--- a/src/app_device.c
+++ b/src/app_device.c
@@ -24,7 +24,7 @@
#include <fcntl.h>
#include <bundle.h>
-#include <appcore-common.h>
+#include <appcore_base.h>
#include <aul.h>
#include <dlog.h>
#include <vconf.h>
@@ -37,13 +37,38 @@
#define LOG_TAG "CAPI_APPFW_APPLICATION"
+static app_device_orientation_e __convert_appcore_rm(int rm)
+{
+ app_device_orientation_e dev_orientation;
+
+ switch (rm) {
+ case APPCORE_BASE_RM_PORTRAIT_NORMAL:
+ dev_orientation = APP_DEVICE_ORIENTATION_0;
+ break;
+ case APPCORE_BASE_RM_PORTRAIT_REVERSE:
+ dev_orientation = APP_DEVICE_ORIENTATION_180;
+ break;
+ case APPCORE_BASE_RM_LANDSCAPE_NORMAL:
+ dev_orientation = APP_DEVICE_ORIENTATION_270;
+ break;
+ case APPCORE_BASE_RM_LANDSCAPE_REVERSE:
+ dev_orientation = APP_DEVICE_ORIENTATION_90;
+ break;
+ default:
+ dev_orientation = APP_DEVICE_ORIENTATION_0;
+ break;
+ }
+
+ return dev_orientation;
+}
+
app_device_orientation_e app_get_device_orientation(void)
{
- enum appcore_rm rm;
+ enum appcore_base_rm rm;
app_device_orientation_e dev_orientation = APP_DEVICE_ORIENTATION_0;
- if (appcore_get_rotation_state(&rm) == 0)
- dev_orientation = app_convert_appcore_rm(rm);
+ if (appcore_base_get_rotation_state(&rm) == 0)
+ dev_orientation = __convert_appcore_rm(rm);
return dev_orientation;
}
diff --git a/src/app_main.c b/src/app_main.c
index fc57921..b081d5e 100755
--- a/src/app_main.c
+++ b/src/app_main.c
@@ -23,13 +23,9 @@
#include <fcntl.h>
#include <bundle.h>
-#include <appcore-common.h>
-#include <appcore-efl.h>
-#include <aul.h>
+#include <appcore_ui_base.h>
#include <dlog.h>
-#include <Elementary.h>
-
#include <app_internal.h>
#include <app_control_internal.h>
#include <tizen_error.h>
@@ -50,843 +46,196 @@ typedef enum {
APP_STATE_RUNNING, /* The application is running in the foreground and background */
} app_state_e;
-typedef struct {
- char *package;
- char *app_name;
- app_event_callback_s *callback;
+struct app_event_handler {
+ app_event_type_e type;
+ app_event_cb cb;
void *data;
-} app_context_s;
+ void *raw;
+};
-typedef app_context_s *app_context_h;
+struct app_event_info {
+ app_event_type_e type;
+ void *value;
+};
struct ui_app_context {
- char *package;
- char *app_name;
- ui_app_lifecycle_callback_s *callback;
+ ui_app_lifecycle_callback_s callback;
void *data;
};
-static Eina_List *handler_list[UI_APP_EVENT_MAX] = {NULL, };
-static int handler_initialized;
-static int appcore_initialized;
-static app_state_e app_state = APP_STATE_NOT_RUNNING;
-
-static int app_appcore_create(void *data);
-static int app_appcore_pause(void *data);
-static int app_appcore_resume(void *data);
-static int app_appcore_terminate(void *data);
-static int app_appcore_reset(bundle *appcore_bundle, void *data);
-
-static int app_appcore_low_memory(void *event, void *data);
-static int app_appcore_low_battery(void *event, void *data);
-static int app_appcore_rotation_event(void *event, enum appcore_rm rm, void *data);
-static int app_appcore_lang_changed(void *event, void *data);
-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);
-}
+static struct ui_app_context __context;
+static app_state_e __app_state = APP_STATE_NOT_RUNNING;
-int app_efl_main(int *argc, char ***argv, app_event_callback_s *callback, void *user_data)
-{
- app_context_s app_context = {
- .package = NULL,
- .app_name = NULL,
- .callback = callback,
- .data = user_data
- };
-
- struct appcore_ops appcore_context = {
- .data = &app_context,
- .create = app_appcore_create,
- .terminate = app_appcore_terminate,
- .pause = app_appcore_pause,
- .resume = app_appcore_resume,
- .reset = app_appcore_reset,
- };
-
- if (argc == NULL || argv == NULL || callback == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (callback->create == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "app_create_cb() callback must be registered");
-
- if (app_state != APP_STATE_NOT_RUNNING)
- return app_error(APP_ERROR_ALREADY_RUNNING, __FUNCTION__, NULL);
-
- if (app_get_id(&(app_context.package)) != APP_ERROR_NONE)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
-
- if (app_get_package_app_name(app_context.package, &(app_context.app_name)) != APP_ERROR_NONE) {
- free(app_context.package);
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package's app name");
- }
-
- app_state = APP_STATE_CREATING;
-
- appcore_efl_main(app_context.app_name, argc, argv, &appcore_context);
-
- app_state = APP_STATE_NOT_RUNNING;
- free(app_context.package);
- free(app_context.app_name);
-
- return APP_ERROR_NONE;
-}
-
-void app_exit(void)
-{
- app_efl_exit();
-}
-
-void app_efl_exit(void)
-{
- elm_exit();
-}
+static int __app_event_converter[APPCORE_BASE_EVENT_MAX] = {
+ [APP_EVENT_LOW_MEMORY] = APPCORE_BASE_EVENT_LOW_MEMORY,
+ [APP_EVENT_LOW_BATTERY] = APPCORE_BASE_EVENT_LOW_BATTERY,
+ [APP_EVENT_LANGUAGE_CHANGED] = APPCORE_BASE_EVENT_LANG_CHANGE,
+ [APP_EVENT_DEVICE_ORIENTATION_CHANGED] = APPCORE_BASE_EVENT_DEVICE_ORIENTATION_CHANGED,
+ [APP_EVENT_REGION_FORMAT_CHANGED] = APPCORE_BASE_EVENT_REGION_CHANGE,
+ [APP_EVENT_SUSPENDED_STATE_CHANGED] = APPCORE_BASE_EVENT_SUSPENDED_STATE_CHANGE,
+};
-int app_appcore_create(void *data)
+static int __ui_app_create(void *data)
{
- app_context_h app_context = data;
- app_create_cb create_cb;
- char locale_dir[TIZEN_PATH_MAX] = {0, };
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- app_set_appcore_event_cb(app_context);
-
- snprintf(locale_dir, TIZEN_PATH_MAX, "%s/%s" PATH_FMT_RES_DIR
- PATH_FMT_LOCALE_DIR, PATH_FMT_APP_ROOT, app_context->package);
- if (access(locale_dir, R_OK) != 0) {
- snprintf(locale_dir, TIZEN_PATH_MAX, "%s/%s" PATH_FMT_RO_RES_DIR
- PATH_FMT_RO_LOCALE_DIR, PATH_FMT_RO_APP_ROOT, app_context->package);
- }
- appcore_set_i18n(app_context->app_name, locale_dir);
-
- create_cb = app_context->callback->create;
- if (create_cb == NULL || create_cb(app_context->data) == false)
+ appcore_ui_base_on_create();
+ if (__context.callback.create == NULL ||
+ __context.callback.create(__context.data) == false)
return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "app_create_cb() returns false");
- app_state = APP_STATE_RUNNING;
-
return APP_ERROR_NONE;
}
-int app_appcore_terminate(void *data)
+static int __ui_app_terminate(void *data)
{
- app_context_h app_context = data;
- app_terminate_cb terminate_cb;
+ appcore_ui_base_on_terminate();
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- terminate_cb = app_context->callback->terminate;
-
- if (terminate_cb != NULL)
- terminate_cb(app_context->data);
-
- app_unset_appcore_event_cb();
-
- app_finalizer_execute();
-
- return APP_ERROR_NONE;
-}
-
-/* LCOV_EXCL_START */
-int app_appcore_pause(void *data)
-{
- app_context_h app_context = data;
- app_pause_cb pause_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- pause_cb = app_context->callback->pause;
- if (pause_cb != NULL)
- pause_cb(app_context->data);
-
- return APP_ERROR_NONE;
-}
-/* LCOV_EXCL_STOP */
-
-/* LCOV_EXCL_START */
-int app_appcore_resume(void *data)
-{
- app_context_h app_context = data;
- app_resume_cb resume_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- resume_cb = app_context->callback->resume;
- if (resume_cb != NULL)
- resume_cb(app_context->data);
-
- return APP_ERROR_NONE;
-}
-/* LCOV_EXCL_STOP */
-
-int app_appcore_reset(bundle *appcore_bundle, void *data)
-{
- app_context_h app_context = data;
- app_control_cb callback;
- app_control_h app_control;
-
- 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 service handle from the bundle");
-
- callback = app_context->callback->app_control;
- if (callback != NULL)
- callback(app_control, app_context->data);
-
- app_control_destroy(app_control);
+ if (__context.callback.terminate)
+ __context.callback.terminate(__context.data);
return APP_ERROR_NONE;
}
-int app_appcore_low_memory(void *event_info, void *data)
+static int __ui_app_control(bundle *b, void *data)
{
- app_context_h app_context = data;
- app_low_memory_cb low_memory_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- low_memory_cb = app_context->callback->low_memory;
- if (low_memory_cb != NULL)
- low_memory_cb(app_context->data);
+ app_control_h app_control = NULL;
- return APP_ERROR_NONE;
-}
+ appcore_ui_base_on_control(b);
-int app_appcore_low_battery(void *event_info, void *data)
-{
- app_context_h app_context = data;
- app_low_battery_cb low_battery_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- low_battery_cb = app_context->callback->low_battery;
- if (low_battery_cb != NULL)
- low_battery_cb(app_context->data);
-
- return APP_ERROR_NONE;
-}
-
-/* LCOV_EXCL_START */
-int app_appcore_rotation_event(void *event_info, enum appcore_rm rm, void *data)
-{
- app_context_h app_context = data;
- app_device_orientation_cb device_orientation_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- device_orientation_cb = app_context->callback->device_orientation;
- if (device_orientation_cb != NULL) {
- app_device_orientation_e dev_orientation;
-
- dev_orientation = app_convert_appcore_rm(rm);
-
- device_orientation_cb(dev_orientation, app_context->data);
- }
-
- return APP_ERROR_NONE;
-}
-/* LCOV_EXCL_STOP */
-
-int app_appcore_lang_changed(void *event_info, void *data)
-{
- app_context_h app_context = data;
- app_language_changed_cb lang_changed_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- lang_changed_cb = app_context->callback->language_changed;
- if (lang_changed_cb != NULL)
- lang_changed_cb(app_context->data);
-
- return APP_ERROR_NONE;
-}
-
-int app_appcore_region_changed(void *event_info, void *data)
-{
- app_context_h app_context = data;
- app_region_format_changed_cb region_changed_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- region_changed_cb = app_context->callback->region_format_changed;
- if (region_changed_cb != NULL)
- region_changed_cb(app_context->data);
-
- return APP_ERROR_NONE;
-}
-
-void app_set_appcore_event_cb(app_context_h app_context)
-{
- if (app_context->callback->low_memory != NULL)
- appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, app_appcore_low_memory, app_context);
-
- if (app_context->callback->low_battery != NULL)
- appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, app_appcore_low_battery, app_context);
-
- if (app_context->callback->device_orientation != NULL)
- appcore_set_rotation_cb(app_appcore_rotation_event, app_context);
-
- if (app_context->callback->language_changed != NULL)
- appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, app_appcore_lang_changed, app_context);
-
- if (app_context->callback->region_format_changed != NULL)
- appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, app_appcore_region_changed, app_context);
-}
-
-void 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);
- appcore_unset_rotation_cb();
- appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, NULL, NULL);
- appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, NULL, NULL);
-}
-
-static void _free_handler_list(void)
-{
- int i;
- app_event_handler_h handler;
-
- for (i = 0; i < UI_APP_EVENT_MAX; i++) {
- EINA_LIST_FREE(handler_list[i], handler)
- if (handler)
- free(handler);
- }
-
- eina_shutdown();
-}
-
-static int _ui_app_appcore_low_memory(void *event_info, void *data)
-{
- Eina_List *l;
- app_event_handler_h handler;
- struct app_event_info event;
-
- LOGI("_app_appcore_low_memory");
-
- event.type = APP_EVENT_LOW_MEMORY;
- event.value = event_info;
-
- EINA_LIST_FOREACH(handler_list[APP_EVENT_LOW_MEMORY], l, handler) {
- handler->cb(&event, handler->data);
- }
-
- return APP_ERROR_NONE;
-}
-
-static int _ui_app_appcore_low_battery(void *event_info, void *data)
-{
- Eina_List *l;
- app_event_handler_h handler;
- struct app_event_info event;
-
- LOGI("_ui_app_appcore_low_battery");
-
- event.type = APP_EVENT_LOW_BATTERY;
- event.value = event_info;
-
- EINA_LIST_FOREACH(handler_list[APP_EVENT_LOW_BATTERY], l, handler) {
- handler->cb(&event, handler->data);
- }
-
- return APP_ERROR_NONE;
-}
-
-/* LCOV_EXCL_START */
-static int _ui_app_appcore_rotation_event(void *event_info, enum appcore_rm rm, void *data)
-{
- Eina_List *l;
- app_event_handler_h handler;
- struct app_event_info event;
-
- LOGI("_ui_app_appcore_rotation_event");
-
- event.type = APP_EVENT_DEVICE_ORIENTATION_CHANGED;
- event.value = event_info;
-
- EINA_LIST_FOREACH(handler_list[APP_EVENT_DEVICE_ORIENTATION_CHANGED], l, handler) {
- handler->cb(&event, handler->data);
- }
-
- return APP_ERROR_NONE;
-}
-/* LCOV_EXCL_STOP */
-
-static int _ui_app_appcore_lang_changed(void *event_info, void *data)
-{
- Eina_List *l;
- app_event_handler_h handler;
- struct app_event_info event;
-
- LOGI("_ui_app_appcore_lang_changed");
-
- event.type = APP_EVENT_LANGUAGE_CHANGED;
- event.value = event_info;
-
- EINA_LIST_FOREACH(handler_list[APP_EVENT_LANGUAGE_CHANGED], l, handler) {
- handler->cb(&event, handler->data);
- }
-
- return APP_ERROR_NONE;
-}
-
-static int _ui_app_appcore_region_changed(void *event_info, void *data)
-{
- Eina_List *l;
- app_event_handler_h handler;
- struct app_event_info event;
-
- if (event_info == NULL) {
- LOGI("receive empty event, ignore it");
- return APP_ERROR_NONE;
- }
-
- LOGI("_ui_app_appcore_region_changed");
-
- event.type = APP_EVENT_REGION_FORMAT_CHANGED;
- event.value = event_info;
-
- EINA_LIST_FOREACH(handler_list[APP_EVENT_REGION_FORMAT_CHANGED], l, handler) {
- handler->cb(&event, handler->data);
- }
-
- return APP_ERROR_NONE;
-}
-
-/* LCOV_EXCL_START */
-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;
-}
-/* LCOV_EXCL_STOP */
-
-static int _ui_app_appcore_update_requested(void *event_info, void *data)
-{
- Eina_List *l;
- app_event_handler_h handler;
- struct app_event_info event;
-
- LOGI("_ui_app_appcore_update_requested");
-
- event.type = APP_EVENT_UPDATE_REQUESTED;
- event.value = event_info;
-
- EINA_LIST_FOREACH(handler_list[APP_EVENT_UPDATE_REQUESTED], 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;
- case APP_EVENT_UPDATE_REQUESTED:
- appcore_set_event_callback(APPCORE_EVENT_UPDATE_REQUESTED, _ui_app_appcore_update_requested, 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;
- case APP_EVENT_UPDATE_REQUESTED:
- appcore_set_event_callback(APPCORE_EVENT_UPDATE_REQUESTED, NULL, NULL);
- break;
- default:
- break;
+ if (b) {
+ if (app_control_create_event(b, &app_control) != APP_ERROR_NONE)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to create an app_control handle");
+ } else {
+ if (app_control_create(&app_control) != APP_ERROR_NONE)
+ return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "Failed to create an app_control handle");
}
-}
-
-static void _ui_app_set_appcore_event_cb(void)
-{
- _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)
- _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);
- if (eina_list_count(handler_list[APP_EVENT_UPDATE_REQUESTED]) > 0)
- _ui_app_appcore_set_event_cb(APP_EVENT_UPDATE_REQUESTED);
-}
-
-static void _ui_app_unset_appcore_event_cb(void)
-{
- _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)
- _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);
- if (eina_list_count(handler_list[APP_EVENT_UPDATE_REQUESTED]) > 0)
- _ui_app_appcore_unset_event_cb(APP_EVENT_UPDATE_REQUESTED);
-}
-
-static int _ui_app_appcore_create(void *data)
-{
- LOGI("app_appcore_create");
- struct ui_app_context *app_context = data;
- app_create_cb create_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- appcore_initialized = 1;
- _ui_app_set_appcore_event_cb();
-
- create_cb = app_context->callback->create;
- if (create_cb == NULL || create_cb(app_context->data) == false)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "app_create_cb() returns false");
-
- app_state = APP_STATE_RUNNING;
-
- return APP_ERROR_NONE;
-}
-
-static int _ui_app_appcore_terminate(void *data)
-{
- LOGI("app_appcore_terminate");
- struct ui_app_context *app_context = data;
- app_terminate_cb terminate_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- terminate_cb = app_context->callback->terminate;
+ if (__context.callback.app_control)
+ __context.callback.app_control(app_control, __context.data);
- if (terminate_cb != NULL)
- terminate_cb(app_context->data);
-
- _ui_app_unset_appcore_event_cb();
-
- app_finalizer_execute();
-
- if (handler_initialized) {
- _free_handler_list();
- handler_initialized = 0;
- }
+ app_control_destroy(app_control);
return APP_ERROR_NONE;
}
-/* LCOV_EXCL_START */
-static int _ui_app_appcore_pause(void *data)
+static int __ui_app_pause(void *data)
{
- LOGI("app_appcore_pause");
- struct ui_app_context *app_context = data;
- app_pause_cb pause_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- pause_cb = app_context->callback->pause;
-
- if (pause_cb != NULL)
- pause_cb(app_context->data);
-
+ appcore_ui_base_on_pause();
+ if (__context.callback.pause)
+ __context.callback.pause(__context.data);
return APP_ERROR_NONE;
}
-/* LCOV_EXCL_STOP */
-/* LCOV_EXCL_START */
-static int _ui_app_appcore_resume(void *data)
+static int __ui_app_resume(void *data)
{
- LOGI("app_appcore_resume");
- struct ui_app_context *app_context = data;
- app_resume_cb resume_cb;
-
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- resume_cb = app_context->callback->resume;
-
- if (resume_cb != NULL)
- resume_cb(app_context->data);
-
+ appcore_ui_base_on_resume();
+ if (__context.callback.resume)
+ __context.callback.resume(__context.data);
return APP_ERROR_NONE;
}
-/* LCOV_EXCL_STOP */
-static int _ui_app_appcore_reset(bundle *appcore_bundle, void *data)
+static int __app_init(int argc, char **argv, ui_app_lifecycle_callback_s *callback, void *user_data, appcore_ui_base_ops ops)
{
- LOGI("app_appcore_reset");
- struct ui_app_context *app_context = data;
- app_control_cb callback;
- app_control_h app_control;
int ret;
- if (app_context == NULL)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- 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 an app_control handle from the bundle");
- } else {
- ret = app_control_create(&app_control);
- if (ret != APP_ERROR_NONE)
- return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create an app_control");
- }
-
- callback = app_context->callback->app_control;
-
- if (callback != NULL)
- callback(app_control, app_context->data);
-
- app_control_destroy(app_control);
-
- return APP_ERROR_NONE;
-}
+ if (argc < 1 || argv == NULL || callback == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-static int __create_ui_app_context(ui_app_lifecycle_callback_s *callback, void *user_data, struct ui_app_context **handle)
-{
- struct ui_app_context *app_context;
- int ret;
+ if (callback->create == NULL)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "app_create_cb() callback must be registered");
- app_context = (struct ui_app_context *)calloc(1, sizeof(struct ui_app_context));
- if (app_context == NULL)
- return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ if (__app_state != APP_STATE_NOT_RUNNING)
+ return app_error(APP_ERROR_ALREADY_RUNNING, __FUNCTION__, NULL);
- ret = app_get_id(&app_context->package);
- if (ret != APP_ERROR_NONE) {
- free(app_context);
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package");
- }
+ __context.callback = *callback;
+ __context.data = user_data;
+ __app_state = APP_STATE_CREATING;
- ret = app_get_package_app_name(app_context->package, &app_context->app_name);
- if (ret != APP_ERROR_NONE) {
- free(app_context->package);
- free(app_context);
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, "failed to get the package's app name");
- }
+ ret = appcore_ui_base_init(ops, argc, argv, NULL,
+ APPCORE_UI_BASE_HINT_WINDOW_GROUP_CONTROL |
+ APPCORE_UI_BASE_HINT_WINDOW_STACK_CONTROL |
+ APPCORE_UI_BASE_HINT_BG_LAUNCH_CONTROL |
+ APPCORE_UI_BASE_HINT_HW_ACC_CONTROL);
- app_context->callback = (ui_app_lifecycle_callback_s *)malloc(sizeof(ui_app_lifecycle_callback_s));
- if (app_context->callback == NULL) {
- free(app_context->app_name);
- free(app_context->package);
- free(app_context);
- return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ if (ret < 0) {
+ __app_state = APP_STATE_NOT_RUNNING;
+ return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
}
- memcpy(app_context->callback, callback, sizeof(ui_app_lifecycle_callback_s));
-
- app_context->data = user_data;
-
- *handle = app_context;
return APP_ERROR_NONE;
}
-static void __destroy_ui_app_context(struct ui_app_context *handle)
+static void __app_fini(void)
{
- if (handle == NULL)
- return;
-
- if (handle->callback) {
- free(handle->callback);
- handle->callback = NULL;
- }
-
- if (handle->app_name) {
- free(handle->app_name);
- handle->app_name = NULL;
- }
-
- if (handle->package) {
- free(handle->package);
- handle->package = NULL;
- }
+ appcore_ui_base_fini();
+ __app_state = APP_STATE_NOT_RUNNING;
- free(handle);
}
-static int __create_appcore_context(struct ui_app_context *app_context, struct appcore_ops **handle)
+int ui_app_init(int argc, char **argv, ui_app_lifecycle_callback_s *callback, void *user_data, appcore_context_h *handle)
{
- struct appcore_ops *appcore_context;
-
- appcore_context = (struct appcore_ops *)malloc(sizeof(struct appcore_ops));
- if (appcore_context == NULL)
- return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
+ appcore_ui_base_ops ops = appcore_ui_base_get_default_ops();
- appcore_context->data = app_context;
- appcore_context->create = _ui_app_appcore_create;
- appcore_context->terminate = _ui_app_appcore_terminate;
- appcore_context->pause = _ui_app_appcore_pause;
- appcore_context->resume = _ui_app_appcore_resume;
- appcore_context->reset = _ui_app_appcore_reset;
+ /* override methods */
+ ops.base.create = __ui_app_create;
+ ops.base.control = __ui_app_control;
+ ops.base.terminate = __ui_app_terminate;
+ ops.pause = __ui_app_pause;
+ ops.resume = __ui_app_resume;
+ ops.base.run = NULL;
+ ops.base.exit = NULL;
- *handle = appcore_context;
-
- return APP_ERROR_NONE;
+ return __app_init(argc, argv, callback, user_data, ops);
}
-static void __destroy_appcore_context(struct appcore_ops *handle)
+void ui_app_fini(appcore_context_h handle)
{
- if (handle == NULL)
- return;
-
- __destroy_ui_app_context((struct ui_app_context *)handle->data);
- free(handle);
+ __app_fini();
}
-int ui_app_init(int argc, char **argv, ui_app_lifecycle_callback_s *callback, void *user_data, appcore_context_h *handle)
+int ui_app_main(int argc, char **argv, ui_app_lifecycle_callback_s *callback, void *user_data)
{
- struct ui_app_context *app_context = NULL;
- struct appcore_ops *appcore_context = NULL;
int ret;
+ appcore_ui_base_ops ops = appcore_ui_base_get_default_ops();
- if (argc < 1 || argv == NULL || callback == NULL || handle == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
-
- if (callback->create == NULL)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "app_create_cb() callback must be registered");
-
- if (app_state != APP_STATE_NOT_RUNNING)
- return app_error(APP_ERROR_ALREADY_RUNNING, __FUNCTION__, NULL);
+ /* override methods */
+ ops.base.create = __ui_app_create;
+ ops.base.control = __ui_app_control;
+ ops.base.terminate = __ui_app_terminate;
+ ops.pause = __ui_app_pause;
+ ops.resume = __ui_app_resume;
- ret = __create_ui_app_context(callback, user_data, &app_context);
+ ret = __app_init(argc, argv, callback, user_data, ops);
if (ret != APP_ERROR_NONE)
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
-
- ret = __create_appcore_context(app_context, &appcore_context);
- if (ret != APP_ERROR_NONE) {
- __destroy_ui_app_context(app_context);
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
- }
-
- app_state = APP_STATE_CREATING;
-
- LOGI("app_efl_init");
- ret = appcore_efl_init(app_context->app_name, &argc, &argv, appcore_context);
- if (ret != APP_ERROR_NONE) {
- app_state = APP_STATE_NOT_RUNNING;
- __destroy_appcore_context(appcore_context);
- return app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
- }
+ return ret;
- *handle = appcore_context;
+ __app_fini();
- return APP_ERROR_NONE;
+ return APP_ERROR_NONE;
}
-void ui_app_fini(appcore_context_h handle)
+void ui_app_exit(void)
{
- appcore_efl_fini();
-
- app_state = APP_STATE_NOT_RUNNING;
-
- __destroy_appcore_context(handle);
+ appcore_ui_base_exit();
}
-int ui_app_main(int argc, char **argv, ui_app_lifecycle_callback_s *callback, void *user_data)
+int __event_cb(void *event, void *data)
{
- appcore_context_h handle = NULL;
- int ret;
+ app_event_handler_h handler = data;
- ret = ui_app_init(argc, argv, callback, user_data, &handle);
- if (ret != APP_ERROR_NONE)
- return app_error(ret, __FUNCTION__, NULL);
+ struct app_event_info app_event;
- LOGI("run ui_app_main");
- elm_run();
+ app_event.type = handler->type;
+ app_event.value = event;
- ui_app_fini(handle);
-
- return APP_ERROR_NONE;
-}
+ if (handler->cb)
+ handler->cb(&app_event, handler->data);
-void ui_app_exit(void)
-{
- app_efl_exit();
+ return 0;
}
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)
{
app_event_handler_h handler;
- Eina_List *l_itr;
-
- if (!handler_initialized) {
- eina_init();
- handler_initialized = 1;
- }
if (event_handler == NULL || callback == NULL)
return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "null parameter");
@@ -894,11 +243,6 @@ int ui_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_
if (event_type < APP_EVENT_LOW_MEMORY || event_type > APP_EVENT_UPDATE_REQUESTED)
return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid event type");
- EINA_LIST_FOREACH(handler_list[event_type], l_itr, handler) {
- if (handler->cb == callback)
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "already registered");
- }
-
handler = calloc(1, sizeof(struct app_event_handler));
if (!handler)
return app_error(APP_ERROR_OUT_OF_MEMORY, __FUNCTION__, "failed to create handler");
@@ -906,11 +250,7 @@ int ui_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_
handler->type = event_type;
handler->cb = callback;
handler->data = user_data;
-
- 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);
+ handler->raw = appcore_base_add_event(__app_event_converter[event_type], __event_cb, handler);
*event_handler = handler;
@@ -919,35 +259,23 @@ int ui_app_add_event_handler(app_event_handler_h *event_handler, app_event_type_
int ui_app_remove_event_handler(app_event_handler_h event_handler)
{
- app_event_handler_h handler;
+ int ret;
app_event_type_e type;
- Eina_List *l_itr;
- Eina_List *l_next;
if (event_handler == NULL)
return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "handler is null");
- if (!handler_initialized) {
- LOGI("handler list is not initialized");
- return APP_ERROR_NONE;
- }
-
type = event_handler->type;
if (type < APP_EVENT_LOW_MEMORY || type > APP_EVENT_UPDATE_REQUESTED)
return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid handler");
- EINA_LIST_FOREACH_SAFE(handler_list[type], l_itr, l_next, handler) {
- if (handler == event_handler) {
- free(handler);
- handler_list[type] = eina_list_remove_list(handler_list[type], l_itr);
- if (appcore_initialized && eina_list_count(handler_list[type]) == 0)
- _ui_app_appcore_unset_event_cb(type);
+ ret = appcore_base_remove_event(event_handler->raw);
+ if (ret < 0)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid raw handler");
- return APP_ERROR_NONE;
- }
- }
+ free(event_handler);
- return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "cannot find such handler");
+ return APP_ERROR_NONE;
}
diff --git a/src/app_main_legacy.c b/src/app_main_legacy.c
new file mode 100755
index 0000000..daf6a58
--- /dev/null
+++ b/src/app_main_legacy.c
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2011 - 2016 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 <stdio.h>
+#include <stdlib.h>
+#include <dlog.h>
+
+#include <app_internal.h>
+#include <tizen_error.h>
+
+#include <app.h>
+#include "app_extension.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "CAPI_APPFW_APPLICATION"
+
+typedef struct {
+ app_event_callback_s *callback;
+ void *data;
+} app_context_s;
+
+static bool __on_create(void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->create)
+ return context->callback->create(context->data);
+
+ return false;
+}
+
+static void __on_terminate(void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->terminate)
+ context->callback->terminate(context->data);
+}
+
+/* LCOV_EXCL_START */
+static void __on_pause(void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->pause)
+ context->callback->pause(context->data);
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+static void __on_resume(void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->resume)
+ context->callback->resume(context->data);
+
+}
+/* LCOV_EXCL_STOP */
+
+static void __on_app_control(app_control_h app_control, void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->app_control)
+ context->callback->app_control(app_control, context->data);
+}
+
+static void __on_low_memory(app_event_info_h event_info, void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->low_memory)
+ context->callback->low_memory(context->data);
+}
+
+static void __on_low_battery(app_event_info_h event_info, void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->low_battery)
+ context->callback->low_battery(context->data);
+}
+
+/* LCOV_EXCL_START */
+static void __on_rotation_event(app_event_info_h event_info, void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->device_orientation) {
+ app_device_orientation_e ori;
+ app_event_get_device_orientation(event_info, &ori);
+ context->callback->device_orientation(ori, context->data);
+ }
+
+}
+/* LCOV_EXCL_STOP */
+
+static void __on_lang_changed(app_event_info_h event_info, void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->language_changed)
+ context->callback->language_changed(context->data);
+}
+
+static void __on_region_changed(app_event_info_h event_info, void *data)
+{
+ app_context_s *context = data;
+
+ if (context->callback->region_format_changed)
+ context->callback->region_format_changed(context->data);
+}
+
+int app_main(int argc, char **argv, app_event_callback_s *callback, void *data)
+{
+ ui_app_lifecycle_callback_s cb = {
+ .create = __on_create,
+ .terminate = __on_terminate,
+ .pause = __on_pause,
+ .resume = __on_resume,
+ .app_control = __on_app_control
+ };
+
+ app_context_s app_context = {
+ .callback = callback,
+ .data = data
+ };
+
+ app_event_handler_h handler;
+
+ if (!callback)
+ return app_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+ if (callback->low_memory)
+ ui_app_add_event_handler(&handler, APP_EVENT_LOW_MEMORY, __on_low_memory, &app_context);
+ if (callback->low_battery)
+ ui_app_add_event_handler(&handler, APP_EVENT_LOW_BATTERY, __on_low_battery, &app_context);
+ if (callback->language_changed)
+ ui_app_add_event_handler(&handler, APP_EVENT_LANGUAGE_CHANGED, __on_lang_changed, &app_context);
+ if (callback->device_orientation)
+ ui_app_add_event_handler(&handler, APP_EVENT_DEVICE_ORIENTATION_CHANGED, __on_rotation_event, &app_context);
+ if (callback->region_format_changed)
+ ui_app_add_event_handler(&handler, APP_EVENT_REGION_FORMAT_CHANGED, __on_region_changed, &app_context);
+
+ return ui_app_main(argc, argv, &cb, &app_context);
+}
+
+int app_efl_main(int *argc, char ***argv, app_event_callback_s *callback, void *user_data)
+{
+ return app_main(*argc, *argv, callback, user_data);
+}
+
+void app_exit(void)
+{
+ ui_app_exit();
+}
+
+void app_efl_exit(void)
+{
+ ui_app_exit();
+}
+
+
+
diff --git a/src/app_resource.c b/src/app_resource.c
index ff36edc..c78c223 100644
--- a/src/app_resource.c
+++ b/src/app_resource.c
@@ -14,57 +14,20 @@
* limitations under the License.
*/
-
-#include <appcore-common.h>
-#include <appcore-efl.h>
#include <aul.h>
-#include <Elementary.h>
-
-#include "app_extension.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "CAPI_APPFW_APPLICATION"
void *app_get_preinitialized_window(const char *win_name)
{
- void *win;
-
- win = elm_win_precreated_object_get();
- if (win == NULL)
- return NULL;
-
- appcore_set_preinit_window_name(win_name);
- elm_win_precreated_object_set(NULL);
-
- return win;
+ return NULL;
}
void *app_get_preinitialized_background(void)
{
- void *background;
-
- background = elm_bg_precreated_object_get();
- if (background == NULL)
- return NULL;
-
- elm_bg_precreated_object_set(NULL);
-
- return background;
+ return NULL;
}
void *app_get_preinitialized_conformant(void)
{
- void *conformant;
-
- conformant = elm_conformant_precreated_object_get();
- if (conformant == NULL)
- return NULL;
-
- elm_conformant_precreated_object_set(NULL);
-
- return conformant;
+ return NULL;
}